The AirDrop
contract enables the efficient distribution of ERC-20 tokens to multiple addresses in a single transaction. This contract can be used for airdrops, distributing rewards, or any scenario requiring token transfers to multiple recipients.
- Batch Token Distribution: Distribute ERC-20 tokens to multiple recipients in a single transaction.
- Flexible Amounts: Specify individual token amounts for each recipient.
- Address Verification: Ensures that the provided token address is a valid contract.
- Ownership Control: Only the contract owner can initiate airdrops.
- Description: Initializes the
AirDropRc31
contract. No parameters are required for deployment.
- Description: Transfers specified amounts of an ERC-20 token to a list of recipient addresses.
- Parameters:
_address
- An array of addresses to receive tokens.amounts
- An array of token amounts corresponding to each recipient.tokenInstance
- The address of the ERC-20 token contract.
- Returns: A boolean value indicating whether the airdrop was successful.
- Requirements:
- The
_address
andamounts
arrays must have the same length. tokenInstance
must be a valid ERC-20 token contract.
- The
- Deploy the contract.
- Call the
doAirDrop
function, passing in:- A list of recipient addresses (
_address
). - The amounts of tokens to send to each recipient (
amounts
). - The address of the ERC-20 token contract (
tokenInstance
).
- A list of recipient addresses (
Only the contract owner can initiate the airdrop. This ensures secure and controlled token distribution.
- Solidity version ^0.8.1
- An ERC-20 token contract for the token distribution.
address[] memory recipients = [0xRecipientAddress1, 0xRecipientAddress2];
uint[] memory amounts = [100 * 10 ** 18, 50 * 10 ** 18];
airDropInstance.doAirDrop(recipients, amounts, tokenAddress);
- Ensure that the contract has sufficient allowance to transfer the specified amounts from the sender’s wallet.
- The function will revert if any transfer fails.