ETH Price: $3,917.50 (+4.82%)
Gas: 7 Gwei

Contract

0xE233009838CB898b50e0012a6E783FC9FeE447FB
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Value
0x60c03461178421622023-08-04 14:17:47296 days ago1691158667IN
 Contract Creation
0 ETH0.0345839835.16544965

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Similar Match Source Code
This contract matches the deployed Bytecode of the Source Code for Contract 0x4BA640E1...61a9aD130
The constructor portion of the code might be different and could alter the actual behaviour of the contract

Contract Name:
ZkSync_Adapter

Compiler Version
v0.8.18+commit.87f61d96

Optimization Enabled:
Yes with 1000000 runs

Other Settings:
default evmVersion
File 1 of 7 : ZkSync_Adapter.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.0;

import "./interfaces/AdapterInterface.sol";
import "../external/interfaces/WETH9Interface.sol";

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";

interface ZkSyncInterface {
    // _contractL2: L2 address of the contract to be called.
    // _l2Value: Amount of ETH to pass with the call to L2; used as msg.value for the transaction.
    // _calldata: Calldata of the transaction call; encoded the same way as in Ethereum.
    // _l2GasLimit: Gas limit of the L2 transaction call.
    // _l2GasPerPubdataByteLimit: A constant representing how much gas is required to publish a byte of data from
    //  L1 to L2. https://era.zksync.io/docs/api/js/utils.html#gas
    // _factoryDeps: Bytecodes array containing the bytecode of the contract being deployed.
    //  If the contract is a factory contract, the array contains the bytecodes of the contracts it can deploy.
    // _refundRecipient: Address that receives the rest of the fee after the transaction execution.
    //  If refundRecipient == 0, L2 msg.sender is used. Note: If the _refundRecipient is a smart contract,
    //  then during the L1 to L2 transaction its address is aliased.
    function requestL2Transaction(
        address _contractL2,
        uint256 _l2Value,
        bytes calldata _calldata,
        uint256 _l2GasLimit,
        uint256 _l2GasPerPubdataByteLimit,
        bytes[] calldata _factoryDeps,
        address _refundRecipient
    ) external payable returns (bytes32 canonicalTxHash);

    // @notice Estimates the cost in Ether of requesting execution of an L2 transaction from L1
    // @param _l1GasPrice Effective gas price on L1 (priority fee + base fee)
    // @param _l2GasLimit Gas limit for the L2 transaction
    // @param _l2GasPerPubdataByteLimit Gas limit for the L2 transaction per byte of pubdata
    // @return The estimated L2 gas for the transaction to be paid
    function l2TransactionBaseCost(
        uint256 _l1GasPrice,
        uint256 _l2GasLimit,
        uint256 _l2GasPerPubdataByteLimit
    ) external view returns (uint256);
}

interface ZkBridgeLike {
    // @dev: Use ZkSyncInterface.requestL2Transaction to bridge WETH as ETH to L2.
    function deposit(
        address _l2Receiver,
        address _l1Token,
        uint256 _amount,
        uint256 _l2TxGasLimit,
        uint256 _l2TxGasPerPubdataByte,
        address _refundRecipient
    ) external payable returns (bytes32 txHash);
}

// Note: this contract just forwards the calls from the HubPool to ZkSync to avoid limits.
// A modified ZKSync_Adapter should be deployed with this address swapped in for all zkSync addresses.
contract LimitBypassProxy is ZkSyncInterface, ZkBridgeLike {
    using SafeERC20 for IERC20;
    ZkSyncInterface public constant zkSync = ZkSyncInterface(0x32400084C286CF3E17e7B677ea9583e60a000324);
    ZkBridgeLike public constant zkErc20Bridge = ZkBridgeLike(0x57891966931Eb4Bb6FB81430E6cE0A03AAbDe063);

    function l2TransactionBaseCost(
        uint256 _l1GasPrice,
        uint256 _l2GasLimit,
        uint256 _l2GasPerPubdataByteLimit
    ) external view returns (uint256) {
        return zkSync.l2TransactionBaseCost(_l1GasPrice, _l2GasLimit, _l2GasPerPubdataByteLimit);
    }

    function requestL2Transaction(
        address _contractL2,
        uint256 _l2Value,
        bytes calldata _calldata,
        uint256 _l2GasLimit,
        uint256 _l2GasPerPubdataByteLimit,
        bytes[] calldata _factoryDeps,
        address _refundRecipient
    ) external payable returns (bytes32 canonicalTxHash) {
        return
            zkSync.requestL2Transaction{ value: msg.value }(
                _contractL2,
                _l2Value,
                _calldata,
                _l2GasLimit,
                _l2GasPerPubdataByteLimit,
                _factoryDeps,
                _refundRecipient
            );
    }

    function deposit(
        address _l2Receiver,
        address _l1Token,
        uint256 _amount,
        uint256 _l2TxGasLimit,
        uint256 _l2TxGasPerPubdataByte,
        address _refundRecipient
    ) external payable returns (bytes32 txHash) {
        IERC20(_l1Token).safeIncreaseAllowance(address(zkErc20Bridge), _amount);
        return
            zkErc20Bridge.deposit{ value: msg.value }(
                _l2Receiver,
                _l1Token,
                _amount,
                _l2TxGasLimit,
                _l2TxGasPerPubdataByte,
                _refundRecipient
            );
    }
}

/**
 * @notice Contract containing logic to send messages from L1 to ZkSync.
 * @dev Public functions calling external contracts do not guard against reentrancy because they are expected to be
 * called via delegatecall, which will execute this contract's logic within the context of the originating contract.
 * For example, the HubPool will delegatecall these functions, therefore its only necessary that the HubPool's methods
 * that call this contract's logic guard against reentrancy.
 */

// solhint-disable-next-line contract-name-camelcase
contract ZkSync_Adapter is AdapterInterface {
    using SafeERC20 for IERC20;

    // We need to pay a base fee to the operator to include our L1 --> L2 transaction.
    // https://era.zksync.io/docs/dev/developer-guides/bridging/l1-l2.html#getting-the-base-cost

    // Generally, the following params are a bit hard to set and may change in the future once ZkSync
    // goes live. For now, we'll hardcode these and use aggressive values to ensure inclusion.

    // Limit on L2 gas to spend.
    uint256 public constant L2_GAS_LIMIT = 2_000_000;

    // How much gas is required to publish a byte of data from L1 to L2. 800 is the required value
    // as set here https://github.com/matter-labs/era-contracts/blob/6391c0d7bf6184d7f6718060e3991ba6f0efe4a7/ethereum/contracts/zksync/facets/Mailbox.sol#L226
    // Note, this value can change and will require an updated adapter.
    uint256 public constant L1_GAS_TO_L2_GAS_PER_PUB_DATA_LIMIT = 800;

    // This address receives any remaining fee after an L1 to L2 transaction completes.
    // If refund recipient = address(0) then L2 msg.sender is used, unless msg.sender is a contract then its address
    // gets aliased.
    address public immutable l2RefundAddress;

    // Hardcode the following ZkSync system contract addresses to save gas on construction. This adapter can be
    // redeployed in the event that the following addresses change.

    // Main contract used to send L1 --> L2 messages. Fetchable via `zks_getMainContract` method on JSON RPC.
    ZkSyncInterface public constant zkSyncMessageBridge = ZkSyncInterface(0x32400084C286CF3E17e7B677ea9583e60a000324);

    // Contract used to send ETH to L2. Note: this is the same address as the main contract, but separated to allow
    // only this contract to be swapped (leaving the main zkSync contract to be used for messaging).
    ZkSyncInterface public constant zkSyncEthBridge = ZkSyncInterface(0x32400084C286CF3E17e7B677ea9583e60a000324);

    // Bridges to send ERC20 and ETH to L2. Fetchable via `zks_getBridgeContracts` method on JSON RPC.
    ZkBridgeLike public constant zkErc20Bridge = ZkBridgeLike(0x57891966931Eb4Bb6FB81430E6cE0A03AAbDe063);

    // Set l1Weth at construction time to make testing easier.
    WETH9Interface public immutable l1Weth;

    event ZkSyncMessageRelayed(bytes32 canonicalTxHash);

    /**
     * @notice Constructs new Adapter.
     * @param _l1Weth WETH address on L1.
     * @param _l2RefundAddress address that recieves excess gas refunds on L2.
     */
    constructor(WETH9Interface _l1Weth, address _l2RefundAddress) {
        l1Weth = _l1Weth;
        l2RefundAddress = _l2RefundAddress;
    }

    /**
     * @notice Send cross-chain message to target on ZkSync.
     * @notice This contract must hold at least getL1CallValue() amount of ETH to send a message, or the message
     * will revert.
     * @param target Contract on L2 that will receive message.
     * @param message Data to send to target.
     */
    function relayMessage(address target, bytes memory message) external payable override {
        uint256 txBaseCost = _contractHasSufficientEthBalance();

        // Returns the hash of the requested L2 transaction. This hash can be used to follow the transaction status.
        bytes32 canonicalTxHash = zkSyncMessageBridge.requestL2Transaction{ value: txBaseCost }(
            target,
            // We pass no ETH with the call, otherwise we'd need to add to the txBaseCost this value.
            0,
            message,
            L2_GAS_LIMIT,
            L1_GAS_TO_L2_GAS_PER_PUB_DATA_LIMIT,
            new bytes[](0),
            l2RefundAddress
        );

        emit MessageRelayed(target, message);
        emit ZkSyncMessageRelayed(canonicalTxHash);
    }

    /**
     * @notice Bridge tokens to ZkSync.
     * @notice This contract must hold at least getL1CallValue() amount of ETH to send a message
     * or the message will revert.
     * @param l1Token L1 token to deposit.
     * @param l2Token L2 token to receive.
     * @param amount Amount of L1 tokens to deposit and L2 tokens to receive.
     * @param to Bridge recipient.
     */
    function relayTokens(
        address l1Token,
        address l2Token, // l2Token is unused.
        uint256 amount,
        address to
    ) external payable override {
        // This could revert if the relay amount is over the ZkSync deposit
        // limit: https://github.com/matter-labs/era-contracts/blob/main/ethereum/contracts/common/AllowList.sol#L150
        // We should make sure that the limit is either set very high or we need to do logic
        // that splits the amount to deposit into multiple chunks. We can't have
        // this function revert or the HubPool will not be able to proceed to the
        // next bundle. See more here:
        // https://github.com/matter-labs/era-contracts/blob/main/docs/Overview.md#deposit-limitation
        // https://github.com/matter-labs/era-contracts/blob/6391c0d7bf6184d7f6718060e3991ba6f0efe4a7/ethereum/contracts/zksync/facets/Mailbox.sol#L230
        uint256 txBaseCost = _contractHasSufficientEthBalance();

        // If the l1Token is WETH then unwrap it to ETH then send the ETH to the standard bridge along with the base
        // cost. I've tried sending WETH over the erc20Bridge directly but we receive the wrong WETH
        // on the L2 side. So, we need to unwrap the WETH into ETH and then send.
        bytes32 txHash;
        if (l1Token == address(l1Weth)) {
            l1Weth.withdraw(amount);
            // We cannot call the standard ERC20 bridge because it disallows ETH deposits.
            txHash = zkSyncEthBridge.requestL2Transaction{ value: txBaseCost + amount }(
                to,
                amount,
                "",
                L2_GAS_LIMIT,
                L1_GAS_TO_L2_GAS_PER_PUB_DATA_LIMIT,
                new bytes[](0),
                l2RefundAddress
            );
        } else {
            IERC20(l1Token).safeIncreaseAllowance(address(zkErc20Bridge), amount);
            txHash = zkErc20Bridge.deposit{ value: txBaseCost }(
                to,
                l1Token,
                amount,
                L2_GAS_LIMIT,
                L1_GAS_TO_L2_GAS_PER_PUB_DATA_LIMIT,
                l2RefundAddress
            );
        }

        emit TokensRelayed(l1Token, l2Token, amount, to);
        emit ZkSyncMessageRelayed(txHash);
    }

    /**
     * @notice Returns required amount of ETH to send a message.
     * @return amount of ETH that this contract needs to hold in order for relayMessage to succeed.
     */
    function getL1CallValue() public view returns (uint256) {
        // - tx.gasprice returns effective_gas_price. It's also used by Mailbox contract to estimate L2GasPrice
        // so using tx.gasprice should always pass this check that msg.value >= baseCost + _l2Value
        // https://github.com/matter-labs/era-contracts/blob/6391c0d7bf6184d7f6718060e3991ba6f0efe4a7/ethereum/contracts/zksync/facets/Mailbox.sol#L273
        // - priority_fee_per_gas = min(transaction.max_priority_fee_per_gas, transaction.max_fee_per_gas - block.base_fee_per_gas)
        // - effective_gas_price = priority_fee_per_gas + block.base_fee_per_gas
        return
            zkSyncMessageBridge.l2TransactionBaseCost(tx.gasprice, L2_GAS_LIMIT, L1_GAS_TO_L2_GAS_PER_PUB_DATA_LIMIT);
    }

    function _contractHasSufficientEthBalance() internal view returns (uint256 requiredL1CallValue) {
        requiredL1CallValue = getL1CallValue();
        require(address(this).balance >= requiredL1CallValue, "Insufficient ETH balance");
    }
}

File 2 of 7 : IERC20Permit.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/IERC20Permit.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
 * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
 *
 * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
 * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
 * need to send a transaction, and thus is not required to hold Ether at all.
 */
interface IERC20Permit {
    /**
     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
     * given ``owner``'s signed approval.
     *
     * IMPORTANT: The same issues {IERC20-approve} has related to transaction
     * ordering also apply here.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `deadline` must be a timestamp in the future.
     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
     * over the EIP712-formatted function arguments.
     * - the signature must use ``owner``'s current nonce (see {nonces}).
     *
     * For more information on the signature format, see the
     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
     * section].
     */
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

    /**
     * @dev Returns the current nonce for `owner`. This value must be
     * included whenever a signature is generated for {permit}.
     *
     * Every successful call to {permit} increases ``owner``'s nonce by one. This
     * prevents a signature from being used multiple times.
     */
    function nonces(address owner) external view returns (uint256);

    /**
     * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
     */
    // solhint-disable-next-line func-name-mixedcase
    function DOMAIN_SEPARATOR() external view returns (bytes32);
}

File 3 of 7 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(address indexed owner, address indexed spender, uint256 value);

    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the amount of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves `amount` tokens from the caller's account to `to`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address to, uint256 amount) external returns (bool);

    /**
     * @dev Returns the remaining number of tokens that `spender` will be
     * allowed to spend on behalf of `owner` through {transferFrom}. This is
     * zero by default.
     *
     * This value changes when {approve} or {transferFrom} are called.
     */
    function allowance(address owner, address spender) external view returns (uint256);

    /**
     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * IMPORTANT: Beware that changing an allowance with this method brings the risk
     * that someone may use both the old and the new allowance by unfortunate
     * transaction ordering. One possible solution to mitigate this race
     * condition is to first reduce the spender's allowance to 0 and set the
     * desired value afterwards:
     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
     *
     * Emits an {Approval} event.
     */
    function approve(address spender, uint256 amount) external returns (bool);

    /**
     * @dev Moves `amount` tokens from `from` to `to` using the
     * allowance mechanism. `amount` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(address from, address to, uint256 amount) external returns (bool);
}

File 4 of 7 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

import "../IERC20.sol";
import "../extensions/IERC20Permit.sol";
import "../../../utils/Address.sol";

/**
 * @title SafeERC20
 * @dev Wrappers around ERC20 operations that throw on failure (when the token
 * contract returns false). Tokens that return no value (and instead revert or
 * throw on failure) are also supported, non-reverting calls are assumed to be
 * successful.
 * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
 * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
 */
library SafeERC20 {
    using Address for address;

    /**
     * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeTransfer(IERC20 token, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
    }

    /**
     * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
     * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
     */
    function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
    }

    /**
     * @dev Deprecated. This function has issues similar to the ones found in
     * {IERC20-approve}, and its usage is discouraged.
     *
     * Whenever possible, use {safeIncreaseAllowance} and
     * {safeDecreaseAllowance} instead.
     */
    function safeApprove(IERC20 token, address spender, uint256 value) internal {
        // safeApprove should only be called when setting an initial allowance,
        // or when resetting it to zero. To increase and decrease it, use
        // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
        require(
            (value == 0) || (token.allowance(address(this), spender) == 0),
            "SafeERC20: approve from non-zero to non-zero allowance"
        );
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
    }

    /**
     * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        uint256 oldAllowance = token.allowance(address(this), spender);
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));
    }

    /**
     * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        unchecked {
            uint256 oldAllowance = token.allowance(address(this), spender);
            require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));
        }
    }

    /**
     * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful. Compatible with tokens that require the approval to be set to
     * 0 before setting it to a non-zero value.
     */
    function forceApprove(IERC20 token, address spender, uint256 value) internal {
        bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);

        if (!_callOptionalReturnBool(token, approvalCall)) {
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));
            _callOptionalReturn(token, approvalCall);
        }
    }

    /**
     * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.
     * Revert on invalid signature.
     */
    function safePermit(
        IERC20Permit token,
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal {
        uint256 nonceBefore = token.nonces(owner);
        token.permit(owner, spender, value, deadline, v, r, s);
        uint256 nonceAfter = token.nonces(owner);
        require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     */
    function _callOptionalReturn(IERC20 token, bytes memory data) private {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that
        // the target address contains contract code and also asserts for success in the low-level call.

        bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
        require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     *
     * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.
     */
    function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false
        // and not revert is the subcall reverts.

        (bool success, bytes memory returndata) = address(token).call(data);
        return
            success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token));
    }
}

File 5 of 7 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)

pragma solidity ^0.8.1;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     *
     * Furthermore, `isContract` will also return true if the target contract within
     * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
     * which only has an effect at the end of a transaction.
     * ====
     *
     * [IMPORTANT]
     * ====
     * You shouldn't rely on `isContract` to protect against flash loan attacks!
     *
     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
     * constructor.
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize/address.code.length, which returns 0
        // for contracts in construction, since the code is only stored at the end
        // of the constructor execution.

        return account.code.length > 0;
    }

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].
     *
     * IMPORTANT: because control is transferred to `recipient`, care must be
     * taken to not create reentrancy vulnerabilities. Consider using
     * {ReentrancyGuard} or the
     * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

        (bool success, ) = recipient.call{value: amount}("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

    /**
     * @dev Performs a Solidity function call using a low level `call`. A
     * plain `call` is an unsafe replacement for a function call: use this
     * function instead.
     *
     * If `target` reverts with a revert reason, it is bubbled up by this
     * function (like regular Solidity function calls).
     *
     * Returns the raw returned data. To convert to the expected return value,
     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
     *
     * Requirements:
     *
     * - `target` must be a contract.
     * - calling `target` with `data` must not revert.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, "Address: low-level call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
     * `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
        return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
    }

    /**
     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
     * with `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(address(this).balance >= value, "Address: insufficient balance for call");
        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        return functionStaticCall(target, data, "Address: low-level static call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionDelegateCall(target, data, "Address: low-level delegate call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
     * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
     *
     * _Available since v4.8._
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        if (success) {
            if (returndata.length == 0) {
                // only check isContract if the call was successful and the return data is empty
                // otherwise we already know that it was a contract
                require(isContract(target), "Address: call to non-contract");
            }
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    /**
     * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason or using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    function _revert(bytes memory returndata, string memory errorMessage) private pure {
        // Look for revert reason and bubble it up if present
        if (returndata.length > 0) {
            // The easiest way to bubble the revert reason is using memory via assembly
            /// @solidity memory-safe-assembly
            assembly {
                let returndata_size := mload(returndata)
                revert(add(32, returndata), returndata_size)
            }
        } else {
            revert(errorMessage);
        }
    }
}

File 6 of 7 : AdapterInterface.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.0;

/**
 * @notice Sends cross chain messages and tokens to contracts on a specific L2 network.
 * This interface is implemented by an adapter contract that is deployed on L1.
 */

interface AdapterInterface {
    event MessageRelayed(address target, bytes message);

    event TokensRelayed(address l1Token, address l2Token, uint256 amount, address to);

    /**
     * @notice Send message to `target` on L2.
     * @dev This method is marked payable because relaying the message might require a fee
     * to be paid by the sender to forward the message to L2. However, it will not send msg.value
     * to the target contract on L2.
     * @param target L2 address to send message to.
     * @param message Message to send to `target`.
     */
    function relayMessage(address target, bytes calldata message) external payable;

    /**
     * @notice Send `amount` of `l1Token` to `to` on L2. `l2Token` is the L2 address equivalent of `l1Token`.
     * @dev This method is marked payable because relaying the message might require a fee
     * to be paid by the sender to forward the message to L2. However, it will not send msg.value
     * to the target contract on L2.
     * @param l1Token L1 token to bridge.
     * @param l2Token L2 token to receive.
     * @param amount Amount of `l1Token` to bridge.
     * @param to Bridge recipient.
     */
    function relayTokens(
        address l1Token,
        address l2Token,
        uint256 amount,
        address to
    ) external payable;
}

File 8 of 7 : WETH9Interface.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.0;

/**
 * @notice Interface for the WETH9 contract.
 */
interface WETH9Interface {
    /**
     * @notice Burn Wrapped Ether and receive native Ether.
     * @param wad Amount of WETH to unwrap and send to caller.
     */
    function withdraw(uint256 wad) external;

    /**
     * @notice Lock native Ether and mint Wrapped Ether ERC20
     * @dev msg.value is amount of Wrapped Ether to mint/Ether to lock.
     */
    function deposit() external payable;

    /**
     * @notice Get balance of WETH held by `guy`.
     * @param guy Address to get balance of.
     * @return wad Amount of WETH held by `guy`.
     */
    function balanceOf(address guy) external view returns (uint256 wad);

    /**
     * @notice Transfer `wad` of WETH from caller to `guy`.
     * @param guy Address to send WETH to.
     * @param wad Amount of WETH to send.
     * @return ok True if transfer succeeded.
     */
    function transfer(address guy, uint256 wad) external returns (bool);
}

Settings
{
  "optimizer": {
    "enabled": true,
    "runs": 1000000
  },
  "viaIR": true,
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "metadata": {
    "useLiteralContent": true
  },
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"contract WETH9Interface","name":"_l1Weth","type":"address"},{"internalType":"address","name":"_l2RefundAddress","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"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"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"canonicalTxHash","type":"bytes32"}],"name":"ZkSyncMessageRelayed","type":"event"},{"inputs":[],"name":"L1_GAS_TO_L2_GAS_PER_PUB_DATA_LIMIT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"L2_GAS_LIMIT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getL1CallValue","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"l1Weth","outputs":[{"internalType":"contract WETH9Interface","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"l2RefundAddress","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":"l1Token","type":"address"},{"internalType":"address","name":"l2Token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"to","type":"address"}],"name":"relayTokens","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"zkErc20Bridge","outputs":[{"internalType":"contract ZkBridgeLike","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"zkSyncEthBridge","outputs":[{"internalType":"contract ZkSyncInterface","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"zkSyncMessageBridge","outputs":[{"internalType":"contract ZkSyncInterface","name":"","type":"address"}],"stateMutability":"view","type":"function"}]

Deployed Bytecode

0x6080604052600436101561001257600080fd5b6000803560e01c806308f1ed1514610c34578063146bf4b114610bc557806352c8c75c146104155780635e743ef7146103d95780636c9075b71461039e5780638446ec811461032f578063bb3e04b5146102df578063c9f5a053146102da578063cdc2b148146102da5763e6eb8ade1461008b57600080fd5b7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc6040813601126102d2576100be610c75565b906024359167ffffffffffffffff83116102d657366023840112156102d657826004013591846100ed84610d55565b946100fb6040519687610ce5565b84865236602486830101116102d257846024956020968793018389013786010152826101b761012861103d565b610130610d8f565b936040518096819482937feb67241900000000000000000000000000000000000000000000000000000000845273ffffffffffffffffffffffffffffffffffffffff809316988960048601528d602486015260e060448601526101978d60e4870190610db3565b91621e8480606487015261032060848701528583030160a4860152610e11565b907f000000000000000000000000428ab2ba90eba0a4be7af34c9ac451ab061ac0101660c483015203917332400084c286cf3e17e7b677ea9583e60a0003245af19182156102c7578592610273575b507f82e577407245f8e8c446b39602dae3fffacbc21172a51c88525e050063929b2f937f9e6c52944e331ba6270e7fe4cea2a4086bae8f7a27e1cdba07f416806f5d0ac49161026660405192839283526040878401526040830190610db3565b0390a1604051908152a180f35b9091508281813d83116102c0575b61028b8183610ce5565b810103126102bb5751907f82e577407245f8e8c446b39602dae3fffacbc21172a51c88525e050063929b2f610206565b600080fd5b503d610281565b6040513d87823e3d90fd5b5080fd5b8380fd5b610c98565b503461032c57807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261032c5760206040517357891966931eb4bb6fb81430e6ce0a03aabde0638152f35b80fd5b503461032c57807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261032c57602060405173ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000428ab2ba90eba0a4be7af34c9ac451ab061ac010168152f35b503461032c57807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261032c5760206040516103208152f35b503461032c57807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261032c576020604051621e84808152f35b5060807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261032c57610448610c75565b6024359073ffffffffffffffffffffffffffffffffffffffff82168203610bc15760643573ffffffffffffffffffffffffffffffffffffffff811681036102d65761049161103d565b73ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc216908173ffffffffffffffffffffffffffffffffffffffff85161460001461074757813b15610743576040517f2e1a7d4d000000000000000000000000000000000000000000000000000000008152868160248183604435978860048401525af18015610738576106ef575b50816105446105cb93602093610e8b565b61054c610d8f565b916040518095819482937feb67241900000000000000000000000000000000000000000000000000000000845273ffffffffffffffffffffffffffffffffffffffff8a166004850152602484015260e060448401528b60e4840152621e84806064840152610320608484015261010060a4840152610104830190610e11565b73ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000428ab2ba90eba0a4be7af34c9ac451ab061ac0101660c483015203917332400084c286cf3e17e7b677ea9583e60a0003245af19081156102c75785916106b7575b50608060209373ffffffffffffffffffffffffffffffffffffffff7f82e577407245f8e8c446b39602dae3fffacbc21172a51c88525e050063929b2f9694817fd7e09655439c3932e55857df3220186e5a7f0980825f20691c2b35d941dee75b95965b816040519516855216878401526044356040840152166060820152a1604051908152a180f35b90506020939193813d82116106e7575b816106d460209383610ce5565b810103126102bb5751909290608061062e565b3d91506106c7565b67ffffffffffffffff819792971161070b576040529481610533565b6024827f4e487b710000000000000000000000000000000000000000000000000000000081526041600452fd5b6040513d89823e3d90fd5b8580fd5b90506040517fdd62ed3e0000000000000000000000000000000000000000000000000000000081523060048201527357891966931eb4bb6fb81430e6ce0a03aabde0636024820152604490602081838173ffffffffffffffffffffffffffffffffffffffff89165afa8015610738578790610b8d575b6107ca9150823590610e8b565b604051907f095ea7b30000000000000000000000000000000000000000000000000000000060208301527357891966931eb4bb6fb81430e6ce0a03aabde06360248301528282015281815267ffffffffffffffff81608081011081608084011117610b60576080820160c08301109060c083011117610b33578060c06108e79201604052602060808201527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c656460a082015287808251602084018273ffffffffffffffffffffffffffffffffffffffff8b165af1903d15610b295760803d916108b183610d55565b926108bf6040519485610ce5565b83523d8b602085013e5b019173ffffffffffffffffffffffffffffffffffffffff8816610ec7565b8051908115918215610b02575b505015610a7e5760209060c4604051809481937fe8b99b1b00000000000000000000000000000000000000000000000000000000835273ffffffffffffffffffffffffffffffffffffffff8816600484015273ffffffffffffffffffffffffffffffffffffffff89166024840152803590830152621e84806064830152610320608483015273ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000428ab2ba90eba0a4be7af34c9ac451ab061ac0101660a48301527357891966931eb4bb6fb81430e6ce0a03aabde0635af19081156102c7578591610a41575b50608060209373ffffffffffffffffffffffffffffffffffffffff7f82e577407245f8e8c446b39602dae3fffacbc21172a51c88525e050063929b2f9694817fd7e09655439c3932e55857df3220186e5a7f0980825f20691c2b35d941dee75b9596610691565b90506020939193813d602011610a76575b81610a5f60209383610ce5565b81010312610a72575190929060806109da565b8480fd5b3d9150610a52565b6084907f5361666545524332303a204552433230206f7065726174696f6e20646964206e604051917f08c379a000000000000000000000000000000000000000000000000000000000835260206004840152602a60248401528201527f6f742073756363656564000000000000000000000000000000000000000000006064820152fd5b8192509060209181010312610b2557602001518015158103610b255738806108f4565b8680fd5b60806060916108c9565b6024877f4e487b710000000000000000000000000000000000000000000000000000000081526041600452fd5b6024887f4e487b710000000000000000000000000000000000000000000000000000000081526041600452fd5b506020813d602011610bb9575b81610ba760209383610ce5565b81010312610b25576107ca90516107bd565b3d9150610b9a565b8280fd5b503461032c57807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261032c57602060405173ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2168152f35b503461032c57807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261032c576020610c6d610f97565b604051908152f35b6004359073ffffffffffffffffffffffffffffffffffffffff821682036102bb57565b346102bb5760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102bb5760206040517332400084c286cf3e17e7b677ea9583e60a0003248152f35b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff821117610d2657604052565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b67ffffffffffffffff8111610d2657601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b6040516020810181811067ffffffffffffffff821117610d26576040526000815290565b919082519283825260005b848110610dfd5750507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8460006020809697860101520116010190565b602081830181015184830182015201610dbe565b90808183519182825260208080809401958560051b01019501936000915b848310610e3f5750505050505090565b9091929394958480610e7b837fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe086600196030187528a51610db3565b9801930193019194939290610e2f565b91908201809211610e9857565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b91929015610f425750815115610edb575090565b3b15610ee45790565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152fd5b825190915015610f555750805190602001fd5b610f93906040519182917f08c379a0000000000000000000000000000000000000000000000000000000008352602060048401526024830190610db3565b0390fd5b6040517fb473318e0000000000000000000000000000000000000000000000000000000081523a6004820152621e8480602482015261032060448201526020816064817332400084c286cf3e17e7b677ea9583e60a0003245afa90811561103157600091611003575090565b906020823d8211611029575b8161101c60209383610ce5565b8101031261032c57505190565b3d915061100f565b6040513d6000823e3d90fd5b611045610f97565b9081471061104f57565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f496e73756666696369656e74204554482062616c616e636500000000000000006044820152fdfea2646970667358221220bff645f26f4ee22fe6f4ac5d9e1de3e44447a5b9b0a1de51b75e9b931343de0664736f6c63430008120033

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading
[ Download: CSV Export  ]

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.