IERC20InboxLike
This is the minimal interface needed by contracts within this subdirectory.
Functions
sendContractTransaction
Sends a contract transaction to the L2 inbox, with a single-try execution on the L3.
function sendContractTransaction(
uint256 gasLimit_,
uint256 maxFeePerGas_,
address to_,
uint256 value_,
bytes calldata data_
) external returns (uint256 messageNumber_);
createRetryableTicket
Put a message in the L2 inbox that can be re-executed for some fixed amount of time if it reverts.
All tokenTotalFeeAmount will be deposited to callValueRefundAddress on L2.
Gas limit and maxFeePerGas should not be set to 1 as that is used to trigger the RetryableData error
In case of native token having non-18 decimals: tokenTotalFeeAmount is denominated in native token's decimals. All other value params - l2CallValue, maxSubmissionCost and maxFeePerGas are denominated in child chain's native 18 decimals.
tokenTotalFeeAmount_ (converted to 18 decimals on the L2) must be greater than or equal to the sum of
gasLimit_ multiplied by maxFeePerGas_ and maxSubmissionCost_.
Retryable ticket's submission fee is not charged when ERC20 token is used to pay for fees (see https://github.com/OffchainLabs/nitro-contracts/blob/v3.1.0/src/bridge/ERC20Inbox.sol#L118).
function createRetryableTicket(
address to_,
uint256 l2CallValue_,
uint256 maxSubmissionCost_,
address excessFeeRefundAddress_,
address callValueRefundAddress_,
uint256 gasLimit_,
uint256 maxFeePerGas_,
uint256 tokenTotalFeeAmount_,
bytes calldata data_
) external returns (uint256 messageNumber_);
Parameters
| Name | Type | Description |
|---|---|---|
to_ | address | Destination L2 contract address. |
l2CallValue_ | uint256 | Call value for retryable L2 message. |
maxSubmissionCost_ | uint256 | Max gas deducted from user's L2 balance to cover base submission fee (denominated in app chain's gas token's 18 decimals). |
excessFeeRefundAddress_ | address | The address which receives the difference between execution fee paid and the actual execution cost. In case this address is a contract, funds will be received in its alias on L2. |
callValueRefundAddress_ | address | L2 call value gets credited here on L2 if retryable txn times out or gets cancelled. In case this address is a contract, funds will be received in its alias on L2. |
gasLimit_ | uint256 | Max gas deducted from user's L2 balance to cover L2 execution. Should not be set to 1 (magic value used to trigger the RetryableData error). |
maxFeePerGas_ | uint256 | Price bid for L2 execution. Should not be set to 1 (magic value used to trigger the RetryableData error). |
tokenTotalFeeAmount_ | uint256 | The amount of fees to be deposited in native token to cover for retryable ticket cost (denominated in native token's decimals). |
data_ | bytes | ABI encoded data of L2 message. |
Returns
| Name | Type | Description |
|---|---|---|
messageNumber_ | uint256 | The message number of the retryable transaction. |
depositERC20
Deposits an ERC20 token into the L2 inbox, to be sent to the L3 where it is the gas token of that chain.
function depositERC20(uint256 amount_) external returns (uint256 messageNumber_);
calculateRetryableSubmissionFee
Calculates the submission fee for a retryable ticket.
function calculateRetryableSubmissionFee(uint256 dataLength_, uint256 baseFee_)
external
view
returns (uint256 submissionFee_);