# Write Contract

## Link to the Smart Contract:

{% embed url="<https://bscscan.com/address/0xa293d68684be29540838dc8a0222de0c43c6b5b4#writeContract>" %}
Write Contract
{% endembed %}

### **Create**

This is a function in the smart contract used to create a new Non-Fungible Token (NFT) on the ERC1155 standard

| **Data**                 | **Description**                                                                                                                   | **Restrictions**                                                            |
| ------------------------ | --------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------- |
| Create                   | Specifies the payable price that the user must pay to create the new NFT token                                                    | <ul><li>must be a positive number.</li><li>at least it must be 0.</li></ul> |
| Initial Owner (address)  | It is the BNB address that will be the initial owner of the new NFT token.                                                        | <ul><li>must be a correct contract address.</li></ul>                       |
| Initial Supply (uint256) | Specifies the number of available copies of the same NFT token to be created                                                      | <ul><li>must be a positive number.</li><li>must be an integer.</li></ul>    |
| bucketHash (string)      | Represents the hash of data associated with the NFT token, such as the hash of an image, metadata file, etc., stored as a string. | <ul><li>must be unique.</li><li>cannot be empty.</li></ul>                  |
| data (bytes)             | Additional data, if needed.                                                                                                       | <ul><li>By default, it is set to 0x00</li></ul>                             |

**Example transaction:**

{% embed url="<https://testnet.bscscan.com/tx/0x12cb9bd37292165d9be3997318006332abdd63a4b3b733816bc5a881ae4348ef>" %}

<figure><img src="https://t26441698.p.clickup-attachments.com/t26441698/b6156c9d-d80f-4e67-a887-33f1a6b1911f/image.png" alt=""><figcaption></figcaption></figure>

**a. Token Transfered FROM:** Address from where the token was created

**b. Token Transferred To:** Address where the created Token was sent

**c. Token Transferred:** ERC-1155 standard of the token

**d. Token Transferred:** Amount of created tokens

**e. Token Transferred:** Token ID \[number of the token ID]

**f. Token Transferred:** Token Contract Address

### **CreateReserved**

The method is used to create special NFT tokens with IDs less than 1000. These tokens are reserved for specific purposes or special use cases done by Smart Contract Owner.

<table data-header-hidden><thead><tr><th width="227.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>ID (unit256)</td><td>The ID of the token to be created. It must be less than 1000 and unique for each token.</td><td><ul><li>Must be unique.</li><li>Must be a positive number.</li><li>must be an integer</li></ul></td></tr><tr><td>initial Owner (address)</td><td>The address of the contract owner where the newly created token will be initially owned.</td><td><ul><li>must be a correct contract address.</li></ul></td></tr><tr><td>Initial Supply (uint256)</td><td>Specifies the number of available copies of the same NFT token to be created</td><td><ul><li>must be a positive number.</li><li>must be an integer.</li></ul></td></tr><tr><td>BucketHash (string)</td><td>Represents the hash of data associated with the NFT token, such as the hash of an image, metadata file, etc., stored as a string.</td><td><ul><li>must be unique.</li><li>cannot be empty.</li></ul></td></tr><tr><td>Data (bytes)</td><td>Additional data, if needed.</td><td><ul><li>By default, it is set to 0x00</li></ul></td></tr></tbody></table>

###

### **Migrate**

The **Migrate** method is a special function available only to the contract creator, allowing the migration of Meta Assets to a new contract, specifically NFT Meta Asset V2. It is important to note that **this function has been included temporarily** to facilitate the migration process while **the next iteration of the standard (V2) is being developed. The planned release of Meta Asset V2 is set for Q1 2024.** This function serves as a transitional measure and **will be removed in the final version (V2)** of the standard to ensure decentralization and avoid centralization concerns.

<table data-header-hidden><thead><tr><th width="218"></th><th></th></tr></thead><tbody><tr><td><strong>Data</strong></td><td><strong>Description</strong></td></tr><tr><td>ID (uint256)</td><td>The ID of the token to be migrated.</td></tr><tr><td>Creator (address)</td><td>The address of the creator of the token.</td></tr><tr><td>bucketHash (string)</td><td>The bucket hash is where the asset data is stored.</td></tr><tr><td>to (address)</td><td>The address of the destination contract where the token will be transferred.</td></tr><tr><td>amount (uint256)</td><td>The number of tokens to transfer.</td></tr><tr><td>data (bytes)</td><td>Additional data, if needed.</td></tr></tbody></table>

### **Pause**

The method aims to suspend the functionality of the contract. It is accessible only to the contract's owner.

### **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.

### **safeBatchTransferFrom**

The safeBatchTransferFrom function allows for the secure transfer of multiple tokens from the owner's wallet to another specified address. The function takes the following parameters

<table data-header-hidden><thead><tr><th width="209.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>From (address)</td><td>The address of the token owner's wallet.</td><td><ul><li>must be a wallet address</li><li>must be the owner of tokens</li></ul></td></tr><tr><td>To (address)</td><td>The address of the recipient's wallet to whom we want to transfer the tokens.</td><td><ul><li>must be a wallet address</li></ul></td></tr><tr><td>Ids (uint256[])</td><td>An array of token IDs that we want to transfer to the other address, is provided in the format [id1,id2,...].</td><td><ul><li>must be a positive number</li><li>token must exist</li></ul></td></tr><tr><td>Amounts (uint256[])</td><td>An array specifying the quantities of the respective tokens listed above, provided in the format [amountId1, amountId2,...]</td><td><ul><li>must be a positive number</li><li>transfers from 1 to max amount</li><li>the first amount field is for the first id field</li></ul></td></tr><tr><td>data (bytes)</td><td>Additional data, if needed.</td><td><ul><li>By default, it is set to 0x00</li></ul></td></tr></tbody></table>

**Example transaction:**

{% embed url="<https://testnet.bscscan.com/tx/0xb7fdd07f74ee1319f1df570b49e55d7dedb8bfe0bcd51c5139290a3273a6097b>" %}

<figure><img src="https://t26441698.p.clickup-attachments.com/t26441698/aced132a-e100-48dd-8f34-e1e09fee930e/image.png" alt=""><figcaption></figcaption></figure>

**safeTransferFrom**

The function allows for the secure transfer of a single token from the owner's wallet to another specified address. The function takes the following parameters:

<table data-header-hidden><thead><tr><th width="180.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>From (address)</td><td>The address of the token owner's wallet.</td><td><ul><li>must be a wallet address</li><li>must be the owner of the tokens</li></ul></td></tr><tr><td>To (address)</td><td>The address of the recipient's wallet to whom we want to transfer the token.</td><td><ul><li>must be a wallet address</li></ul></td></tr><tr><td>Id (uint256)</td><td>The unique identifier of the token is to be transferred.</td><td><ul><li>must be a positive number</li><li>token must exist</li></ul></td></tr><tr><td>amount (uint256)</td><td>The quantity of the token to be transferred.</td><td><ul><li>must be a positive number</li><li>transfers from 1 to max amount</li><li>the first amount field is for the first id field</li></ul></td></tr><tr><td>data (bytes)</td><td>Additional data, if needed.</td><td><ul><li>By default, it is set to 0x00</li></ul></td></tr></tbody></table>

**Example transaction:**

{% embed url="<https://testnet.bscscan.com/tx/0x7a693c8ea5f2cfe9d26eafdccacd2c1304799204fc4ec1588ac69ec644979336>" %}

<figure><img src="https://t26441698.p.clickup-attachments.com/t26441698/da40924f-8465-4b2e-95b5-b6b593ee9dca/image.png" alt=""><figcaption></figcaption></figure>

**a. Tokens Transfered FROM:** Address from where the token was transferred

**b. Tokens Transferred To:** Address where the Tokens are sent

**c. Tokens Transferred:** ERC-1155 standard of the token

**d. Tokens Transferred:** Amount of tokens

**e. Tokens Transferred:** Token ID \[ID of the transferred token]

**f. Tokens Transferred:** Token Contract Address

### **SetApprovalForAll**

The method is used to allow or revoke permission for another contract to manage tokens on behalf of the caller. By setting the approval status to **ture**, we grant the operator the ability to manage the tokens, and by setting it to **false**, we revoke this permission.

<table data-header-hidden><thead><tr><th width="206.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>Operator (address)</td><td>The address of the contract to which we want to grant or revoke management permission.</td><td><ul><li>must be an address</li></ul></td></tr><tr><td>Approved (bool)</td><td>Specifies whether we are allowing (true) or revoking (false) the management permission for the operator.</td><td><ul><li>can be only <strong>true</strong> or <strong>false</strong></li><li>we can use "1" (true) or "0" (false)</li></ul></td></tr></tbody></table>

**Example transaction:**

{% embed url="<https://testnet.bscscan.com/tx/0x77a5df5784793ca5366bd85cc71d314bee1ac83f0853ada29fa38f7ccbcd5fb3>" %}

<figure><img src="https://t26441698.p.clickup-attachments.com/t26441698/096c250f-53f8-4b55-b099-41931086a41a/image.png" alt=""><figcaption></figcaption></figure>

### **setFee**

This method is used to set the transaction fee in the contract. It is accessible only to the contract's owner.

<table data-header-hidden><thead><tr><th width="163.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>fee (unit256)</td><td>The amount of the transaction fee to be set.</td><td><ul><li>Only for the Contract owner</li><li>Must be a integer positive number</li></ul></td></tr></tbody></table>

###

### **setTreasuryAddress**

The method is used to set the treasury address in the contract. The treasury address is the designated account where funds or tokens are stored for various purposes, such as collecting fees, managing reserves, or distributing rewards.

<table data-header-hidden><thead><tr><th width="200.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>Address (address)</td><td>The new treasury address to be set.</td><td><ul><li>You must be the Contract owner</li><li>Must be a wallet address</li></ul></td></tr></tbody></table>

###

### **setUri**

The method allows the contract owner to update the URI associated with the NFTs in the contract. The URI points to a metadata file that contains information about the NFT, such as its name, description, image, and other attributes.

<table data-header-hidden><thead><tr><th width="207.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>newUri (string)</td><td>The new URI to be set.</td><td><ul><li>Must be a string</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="209.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>

### **unpause**

The method aims to resume the functionality of the contract. It is accessible only to the contract's owner.


---

# 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/metaprometaasset/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.
