Skip to content

Conversation

@gvladika
Copy link
Contributor

@gvladika gvladika commented Apr 29, 2024

Token bridge creator sends 2 retryable tickets:

  • one to deploy factory (it is created by L1AtomicTokenBridgeCreator itself)
  • one to call factory function to create contracts (creation is delegated to 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 of sendRetryable function which is used by L1AtomicTokenBridgeCreator. So for existing token bridge creators, upgrade of both contracts needs to be synced.

@cla-bot cla-bot bot added the cla-signed label Apr 29, 2024
@gvladika gvladika marked this pull request as ready for review May 9, 2024 11:01
@gvladika gvladika changed the title Non 18 decimals Handle non-18-decimal fee tokens in token bridge creator May 9, 2024
@gvladika gvladika changed the base branch from add-e2e-tests to main May 23, 2024 12:49
Copy link
Member

@gzeoneth gzeoneth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.

Copy link
Member

@gzeoneth gzeoneth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@gzeoneth gzeoneth changed the base branch from main to develop July 8, 2024 16:08
@gzeoneth gzeoneth merged commit c60c265 into develop Jul 8, 2024
@gzeoneth gzeoneth deleted the non-18-decimals branch July 8, 2024 16:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants