# Write Contract

## Link to the Smart Contract:&#x20;

{% embed url="<https://bscscan.com/address/0x5078ef87Afb28e24936a16Fd3FBac27867549626#writeContract>" %}

### renounceOwnership

This method allows the **contract's owner** to renounce their ownership. This method is accessible only to the contract's owner. This function enables the current owner to renounce ownership of the contract. Once this method is called, the owner will lose their privileges to manage the contract, and any methods that require owner permissions will no longer be accessible.

### saveReferralDeposit

The saveReferralDeposit function is responsible for saving a deposit related to the referral system. The function accepts various parameters. After saving the deposit, the function updates referral-related structures by adding the depositor's address to the appropriate referral levels within the structure.

<table data-header-hidden><thead><tr><th width="217.33333333333331"></th><th></th><th></th></tr></thead><tbody><tr><td><strong>Data</strong></td><td><strong>Description</strong></td><td><strong>Restrictions</strong></td></tr><tr><td>_referrer (address)</td><td>Address of the person who referred.</td><td><ul><li>must be an address</li></ul></td></tr><tr><td>_contractAddress (address)</td><td>Address of the contract.</td><td><ul><li>must be an address</li></ul></td></tr><tr><td>_auctionId (uint256)</td><td>The ID of the auction.</td><td><ul><li>must be a number</li></ul></td></tr><tr><td>_tokenId (uint256)</td><td>The ID of the token.</td><td><ul><li>must be a number</li></ul></td></tr><tr><td>_depositer (address)</td><td>Address of the depositor.</td><td><ul><li>must be an address</li></ul></td></tr><tr><td>_level (uint256)</td><td>Referral level.</td><td><ul><li>must be a number</li></ul></td></tr><tr><td>_provision (uint256)</td><td>Value of the provision.</td><td><ul><li>must be a number</li></ul></td></tr></tbody></table>

### setAdminStatus

The setAdminStatus function allows the contract owner to change the admin status. Administrators are individuals with special privileges within the system. The function takes two parameters: the admin's address (\_admin) and the status (\_status).

| **Data**          | **Description**                          | **Restrictions**                        |
| ----------------- | ---------------------------------------- | --------------------------------------- |
| \_admin (address) | The address of the administrator.        | <ul><li>must be an address</li></ul>    |
| \_status (bool)   | The status to set for the administrator. | <ul><li>must be true or false</li></ul> |

### setMyReferral

The setMyReferral function is used to set a referrer for a given wallet address. The function is public and can be called by any user. If no referrer has been set for a particular wallet address (i.e., there's no entry in activeReferral), the function allows assigning the current caller (msg.sender) as the referrer.

| **Data**             | **Description**                                  | **Restrictions**                     |
| -------------------- | ------------------------------------------------ | ------------------------------------ |
| \_referred (address) | The address for which the referrer is being set. | <ul><li>Must be an address</li></ul> |

### setMyReferrals

The setMyReferrals function allows setting a referrer for multiple wallet addresses simultaneously. The function is public and can be called by any user. For each address in the \_referred array, the function checks if a referrer has not been set yet (i.e., there's no entry in activeReferral). If the condition is met, the caller (msg.sender) is set as the referrer, and the referrer is also recorded in the referral structure for the given \_referred\[i] address. The count of referred individuals for the caller is incremented by the length of the \_referred array. The function emits a SetReferral event for each address in the \_referred array to indicate the referral setting.

<table data-header-hidden><thead><tr><th width="223.33333333333331"></th><th></th><th></th></tr></thead><tbody><tr><td><strong>Data</strong></td><td><strong>Description</strong></td><td><strong>Restrictions</strong></td></tr><tr><td>_referred (address[])</td><td>An array of addresses for which the referrer is being set.</td><td><ul><li>must be an address</li></ul></td></tr></tbody></table>

### setReferral

The setReferral function enables administrators to set referrers for specific wallet addresses. The function is only accessible to administrators, meaning that only individuals with the appropriate permissions can use it. The function checks whether a referrer has not been set for the given wallet address (activeReferral\[\_referred] is empty) and whether the provided referrer address (\_referrer) is not empty. If both conditions are met, the provided referrer is assigned as the referrer for the \_referred wallet address, and the count of referred individuals for the referrer is incremented by one. The function emits a SetReferral event to indicate the referral setting.

<table data-header-hidden><thead><tr><th width="215.33333333333331"></th><th></th><th></th></tr></thead><tbody><tr><td><strong>Data</strong></td><td><strong>Description</strong></td><td><strong>Restrictions</strong></td></tr><tr><td>_referred (address)</td><td>The address for which the referrer is being set.</td><td><ul><li>Must be an address</li></ul></td></tr><tr><td>_referrer (address)</td><td>The address of the referrer being assigned.</td><td><ul><li>Must be an address</li></ul></td></tr></tbody></table>

### setReferralStructure

The setReferralStructure function is used to set the referral structure for a specific referrer. The function can only be called by the contract owner. The function accepts several parameters, including the referrer's address (\_referrer), the upline referrer's address (\_uplineReferrer), and three arrays of addresses (\_level1Referred, \_level2Referred, \_level3Referred) representing referred individuals at different levels. After the function is called, the referral structure for the referrer \_referrer is updated. The upline referrer's address for the referrer \_referrer is set to \_uplineReferrer, and the referred individuals at different levels are added to the respective arrays in the referral structure. The function checks if a referred individual does not already exist in the specific level array to avoid duplicates.

<table data-header-hidden><thead><tr><th width="218.33333333333331"></th><th></th><th></th></tr></thead><tbody><tr><td><strong>Data</strong></td><td><strong>Description</strong></td><td><strong>Restrictions</strong></td></tr><tr><td>_referrer (address)</td><td>The address of the referrer for whom the referral structure is being set.</td><td><ul><li>Must be an address</li></ul></td></tr><tr><td>_uplineReferrer (address)</td><td>The address of the upline referrer for the specified referrer.</td><td><ul><li>Must be an address</li></ul></td></tr><tr><td>_level1Referred (address[])</td><td>An array of addresses representing referred individuals on level 1.</td><td><ul><li>Must be an address</li></ul></td></tr><tr><td>_level2Referred (address[])</td><td>An array of addresses representing referred individuals on level 2.</td><td><ul><li>Must be an address</li></ul></td></tr><tr><td>_level3Referred (address[])</td><td>An array of addresses representing referred individuals on level 3.</td><td><ul><li>Must be an address</li></ul></td></tr></tbody></table>

###

### transferOwnership

The method is **available only to the current owner** **of the contract** and allows changing the ownership of the contract

<table data-header-hidden><thead><tr><th width="217.33333333333331"></th><th></th><th></th></tr></thead><tbody><tr><td><strong>Data</strong></td><td><strong>Description</strong></td><td><strong>Restrictions</strong></td></tr><tr><td>newOwner (address)</td><td>The address of the new contract owner.</td><td><ul><li>must be a wallet address</li></ul></td></tr></tbody></table>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.metaproprotocol.com/developer-documentation/smart-contracts/metaproreferral/write-contract.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
