How to set up a contract so people can batch mint an amount or NFTS equal to the amount of NFTS they're holding from a different project

Howdy guys, I’m looking for a contract solution for a free give away for one of my projects where holders will able to mint x amount of nfts at once based on the amount of tokens from the original project that they're holding.

Seems like you need an airdrop, maybe you can have a look at this tutorial: Building an NFT Merkle Airdrop - OpenZeppelin blog

1 Like

You can try this:

contract NewIssuieNFT is ERC721 {

    erc721 originalProjectNFT;   // or erc20 token

    function mint() public {
        uint256 amount = originalProjectNFT.balanceOf(msg.sender);
        for(int I = 0; I < amount; i++) {
           _safeMint(msg.sender);
        }
    }
}

I'm actually working to migrate my ERC721 contract so I can add a few things and remove a few others. What I'm having trouble getting the new contract to do, is read the original contract and allow the migration to happen. I've even deployed a "new" original contract on test net. When it comes to using the migration function, it keeps failing. Any pointers on this? Below is the function I'm trying to use.

function migrate(uint256 tokenId_) external {
  require(msg.sender == V1.ownerOf(tokenId_), 
    "You are not the owner!");

  V1.transferFrom(msg.sender, address(this), tokenId_);

  _mint(msg.sender, tokenId_);
}

I think you need approve before calling the migrate.