+ "metadata": "{\"compiler\":{\"version\":\"0.8.23+commit.f704f362\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"underlyingAdapter\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"DelegateCallFailed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"RelayTokensNotSupported\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TargetSpokeMismatch\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"target\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"MessageRelayed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"l1Token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"l2Token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"TokensRelayed\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"UNDERLYING_ADAPTER\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"target\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"relayMessage\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"relayTokens\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"A custom adapter that allows admin to delegatecall `relayTokens` on other adapters by calling `relaySpokePoolAdminFunction` on the HubPool\",\"kind\":\"dev\",\"methods\":{\"relayMessage(address,bytes)\":{\"params\":{\"message\":\"Abi-encoded arguments params for the `relayTokens` function call: (address l1Token, address l2Token, uint256 amount, address spokePool)\",\"target\":\"Receiver of tokens on the destination chain. SpokePool address passed in by the HubPool\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/chain-adapters/AdminRelayTokensAdapter.sol\":\"AdminRelayTokensAdapter\"},\"debug\":{\"revertStrings\":\"strip\"},\"evmVersion\":\"shanghai\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1000000},\"remappings\":[],\"viaIR\":true},\"sources\":{\"contracts/chain-adapters/AdminRelayTokensAdapter.sol\":{\"content\":\"// SPDX-License-Identifier: BUSL-1.1\\npragma solidity ^0.8.0;\\n\\nimport { AdapterInterface } from \\\"./interfaces/AdapterInterface.sol\\\";\\n\\n/**\\n * @dev A custom adapter that allows admin to delegatecall `relayTokens` on other adapters by calling `relaySpokePoolAdminFunction` on the HubPool\\n */\\ncontract AdminRelayTokensAdapter is AdapterInterface {\\n error TargetSpokeMismatch();\\n error DelegateCallFailed();\\n error RelayTokensNotSupported();\\n\\n // @dev Underlying adapter whose `relayTokens` logic will be executed via delegatecall. Must be trusted\\n address public immutable UNDERLYING_ADAPTER;\\n\\n constructor(address underlyingAdapter) {\\n UNDERLYING_ADAPTER = underlyingAdapter;\\n }\\n\\n /**\\n * @param target Receiver of tokens on the destination chain. SpokePool address passed in by the HubPool\\n * @param message Abi-encoded arguments params for the `relayTokens` function call: (address l1Token,\\n * address l2Token, uint256 amount, address spokePool)\\n */\\n function relayMessage(address target, bytes calldata message) external payable {\\n (address l1Token, address l2Token, uint256 amount, address spokePool) = abi.decode(\\n message,\\n (address, address, uint256, address)\\n );\\n if (target != spokePool) {\\n revert TargetSpokeMismatch();\\n }\\n\\n // We are ok with this low-level call since the adapter address is set by the admin and we've\\n // already checked that its not the zero address.\\n // solhint-disable-next-line avoid-low-level-calls\\n (bool success, ) = UNDERLYING_ADAPTER.delegatecall(\\n abi.encodeWithSelector(\\n AdapterInterface.relayTokens.selector,\\n l1Token, // l1Token.\\n l2Token, // l2Token.\\n amount, // amount.\\n spokePool // to. This should be the spokePool.\\n )\\n );\\n if (!success) {\\n revert DelegateCallFailed();\\n }\\n }\\n\\n function relayTokens(address, address, uint256, address) external payable {\\n revert RelayTokensNotSupported();\\n }\\n}\\n\",\"keccak256\":\"0x3989bc4d2c4d967378d7b5e0c360897e785f958f3b384cdbd47da4aab48137e1\",\"license\":\"BUSL-1.1\"},\"contracts/chain-adapters/interfaces/AdapterInterface.sol\":{\"content\":\"// SPDX-License-Identifier: BUSL-1.1\\npragma solidity ^0.8.0;\\n\\n/**\\n * @notice Sends cross chain messages and tokens to contracts on a specific L2 network.\\n * This interface is implemented by an adapter contract that is deployed on L1.\\n */\\n\\ninterface AdapterInterface {\\n event MessageRelayed(address target, bytes message);\\n\\n event TokensRelayed(address l1Token, address l2Token, uint256 amount, address to);\\n\\n /**\\n * @notice Send message to `target` on L2.\\n * @dev This method is marked payable because relaying the message might require a fee\\n * to be paid by the sender to forward the message to L2. However, it will not send msg.value\\n * to the target contract on L2.\\n * @param target L2 address to send message to.\\n * @param message Message to send to `target`.\\n */\\n function relayMessage(address target, bytes calldata message) external payable;\\n\\n /**\\n * @notice Send `amount` of `l1Token` to `to` on L2. `l2Token` is the L2 address equivalent of `l1Token`.\\n * @dev This method is marked payable because relaying the message might require a fee\\n * to be paid by the sender to forward the message to L2. However, it will not send msg.value\\n * to the target contract on L2.\\n * @param l1Token L1 token to bridge.\\n * @param l2Token L2 token to receive.\\n * @param amount Amount of `l1Token` to bridge.\\n * @param to Bridge recipient.\\n */\\n function relayTokens(\\n address l1Token,\\n address l2Token,\\n uint256 amount,\\n address to\\n ) external payable;\\n}\\n\",\"keccak256\":\"0x1d52fcb8b10dc7f260345918c1a90d496a4c9f774402cbd5ebde881b8fed6d50\",\"license\":\"BUSL-1.1\"}},\"version\":1}",
0 commit comments