Write Contract

addAddress

The addAddress method enables the contract owner to add a specific wallet address to the list of participants for a designated token airdrop. This functionality is exclusively accessible to the contract owner.

Data

Description

Restrictions

_tokenId (uint256)

This parameter represents the ID of the token for which the specified address is being added to the airdrop.

  • must be a number

_address (address)

This parameter is the wallet address that is intended to be added to the airdrop participant list.

  • must be an address

addAddresses

The addAddresses method provides the contract owner with the capability to add multiple wallet addresses simultaneously to the list of participants for a specified token airdrop. This feature streamlines the process of adding multiple addresses to a single airdrop.

Data

Description

Restrictions

_tokenId (uint256)

This parameter represents the ID of the token for which the provided addresses are being added to the airdrop.

  • must be a number

_addresses (address[])

This parameter is an array of wallet addresses that are intended to be added to the participant list of the airdrop.

  • must be an address

claim

The claim method facilitates the process of retrieving tokens from the contract. In order to successfully claim tokens, a user must meet two criteria: being whitelisted by the contract owner and providing the ID of the desired token.

Data

Description

Restrictions

_tokenId (uint256)

This parameter represents the ID of the token that the user wishes to claim from the contract.

  • must be a number

_data (bytes)

Additional data, if needed.

  • By default, it is set to 0x00

createAirdrop

The createAirdrop method serves the purpose of allowing the contract owner to initiate the creation of an airdrop. Only the contract owner has the authority to create airdrops. The method requires five key parameters to define the characteristics of the airdrop:

Data

Description

Restrictions

_tokenId (uint256)

This parameter represents the ID of the token that is intended to be distributed in the airdrop.

  • must be a number

  • must be an owner of the token

_startBlock (uint256)

This parameter indicates the block number at which the airdrop is scheduled to begin.

  • must be a number

  • block must be lower than endBlock

_endBlock (uint256)

This parameter signifies the block number at which the airdrop is planned to conclude.

  • must be number

  • block must be higher than startBlock

_amount (uint256)

This parameter specifies the quantity of tokens that will be sent to the contract for distribution in the airdrop.

  • must be a number

  • cannot be higher than owned

_data (bytes)

Additional data, if needed.

  • By default, it is set to 0x00

onERC1155BatchReveived

The onERC1155BatchReceived is a standard function within the ERC-1155 interface in the Solidity environment, similar to onERC1155Received. However, it is used to handle the batch (multiple) receipt of tokens by a contract. When an address receives a batch of tokens (either NFTs or MFTs) on its contract, if that contract includes the onERC1155BatchReceived method, it is automatically invoked. This allows the contract to respond to the receipt of multiple tokens in a single transaction and execute appropriate actions.

Data

Description

Restrictions

address (operator)

The address performing the token batch transfer operation.

  • must be an address

address (from)

The address from which the tokens were sent.

  • must be an address

uint256[] (tokenID)

An array of token identifiers.

  • must be a number

uint256[] (value)

An array of amounts of received tokens corresponding to the respective IDs.

  • must be a number

bytes

Additional data passed along with the transfer operation.

  • By default, it is set to 0x00

The onERC1155Received function returns a special four-byte code (bytes4), which serves as a confirmation that the contract successfully received the tokens. In summary, onERC1155BatchReceived allows a contract to react to the receipt of a batch of ERC-1155 tokens and execute specific actions in response to this batch event.

onERC1155Received

The onERC1155Received function is a standard function within the ERC-1155 interface in the Solidity environment, concerning non-fungible tokens (NFTs) or multi-fungible tokens (MFTs). This function is designed to handle the receipt of tokens by a contract. When an address receives tokens (either NFTs or MFTs) on its contract, if that contract includes the onERC1155Received function, it is automatically invoked. This allows the contract to respond to the receipt of new tokens and execute appropriate actions.

Data

Description

Restrictions

address (operator)

The address performing the token transfer operation.

  • must be an address

address (from)

The address from which the tokens were sent.

  • must be an address

uint256 (tokenID)

The token identifier.

  • must be a number

uint256 (value)

The ammount of received tokens.

  • must be number

bytes

Additional data passed along with the transfer operation.

  • By default, it is set to 0x00

The onERC1155Received function returns a special four-byte code (bytes4), which serves as a confirmation that the contract successfully received the tokens. In summary, onERC1155Received enables a contract to react to the receipt of ERC-1155 tokens and trigger specific actions in response to this event.

removeAddress

The removeAddress method grants the contract owner the capability to remove a specific user's address from an ongoing airdrop. This functionality is restricted to the contract owner.

Data

Description

Restrictions

_tokenId (uint256)

This parameter represents the ID of the token for which the specified user's address is being removed from the airdrop.

  • must be a number

_address (address)

This parameter is the wallet address of the user who is intended to be removed from the airdrop participant list.

  • must be an address

  • must be added to whitelist

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.

setTokenAddress

The setTokenAddress method provides the contract owner with the ability to change the address of the token contract. This function is particularly useful when you intend to conduct an airdrop using tokens from a different contract. The method can only be accessed by the contract owner.

Data

Description

Restrictions

_newAddress (address)

This parameter represents the new address of the token contract that you wish to associate with the airdrop.

  • must be an address

transferOwnership

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

Data

Description

Restrictions

newOwner (address)

The address of the new contract owner.

  • must be a wallet address

withdrawUnclaimedTokens

The withdrawUnclaimedTokens method serves the purpose of enabling the contract owner to collect all the unclaimed tokens from the contract after the conclusion of an airdrop. This feature allows the owner to retrieve any remaining tokens that were not claimed by participants during the airdrop period.

Data

Description

Restrictions

_tokenId (uint256)

This parameter represents the ID of the token for which the contract owner intends to retrieve unclaimed tokens.

  • must be a number

_data (bytes)

Additional data, if needed.

  • By default, it is set to 0x00

Last updated