ETH Price: $3,951.30 (-2.07%)
Gas: 0.32 GWei

Contract

0xAcC7A83FE6a9C7CFcA7B9Df6c7DeBc339fC5d633

Overview

ETH Balance

Linea Mainnet LogoLinea Mainnet LogoLinea Mainnet Logo0 ETH

ETH Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To

There are no matching entries

Please try again later

Latest 25 internal transactions (View All)

Parent Transaction Hash Block From To
134189942024-12-17 8:16:5010 hrs ago1734423410
0xAcC7A83F...39fC5d633
0 ETH
134185622024-12-17 8:02:2210 hrs ago1734422542
0xAcC7A83F...39fC5d633
0 ETH
134162282024-12-17 6:43:5211 hrs ago1734417832
0xAcC7A83F...39fC5d633
0.0050515 ETH
133917282024-12-16 16:27:0326 hrs ago1734366423
0xAcC7A83F...39fC5d633
0.00398059 ETH
133916752024-12-16 16:25:1526 hrs ago1734366315
0xAcC7A83F...39fC5d633
0 ETH
133905442024-12-16 15:46:5726 hrs ago1734364017
0xAcC7A83F...39fC5d633
0 ETH
133899742024-12-16 15:27:4527 hrs ago1734362865
0xAcC7A83F...39fC5d633
0.10809054 ETH
133897982024-12-16 15:21:4927 hrs ago1734362509
0xAcC7A83F...39fC5d633
0 ETH
133894972024-12-16 15:11:4127 hrs ago1734361901
0xAcC7A83F...39fC5d633
0 ETH
133887952024-12-16 14:48:0727 hrs ago1734360487
0xAcC7A83F...39fC5d633
0 ETH
133887022024-12-16 14:45:0127 hrs ago1734360301
0xAcC7A83F...39fC5d633
0 ETH
133752942024-12-16 7:13:1735 hrs ago1734333197
0xAcC7A83F...39fC5d633
0.0011003 ETH
133611032024-12-15 22:59:0343 hrs ago1734303543
0xAcC7A83F...39fC5d633
0 ETH
133609322024-12-15 22:52:5543 hrs ago1734303175
0xAcC7A83F...39fC5d633
0 ETH
133609172024-12-15 22:52:2343 hrs ago1734303143
0xAcC7A83F...39fC5d633
0 ETH
133609172024-12-15 22:52:2343 hrs ago1734303143
0xAcC7A83F...39fC5d633
0 ETH
133604862024-12-15 22:36:2543 hrs ago1734302185
0xAcC7A83F...39fC5d633
0.0007 ETH
133604452024-12-15 22:35:0143 hrs ago1734302101
0xAcC7A83F...39fC5d633
0.0007 ETH
133604062024-12-15 22:33:3343 hrs ago1734302013
0xAcC7A83F...39fC5d633
0.0007 ETH
133602212024-12-15 22:27:0144 hrs ago1734301621
0xAcC7A83F...39fC5d633
0.0007 ETH
133564882024-12-15 20:15:1146 hrs ago1734293711
0xAcC7A83F...39fC5d633
0.060143 ETH
133455682024-12-15 14:00:392 days ago1734271239
0xAcC7A83F...39fC5d633
0.00197377 ETH
133439652024-12-15 13:06:532 days ago1734268013
0xAcC7A83F...39fC5d633
0 ETH
133323462024-12-15 6:32:222 days ago1734244342
0xAcC7A83F...39fC5d633
0.20011 ETH
133187822024-12-14 22:19:002 days ago1734214740
0xAcC7A83F...39fC5d633
0.00040913 ETH
View All Internal Transactions
Loading...
Loading

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

Contract Name:
Bridge

Compiler Version
v0.8.18+commit.87f61d96

Optimization Enabled:
Yes with 200 runs

Other Settings:
paris EvmVersion
File 1 of 13 : Bridge.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import {ReentrancyGuardUpgradeable} from "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";
import {IERC20, SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {Address} from "@openzeppelin/contracts/utils/Address.sol";

import "./interfaces/IZKBridgeReceiver.sol";
import "./interfaces/IZKBridgeEndpoint.sol";
import "./interfaces/IL1Bridge.sol";

import {Pool} from "./Pool.sol";

contract Bridge is IZKBridgeReceiver, Initializable, ReentrancyGuardUpgradeable, Pool {
    using SafeERC20 for IERC20;

    IZKBridgeEndpoint public immutable zkBridgeEndpoint;
    IL1Bridge public immutable l1Bridge;

    // chainId -> bridge address, mapping of token bridge contracts on other chains
    mapping(uint16 => address) public bridgeLookup;

    // For two-step bridge management
    bool public pendingBridge;
    uint16 public pendingDstChainId;
    address public pendingBridgeAddress;

    event TransferToken(
        uint64 indexed sequence,
        uint16 indexed dstChainId,
        uint256 indexed poolId,
        address sender,
        address recipient,
        uint256 amount
    );

    event ReceiveToken(
        uint64 indexed sequence, uint16 indexed srcChainId, uint256 indexed poolId, address recipient, uint256 amount
    );

    event NewPendingBridge(uint16 chainId, address bridge);
    event NewBridge(uint16 chainId, address bridge);

    /// @dev l1Bridge_ could be address(0) when Mux functions are not needed
    constructor(IZKBridgeEndpoint zkBridgeEndpoint_, IL1Bridge l1Bridge_, uint256 NATIVE_TOKEN_POOL_ID_)
        Pool(NATIVE_TOKEN_POOL_ID_)
    {
        require(address(zkBridgeEndpoint_) != address(0), "Bridge: zkBridgeEndpoint is the zero address");
        zkBridgeEndpoint = zkBridgeEndpoint_;
        l1Bridge = l1Bridge_;
    }

    function initialize() external initializer {
        __ReentrancyGuard_init();
        __Admin_init();
    }

    function estimateFee(uint256 poolId, uint16 dstChainId, uint256 amount) public view returns (uint256) {
        _checkDstChain(poolId, dstChainId);
        uint256 uaFee = getFee(poolId, dstChainId, amount);
        uint256 zkBridgeFee = zkBridgeEndpoint.estimateFee(dstChainId);
        return uaFee + zkBridgeFee;
    }

    function _transfer(uint16 dstChainId, uint256 poolId, uint256 amount, address recipient, uint256 fee)
        internal
        returns (uint256)
    {
        address dstBridge = bridgeLookup[dstChainId];
        require(dstBridge != address(0), "Bridge: dstChainId does not exist");

        uint256 uaFee = getFee(poolId, dstChainId, amount);
        uint256 zkBridgeFee = zkBridgeEndpoint.estimateFee(dstChainId);
        require(fee >= uaFee + zkBridgeFee, "Bridge: Insufficient Fee");

        uint256 amountSD = _deposit(poolId, dstChainId, amount);

        bytes memory payload = abi.encode(poolId, amountSD, recipient);
        uint64 sequence = zkBridgeEndpoint.send{value: zkBridgeFee}(dstChainId, dstBridge, payload);

        emit TransferToken(sequence, dstChainId, poolId, msg.sender, recipient, amountSD);

        // Returns the actual amount of fees used
        return uaFee + zkBridgeFee;
    }

    /// @notice The main function for sending native token through bridge
    function transferETH(uint16 dstChainId, uint256 amount, address recipient) external payable nonReentrant {
        require(msg.value >= amount, "Bridge: Insufficient ETH");
        _transfer(dstChainId, NATIVE_TOKEN_POOL_ID, amount, recipient, msg.value - amount);
    }

    /// @notice The main function for sending ERC20 tokens through bridge
    function transferToken(uint16 dstChainId, uint256 poolId, uint256 amount, address recipient)
        external
        payable
        nonReentrant
    {
        require(poolId != NATIVE_TOKEN_POOL_ID, "Bridge: Can't transfer token using native token pool ID");
        IERC20(_poolInfo[poolId].token).safeTransferFrom(msg.sender, address(this), amount);
        _transfer(dstChainId, poolId, amount, recipient, msg.value);
    }

    /// @notice The main function for receiving tokens. Should only be called by zkBridge
    function zkReceive(uint16 srcChainId, address srcAddress, uint64 sequence, bytes calldata payload)
        external
        nonReentrant
    {
        require(msg.sender == address(zkBridgeEndpoint), "Bridge: Not from zkBridgeEndpoint");
        require(srcAddress != address(0) && srcAddress == bridgeLookup[srcChainId], "Bridge: Invalid emitter");

        (uint256 poolId, uint256 amountSD, address recipient) = abi.decode(payload, (uint256, uint256, address));

        uint256 amount = _withdraw(poolId, srcChainId, amountSD);

        if (poolId == NATIVE_TOKEN_POOL_ID) {
            Address.sendValue(payable(recipient), amount);
        } else {
            IERC20(_poolInfo[poolId].token).safeTransfer(recipient, amount);
        }

        emit ReceiveToken(sequence, srcChainId, poolId, recipient, amountSD);
    }

    /// @notice Sending native token through bridge, fallback to l1bridge when limits are triggered
    function transferETHMux(uint16 dstChainId, uint256 amount, address recipient) external payable nonReentrant {
        require(address(l1Bridge) != address(0), "Bridge: l1Bridge not available");
        uint256 refundAmount;
        if (
            _poolInfo[NATIVE_TOKEN_POOL_ID].balance + amount <= _poolInfo[NATIVE_TOKEN_POOL_ID].maxLiquidity
                && amount <= _dstChains[NATIVE_TOKEN_POOL_ID][dstChainId].maxTransferLimit
        ) {
            require(msg.value >= amount, "Bridge: Insufficient ETH");
            uint256 fee = _transfer(dstChainId, NATIVE_TOKEN_POOL_ID, amount, recipient, msg.value - amount);
            refundAmount = msg.value - amount - fee;
        } else {
            uint256 fee = l1Bridge.fees(dstChainId);
            require(msg.value >= amount + fee, "Bridge: Insufficient ETH");
            l1Bridge.transferETH{value: amount + fee}(dstChainId, amount, recipient);
            refundAmount = msg.value - amount - fee;
        }

        if (refundAmount > 0) {
            Address.sendValue(payable(msg.sender), refundAmount);
        }
    }

    /// @notice Sending ERC20 tokens through bridge, fallback to l1bridge when limits are triggered
    function transferTokenMux(uint16 dstChainId, uint256 poolId, uint256 amount, address recipient)
        external
        payable
        nonReentrant
    {
        require(address(l1Bridge) != address(0), "Bridge: l1Bridge not available");
        require(poolId != NATIVE_TOKEN_POOL_ID, "Bridge: Can't transfer token using native token pool ID");
        address token = _poolInfo[poolId].token;
        require(token != address(0), "Bridge: pool not found");
        IERC20(token).safeTransferFrom(msg.sender, address(this), amount);
        uint256 refundAmount;
        if (
            _poolInfo[poolId].balance + amount <= _poolInfo[poolId].maxLiquidity
                && amount <= _dstChains[poolId][dstChainId].maxTransferLimit
        ) {
            uint256 fee = _transfer(dstChainId, poolId, amount, recipient, msg.value);
            refundAmount = msg.value - fee;
        } else {
            uint256 fee = l1Bridge.fees(dstChainId);
            require(msg.value >= fee, "Bridge: Insufficient fee");
            IERC20(token).safeApprove(address(l1Bridge), amount);
            l1Bridge.transferERC20{value: fee}(dstChainId, token, amount, recipient);
            IERC20(token).safeApprove(address(l1Bridge), 0);
            refundAmount = msg.value - fee;
        }

        if (refundAmount > 0) {
            Address.sendValue(payable(msg.sender), refundAmount);
        }
    }

    function estimateFeeMux(uint256 poolId, uint16 dstChainId, uint256 amount) external view returns (uint256) {
        require(address(l1Bridge) != address(0), "Bridge: l1Bridge not available");
        uint256 fee = estimateFee(poolId, dstChainId, amount);
        uint256 l1Fee = l1Bridge.fees(dstChainId);
        return fee > l1Fee ? fee : l1Fee;
    }

    /// @notice adding a new dstChain bridge address
    /// @param bridge could be address(0) when deleting a bridge
    function setBridge(uint16 dstChainId, address bridge) external onlyBridgeManager nonReentrant {
        if (bridgeManager != bridgeReviewer) {
            // Two-step bridge management needed
            pendingDstChainId = dstChainId;
            pendingBridgeAddress = bridge;
            pendingBridge = true;
            emit NewPendingBridge(dstChainId, bridge);
        } else {
            // bridgeManager is the same as bridgeReviewer, two-step bridge management not needed
            bridgeLookup[dstChainId] = bridge;
            if (pendingBridge) {
                pendingBridge = false;
            }
            emit NewBridge(dstChainId, bridge);
        }
    }

    /// @notice approve a new dstChain bridge address
    /// @dev The dstChainId and bridge params are required to prevent front-running attacks
    function approveSetBridge(uint16 dstChainId, address bridge) external onlyBridgeReviewer nonReentrant {
        require(pendingBridge, "Bridge: no pending bridge");
        require(
            dstChainId == pendingDstChainId && bridge == pendingBridgeAddress,
            "Bridge: dstChainId or bridge does not match"
        );
        bridgeLookup[dstChainId] = bridge;
        pendingBridge = false;
        emit NewBridge(dstChainId, bridge);
    }
}

File 2 of 13 : Initializable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol)

pragma solidity ^0.8.2;

import "../../utils/AddressUpgradeable.sol";

/**
 * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
 * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an
 * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
 * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
 *
 * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be
 * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in
 * case an upgrade adds a module that needs to be initialized.
 *
 * For example:
 *
 * [.hljs-theme-light.nopadding]
 * ```solidity
 * contract MyToken is ERC20Upgradeable {
 *     function initialize() initializer public {
 *         __ERC20_init("MyToken", "MTK");
 *     }
 * }
 *
 * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {
 *     function initializeV2() reinitializer(2) public {
 *         __ERC20Permit_init("MyToken");
 *     }
 * }
 * ```
 *
 * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
 * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
 *
 * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
 * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
 *
 * [CAUTION]
 * ====
 * Avoid leaving a contract uninitialized.
 *
 * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
 * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke
 * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:
 *
 * [.hljs-theme-light.nopadding]
 * ```
 * /// @custom:oz-upgrades-unsafe-allow constructor
 * constructor() {
 *     _disableInitializers();
 * }
 * ```
 * ====
 */
abstract contract Initializable {
    /**
     * @dev Indicates that the contract has been initialized.
     * @custom:oz-retyped-from bool
     */
    uint8 private _initialized;

    /**
     * @dev Indicates that the contract is in the process of being initialized.
     */
    bool private _initializing;

    /**
     * @dev Triggered when the contract has been initialized or reinitialized.
     */
    event Initialized(uint8 version);

    /**
     * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
     * `onlyInitializing` functions can be used to initialize parent contracts.
     *
     * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a
     * constructor.
     *
     * Emits an {Initialized} event.
     */
    modifier initializer() {
        bool isTopLevelCall = !_initializing;
        require(
            (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),
            "Initializable: contract is already initialized"
        );
        _initialized = 1;
        if (isTopLevelCall) {
            _initializing = true;
        }
        _;
        if (isTopLevelCall) {
            _initializing = false;
            emit Initialized(1);
        }
    }

    /**
     * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
     * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
     * used to initialize parent contracts.
     *
     * A reinitializer may be used after the original initialization step. This is essential to configure modules that
     * are added through upgrades and that require initialization.
     *
     * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`
     * cannot be nested. If one is invoked in the context of another, execution will revert.
     *
     * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
     * a contract, executing them in the right order is up to the developer or operator.
     *
     * WARNING: setting the version to 255 will prevent any future reinitialization.
     *
     * Emits an {Initialized} event.
     */
    modifier reinitializer(uint8 version) {
        require(!_initializing && _initialized < version, "Initializable: contract is already initialized");
        _initialized = version;
        _initializing = true;
        _;
        _initializing = false;
        emit Initialized(version);
    }

    /**
     * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
     * {initializer} and {reinitializer} modifiers, directly or indirectly.
     */
    modifier onlyInitializing() {
        require(_initializing, "Initializable: contract is not initializing");
        _;
    }

    /**
     * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
     * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
     * to any version. It is recommended to use this to lock implementation contracts that are designed to be called
     * through proxies.
     *
     * Emits an {Initialized} event the first time it is successfully executed.
     */
    function _disableInitializers() internal virtual {
        require(!_initializing, "Initializable: contract is initializing");
        if (_initialized != type(uint8).max) {
            _initialized = type(uint8).max;
            emit Initialized(type(uint8).max);
        }
    }

    /**
     * @dev Returns the highest version that has been initialized. See {reinitializer}.
     */
    function _getInitializedVersion() internal view returns (uint8) {
        return _initialized;
    }

    /**
     * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.
     */
    function _isInitializing() internal view returns (bool) {
        return _initializing;
    }
}

File 3 of 13 : ReentrancyGuardUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol)

pragma solidity ^0.8.0;
import "../proxy/utils/Initializable.sol";

/**
 * @dev Contract module that helps prevent reentrant calls to a function.
 *
 * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
 * available, which can be applied to functions to make sure there are no nested
 * (reentrant) calls to them.
 *
 * Note that because there is a single `nonReentrant` guard, functions marked as
 * `nonReentrant` may not call one another. This can be worked around by making
 * those functions `private`, and then adding `external` `nonReentrant` entry
 * points to them.
 *
 * TIP: If you would like to learn more about reentrancy and alternative ways
 * to protect against it, check out our blog post
 * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
 */
abstract contract ReentrancyGuardUpgradeable is Initializable {
    // Booleans are more expensive than uint256 or any type that takes up a full
    // word because each write operation emits an extra SLOAD to first read the
    // slot's contents, replace the bits taken up by the boolean, and then write
    // back. This is the compiler's defense against contract upgrades and
    // pointer aliasing, and it cannot be disabled.

    // The values being non-zero value makes deployment a bit more expensive,
    // but in exchange the refund on every call to nonReentrant will be lower in
    // amount. Since refunds are capped to a percentage of the total
    // transaction's gas, it is best to keep them low in cases like this one, to
    // increase the likelihood of the full refund coming into effect.
    uint256 private constant _NOT_ENTERED = 1;
    uint256 private constant _ENTERED = 2;

    uint256 private _status;

    function __ReentrancyGuard_init() internal onlyInitializing {
        __ReentrancyGuard_init_unchained();
    }

    function __ReentrancyGuard_init_unchained() internal onlyInitializing {
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and making it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        _nonReentrantBefore();
        _;
        _nonReentrantAfter();
    }

    function _nonReentrantBefore() private {
        // On the first call to nonReentrant, _status will be _NOT_ENTERED
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

        // Any calls to nonReentrant after this point will fail
        _status = _ENTERED;
    }

    function _nonReentrantAfter() private {
        // By storing the original value once again, a refund is triggered (see
        // https://eips.ethereum.org/EIPS/eip-2200)
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
     * `nonReentrant` function in the call stack.
     */
    function _reentrancyGuardEntered() internal view returns (bool) {
        return _status == _ENTERED;
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[49] private __gap;
}

File 4 of 13 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.3) (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. Meant to be used with tokens that require the approval
     * to be set to zero before setting it to a non-zero value, such as USDT.
     */
    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 13 : 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 13 : IZKBridgeReceiver.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

interface IZKBridgeReceiver {
    // @notice ZKBridge endpoint will invoke this function to deliver the message on the destination
    // @param srcChainId - the source endpoint identifier
    // @param srcAddress - the source sending contract address from the source chain
    // @param sequence - the ordered message nonce
    // @param payload - the signed payload is the UA bytes has encoded to be sent
    function zkReceive(uint16 srcChainId, address srcAddress, uint64 sequence, bytes calldata payload) external;
}

File 7 of 13 : IZKBridgeEndpoint.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

interface IZKBridgeEndpoint {
    function send(uint16 dstChainId, address dstAddress, bytes memory payload) external payable returns (uint64);

    function estimateFee(uint16 dstChainId) external view returns (uint256 fee);

    function chainId() external view returns (uint16);
}

File 8 of 13 : IL1Bridge.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface IL1Bridge {
    function transferETH(uint16 dstChainId_, uint256 amount_, address recipient_) external payable;

    function transferETHFromVault(uint16 dstChainId_, address recipient_) external payable;

    function transferERC20(uint16 dstChainId_, address l1Token_, uint256 amount_, address recipient_)
        external
        payable;

    function transferERC20FromVault(uint16 dstChainId_, address l1Token_, uint256 amount_, address recipient_)
        external;

    function fees(uint16 dstChainId_) external view returns (uint256);
}

File 9 of 13 : Pool.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import {ReentrancyGuardUpgradeable} from "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";
import {IERC20, SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {Address} from "@openzeppelin/contracts/utils/Address.sol";

import {Admin} from "./Admin.sol";

abstract contract Pool is ReentrancyGuardUpgradeable, Admin {
    using SafeERC20 for IERC20;

    struct DstChainInfo {
        // Whether dstChain is enabled for this pool
        bool enabled;
        // Static fee when sending tokens to dstChain
        uint128 staticFee;
        // Numerator of dynamic fee, a fee proportionate to the transfer amount
        // Currently only supports native token pools
        uint64 dynamicFeeNum;
        // Limit of a single transfer
        uint256 maxTransferLimit;
    }

    uint256 public constant DYNAMIC_FEE_DEN = 1000000000; // denominator of dynamic fee

    struct PoolInfo {
        // Whether this pool is enabled
        bool enabled;
        // Should be (local decimals - shared decimals)
        // e.g. If local decimals is 18 and shared decimals is 6, this number should be 12
        // Local decimals is the decimals of the underlying ERC20 token
        // Shared decimals is the common decimals across all chains
        uint8 convertRateDecimals;
        // ERC20 token address. Should be address(0) for native token pool
        address token;
        // Token balance of this pool
        // This should be tracked via a variable because this contract also hold fees
        // Also, an attacker may force transfer tokens to this contract to reach maxLiquidity
        uint256 balance;
        // The liquidity of this pool when the remote pool is exhausted
        // Only works when there are two chains
        // When there are >= 3 chains, this does not work and should be set to type(uint256).max
        uint256 maxLiquidity;
    }

    // poolId -> dstChainId -> DstChainInfo
    mapping(uint256 => mapping(uint16 => DstChainInfo)) internal _dstChains;

    // Native token pool ID
    uint256 public immutable NATIVE_TOKEN_POOL_ID;

    // poolId -> PoolInfo
    // poolId needs to be the same across different chains for the same token
    mapping(uint256 => PoolInfo) internal _poolInfo;

    mapping(address => bool) public whitelists;

    event AddLiquidity(uint256 indexed poolId, uint256 amount);
    event RemoveLiquidity(uint256 indexed poolId, uint256 amount);
    event DstChainStatusChanged(uint256 indexed poolId, uint16 indexed dstChainId, bool indexed enabled);
    event NewMaxTransferLimit(uint256 indexed poolId, uint16 indexed dstChainId, uint256 maxTransferLimit);
    event NewMaxLiquidity(uint256 indexed poolId, uint256 maxLiquidity);
    event NewFee(uint256 indexed poolId, uint16 indexed dstChainId, uint256 staticFee, uint256 dynamicFeeNum);
    event ClaimedFees(address to, uint256 amount);

    constructor(uint256 NATIVE_TOKEN_POOL_ID_) {
        NATIVE_TOKEN_POOL_ID = NATIVE_TOKEN_POOL_ID_;
    }

    function poolInfo(uint256 poolId) public view returns (PoolInfo memory) {
        return _poolInfo[poolId];
    }

    function dstChains(uint256 poolId, uint16 dstChainId) public view returns (DstChainInfo memory) {
        return _dstChains[poolId][dstChainId];
    }

    function convertRate(uint256 poolId) public view returns (uint256) {
        return 10 ** _poolInfo[poolId].convertRateDecimals;
    }

    /// @dev ensure amount is a multiple of convertRate
    function _checkConvertRate(uint256 poolId, uint256 amount) internal view {
        require(amount % convertRate(poolId) == 0, "Pool: amount is not a multiple of convert rate");
    }

    function _checkPool(uint256 poolId) internal view {
        require(_poolInfo[poolId].enabled, "Pool: pool ID not enabled");
    }

    function _checkDstChain(uint256 poolId, uint16 dstChainId) internal view {
        _checkPool(poolId);
        require(_dstChains[poolId][dstChainId].enabled, "Pool: pool ID or dst chain ID not enabled");
    }

    function getFee(uint256 poolId, uint16 dstChainId, uint256 amount) public view returns (uint256) {
        return amount * _dstChains[poolId][dstChainId].dynamicFeeNum / DYNAMIC_FEE_DEN
            + _dstChains[poolId][dstChainId].staticFee;
    }

    /// @notice The main function for adding liquidity of ERC20 tokens
    function addLiquidity(uint256 poolId, uint256 amount) public onlyPoolManager nonReentrant {
        _checkPool(poolId);
        _checkConvertRate(poolId, amount);
        IERC20(_poolInfo[poolId].token).safeTransferFrom(msg.sender, address(this), amount);
        _poolInfo[poolId].balance += amount;
        emit AddLiquidity(poolId, amount);
    }

    /// @notice The main function for adding liquidity of native token
    function addLiquidityETH() public payable onlyPoolManager nonReentrant {
        uint256 poolId = NATIVE_TOKEN_POOL_ID;
        _checkPool(poolId);
        _checkConvertRate(poolId, msg.value);
        _poolInfo[poolId].balance += msg.value;
        emit AddLiquidity(poolId, msg.value);
    }

    /// @notice The main function for adding liquidity of ERC20 tokens without permission
    /// @dev When there are >= 3 chains, maxLiquidity is not enforced so everyone can add liquidity without any problem
    function addLiquidityPublic(uint256 poolId, uint256 amount) external nonReentrant {
        _checkPool(poolId);
        require(
            _poolInfo[poolId].maxLiquidity == type(uint256).max,
            "Pool: addLiquidityPublic only work when maxLiquidity is not limited"
        );
        _checkConvertRate(poolId, amount);
        IERC20(_poolInfo[poolId].token).safeTransferFrom(msg.sender, address(this), amount);
        _poolInfo[poolId].balance += amount;
        emit AddLiquidity(poolId, amount);
    }

    /// @notice The main function for adding liquidity of native token without permission
    /// @dev When there are >= 3 chains, maxLiquidity is not enforced so everyone can add liquidity without any problem
    function addLiquidityETHPublic() external payable nonReentrant {
        uint256 poolId = NATIVE_TOKEN_POOL_ID;
        _checkPool(poolId);
        require(
            _poolInfo[poolId].maxLiquidity == type(uint256).max,
            "Pool: addLiquidityPublic only work when maxLiquidity is not limited"
        );
        _checkConvertRate(poolId, msg.value);
        _poolInfo[poolId].balance += msg.value;
        emit AddLiquidity(poolId, msg.value);
    }

    /// @notice The main function for removing liquidity
    function removeLiquidity(uint256 poolId, uint256 amount) external onlyPoolManager nonReentrant {
        _checkPool(poolId);
        _checkConvertRate(poolId, amount);
        require(amount <= _poolInfo[poolId].balance);
        if (poolId == NATIVE_TOKEN_POOL_ID) {
            Address.sendValue(payable(msg.sender), amount);
        } else {
            IERC20(_poolInfo[poolId].token).safeTransfer(msg.sender, amount);
        }
        _poolInfo[poolId].balance -= amount;
        emit RemoveLiquidity(poolId, amount);
    }

    /// @notice Enable or disable a dstChain for a pool
    function setDstChain(uint256 poolId, uint16 dstChainId, bool enabled) external onlyPoolManager nonReentrant {
        _checkPool(poolId);
        require(_dstChains[poolId][dstChainId].enabled != enabled, "Pool: dst chain already enabled/disabled");
        _dstChains[poolId][dstChainId].enabled = enabled;
        emit DstChainStatusChanged(poolId, dstChainId, enabled);
    }

    /// @notice Set maxLiquidity. See the comments of PoolInfo.maxLiquidity
    function setMaxLiquidity(uint256 poolId, uint256 maxLiquidity) public onlyPoolManager nonReentrant {
        _checkPool(poolId);
        _poolInfo[poolId].maxLiquidity = maxLiquidity;
        emit NewMaxLiquidity(poolId, maxLiquidity);
    }

    /// @notice Adding liquidity and setting maxLiquidity in a single tx
    /// If you add liquidity first and then set maxLiquidity, the maxLiquidity may be reached between the two transactions, making the bridge unusable.
    /// If you raise maxLiquidity first and then add liquidity, a large number of users may use it between the two transactions, resulting in insufficient liquidity.
    /// Therefore, this function is provided to ensure atomicity.
    function addLiquidityAndSetMaxLiquidity(uint256 poolId, uint256 amount, uint256 maxLiquidity) external {
        addLiquidity(poolId, amount);
        setMaxLiquidity(poolId, maxLiquidity);
    }

    function addLiquidityETHAndSetMaxLiquidity(uint256 maxLiquidity) external payable {
        addLiquidityETH();
        setMaxLiquidity(NATIVE_TOKEN_POOL_ID, maxLiquidity);
    }

    function setMaxTransferLimit(uint256 poolId, uint16 dstChainId, uint256 maxTransferLimit)
        external
        onlyPoolManager
        nonReentrant
    {
        _checkDstChain(poolId, dstChainId);
        _dstChains[poolId][dstChainId].maxTransferLimit = maxTransferLimit;
        emit NewMaxTransferLimit(poolId, dstChainId, maxTransferLimit);
    }

    function setFee(uint256 poolId, uint16 dstChainId, uint256 staticFee, uint256 dynamicFeeNum)
        external
        onlyPoolManager
        nonReentrant
    {
        _checkDstChain(poolId, dstChainId);

        _dstChains[poolId][dstChainId].staticFee = uint128(staticFee);
        _dstChains[poolId][dstChainId].dynamicFeeNum = uint64(dynamicFeeNum);
        emit NewFee(poolId, dstChainId, staticFee, dynamicFeeNum);
    }

    function _deposit(uint256 poolId, uint16 dstChainId, uint256 amount) internal returns (uint256) {
        _checkDstChain(poolId, dstChainId);
        _checkConvertRate(poolId, amount);
        require(
            _poolInfo[poolId].balance + amount <= _poolInfo[poolId].maxLiquidity,
            "Pool: Insufficient liquidity on the target chain"
        );
        if (!whitelists[msg.sender]) {
            require(
                amount <= _dstChains[poolId][dstChainId].maxTransferLimit,
                "Pool: Exceeding the maximum limit of a single transfer"
            );
        }

        _poolInfo[poolId].balance += amount;
        return amount / convertRate(poolId);
    }

    function _withdraw(uint256 poolId, uint16 srcChainId, uint256 amountSD) internal returns (uint256) {
        _checkDstChain(poolId, srcChainId);
        uint256 amount = amountSD * convertRate(poolId);
        require(amount <= _poolInfo[poolId].balance, "Pool: Liquidity shortage");
        _poolInfo[poolId].balance -= amount;
        return amount;
    }

    function accumulatedFees() public view returns (uint256) {
        return address(this).balance - _poolInfo[NATIVE_TOKEN_POOL_ID].balance;
    }

    function claimFees() external onlyPoolManager nonReentrant {
        uint256 fee = accumulatedFees();
        Address.sendValue(payable(msg.sender), fee);
        emit ClaimedFees(msg.sender, fee);
    }

    /// @notice Create a new pool
    /// @param poolId is the new pool ID. It should be NATIVE_TOKEN_POOL_ID for native token and other values for ERC20 tokens
    /// poolId needs to be the same across different chains for the same token
    /// @param token ERC20 token address. Should be address(0) for native token pool
    /// @param convertRateDecimals Should be (local decimals - shared decimals). See the comments of PoolInfo.convertRateDecimals
    function createPool(uint256 poolId, address token, uint8 convertRateDecimals)
        external
        onlyBridgeManager
        nonReentrant
    {
        require(!_poolInfo[poolId].enabled, "Pool: pool already created");
        if (poolId == NATIVE_TOKEN_POOL_ID) {
            require(token == address(0), "Pool: native token pool should not have token address");
        } else {
            require(token != address(0), "Pool: token address should not be zero");
        }
        _poolInfo[poolId].enabled = true;
        _poolInfo[poolId].convertRateDecimals = convertRateDecimals;
        _poolInfo[poolId].token = token;
        _poolInfo[poolId].maxLiquidity = type(uint256).max;
    }

    function setWhitelist(address user_, bool enabled_) external onlyPoolManager {
        whitelists[user_] = enabled_;
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[47] private __gap;
}

File 10 of 13 : AddressUpgradeable.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 AddressUpgradeable {
    /**
     * @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 11 of 13 : 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 12 of 13 : 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 13 of 13 : Admin.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";

abstract contract Admin is Initializable {
    address public poolManager;
    address public bridgeManager;
    address public bridgeReviewer; // When bridgeReviewer == bridgeManager, the reviewing step will be skipped.

    // Two-step ownership management design, similar to Ownable2Step in OpenZeppelin Contracts.
    address public pendingPoolManager;
    address public pendingBridgeManager;
    address public pendingBridgeReviewer;

    event PoolManagerTransferStarted(address indexed previousOwner, address indexed newOwner);
    event PoolManagerTransferred(address indexed previousOwner, address indexed newOwner);

    event BridgeManagerTransferStarted(address indexed previousOwner, address indexed newOwner);
    event BridgeManagerTransferred(address indexed previousOwner, address indexed newOwner);

    event BridgeReviewerTransferStarted(address indexed previousOwner, address indexed newOwner);
    event BridgeReviewerTransferred(address indexed previousOwner, address indexed newOwner);

    function __Admin_init() internal onlyInitializing {
        poolManager = msg.sender;
        bridgeManager = msg.sender;
        bridgeReviewer = msg.sender;
    }

    modifier onlyPoolManager() {
        require(msg.sender == poolManager, "Admin: caller is not poolManager");
        _;
    }

    modifier onlyBridgeManager() {
        require(msg.sender == bridgeManager, "Admin: caller is not bridgeManager");
        _;
    }

    modifier onlyBridgeReviewer() {
        require(msg.sender == bridgeReviewer, "Admin: caller is not bridgeReviewer");
        _;
    }

    function transferPoolManager(address newOwner) external onlyPoolManager {
        pendingPoolManager = newOwner;
        emit PoolManagerTransferStarted(msg.sender, newOwner);
    }

    function acceptPoolManager() external {
        require(msg.sender == pendingPoolManager, "Admin: caller is not the new owner");
        delete pendingPoolManager;
        address oldOwner = poolManager;
        poolManager = msg.sender;
        emit PoolManagerTransferred(oldOwner, msg.sender);
    }

    function transferBridgeManager(address newOwner) external onlyBridgeManager {
        pendingBridgeManager = newOwner;
        emit BridgeManagerTransferStarted(msg.sender, newOwner);
    }

    function acceptBridgeManager() external {
        require(msg.sender == pendingBridgeManager, "Admin: caller is not the new owner");
        delete pendingBridgeManager;
        address oldOwner = bridgeManager;
        bridgeManager = msg.sender;
        emit BridgeManagerTransferred(oldOwner, msg.sender);
    }

    function transferBridgeReviewer(address newOwner) external onlyBridgeReviewer {
        pendingBridgeReviewer = newOwner;
        emit BridgeReviewerTransferStarted(msg.sender, newOwner);
    }

    function acceptBridgeReviewer() external {
        require(msg.sender == pendingBridgeReviewer, "Admin: caller is not the new owner");
        delete pendingBridgeReviewer;
        address oldOwner = bridgeReviewer;
        bridgeReviewer = msg.sender;
        emit BridgeReviewerTransferred(oldOwner, msg.sender);
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[44] private __gap;
}

Settings
{
  "remappings": [
    "ds-test/=lib/forge-std/lib/ds-test/src/",
    "forge-std/=lib/forge-std/src/",
    "@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/",
    "@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/",
    "LayerZero-v2/=lib/LayerZero-v2/",
    "erc4626-tests/=lib/openzeppelin-contracts-upgradeable/lib/erc4626-tests/",
    "openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/",
    "openzeppelin-contracts/=lib/openzeppelin-contracts/",
    "openzeppelin/=lib/openzeppelin-contracts-upgradeable/contracts/",
    "solidity-bytes-utils/=lib/solidity-bytes-utils/contracts/"
  ],
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "metadata": {
    "useLiteralContent": false,
    "bytecodeHash": "ipfs",
    "appendCBOR": true
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "evmVersion": "paris",
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"contract IZKBridgeEndpoint","name":"zkBridgeEndpoint_","type":"address"},{"internalType":"contract IL1Bridge","name":"l1Bridge_","type":"address"},{"internalType":"uint256","name":"NATIVE_TOKEN_POOL_ID_","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"poolId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"AddLiquidity","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"BridgeManagerTransferStarted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"BridgeManagerTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"BridgeReviewerTransferStarted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"BridgeReviewerTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"ClaimedFees","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"poolId","type":"uint256"},{"indexed":true,"internalType":"uint16","name":"dstChainId","type":"uint16"},{"indexed":true,"internalType":"bool","name":"enabled","type":"bool"}],"name":"DstChainStatusChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint16","name":"chainId","type":"uint16"},{"indexed":false,"internalType":"address","name":"bridge","type":"address"}],"name":"NewBridge","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"poolId","type":"uint256"},{"indexed":true,"internalType":"uint16","name":"dstChainId","type":"uint16"},{"indexed":false,"internalType":"uint256","name":"staticFee","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"dynamicFeeNum","type":"uint256"}],"name":"NewFee","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"poolId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"maxLiquidity","type":"uint256"}],"name":"NewMaxLiquidity","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"poolId","type":"uint256"},{"indexed":true,"internalType":"uint16","name":"dstChainId","type":"uint16"},{"indexed":false,"internalType":"uint256","name":"maxTransferLimit","type":"uint256"}],"name":"NewMaxTransferLimit","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint16","name":"chainId","type":"uint16"},{"indexed":false,"internalType":"address","name":"bridge","type":"address"}],"name":"NewPendingBridge","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"PoolManagerTransferStarted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"PoolManagerTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint64","name":"sequence","type":"uint64"},{"indexed":true,"internalType":"uint16","name":"srcChainId","type":"uint16"},{"indexed":true,"internalType":"uint256","name":"poolId","type":"uint256"},{"indexed":false,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"ReceiveToken","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"poolId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"RemoveLiquidity","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint64","name":"sequence","type":"uint64"},{"indexed":true,"internalType":"uint16","name":"dstChainId","type":"uint16"},{"indexed":true,"internalType":"uint256","name":"poolId","type":"uint256"},{"indexed":false,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"TransferToken","type":"event"},{"inputs":[],"name":"DYNAMIC_FEE_DEN","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"NATIVE_TOKEN_POOL_ID","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"acceptBridgeManager","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"acceptBridgeReviewer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"acceptPoolManager","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"accumulatedFees","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"poolId","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"addLiquidity","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"poolId","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"maxLiquidity","type":"uint256"}],"name":"addLiquidityAndSetMaxLiquidity","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"addLiquidityETH","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"maxLiquidity","type":"uint256"}],"name":"addLiquidityETHAndSetMaxLiquidity","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"addLiquidityETHPublic","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"poolId","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"addLiquidityPublic","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"dstChainId","type":"uint16"},{"internalType":"address","name":"bridge","type":"address"}],"name":"approveSetBridge","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"","type":"uint16"}],"name":"bridgeLookup","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"bridgeManager","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"bridgeReviewer","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"claimFees","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"poolId","type":"uint256"}],"name":"convertRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"poolId","type":"uint256"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint8","name":"convertRateDecimals","type":"uint8"}],"name":"createPool","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"poolId","type":"uint256"},{"internalType":"uint16","name":"dstChainId","type":"uint16"}],"name":"dstChains","outputs":[{"components":[{"internalType":"bool","name":"enabled","type":"bool"},{"internalType":"uint128","name":"staticFee","type":"uint128"},{"internalType":"uint64","name":"dynamicFeeNum","type":"uint64"},{"internalType":"uint256","name":"maxTransferLimit","type":"uint256"}],"internalType":"struct Pool.DstChainInfo","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"poolId","type":"uint256"},{"internalType":"uint16","name":"dstChainId","type":"uint16"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"estimateFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"poolId","type":"uint256"},{"internalType":"uint16","name":"dstChainId","type":"uint16"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"estimateFeeMux","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"poolId","type":"uint256"},{"internalType":"uint16","name":"dstChainId","type":"uint16"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"getFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"l1Bridge","outputs":[{"internalType":"contract IL1Bridge","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingBridge","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingBridgeAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingBridgeManager","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingBridgeReviewer","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingDstChainId","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingPoolManager","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"poolId","type":"uint256"}],"name":"poolInfo","outputs":[{"components":[{"internalType":"bool","name":"enabled","type":"bool"},{"internalType":"uint8","name":"convertRateDecimals","type":"uint8"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"balance","type":"uint256"},{"internalType":"uint256","name":"maxLiquidity","type":"uint256"}],"internalType":"struct Pool.PoolInfo","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"poolManager","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"poolId","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"removeLiquidity","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"dstChainId","type":"uint16"},{"internalType":"address","name":"bridge","type":"address"}],"name":"setBridge","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"poolId","type":"uint256"},{"internalType":"uint16","name":"dstChainId","type":"uint16"},{"internalType":"bool","name":"enabled","type":"bool"}],"name":"setDstChain","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"poolId","type":"uint256"},{"internalType":"uint16","name":"dstChainId","type":"uint16"},{"internalType":"uint256","name":"staticFee","type":"uint256"},{"internalType":"uint256","name":"dynamicFeeNum","type":"uint256"}],"name":"setFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"poolId","type":"uint256"},{"internalType":"uint256","name":"maxLiquidity","type":"uint256"}],"name":"setMaxLiquidity","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"poolId","type":"uint256"},{"internalType":"uint16","name":"dstChainId","type":"uint16"},{"internalType":"uint256","name":"maxTransferLimit","type":"uint256"}],"name":"setMaxTransferLimit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"user_","type":"address"},{"internalType":"bool","name":"enabled_","type":"bool"}],"name":"setWhitelist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferBridgeManager","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferBridgeReviewer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"dstChainId","type":"uint16"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"}],"name":"transferETH","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint16","name":"dstChainId","type":"uint16"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"}],"name":"transferETHMux","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferPoolManager","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"dstChainId","type":"uint16"},{"internalType":"uint256","name":"poolId","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"}],"name":"transferToken","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint16","name":"dstChainId","type":"uint16"},{"internalType":"uint256","name":"poolId","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"}],"name":"transferTokenMux","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"whitelists","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"zkBridgeEndpoint","outputs":[{"internalType":"contract IZKBridgeEndpoint","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"srcChainId","type":"uint16"},{"internalType":"address","name":"srcAddress","type":"address"},{"internalType":"uint64","name":"sequence","type":"uint64"},{"internalType":"bytes","name":"payload","type":"bytes"}],"name":"zkReceive","outputs":[],"stateMutability":"nonpayable","type":"function"}]

Deployed Bytecode

0x6080604052600436106102c95760003560e01c80637216a5d711610175578063a94a1706116100dc578063dc4c90d311610095578063ed9953071161006f578063ed995307146109a5578063f9085b45146109ad578063fb04c9e0146109cd578063ff440f6914610a0157600080fd5b8063dc4c90d31461095d578063e10bd0cf1461097d578063e7747ce31461098557600080fd5b8063a94a17061461086d578063abca4a92146108d5578063b2ce8089146108e8578063bbc4078414610908578063cfe60a9014610928578063d294f0931461094857600080fd5b8063969b53da1161012e578063969b53da146107a657806398f6b77c146107da5780639a06ce27146107ed5780639cd441da1461080d5780639d7de6b31461082d5780639e5b71051461084d57600080fd5b80637216a5d7146106e657806377f5c01b146107065780638129fc1c1461072657806386b9f6cb1461073b5780638e3b5d6a1461075057806395ce2f5f1461078657600080fd5b8063363b2eb2116102345780634ffb1bd9116101ed57806353d6fd59116101c757806353d6fd591461067957806355ce196814610699578063587f5ed7146106b15780635ea54543146106c657600080fd5b80634ffb1bd91461062457806350bce91b146106445780635226dc5a1461065957600080fd5b8063363b2eb2146105715780633b3edf68146105845780633b824d6a146105a45780633cf6b3f5146105c45780633ef07ff2146105e45780634e6cbad11461060457600080fd5b80631e7be210116102865780631e7be210146104af5780631f034ac6146104ef57806321e0694a146105025780632b4dbf081461051c5780632de9952a1461053c5780632fb228681461055c57600080fd5b806301d16b14146102ce5780630f76c9fe1461031257806310c38ef31461034557806314cc01a01461038757806314d9e096146103a75780631526fe27146103bc575b600080fd5b3480156102da57600080fd5b506098546102f590630100000090046001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b34801561031e57600080fd5b5060985461033290610100900461ffff1681565b60405161ffff9091168152602001610309565b34801561035157600080fd5b506103797f000000000000000000000000000000000000000000000000000000000000000181565b604051908152602001610309565b34801561039357600080fd5b506034546102f5906001600160a01b031681565b6103ba6103b536600461337f565b610a21565b005b3480156103c857600080fd5b506104646103d73660046133bf565b6040805160a08101825260008082526020820181905291810182905260608101829052608081019190915250600090815260666020908152604091829020825160a081018452815460ff8082161515835261010082041693820193909352620100009092046001600160a01b03169282019290925260018201546060820152600290910154608082015290565b604051610309919081511515815260208083015160ff16908201526040808301516001600160a01b031690820152606080830151908201526080918201519181019190915260a00190565b3480156104bb57600080fd5b506104df6104ca3660046133d8565b60676020526000908152604090205460ff1681565b6040519015158152602001610309565b6103ba6104fd3660046133bf565b610a97565b34801561050e57600080fd5b506098546104df9060ff1681565b34801561052857600080fd5b506103ba6105373660046133fc565b610acc565b34801561054857600080fd5b506103ba610557366004613434565b610bac565b34801561056857600080fd5b506103ba610da6565b6103ba61057f3660046134da565b610e2b565b34801561059057600080fd5b506036546102f5906001600160a01b031681565b3480156105b057600080fd5b506103ba6105bf3660046133d8565b610eb9565b3480156105d057600080fd5b506103796105df366004613522565b610f2f565b3480156105f057600080fd5b506103ba6105ff3660046133fc565b610f99565b34801561061057600080fd5b506103ba61061f3660046133d8565b61101c565b34801561063057600080fd5b506103ba61063f3660046133d8565b611092565b34801561065057600080fd5b506103ba611108565b34801561066557600080fd5b506035546102f5906001600160a01b031681565b34801561068557600080fd5b506103ba610694366004613565565b61118d565b3480156106a557600080fd5b50610379633b9aca0081565b3480156106bd57600080fd5b506103796111e2565b3480156106d257600080fd5b506103ba6106e136600461359e565b611224565b3480156106f257600080fd5b50610379610701366004613522565b611238565b34801561071257600080fd5b506037546102f5906001600160a01b031681565b34801561073257600080fd5b506103ba61133a565b34801561074757600080fd5b506103ba611452565b34801561075c57600080fd5b506102f561076b3660046135ca565b6097602052600090815260409020546001600160a01b031681565b34801561079257600080fd5b506103ba6107a13660046135e5565b6114d7565b3480156107b257600080fd5b506102f57f000000000000000000000000000000000000000000000000000000000000000081565b6103ba6107e83660046134da565b611640565b3480156107f957600080fd5b506103ba610808366004613611565b6119cb565b34801561081957600080fd5b506103ba6108283660046133fc565b611aa6565b34801561083957600080fd5b506103ba6108483660046133fc565b611ae1565b34801561085957600080fd5b50610379610868366004613522565b611bfb565b34801561087957600080fd5b5061088d61088836600461364c565b611cb2565b60405161030991908151151581526020808301516001600160801b03169082015260408083015167ffffffffffffffff16908201526060918201519181019190915260800190565b6103ba6108e336600461337f565b611d47565b3480156108f457600080fd5b506103ba610903366004613522565b612027565b34801561091457600080fd5b506103ba610923366004613678565b6120c3565b34801561093457600080fd5b506038546102f5906001600160a01b031681565b34801561095457600080fd5b506103ba6121e4565b34801561096957600080fd5b506033546102f5906001600160a01b031681565b6103ba612271565b34801561099157600080fd5b506103ba6109a03660046135e5565b612344565b6103ba6124c7565b3480156109b957600080fd5b506103ba6109c83660046136ad565b612523565b3480156109d957600080fd5b506102f57f000000000000000000000000a8a4547be2ece6dde2dd91b4a5adfe4a043b21c781565b348015610a0d57600080fd5b50610379610a1c3660046133bf565b61270f565b610a29612731565b81341015610a525760405162461bcd60e51b8152600401610a49906136ea565b60405180910390fd5b610a88837f00000000000000000000000000000000000000000000000000000000000000018484610a838234613737565b61278a565b50610a9260018055565b505050565b610a9f6124c7565b610ac97f000000000000000000000000000000000000000000000000000000000000000182610f99565b50565b610ad4612731565b610add82612a55565b60008281526066602052604090206002015460001914610b0f5760405162461bcd60e51b8152600401610a499061374a565b610b198282612ab3565b600082815260666020526040902054610b43906201000090046001600160a01b0316333084612b2a565b60008281526066602052604081206001018054839290610b649084906137b3565b909155505060405181815282907fcb1652de9aeec38545fc281847b3dbfc89aab56dfa907b1ab68466f602c36fb4906020015b60405180910390a2610ba860018055565b5050565b610bb4612731565b336001600160a01b037f000000000000000000000000a8a4547be2ece6dde2dd91b4a5adfe4a043b21c71614610c365760405162461bcd60e51b815260206004820152602160248201527f4272696467653a204e6f742066726f6d207a6b427269646765456e64706f696e6044820152601d60fa1b6064820152608401610a49565b6001600160a01b03841615801590610c6c575061ffff85166000908152609760205260409020546001600160a01b038581169116145b610cb85760405162461bcd60e51b815260206004820152601760248201527f4272696467653a20496e76616c696420656d69747465720000000000000000006044820152606401610a49565b60008080610cc8848601866137c6565b9250925092506000610cdb848a85612b95565b90507f00000000000000000000000000000000000000000000000000000000000000018403610d1357610d0e8282612c49565b610d3c565b600084815260666020526040902054610d3c906201000090046001600160a01b03168383612d62565b604080516001600160a01b038416815260208101859052859161ffff8c169167ffffffffffffffff8b16917f302b3ebcd58d43753be6657117391b4a3b8dc310ae7054a9905486dd23241676910160405180910390a450505050610d9f60018055565b5050505050565b6037546001600160a01b03163314610dd05760405162461bcd60e51b8152600401610a49906137f4565b603780546001600160a01b0319908116909155603480543392811683179091556040516001600160a01b03909116919082907fd2201da7c443ffc780844bb92267eecd254053cee6183556572d891f029db87d90600090a350565b610e33612731565b7f00000000000000000000000000000000000000000000000000000000000000018303610e725760405162461bcd60e51b8152600401610a4990613836565b600083815260666020526040902054610e9c906201000090046001600160a01b0316333085612b2a565b610ea9848484843461278a565b50610eb360018055565b50505050565b6033546001600160a01b03163314610ee35760405162461bcd60e51b8152600401610a4990613893565b603680546001600160a01b0319166001600160a01b03831690811790915560405133907f224c573cdb8950a1cf5382cbdc4c6fbb5a94c2a07579e014482d20c77d7c8ee490600090a350565b600083815260656020908152604080832061ffff8616845290915281205461010081046001600160801b031690633b9aca0090610f7d90600160881b900467ffffffffffffffff16856138c8565b610f8791906138f5565b610f9191906137b3565b949350505050565b6033546001600160a01b03163314610fc35760405162461bcd60e51b8152600401610a4990613893565b610fcb612731565b610fd482612a55565b600082815260666020526040908190206002018290555182907fffc60309bc0541f9cc67841ccfe5f8600c078153f74509d2c439ec1e40e8b3c090610b979084815260200190565b6034546001600160a01b031633146110465760405162461bcd60e51b8152600401610a4990613909565b603780546001600160a01b0319166001600160a01b03831690811790915560405133907f52eae2ba1561aaf57acd728abc519e08906e6c49b9ec8ba4209bae7fecbcee6f90600090a350565b6035546001600160a01b031633146110bc5760405162461bcd60e51b8152600401610a499061394b565b603880546001600160a01b0319166001600160a01b03831690811790915560405133907f788d10307525180759bacde6500c4c7159d8e09bd79209dea881e3b43e27547290600090a350565b6036546001600160a01b031633146111325760405162461bcd60e51b8152600401610a49906137f4565b603680546001600160a01b0319908116909155603380543392811683179091556040516001600160a01b03909116919082907f12887552f8810a293cba3d436e02a0b49397e811c9b41187c89d7290d9bd192690600090a350565b6033546001600160a01b031633146111b75760405162461bcd60e51b8152600401610a4990613893565b6001600160a01b03919091166000908152606760205260409020805460ff1916911515919091179055565b7f000000000000000000000000000000000000000000000000000000000000000160009081526066602052604081206001015461121f9047613737565b905090565b61122e8383611aa6565b610a928382610f99565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166112805760405162461bcd60e51b8152600401610a499061398e565b600061128d858585611bfb565b604051632f08b92f60e21b815261ffff861660048201529091506000906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063bc22e4bc90602401602060405180830381865afa1580156112fb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061131f91906139c5565b905080821161132e5780611330565b815b9695505050505050565b600054610100900460ff161580801561135a5750600054600160ff909116105b806113745750303b158015611374575060005460ff166001145b6113d75760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610a49565b6000805460ff1916600117905580156113fa576000805461ff0019166101001790555b611402612d92565b61140a612dc1565b8015610ac9576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a150565b6038546001600160a01b0316331461147c5760405162461bcd60e51b8152600401610a49906137f4565b603880546001600160a01b0319908116909155603580543392811683179091556040516001600160a01b03909116919082907f5c4b9e5621878f91d14b060afe833a3597e6e5edbdd74b6161973f747c712ad490600090a350565b6034546001600160a01b031633146115015760405162461bcd60e51b8152600401610a4990613909565b611509612731565b6035546034546001600160a01b039081169116146115ae576098805460ff196001600160a01b038416630100000081026301000000600160b81b031961ffff8816610100810291909116610100600160b81b03199095169490941717919091166001179092556040805191825260208201929092527f375b189bc53525ca31c6fc74f38c76b308773d66c780a57fbb0b9ac94f1d2285910160405180910390a1611637565b61ffff8216600090815260976020526040902080546001600160a01b0319166001600160a01b03831617905560985460ff16156115f0576098805460ff191690555b6040805161ffff841681526001600160a01b03831660208201527f543c07f3f8ff9852dd72fe83bc9f1462fd99575d6a23f6b3f523eab3654b03b191015b60405180910390a15b610ba860018055565b611648612731565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031661168e5760405162461bcd60e51b8152600401610a499061398e565b7f000000000000000000000000000000000000000000000000000000000000000183036116cd5760405162461bcd60e51b8152600401610a4990613836565b6000838152606660205260409020546201000090046001600160a01b0316806117315760405162461bcd60e51b8152602060048201526016602482015275109c9a5919d94e881c1bdbdb081b9bdd08199bdd5b9960521b6044820152606401610a49565b6117466001600160a01b038216333086612b2a565b6000848152606660205260408120600281015460019091015461176a9086906137b3565b111580156117985750600085815260656020908152604080832061ffff8a1684529091529020600101548411155b156117c05760006117ac878787873461278a565b90506117b88134613737565b9150506119b0565b604051632f08b92f60e21b815261ffff871660048201526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063bc22e4bc90602401602060405180830381865afa15801561182b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061184f91906139c5565b9050803410156118a15760405162461bcd60e51b815260206004820152601860248201527f4272696467653a20496e73756666696369656e742066656500000000000000006044820152606401610a49565b6118d56001600160a01b0384167f000000000000000000000000000000000000000000000000000000000000000087612e16565b60405163f6ea14a760e01b815261ffff881660048201526001600160a01b0384811660248301526044820187905285811660648301527f0000000000000000000000000000000000000000000000000000000000000000169063f6ea14a79083906084016000604051808303818588803b15801561195257600080fd5b505af1158015611966573d6000803e3d6000fd5b506119a2935050506001600160a01b03851690507f00000000000000000000000000000000000000000000000000000000000000006000612e16565b6119ac8134613737565b9150505b80156119c0576119c03382612c49565b5050610eb360018055565b6033546001600160a01b031633146119f55760405162461bcd60e51b8152600401610a4990613893565b6119fd612731565b611a078484612f2b565b600084815260656020908152604080832061ffff8716808552908352928190208054610100600160c81b0319166101006001600160801b0388160267ffffffffffffffff60881b191617600160881b67ffffffffffffffff871602179055805185815291820184905286917f69a58b4f1bc0b96ad7ed7c6519275c08221919b7a912310afb48f9f46c15bc10910160405180910390a3610eb360018055565b6033546001600160a01b03163314611ad05760405162461bcd60e51b8152600401610a4990613893565b611ad8612731565b610b0f82612a55565b6033546001600160a01b03163314611b0b5760405162461bcd60e51b8152600401610a4990613893565b611b13612731565b611b1c82612a55565b611b268282612ab3565b600082815260666020526040902060010154811115611b4457600080fd5b7f00000000000000000000000000000000000000000000000000000000000000018203611b7a57611b753382612c49565b611ba3565b600082815260666020526040902054611ba3906201000090046001600160a01b03163383612d62565b60008281526066602052604081206001018054839290611bc4908490613737565b909155505060405181815282907f9101fb4cb96b608de64eae79af26fc5fbe69904c5e3b6108204eefd9212f477090602001610b97565b6000611c078484612f2b565b6000611c14858585610f2f565b60405163103dd74560e11b815261ffff861660048201529091506000906001600160a01b037f000000000000000000000000a8a4547be2ece6dde2dd91b4a5adfe4a043b21c7169063207bae8a90602401602060405180830381865afa158015611c82573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ca691906139c5565b905061133081836137b3565b60408051608081018252600080825260208201819052918101829052606081019190915250600082815260656020908152604080832061ffff851684528252918290208251608081018452815460ff81161515825261010081046001600160801b031693820193909352600160881b90920467ffffffffffffffff169282019290925260019091015460608201525b92915050565b611d4f612731565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316611d955760405162461bcd60e51b8152600401610a499061398e565b7f000000000000000000000000000000000000000000000000000000000000000160009081526066602052604081206002810154600190910154611dda9085906137b3565b11158015611e2957507f0000000000000000000000000000000000000000000000000000000000000001600090815260656020908152604080832061ffff881684529091529020600101548311155b15611ea05782341015611e4e5760405162461bcd60e51b8152600401610a49906136ea565b6000611e81857f00000000000000000000000000000000000000000000000000000000000000018686610a838234613737565b905080611e8e8534613737565b611e989190613737565b915050612017565b604051632f08b92f60e21b815261ffff851660048201526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063bc22e4bc90602401602060405180830381865afa158015611f0b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f2f91906139c5565b9050611f3b81856137b3565b341015611f5a5760405162461bcd60e51b8152600401610a49906136ea565b6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000166314d9e096611f9383876137b3565b6040516001600160e01b031960e084901b16815261ffff89166004820152602481018890526001600160a01b03871660448201526064016000604051808303818588803b158015611fe357600080fd5b505af1158015611ff7573d6000803e3d6000fd5b50505050508084346120099190613737565b6120139190613737565b9150505b8015610a8857610a883382612c49565b6033546001600160a01b031633146120515760405162461bcd60e51b8152600401610a4990613893565b612059612731565b6120638383612f2b565b600083815260656020908152604080832061ffff8616808552908352928190206001018490555183815285917f09cf37f97f4dae874e7cb6b93f49e96cdbe942556630d0c1c446f9de9b5682f3910160405180910390a3610a9260018055565b6033546001600160a01b031633146120ed5760405162461bcd60e51b8152600401610a4990613893565b6120f5612731565b6120fe83612a55565b600083815260656020908152604080832061ffff8616845290915290205481151560ff9091161515036121845760405162461bcd60e51b815260206004820152602860248201527f506f6f6c3a2064737420636861696e20616c726561647920656e61626c65642f604482015267191a5cd8589b195960c21b6064820152608401610a49565b600083815260656020908152604080832061ffff86168085529252808320805460ff19168515159081179091559051909286917f188e2234f6d184edf99d8c78e1fa948bb86c9ba285dc3059bdbe5704e48181aa9190a4610a9260018055565b6033546001600160a01b0316331461220e5760405162461bcd60e51b8152600401610a4990613893565b612216612731565b60006122206111e2565b905061222c3382612c49565b60408051338152602081018390527f0bd19e112d63748ab3d987993abf5208a9a80e2a5615aebf45188a1d1cc59be5910160405180910390a15061226f60018055565b565b612279612731565b7f00000000000000000000000000000000000000000000000000000000000000016122a381612a55565b600081815260666020526040902060020154600019146122d55760405162461bcd60e51b8152600401610a499061374a565b6122df8134612ab3565b600081815260666020526040812060010180543492906123009084906137b3565b909155505060405134815281907fcb1652de9aeec38545fc281847b3dbfc89aab56dfa907b1ab68466f602c36fb49060200160405180910390a25061226f60018055565b6035546001600160a01b0316331461236e5760405162461bcd60e51b8152600401610a499061394b565b612376612731565b60985460ff166123c85760405162461bcd60e51b815260206004820152601960248201527f4272696467653a206e6f2070656e64696e6720627269646765000000000000006044820152606401610a49565b60985461ffff838116610100909204161480156123f957506098546001600160a01b03828116630100000090920416145b6124595760405162461bcd60e51b815260206004820152602b60248201527f4272696467653a20647374436861696e4964206f722062726964676520646f6560448201526a0e640dcdee840dac2e8c6d60ab1b6064820152608401610a49565b61ffff821660008181526097602090815260409182902080546001600160a01b0319166001600160a01b0386169081179091556098805460ff191690558251938452908301527f543c07f3f8ff9852dd72fe83bc9f1462fd99575d6a23f6b3f523eab3654b03b1910161162e565b6033546001600160a01b031633146124f15760405162461bcd60e51b8152600401610a4990613893565b6124f9612731565b7f00000000000000000000000000000000000000000000000000000000000000016122d581612a55565b6034546001600160a01b0316331461254d5760405162461bcd60e51b8152600401610a4990613909565b612555612731565b60008381526066602052604090205460ff16156125b45760405162461bcd60e51b815260206004820152601a60248201527f506f6f6c3a20706f6f6c20616c726561647920637265617465640000000000006044820152606401610a49565b7f00000000000000000000000000000000000000000000000000000000000000018303612655576001600160a01b038216156126505760405162461bcd60e51b815260206004820152603560248201527f506f6f6c3a206e617469766520746f6b656e20706f6f6c2073686f756c64206e6044820152746f74206861766520746f6b656e206164647265737360581b6064820152608401610a49565b6126ba565b6001600160a01b0382166126ba5760405162461bcd60e51b815260206004820152602660248201527f506f6f6c3a20746f6b656e20616464726573732073686f756c64206e6f74206260448201526565207a65726f60d01b6064820152608401610a49565b60008381526066602052604090208054600161ffff1990911661010060ff85160217811762010000600160b01b031916620100006001600160a01b038616021782556000196002909201919091558055505050565b600081815260666020526040812054611d4190610100900460ff16600a613ac2565b6002600154036127835760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610a49565b6002600155565b61ffff85166000908152609760205260408120546001600160a01b0316806127fe5760405162461bcd60e51b815260206004820152602160248201527f4272696467653a20647374436861696e496420646f6573206e6f7420657869736044820152601d60fa1b6064820152608401610a49565b600061280b878988610f2f565b60405163103dd74560e11b815261ffff8a1660048201529091506000906001600160a01b037f000000000000000000000000a8a4547be2ece6dde2dd91b4a5adfe4a043b21c7169063207bae8a90602401602060405180830381865afa158015612879573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061289d91906139c5565b90506128a981836137b3565b8510156128f85760405162461bcd60e51b815260206004820152601860248201527f4272696467653a20496e73756666696369656e742046656500000000000000006044820152606401610a49565b6000612905898b8a612fb3565b60408051602081018c90529081018290526001600160a01b0389166060820152909150600090608001604051602081830303815290604052905060007f000000000000000000000000a8a4547be2ece6dde2dd91b4a5adfe4a043b21c76001600160a01b031663b1d995dd858e89866040518563ffffffff1660e01b815260040161299293929190613b21565b60206040518083038185885af11580156129b0573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906129d59190613b58565b604080513381526001600160a01b038c1660208201529081018590529091508b9061ffff8e169067ffffffffffffffff8416907fe0442d4e58b97ff2055e08df9305389520a00ac06c83a83131ef3d0e1572068c9060600160405180910390a4612a3f84866137b3565b9c9b505050505050505050505050565b60018055565b60008181526066602052604090205460ff16610ac95760405162461bcd60e51b815260206004820152601960248201527f506f6f6c3a20706f6f6c204944206e6f7420656e61626c6564000000000000006044820152606401610a49565b612abc8261270f565b612ac69082613b75565b15610ba85760405162461bcd60e51b815260206004820152602e60248201527f506f6f6c3a20616d6f756e74206973206e6f742061206d756c7469706c65206f60448201526d6620636f6e76657274207261746560901b6064820152608401610a49565b6040516001600160a01b0380851660248301528316604482015260648101829052610eb39085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152613134565b6000612ba18484612f2b565b6000612bac8561270f565b612bb690846138c8565b600086815260666020526040902060010154909150811115612c1a5760405162461bcd60e51b815260206004820152601860248201527f506f6f6c3a204c69717569646974792073686f727461676500000000000000006044820152606401610a49565b60008581526066602052604081206001018054839290612c3b908490613737565b909155509095945050505050565b80471015612c995760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e63650000006044820152606401610a49565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114612ce6576040519150601f19603f3d011682016040523d82523d6000602084013e612ceb565b606091505b5050905080610a925760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d617920686176652072657665727465640000000000006064820152608401610a49565b6040516001600160a01b038316602482015260448101829052610a9290849063a9059cbb60e01b90606401612b5e565b600054610100900460ff16612db95760405162461bcd60e51b8152600401610a4990613b89565b61226f613209565b600054610100900460ff16612de85760405162461bcd60e51b8152600401610a4990613b89565b60338054336001600160a01b0319918216811790925560348054821683179055603580549091169091179055565b801580612e905750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e90604401602060405180830381865afa158015612e6a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612e8e91906139c5565b155b612efb5760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b6064820152608401610a49565b6040516001600160a01b038316602482015260448101829052610a9290849063095ea7b360e01b90606401612b5e565b612f3482612a55565b600082815260656020908152604080832061ffff8516845290915290205460ff16610ba85760405162461bcd60e51b815260206004820152602960248201527f506f6f6c3a20706f6f6c204944206f722064737420636861696e204944206e6f6044820152681d08195b98589b195960ba1b6064820152608401610a49565b6000612fbf8484612f2b565b612fc98483612ab3565b60008481526066602052604090206002810154600190910154612fed9084906137b3565b11156130545760405162461bcd60e51b815260206004820152603060248201527f506f6f6c3a20496e73756666696369656e74206c6971756964697479206f6e2060448201526f3a3432903a30b933b2ba1031b430b4b760811b6064820152608401610a49565b3360009081526067602052604090205460ff166130fa57600084815260656020908152604080832061ffff871684529091529020600101548211156130fa5760405162461bcd60e51b815260206004820152603660248201527f506f6f6c3a20457863656564696e6720746865206d6178696d756d206c696d696044820152753a1037b310309039b4b733b632903a3930b739b332b960511b6064820152608401610a49565b6000848152606660205260408120600101805484929061311b9084906137b3565b9091555061312a90508461270f565b610f9190836138f5565b6000613189826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166132309092919063ffffffff16565b90508051600014806131aa5750808060200190518101906131aa9190613bd4565b610a925760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610a49565b600054610100900460ff16612a4f5760405162461bcd60e51b8152600401610a4990613b89565b6060610f91848460008585600080866001600160a01b031685876040516132579190613bf1565b60006040518083038185875af1925050503d8060008114613294576040519150601f19603f3d011682016040523d82523d6000602084013e613299565b606091505b50915091506132aa878383876132b5565b979650505050505050565b6060831561332457825160000361331d576001600160a01b0385163b61331d5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610a49565b5081610f91565b610f9183838151156133395781518083602001fd5b8060405162461bcd60e51b8152600401610a499190613c0d565b803561ffff8116811461336557600080fd5b919050565b6001600160a01b0381168114610ac957600080fd5b60008060006060848603121561339457600080fd5b61339d84613353565b92506020840135915060408401356133b48161336a565b809150509250925092565b6000602082840312156133d157600080fd5b5035919050565b6000602082840312156133ea57600080fd5b81356133f58161336a565b9392505050565b6000806040838503121561340f57600080fd5b50508035926020909101359150565b67ffffffffffffffff81168114610ac957600080fd5b60008060008060006080868803121561344c57600080fd5b61345586613353565b945060208601356134658161336a565b935060408601356134758161341e565b9250606086013567ffffffffffffffff8082111561349257600080fd5b818801915088601f8301126134a657600080fd5b8135818111156134b557600080fd5b8960208285010111156134c757600080fd5b9699959850939650602001949392505050565b600080600080608085870312156134f057600080fd5b6134f985613353565b9350602085013592506040850135915060608501356135178161336a565b939692955090935050565b60008060006060848603121561353757600080fd5b8335925061354760208501613353565b9150604084013590509250925092565b8015158114610ac957600080fd5b6000806040838503121561357857600080fd5b82356135838161336a565b9150602083013561359381613557565b809150509250929050565b6000806000606084860312156135b357600080fd5b505081359360208301359350604090920135919050565b6000602082840312156135dc57600080fd5b6133f582613353565b600080604083850312156135f857600080fd5b61360183613353565b915060208301356135938161336a565b6000806000806080858703121561362757600080fd5b8435935061363760208601613353565b93969395505050506040820135916060013590565b6000806040838503121561365f57600080fd5b8235915061366f60208401613353565b90509250929050565b60008060006060848603121561368d57600080fd5b8335925061369d60208501613353565b915060408401356133b481613557565b6000806000606084860312156136c257600080fd5b8335925060208401356136d48161336a565b9150604084013560ff811681146133b457600080fd5b60208082526018908201527f4272696467653a20496e73756666696369656e74204554480000000000000000604082015260600190565b634e487b7160e01b600052601160045260246000fd5b81810381811115611d4157611d41613721565b60208082526043908201527f506f6f6c3a206164644c69717569646974795075626c6963206f6e6c7920776f60408201527f726b207768656e206d61784c6971756964697479206973206e6f74206c696d696060820152621d195960ea1b608082015260a00190565b80820180821115611d4157611d41613721565b6000806000606084860312156137db57600080fd5b833592506020840135915060408401356133b48161336a565b60208082526022908201527f41646d696e3a2063616c6c6572206973206e6f7420746865206e6577206f776e60408201526132b960f11b606082015260800190565b60208082526037908201527f4272696467653a2043616e2774207472616e7366657220746f6b656e2075736960408201527f6e67206e617469766520746f6b656e20706f6f6c204944000000000000000000606082015260800190565b6020808252818101527f41646d696e3a2063616c6c6572206973206e6f7420706f6f6c4d616e61676572604082015260600190565b8082028115828204841417611d4157611d41613721565b634e487b7160e01b600052601260045260246000fd5b600082613904576139046138df565b500490565b60208082526022908201527f41646d696e3a2063616c6c6572206973206e6f74206272696467654d616e616760408201526132b960f11b606082015260800190565b60208082526023908201527f41646d696e3a2063616c6c6572206973206e6f742062726964676552657669656040820152623bb2b960e91b606082015260800190565b6020808252601e908201527f4272696467653a206c31427269646765206e6f7420617661696c61626c650000604082015260600190565b6000602082840312156139d757600080fd5b5051919050565b600181815b80851115613a195781600019048211156139ff576139ff613721565b80851615613a0c57918102915b93841c93908002906139e3565b509250929050565b600082613a3057506001611d41565b81613a3d57506000611d41565b8160018114613a535760028114613a5d57613a79565b6001915050611d41565b60ff841115613a6e57613a6e613721565b50506001821b611d41565b5060208310610133831016604e8410600b8410161715613a9c575081810a611d41565b613aa683836139de565b8060001904821115613aba57613aba613721565b029392505050565b60006133f560ff841683613a21565b60005b83811015613aec578181015183820152602001613ad4565b50506000910152565b60008151808452613b0d816020860160208601613ad1565b601f01601f19169290920160200192915050565b61ffff841681526001600160a01b0383166020820152606060408201819052600090613b4f90830184613af5565b95945050505050565b600060208284031215613b6a57600080fd5b81516133f58161341e565b600082613b8457613b846138df565b500690565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b600060208284031215613be657600080fd5b81516133f581613557565b60008251613c03818460208701613ad1565b9190910192915050565b6020815260006133f56020830184613af556fea2646970667358221220f419a44338f461d2ffd53ab9fb98dc4ac7bd559c91f5729028b4a5c5856e683964736f6c63430008120033

Block Transaction Gas Used Reward
view all blocks sequenced

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
[ 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.