-
Notifications
You must be signed in to change notification settings - Fork 157
Handle non-18-decimal fee tokens in token bridge creator #86
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
Merged
Conversation
This file contains hidden or 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
gzeoneth
requested changes
Jul 8, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.
gzeoneth
approved these changes
Jul 8, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
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.
Token bridge creator sends 2 retryable tickets:
L1AtomicTokenBridgeCreatoritself)L1TokenBridgeRetryableSender)In general, retryable ticket params are all denominated in 18 decimals, except for totalFeeAmount which is denominated in fee token's decimals.
Token bridge creator knows gas price bid and gas limit for retryables, and based on those it will calculate fee amounts in fee token that deployer needs to pay. Calculated fee amount is by default denominated in 18 decimals, so token bridge creator has to do additional scaling to convert fee amount to fee token's decimals. Those scaled amounts will then be
safeTransferFrom'd by token bridge creator to the inbox to pay for retryables execution.Ie. let's say fee token is USDC (6 decimals). And gasLimit = 2e6; gasPriceBid = 3e8. That means fee amount, scaled to 6 decimals, will be (2e6*3e8) / (1e(18-6)) = 600 USDC ($0,0006)
PR also adds e2e tests to CI which are executed over the 6-decimals fee token chain.
Note: PR changes
L1TokenBridgeRetryableSender's signature ofsendRetryablefunction which is used byL1AtomicTokenBridgeCreator. So for existing token bridge creators, upgrade of both contracts needs to be synced.