Telepathy
  • Introduction
  • Why Telepathy?
  • Getting Started
  • Build with Telepathy
    • Cross-Chain Messaging
      • Example: Cross-Chain Counter
      • Example: Cross-Chain Messaging Demo
      • Unit Testing
    • Ethereum Data Oracle
      • Example: Cross-Chain Airdrop
      • Example: Cross-Chain ENS Resolution
    • Ethereum Consensus Oracle
      • Example: Validator Balance Data
  • Telepathy Protocol
    • Overview
    • Sync Committee Protocol
    • Proof of Consensus
    • Smart Contracts
    • Off-chain Actors
    • Circuits
    • Guardrails
  • Resources
    • Telepathy Explorer
    • Contract Addresses
    • Brand Assets
  • Demo
  • Explorer
  • Github
  • Website
  • Discord
Powered by GitBook
On this page
  1. Build with Telepathy
  2. Ethereum Data Oracle

Example: Cross-Chain Airdrop

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

PreviousEthereum Data OracleNextExample: Cross-Chain ENS Resolution

Last updated 2 years ago

This feature is in beta, so please fill out 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 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 example.

this form
ERC721.ownerOf(uint256)
NFTAirdrop.sol