Teleporter ERC721 Bridge #222
vikinatora
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
🧍Introduction
The Teleporter protocol is implemented at the smart contract level and serves as a user-friendly interface to AWM, targeting dapp developers. Each dapp protocol can decide for itself how to leverage Teleporter and AWM to enable cross-subnet functionality. Among the common use cases well-known in the blockchain space are ERC20 and ERC721 bridging. This discussion aims to outline the implementation of an ERC721 bridging dApp.
🗺️ Development Roadmap
1. ERC721 Bridge Contract & Permissioned ERC721 Contract
The ERC721 Bridge Contract will enable users to transfer their NFTs from one subnet to another. A key piece of the contract's logic will be to track the other bridge addresses, create a clone of the ERC721 contracts on non-native subnets, as well as mint or burn the tokens depending on the situation. It's going to have the following functionality:
Execute three different cases inside
bridgeNFT:Each outbound message type will have a corresponding inbound message handler inside
receiveTeleporterMessage:Send a message to create a clone of the ERC721 contract.
createaction to the destination subnet.Send a message to mint the user’s token.
This action will be executed if the token exists only on its native subnet.
mintaction to the destination subnet.transfermessage.Send a message to transfer the user’s token to a different subnet.
This action will be executed if the token already exists on a subnet and the owner wants it to be transferred to another subnet. A critical requirement of the bridge is to allow a specific token to exist on only one non-native subnet. That's the reason why in non-native to non-native subnet transfer cases, the “two hops” approach must be implemented.
transferaction to the native chain.receiveTeleporterMessageis explained below.Execute three different cases inside
receiveTeleporterMessage:Create a clone of the ERC721 contract.
name,symbol, andtokenURIas on the native subnet.Mint a specific token.
Transfer token to another subnet.
This case can be triggered only on the token’s native subnet. Depending on the
destinationSubnetmessage payload, the contract will either:destinationSubnetis the token’s native subnet, then the bridge contract will transfer the token back to its owner.destinationSubnetisn’t the token’s native subnet, then the bridge contract will update its mapping that tracks the NFT’s whereabouts and send amintmessage to the destination chain.Additionally, the bridge is going to use an ERC721 contract. Only the bridge contract is going to be authorized to mint tokens.
2. Contract Tests
The contract swill have unit tests validating the correct behaviour of the bridge contract:
createmessage sending.mintmessage sending.transfermessage sending.createmessage processing.mintmessage processing.transfermessage processing.3. Integration Tests
The contract will have set of integrations tests to validate the end-to-end behavior of the contract:
createmessage use case.mintmessage use case.transfermessage use case.4. Documentation
LimeChain recognizes that documentation is a critical component of open-source software. As such, we are committed to providing comprehensive developer documentation.
Note: The contracts shall be implemented in LimeChain’s fork of Teleporter repository. This is due to the fact that all upstream contracts are audited, while the scope outlined above doesn’t include external audits. Nevertheless, the contracts will be audited internally at LimeChain before releasing them.
Beta Was this translation helpful? Give feedback.
All reactions