IAirdropERC1155 Contract
This interface defines the functions for airdropping ERC1155 tokens to a list of recipients. It allows for airdropping multiple token IDs with specific quantities to each recipient.
Features
- Airdrop multiple ERC1155 tokens to a list of recipients
- Specify token IDs and quantities for each recipient
Usage
This interface is intended to be implemented by contracts that need to perform ERC1155 airdrops. Contracts can implement this interface and use its functions to execute airdrops effectively.
Example Implementation
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol";
import "./IAirdropERC1155.sol";
contract AirdropERC1155 is ERC1155, IAirdropERC1155 {
// ... constructor, other functions
function airdrop(
address[] memory recipients,
uint256[] memory tokenIds,
uint256[] memory quantities
) external override {
require(recipients.length == tokenIds.length && tokenIds.length == quantities.length, "Arrays must have the same length");
for (uint256 i = 0; i < recipients.length; i++) {
_mintBatch(recipients[i], tokenIds[i], quantities[i], "");
}
}
}