-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SMR-1727] Map token L1 #103
Closed
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
v1.6.1
Sentence in description seemed to stop part way through: "This is because the only state it holds is" |
…tracts into map-token-L1
* Initial L2-side commit * Almost finished adding child erc20 bridge * Add new child bridge contracts * Child ERC20Bridge and unit tests * Add some todos * Refactor into child and root directories * Child ERC20 token mapping * Cleanup
@Benjimmutable , this PR is stale. Are you still actively working on this? Should this PR be abandoned? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is the first PR for bridge smart contracts that interface with the Axelar Network.
Motivation
Before a token gets bridged, we want to establish a mapping of
L1 Token Address => L2 Token Address
on both Root Chain and Child Chain. To do this, we want to send a Map Token message.Clones.predictDeterministicAddress
function on every bridge operation, but then complexities are introduced in regards to determining if you need to deploy an ERC20 token to that address (i.e. on the first bridge), if the correct SC is deployed there, etc.Changes
This PR is only for the L1 message sending. L2 message receiving will be in a follow up PR.
The rough architecture currently will be as follows:
Justification for Adaptor
The underlying communication protocol may change. Using the adaptor pattern is a modular way that allows us to replace the underlying message passing logic without having to upgrade the bridge contract directly. It also allows us to decouple vendor-specific messaging logic from the bridge logic.
The Adaptor is not made to be upgradeable. This is because the only state it holds is config details (smart contract addresses), it only acts as a middleman message passer, and it is trivial to redeploy a new one and set the adaptor to the new contract.
Feel free to challenge this.
Also worth mentioning that any logic + data checks that are agnostic to the underlying message passing protocol should be done in the
RootERC20Bridge
contract, and anything specific to the Axelar message passing protocol should be in the Axelar adaptor.Prior Art
I copied and took inspiration as much as possible from the Edge Root Bridge contract. The child chain message receiving will be inspired/copied from here.
Pausability
Pausing or anything similar is not introduced in this PR. Given that this is just a PoC I did not spend too much time thinking about this, but it will definitely be something that is scrutinised heavily, and is important to consider, in the near future.
Owner role
There is currently an Ownable2Step role. Again, given that this is just a PoC I did not spend too much time thinking about RBAC but ownership of this contract will definitely be something that is scrutinised heavily in the near future.