|
| 1 | +pragma solidity >=0.7.0; |
| 2 | + |
| 3 | +/** |
| 4 | + * @title precompiled contract in every Arbitrum chain for retryable transaction related data retrieval and interactions. Exists at 0x000000000000000000000000000000000000006E |
| 5 | + */ |
| 6 | +interface IArbRetryableTx { |
| 7 | + /** |
| 8 | + * @notice Redeem a redeemable tx. |
| 9 | + * Revert if called by an L2 contract, or if txId does not exist, or if txId reverts. |
| 10 | + * If this returns, txId has been completed and is no longer available for redemption. |
| 11 | + * If this reverts, txId is still available for redemption (until it times out or is canceled). |
| 12 | + @param txId unique identifier of retryable message: keccak256(keccak256(ArbchainId, inbox-sequence-number), uint(0) ) |
| 13 | + */ |
| 14 | + function redeem(bytes32 txId) external; |
| 15 | + |
| 16 | + /** |
| 17 | + * @notice Return the minimum lifetime of redeemable txn. |
| 18 | + * @return lifetime in seconds |
| 19 | + */ |
| 20 | + function getLifetime() external view returns (uint256); |
| 21 | + |
| 22 | + /** |
| 23 | + * @notice Return the timestamp when ticketId will age out, or zero if ticketId does not exist. |
| 24 | + * The timestamp could be in the past, because aged-out tickets might not be discarded immediately. |
| 25 | + * @param ticketId unique ticket identifier |
| 26 | + * @return timestamp for ticket's deadline |
| 27 | + */ |
| 28 | + function getTimeout(bytes32 ticketId) external view returns (uint256); |
| 29 | + |
| 30 | + /** |
| 31 | + * @notice Return the price, in wei, of submitting a new retryable tx with a given calldata size. |
| 32 | + * @param calldataSize call data size to get price of (in wei) |
| 33 | + * @return (price, nextUpdateTimestamp). Price is guaranteed not to change until nextUpdateTimestamp. |
| 34 | + */ |
| 35 | + function getSubmissionPrice(uint256 calldataSize) external view returns (uint256, uint256); |
| 36 | + |
| 37 | + /** |
| 38 | + * @notice Return the price, in wei, of extending the lifetime of ticketId by an additional lifetime period. Revert if ticketId doesn't exist. |
| 39 | + * @param ticketId unique ticket identifier |
| 40 | + * @return (price, nextUpdateTimestamp). Price is guaranteed not to change until nextUpdateTimestamp. |
| 41 | + */ |
| 42 | + function getKeepalivePrice(bytes32 ticketId) external view returns (uint256, uint256); |
| 43 | + |
| 44 | + /** |
| 45 | + @notice Deposits callvalue into the sender's L2 account, then adds one lifetime period to the life of ticketId. |
| 46 | + * If successful, emits LifetimeExtended event. |
| 47 | + * Revert if ticketId does not exist, or if the timeout of ticketId is already at least one lifetime period in the future, or if the sender has insufficient funds (after the deposit). |
| 48 | + * @param ticketId unique ticket identifier |
| 49 | + * @return New timeout of ticketId. |
| 50 | + */ |
| 51 | + function keepalive(bytes32 ticketId) external payable returns (uint256); |
| 52 | + |
| 53 | + /** |
| 54 | + * @notice Return the beneficiary of ticketId. |
| 55 | + * Revert if ticketId doesn't exist. |
| 56 | + * @param ticketId unique ticket identifier |
| 57 | + * @return address of beneficiary for ticket |
| 58 | + */ |
| 59 | + function getBeneficiary(bytes32 ticketId) external view returns (address); |
| 60 | + |
| 61 | + /** |
| 62 | + * @notice Cancel ticketId and refund its callvalue to its beneficiary. |
| 63 | + * Revert if ticketId doesn't exist, or if called by anyone other than ticketId's beneficiary. |
| 64 | + * @param ticketId unique ticket identifier |
| 65 | + */ |
| 66 | + function cancel(bytes32 ticketId) external; |
| 67 | + |
| 68 | + event TicketCreated(bytes32 indexed ticketId); |
| 69 | + event LifetimeExtended(bytes32 indexed ticketId, uint256 newTimeout); |
| 70 | + event Redeemed(bytes32 indexed ticketId); |
| 71 | + event Canceled(bytes32 indexed ticketId); |
| 72 | +} |
0 commit comments