空投合约增加批量mint nft

This commit is contained in:
CounterFire2023 2024-06-27 20:18:08 +08:00
parent 42b642dd0e
commit 6342b7cc76
6 changed files with 353 additions and 1142 deletions

View File

@ -2,10 +2,15 @@
pragma solidity 0.8.19;
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {IERC721} from "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
contract AirdropToken {
interface IERC721 {
function mint(address to, uint256 tokenID) external;
function transferFrom(address from, address to, uint256 tokenId) external;
}
contract AirdropToken is Ownable{
using SafeERC20 for IERC20;
mapping(address user => uint256 amount) public failTransferList;
@ -40,4 +45,12 @@ contract AirdropToken {
token.transferFrom(msg.sender, _addresses[i], _tokenIds[i]);
}
}
function multiMintERC721(address _token, address[] calldata _addresses, uint256[] calldata _tokenIds) external onlyOwner(){
require(_addresses.length == _tokenIds.length, "Lengths of Addresses and TokenIds NOT EQUAL");
IERC721 token = IERC721(_token);
for (uint256 i; i < _addresses.length; i++) {
token.mint(_addresses[i], _tokenIds[i]);
}
}
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -29,16 +29,16 @@
"json": "assets/contracts/CFNFTGame.json",
"address": "0x75C0c6eD851036DB28c750Bd9bfa3A72B5107801"
},
{
"name": "AirdropToken",
"type": "logic",
"json": "assets/contracts/AirdropToken.json",
"address": "0x4Ef766854EE104053cF2D243620b7A643fCC2B54"
},
{
"name": "NFTClaimStage2WL",
"type": "logic",
"json": "assets/contracts/NFTClaimStage2WL.json",
"address": "0xc11A64Cc2Ec7aEFbd5E25a37f1d9216f3f8CF11a"
},
{
"name": "AirdropToken",
"type": "logic",
"json": "assets/contracts/AirdropToken.json",
"address": "0x02B244Ba62f84ff518a4797b1859977D1fcdBBA8"
}
]