Skip to content

Commit

Permalink
add comment about rounding
Browse files Browse the repository at this point in the history
Signed-off-by: bennett <[email protected]>
  • Loading branch information
bmzig committed Nov 6, 2024
1 parent afda4b4 commit 7082475
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions contracts/chain-adapters/Arbitrum_CustomGasToken_Adapter.sol
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,9 @@ contract Arbitrum_CustomGasToken_Adapter is AdapterInterface, CircleCCTPAdapter
// amount and requiredL1TokenTotalFeeAmount are in the precision of the custom gas token.
uint256 amountToBridge = amount + requiredL1TokenTotalFeeAmount;
CUSTOM_GAS_TOKEN.safeIncreaseAllowance(address(L1_INBOX), amountToBridge);
// Both `l2CallValue` and `tokenTotalFeeAmount` are rounded in the conversion to/from native/18 decimals. `l2CallValue` is rounded down by the call to _fromNativeTo18Decimals()
// in cases where the token's decimals exceeds 18, since we would rather round down and be forced to donate a small amount of the l2 token to the spoke pool to cover the roundoff
// error than overshoot a transfer amount. `amountToBridge` is rounded up since we would rather overpay for gas and be refunded on l2 than underpay and risk stuck cross-chain messages.
L1_INBOX.createRetryableTicket(
to, // destAddr destination L2 contract address
_fromNativeTo18Decimals(amount), // l2CallValue call value for retryable L2 message
Expand Down

0 comments on commit 7082475

Please sign in to comment.