- Bulk token distribution: Automatically distribute tokens to users in bulk. For example, project teams or token issuers can reward their community members, early adopters, and participants in specific campaigns by distributing tokens directly to their blockchain addresses.
- Marketing and promotion: Increase awareness and engagement with a project or token. When a project distributes tokens to a large number of users, this attracts attention and incentivizes users to explore and participate in the project’s ecosystem.
- Community building and engagement: Foster a strong and active community around a project. Distribute tokens to community members to incentivize them to stay engaged, participate in discussions, provide feedback, and contribute to the overall growth and success of the project.
We recommend setting a maximum of 500 recipients per airdrop transaction. More
than 500 recipients can cause the blockchain fees to spike or the transaction
to fail.
Deployment parameters
The Airdrop template creates a customized airdrop smart contract to distribute ERC-20, ERC-721, ERC-1155, or native tokens to multiple users. To create a contract using this template, provide the following parameter values when deploying a smart contract template. To deploy a template, send aPOST request
to the /templates/{id}/deploy endpoint.
Template ID: 13e322f2-18dc-4f57-8eed-4bddfc50f85e
Template deployment parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
defaultAdmin | Add | X | Address of the default admin. This address can execute permissable functions on the contract. Important: You lose administrative access to the contract if this is not set to an address you control. |
contractURI | String | URL for the marketplace metadata of your contract. |
Common functions
This section lists the most commonly used functions on the Airdrop template, their respective parameters, and potential failure scenarios. These functions include:setOwner [write]
ThesetOwner function sets the owner of the smart contract or transfers
ownership from the existing owner to a new owner.
Parameters
The name of the parameter is not used in the request body.
| Parameter | Type | Description |
|---|---|---|
| _newOwner | address | Address of the new owner. |
Failure scenarios
- The
setOwnerfunction fails if it is called by a non-admin.
airdropERC1155 [write]
TheairdropERC1155 function allows the owner of this address to send ERC-1155
tokens to a list of recipients.
Parameters
The names of the parameters are not used in the request body.
| Parameter | Type | Description |
|---|---|---|
| _newOwner | address | Address of the new owner. |
| _contents | tuple: - address - uint256 - uint256 | Array of recipient information: - Address that is to receive the airdrop - ID of the token within the ERC-1155 contract to be distributed - Amount of the token within the ERC-1155 contract to be distributed |
Failure scenarios
TheairdropERC1155 function fails if:
- It is called by a non-admin
- It contains incorrect token information, such as an invalid token ID
- The Airdrop contract is not approved for what’s being transferred, which means it is not authorized to transfer assets on the airdropper’s behalf
- Airdropping to a contract without a receive function
Example
The following sample code shows the new owner address and contents when sending aPOST request to the /developer/transactions/contractExecution endpoint:
JSON
airdropERC721 [write]
TheairdropERC721 function allows the owner of this address to send ERC-20
tokens to a list of recipients.
Parameters
The names of the parameters are not used in the request body.
| Parameter | Type | Description |
|---|---|---|
| _tokenAddress | address | Address of the new owner. |
| _contents | tuple: - address - uint256 | Array of recipient information: - Address that is to receive the airdrop - Amount of the token within the ERC-721 contract to be distributed |
Failure scenarios
TheairdropERC721 function fails if:
- It is called by a non-admin
- It contains incorrect token information, such as an invalid token ID
- The Airdrop contract is not approved for what’s being transferred, which means it is not authorized to transfer assets on the airdropper’s behalf
- Airdropping to a contract without a receive function
Example
The following sample code shows the token address and contents when sending aPOST request to the /developer/transactions/contractExecution endpoint:
JSON
airdropERC20 [write]
TheairdropERC20 function allows the owner of this address to send NFTs to a
list of recipients.
Parameters
The names of the parameters are not used in the request body.
| Parameter | Type | Description |
|---|---|---|
| _tokenAddress | address | Address of the token. |
| _contents | tuple: - address - uint256 | Array of recipient information: - Address that is to receive the airdrop - Quantity of tokens to be transferred |
Failure scenarios
TheairdropERC20 function fails if:
- It is called by a non-admin
- The Airdrop contract is not approved for what’s being transferred, which means it is not authorized to transfer assets on the airdropper’s behalf
- Airdropping to a contract without a receive function
Example
The following sample code shows the token address and contents when sending aPOST request to the /developer/transactions/contractExecution endpoint:
JSON
owner [read]
Theowner function retrieves the address of the current owner.
Example
The following sample code shows theowner function when sending a POST
request to the /contracts/query endpoint:
JSON