This repository has been archived by the owner on Mar 1, 2024. It is now read-only.
fix: bridge ERC20 tokens from L1 to L2 using migrations
scripts
#486
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.
Description
The initial approach involved using
childChain.addToken
to createChildERC20
andChildERC721
contracts, but this rendered them unusable due to ownership issues. In this scenario, theChildChain
contract became the owner, preventing updates to the child chain address and leaving it set to0x0
. Consequently, attempts to bridge resulted in reverting transactions (with no explicit error message 😅) due to the restrictiveonlyChildChain
modifier (see maticnetwork/matic-cli#210).contracts/contracts/child/ChildChain.sol
Lines 55 to 76 in ba520b6
contracts/contracts/child/ChildERC20.sol
Lines 11 to 21 in ba520b6
contracts/contracts/child/ChildToken.sol
Lines 79 to 87 in ba520b6
The revised logic aligns with the updated scripts, employing
ChildERC20Proxified
andChildERC721Proxified
for token creation. This approach allows for proper initialisation, subsequent child chain address updates, and token mapping. As a result, theChildChain
contract can seamlessly send tokens to our L2 address as intended.Jira Ticket
Test
New deployment.
After bridging some ether and ERC20 tokens.