@@ -8,7 +8,18 @@ import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.s
88import { ITokenMessenger as ICCTPTokenMessenger } from "../external/interfaces/CCTPInterfaces.sol " ;
99import { CircleCCTPAdapter, CircleDomainIds } from "../libraries/CircleCCTPAdapter.sol " ;
1010
11+ /**
12+ * @notice Interface for funder contract that this contract pulls from to pay for relayMessage()/relayTokens()
13+ * fees using a custom gas token.
14+ */
1115interface FunderInterface {
16+ /**
17+ * @notice Withdraws amount of token from funder contract to the caller.
18+ * @dev Can only be called by owner of Funder contract, which therefore must be
19+ * this contract.
20+ * @param token Token to withdraw.
21+ * @param amount Amount to withdraw.
22+ */
1223 function withdraw (IERC20 token , uint256 amount ) external ;
1324}
1425
@@ -123,9 +134,9 @@ interface ArbitrumL1ERC20GatewayLike {
123134 * called via delegatecall, which will execute this contract's logic within the context of the originating contract.
124135 * For example, the HubPool will delegatecall these functions, therefore its only necessary that the HubPool's methods
125136 * that call this contract's logic guard against reentrancy.
126- * @dev This contract is very similar to Arbitrum_Adapter but it allows the caller to pay for retryable ticket
127- * submission fees using a custom gas token. This is required to support certain Arbitrum orbit L2s and L3s.
128- * @custom:security-contact [email protected] 137+ * @dev This contract is very similar to Arbitrum_Adapter but it allows the caller to pay for submission
138+ * fees using a custom gas token. This is required to support certain Arbitrum orbit L2s and L3s.
139+ * @dev https://docs.arbitrum.io/launch-orbit-chain/how-tos/use-a-custom-gas-token
129140 */
130141
131142// solhint-disable-next-line contract-name-camelcase
@@ -143,21 +154,34 @@ contract Arbitrum_CustomGasToken_Adapter is AdapterInterface, CircleCCTPAdapter
143154 // L2 Gas price bid for immediate L2 execution attempt (queryable via standard eth*gasPrice RPC)
144155 uint256 public constant L2_GAS_PRICE = 5e9 ; // 5 gWei
145156
157+ // Native token expected to be sent in L2 message. Should be 0 for all use cases of this constant, which
158+ // includes sending messages from L1 to L2 and sending Custom gas token ERC20's, which won't be the native token
159+ // on the L2 by definition.
146160 uint256 public constant L2_CALL_VALUE = 0 ;
147161
162+ // Gas limit for L2 execution of a cross chain token transfer sent via the inbox.
148163 uint32 public constant RELAY_TOKENS_L2_GAS_LIMIT = 300_000 ;
164+ // Gas limit for L2 execution of a message sent via the inbox.
149165 uint32 public constant RELAY_MESSAGE_L2_GAS_LIMIT = 2_000_000 ;
150166
151167 // This address on L2 receives extra gas token that is left over after relaying a message via the inbox.
152168 address public immutable L2_REFUND_L2_ADDRESS;
153169
170+ // Inbox system contract to send messages to Arbitrum. Token bridges use this to send tokens to L2.
171+ // https://github.com/OffchainLabs/nitro-contracts/blob/f7894d3a6d4035ba60f51a7f1334f0f2d4f02dce/src/bridge/Inbox.sol
154172 ArbitrumL1InboxLike public immutable L1_INBOX;
155173
174+ // Router contract to send tokens to Arbitrum. Routes to correct gateway to bridge tokens. Internally this
175+ // contract calls the Inbox.
176+ // Generic gateway: https://github.com/OffchainLabs/token-bridge-contracts/blob/main/contracts/tokenbridge/ethereum/gateway/L1ArbitrumGateway.sol
177+ // Gateway used for communicating with chains that use custom gas tokens:
178+ // https://github.com/OffchainLabs/token-bridge-contracts/blob/main/contracts/tokenbridge/ethereum/gateway/L1ERC20Gateway.sol
156179 ArbitrumL1ERC20GatewayLike public immutable L1_ERC20_GATEWAY_ROUTER;
157180
158181 // This token is used to pay for l1 to l2 messages if its configured by an Arbitrum orbit chain.
159182 IERC20 public immutable CUSTOM_GAS_TOKEN;
160183
184+ // Contract that funds Inbox cross chain messages with the custom gas token.
161185 FunderInterface public immutable CUSTOM_GAS_TOKEN_FUNDER;
162186
163187 error InvalidCustomGasToken ();
0 commit comments