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
-
🧍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.
create
action 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.
mint
action to the destination subnet.transfer
message.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.
transfer
action to the native chain.receiveTeleporterMessage
is explained below.Execute three different cases inside
receiveTeleporterMessage
:Create a clone of the ERC721 contract.
name
,symbol
, andtokenURI
as 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
destinationSubnet
message payload, the contract will either:destinationSubnet
is the token’s native subnet, then the bridge contract will transfer the token back to its owner.destinationSubnet
isn’t the token’s native subnet, then the bridge contract will update its mapping that tracks the NFT’s whereabouts and send amint
message 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:
create
message sending.mint
message sending.transfer
message sending.create
message processing.mint
message processing.transfer
message processing.3. Integration Tests
The contract will have set of integrations tests to validate the end-to-end behavior of the contract:
create
message use case.mint
message use case.transfer
message 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