Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions contracts/chain-adapters/Arbitrum_Adapter.sol
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,17 @@ interface ArbitrumL1InboxLike {
uint256 gasPriceBid,
bytes calldata data
) external payable returns (uint256);

function unsafeCreateRetryableTicket(
address destAddr,
uint256 arbTxCallValue,
uint256 maxSubmissionCost,
address submissionRefundAddress,
address valueRefundAddress,
uint256 maxGas,
uint256 gasPriceBid,
bytes calldata data
) external payable returns (uint256);
}

interface ArbitrumL1ERC20GatewayLike {
Expand Down
8 changes: 5 additions & 3 deletions contracts/chain-adapters/Arbitrum_RescueAdapter.sol
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ contract Arbitrum_RescueAdapter is AdapterInterface {
uint256 public immutable l2MaxSubmissionCost = 0.01e18;

// L2 Gas price bid for immediate L2 execution attempt (queryable via standard eth*gasPrice RPC)
uint256 public immutable l2GasPrice = 150e9;
uint256 public immutable l2GasPrice = 5e9; // 5 gWei

// Gas limit for immediate L2 execution attempt (can be estimated via NodeInterface.estimateRetryableTicket).
// NodeInterface precompile interface exists at L2 address 0x00000000000000000000000000000000000000C8
uint32 public immutable l2GasLimit = 160_000;
uint32 public immutable l2GasLimit = 2_000_000;

// This address on L2 receives extra ETH that is left over after relaying a message via the inbox.
address public immutable l2RefundL2Address;
Expand Down Expand Up @@ -65,7 +65,9 @@ contract Arbitrum_RescueAdapter is AdapterInterface {

// In the rescue ETH setup, we send the transaction to the refund address, we provide a call value equal to the
// amount we want to rescue, and we specify an empty calldata, since it's a simple ETH transfer.
l1Inbox.createRetryableTicket{ value: requiredL1CallValue }(
// Note: we use the unsafe version of createRetryableTicket because it doesn't require the msg.sender to pass
// in arbTxCallValue in addition to maxSubmissionCost + maxGas * gasPriceBid.
l1Inbox.unsafeCreateRetryableTicket{ value: requiredL1CallValue }(
l2RefundL2Address, // destAddr destination L2 contract address
valueToReturn, // l2CallValue call value for retryable L2 message
l2MaxSubmissionCost, // maxSubmissionCost Max gas deducted from user's L2 balance to cover base fee
Expand Down
24 changes: 24 additions & 0 deletions deploy/018_deploy_arbitrum_rescueadapter.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { L1_ADDRESS_MAP } from "./consts";

import "hardhat-deploy";
import { HardhatRuntimeEnvironment } from "hardhat/types/runtime";

const func = async function (hre: HardhatRuntimeEnvironment) {
const { deployments, getNamedAccounts, getChainId } = hre;
const { deploy } = deployments;

const { deployer } = await getNamedAccounts();

const chainId = parseInt(await getChainId());

await deploy("Arbitrum_RescueAdapter", {
from: deployer,
log: true,
skipIfAlreadyDeployed: true,
args: [L1_ADDRESS_MAP[chainId].l1ArbitrumInbox],
});
};

module.exports = func;
func.dependencies = ["HubPool"];
func.tags = ["ArbitrumRescueAdapter", "mainnet"];
269 changes: 269 additions & 0 deletions deployments/mainnet/Arbitrum_RescueAdapter.json

Large diffs are not rendered by default.

Loading