Example: Cross-Chain Airdrop

Allow owners of an ERC721 on Ethereum to claim something on another chain.

circle-info

This feature is in beta, so please fill out this formarrow-up-right to get in touch with the Succinct team about using it.

We've built a simple example contract that allows users that own an ERC721 on mainnet to receive an airdrop such as a new NFT or other tokens on another chain (ex. Polygon). The contract reads ERC721.ownerOf(uint256)arrow-up-right from mainnet to ensure that the wallet is the correct owner.

Since the _giveAirdrop function is abstract, you can add any logic you want for airdrop claimers. This base contract could be used to migrate an NFT to a new chain, give tokens to claimers, or otherwise provide additional utility to ERC721 tokens on mainnet.

Here's an example that gives 1 ETH to airdrop claimers.

contract SimpleNFTAirdrop is NFTAirdrop {
    constructor(address _nft, address _oracle)
        payable
        NFTAirdrop(_nft, _oracle)
    {
        require(msg.value == 10 ether);
    }

    function _giveAirdrop(address _to, uint256 _tokenId) internal override {
        (bool success, ) = payable(_to).call{value: 1 ether}("");
        require(success);
    }
}

The full source code for the contracts used in this below can be found at the Github NFTAirdrop.solarrow-up-right example.

Last updated