relevant tag icon
NFT Linker
copy icon
Axelar
• version 1.0.0
crosschain
NFT
relay

NFT Linker

Send an NFT on a source chain to a recipient on a destination chain using the callContract function. If the source chain is where the NFT was originally created, the NFT gets locked in the contract and minted on the destination chain; in the reverse direction, the NFT is burned and transferred to its final recipient on the destination (/original home) chain. Get more info: https://github.com/axelarnetwork/axelar-examples/tree/main/examples/evm/nft-linker

*Visit desktop site to download or deploy

Version

1.0.0

Creator

Axelar

Recent Use

🍞 0x705c downloaded

Last Publish

2/28/2023
Any contract you deploy is yours.
Fully owned and controlled by your wallet.
Documentation
Source Code
_setup() :
This function sets up the contract by decoding the parameters passed in and assigning them to the chainName variable. It also checks to make sure that the chainName variable has not already been initialized, and if it has, it reverts the transaction. (autogenerated documentation)
sendNFT(address,uint256,string,address) :
This function allows a user to send an NFT (Non-Fungible Token) from one chain to another. It first checks if the operator is the same as the address of the contract. If it is, it checks that the sender is the owner of the token, and then calls the _sendMintedToken function to send the token to the destination chain. If the operator is not the same as the address of the contract, it calls the IERC721 transferFrom function to transfer the token from the sender to the contract, and then calls the _sendNativeToken function to send the token to the destination chain. (autogenerated documentation)
_sendMintedToken(uint256,string,address) :
This function is used to send a token from one blockchain to another. It takes in three parameters: the token ID, the destination chain, and the destination address. It first burns the token on the original chain, then it encodes the original chain, the operator, the original token ID, and the destination address into a payload. It then calls the gasService to pay for the contract call, and finally calls the gateway contract with the payload. (autogenerated documentation)
_sendNativeToken(address,uint256,string,address) :
This function is used to send a native token from one chain to another. It takes in four parameters: the address of the operator, the token ID, the destination chain, and the destination address. It then encodes the chain name, operator address, token ID, and destination address into a payload. It then calls the gasService contract to pay for the contract call, and then calls the gateway contract with the payload. The gateway contract will then send the native token to the destination address on the destination chain. (autogenerated documentation)
_execute(string,string) :
This function is used to transfer a token from one chain to another. It takes in a calldata, source address, and payload as parameters. The payload contains the original chain name, the operator address, and the token ID. The function first checks if the original chain name is the same as the current chain name. If it is, it calls the IERC721 transferFrom function to transfer the token from the current address to the destination address. If the original chain name is different, it creates a new token ID by hashing the original chain name, operator address, and token ID. It then stores the original data in the original mapping and calls the _safeMint function to mint the token to the destination address. (autogenerated documentation)
contractId() :
This function returns a bytes32 value that is the result of the keccak256 hashing algorithm applied to the string 'example'. The keccak256 algorithm is a cryptographic hashing algorithm that takes an input of any length and produces a fixed-length output. This output is a unique identifier that can be used to identify the input data. In this case, the output is a bytes32 value that can be used to uniquely identify the string 'example'. (autogenerated documentation)

Get Cookin'
share iconShare

copy iconDownload Source
copy iconnpx cookbookdev i NFT-Linker
copy icon

Recent Use

🍞 0x705c downloaded

Last Publish

2/28/2023

Version

1.0.0

Creator

Axelar

Cookbook is free.
Any contract you deploy is yours.
Your contract is owned and controlled by you.