ETH Price: $2,002.26 (+1.42%)

Contract

0x7eAd444f525922666D128859b76e8F96Ebf8d4a2
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Token Holdings

More Info

Private Name Tags

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Register Remote ...198185112024-05-07 13:32:47670 days ago1715088767IN
0x7eAd444f...6Ebf8d4a2
0 ETH0.000798818.75973766
Register Remote ...196704542024-04-16 20:34:35691 days ago1713299675IN
0x7eAd444f...6Ebf8d4a2
0 ETH0.000857769.40982441
Register Remote ...196203662024-04-09 20:08:23698 days ago1712693303IN
0x7eAd444f...6Ebf8d4a2
0 ETH0.0024537526.91815229
Register Remote ...196202322024-04-09 19:41:35698 days ago1712691695IN
0x7eAd444f...6Ebf8d4a2
0 ETH0.000790125.10813465
Register Remote ...196202152024-04-09 19:38:11698 days ago1712691491IN
0x7eAd444f...6Ebf8d4a2
0 ETH0.0021208223.26278257
Register Remote ...194793252024-03-20 23:56:59718 days ago1710979019IN
0x7eAd444f...6Ebf8d4a2
0 ETH0.0011370536.1613911
Register Remote ...194793212024-03-20 23:56:11718 days ago1710978971IN
0x7eAd444f...6Ebf8d4a2
0 ETH0.0031063834.0731409
Register Remote ...194793082024-03-20 23:53:35718 days ago1710978815IN
0x7eAd444f...6Ebf8d4a2
0 ETH0.0011421236.30878237
Register Remote ...194792672024-03-20 23:45:23718 days ago1710978323IN
0x7eAd444f...6Ebf8d4a2
0 ETH0.0010096232.07203637
Register Remote ...194792482024-03-20 23:41:35718 days ago1710978095IN
0x7eAd444f...6Ebf8d4a2
0 ETH0.003159734.65349472
Register Remote ...194791922024-03-20 23:30:11718 days ago1710977411IN
0x7eAd444f...6Ebf8d4a2
0 ETH0.0035823739.2993423
Register Remote ...194790312024-03-20 22:57:35718 days ago1710975455IN
0x7eAd444f...6Ebf8d4a2
0 ETH0.0036239139.76031006
Register Remote ...194789162024-03-20 22:34:23718 days ago1710974063IN
0x7eAd444f...6Ebf8d4a2
0 ETH0.0036870740.45325183
Register Remote ...194789102024-03-20 22:33:11718 days ago1710973991IN
0x7eAd444f...6Ebf8d4a2
0 ETH0.0038245141.95566716
Set Bridge Execu...194724582024-03-20 0:49:47719 days ago1710895787IN
0x7eAd444f...6Ebf8d4a2
0 ETH0.0014419631.17357334
Set Router194724582024-03-20 0:49:47719 days ago1710895787IN
0x7eAd444f...6Ebf8d4a2
0 ETH0.0014440231.17357334
Set Utb194724582024-03-20 0:49:47719 days ago1710895787IN
0x7eAd444f...6Ebf8d4a2
0 ETH0.0014426531.17357334

Latest 25 internal transactions (View All)

Advanced mode:
Parent Transaction Hash Method Block
From
To
Bridge With Payl...198500892024-05-11 23:31:47666 days ago1715470307
0x7eAd444f...6Ebf8d4a2
0.00030272 ETH
Bridge198500892024-05-11 23:31:47666 days ago1715470307
0x7eAd444f...6Ebf8d4a2
0.00030272 ETH
Bridge With Payl...198387462024-05-10 9:29:23668 days ago1715333363
0x7eAd444f...6Ebf8d4a2
0.20033252 ETH
Bridge198387462024-05-10 9:29:23668 days ago1715333363
0x7eAd444f...6Ebf8d4a2
0.20033252 ETH
Bridge With Payl...198387442024-05-10 9:28:47668 days ago1715333327
0x7eAd444f...6Ebf8d4a2
0.20033252 ETH
Bridge198387442024-05-10 9:28:47668 days ago1715333327
0x7eAd444f...6Ebf8d4a2
0.20033252 ETH
Bridge With Payl...198372392024-05-10 4:26:11668 days ago1715315171
0x7eAd444f...6Ebf8d4a2
0.00093348 ETH
Bridge198372392024-05-10 4:26:11668 days ago1715315171
0x7eAd444f...6Ebf8d4a2
0.00093348 ETH
Bridge With Payl...198355432024-05-09 22:43:35668 days ago1715294615
0x7eAd444f...6Ebf8d4a2
0.00370242 ETH
Bridge198355432024-05-09 22:43:35668 days ago1715294615
0x7eAd444f...6Ebf8d4a2
0.00370242 ETH
Bridge With Payl...198331142024-05-09 14:33:59668 days ago1715265239
0x7eAd444f...6Ebf8d4a2
0.03030242 ETH
Bridge198331142024-05-09 14:33:59668 days ago1715265239
0x7eAd444f...6Ebf8d4a2
0.03030242 ETH
Bridge With Payl...198323742024-05-09 12:05:47668 days ago1715256347
0x7eAd444f...6Ebf8d4a2
0.01436975 ETH
Bridge198323742024-05-09 12:05:47668 days ago1715256347
0x7eAd444f...6Ebf8d4a2
0.01436975 ETH
Bridge With Payl...198291902024-05-09 1:24:23669 days ago1715217863
0x7eAd444f...6Ebf8d4a2
0.00117367 ETH
Bridge198291902024-05-09 1:24:23669 days ago1715217863
0x7eAd444f...6Ebf8d4a2
0.00117367 ETH
Bridge With Payl...198248252024-05-08 10:44:11669 days ago1715165051
0x7eAd444f...6Ebf8d4a2
0.00530242 ETH
Bridge198248252024-05-08 10:44:11669 days ago1715165051
0x7eAd444f...6Ebf8d4a2
0.00530242 ETH
Bridge With Payl...198247932024-05-08 10:37:23669 days ago1715164643
0x7eAd444f...6Ebf8d4a2
0.00031624 ETH
Bridge198247932024-05-08 10:37:23669 days ago1715164643
0x7eAd444f...6Ebf8d4a2
0.00031624 ETH
Bridge With Payl...198247572024-05-08 10:30:11669 days ago1715164211
0x7eAd444f...6Ebf8d4a2
0.00066016 ETH
Bridge198247572024-05-08 10:30:11669 days ago1715164211
0x7eAd444f...6Ebf8d4a2
0.00066016 ETH
Bridge With Payl...198242172024-05-08 8:41:23670 days ago1715157683
0x7eAd444f...6Ebf8d4a2
0.01530242 ETH
Bridge198242172024-05-08 8:41:23670 days ago1715157683
0x7eAd444f...6Ebf8d4a2
0.01530242 ETH
Bridge With Payl...198242062024-05-08 8:39:11670 days ago1715157551
0x7eAd444f...6Ebf8d4a2
0.00031487 ETH
View All Internal Transactions
Loading...
Loading
Loading...
Loading
Cross-Chain Transactions

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
DecentBridgeAdapter

Compiler Version
v0.8.20+commit.a1b79de6

Optimization Enabled:
Yes with 200 runs

Other Settings:
paris EvmVersion
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;

import {IERC20} from "forge-std/interfaces/IERC20.sol";
import {IUTB} from "../interfaces/IUTB.sol";
import {IBridgeAdapter} from "../interfaces/IBridgeAdapter.sol";
import {SwapInstructions} from "../CommonTypes.sol";
import {SwapParams} from "../swappers/SwapParams.sol";
import {IDecentEthRouter} from "decent-bridge/src/interfaces/IDecentEthRouter.sol";
import {BaseAdapter} from "./BaseAdapter.sol";

contract DecentBridgeAdapter is BaseAdapter, IBridgeAdapter {
    uint8 public constant BRIDGE_ID = 0;
    mapping(uint256 => address) public destinationBridgeAdapter;
    IDecentEthRouter public router;
    mapping(uint256 => uint16) public lzIdLookup;
    mapping(uint16 => uint256) public chainIdLookup;
    bool public gasIsEth;
    address public bridgeToken;

    constructor(bool _gasIsEth, address _bridgeToken) BaseAdapter() {
        gasIsEth = _gasIsEth;
        bridgeToken = _bridgeToken;
    }

    function setRouter(address _router) public onlyAdmin {
        router = IDecentEthRouter(payable(_router));
    }

    function getId() public pure returns (uint8) {
        return BRIDGE_ID;
    }

    function registerRemoteBridgeAdapter(
        uint256 dstChainId,
        uint16 dstLzId,
        address decentBridgeAdapter
    ) public onlyAdmin {
        lzIdLookup[dstChainId] = dstLzId;
        chainIdLookup[dstLzId] = dstChainId;
        destinationBridgeAdapter[dstChainId] = decentBridgeAdapter;
    }

    function estimateFees(
        SwapInstructions memory postBridge,
        uint256 dstChainId,
        address target,
        uint64 dstGas,
        bytes memory payload
    ) public view returns (uint nativeFee, uint zroFee) {
        SwapParams memory swapParams = abi.decode(
            postBridge.swapPayload,
            (SwapParams)
        );
        return
            router.estimateSendAndCallFee(
                router.MT_ETH_TRANSFER_WITH_PAYLOAD(),
                lzIdLookup[dstChainId],
                target,
                msg.sender,
                swapParams.amountIn,
                dstGas,
                false,
                payload
            );
    }

    function getBridgeToken(
        bytes calldata /*additionalArgs*/
    ) external view returns (address) {
        return bridgeToken;
    }

    function getBridgedAmount(
        uint256 amt2Bridge,
        address /*preBridgeToken*/,
        address /*postBridgeToken*/,
        bytes calldata /*additionalArgs*/
    ) external pure returns (uint256) {
        return amt2Bridge;
    }

    function bridge(
        uint256 amt2Bridge,
        SwapInstructions memory postBridge,
        uint256 dstChainId,
        address target,
        address paymentOperator,
        bytes memory payload,
        bytes calldata additionalArgs,
        address refund
    ) public payable onlyUtb returns (bytes memory bridgePayload) {
        if (destinationBridgeAdapter[dstChainId] == address(0)) revert NoDstBridge();

        uint64 dstGas = abi.decode(additionalArgs, (uint64));

        bridgePayload = abi.encodeCall(
            this.receiveFromBridge,
            (postBridge, target, paymentOperator, payload, refund)
        );

        SwapParams memory swapParams = abi.decode(
            postBridge.swapPayload,
            (SwapParams)
        );

        if (!gasIsEth) {
            IERC20(bridgeToken).transferFrom(
                msg.sender,
                address(this),
                amt2Bridge
            );
            IERC20(bridgeToken).approve(address(router), amt2Bridge);
        }

        router.bridgeWithPayload{value: msg.value}(
            lzIdLookup[dstChainId],
            destinationBridgeAdapter[dstChainId],
            refund,
            swapParams.amountIn,
            false,
            dstGas,
            bridgePayload
        );
    }

    function receiveFromBridge(
        SwapInstructions memory postBridge,
        address target,
        address paymentOperator,
        bytes memory payload,
        address refund
    ) public onlyExecutor {
        SwapParams memory swapParams = abi.decode(
            postBridge.swapPayload,
            (SwapParams)
        );

        IERC20(swapParams.tokenIn).transferFrom(
            msg.sender,
            address(this),
            swapParams.amountIn
        );

        IERC20(swapParams.tokenIn).approve(utb, swapParams.amountIn);

        IUTB(utb).receiveFromBridge(
            postBridge,
            target,
            paymentOperator,
            payload,
            refund,
            BRIDGE_ID
        );
    }

    receive() external payable {}

    fallback() external payable {}
}

// SPDX-License-Identifier: MIT
pragma solidity >=0.6.2;

/// @dev Interface of the ERC20 standard as defined in the EIP.
/// @dev This includes the optional name, symbol, and decimals metadata.
interface IERC20 {
    /// @dev Emitted when `value` tokens are moved from one account (`from`) to another (`to`).
    event Transfer(address indexed from, address indexed to, uint256 value);

    /// @dev Emitted when the allowance of a `spender` for an `owner` is set, where `value`
    /// is the new allowance.
    event Approval(address indexed owner, address indexed spender, uint256 value);

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

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

    /// @notice Moves `amount` tokens from the caller's account to `to`.
    function transfer(address to, uint256 amount) external returns (bool);

    /// @notice Returns the remaining number of tokens that `spender` is allowed
    /// to spend on behalf of `owner`
    function allowance(address owner, address spender) external view returns (uint256);

    /// @notice Sets `amount` as the allowance of `spender` over the caller's tokens.
    /// @dev Be aware of front-running risks: https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
    function approve(address spender, uint256 amount) external returns (bool);

    /// @notice Moves `amount` tokens from `from` to `to` using the allowance mechanism.
    /// `amount` is then deducted from the caller's allowance.
    function transferFrom(address from, address to, uint256 amount) external returns (bool);

    /// @notice Returns the name of the token.
    function name() external view returns (string memory);

    /// @notice Returns the symbol of the token.
    function symbol() external view returns (string memory);

    /// @notice Returns the decimals places of the token.
    function decimals() external view returns (uint8);
}

// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;

import {SwapInstructions, FeeData, BridgeInstructions, SwapAndExecuteInstructions} from "../CommonTypes.sol";

interface IUTB {

    event Swapped();
    event BridgeCalled();
    event RecievedFromBridge();

    /// @notice Thrown when protocol fees cannot be collected
    error ProtocolFeeCannotBeFetched();

    /// @notice Thrown when UTB is paused
    error UTBPaused();

    /// @notice Thrown when not enough native is passed for swap
    error NotEnoughNative();

    /// @notice Thrown when receive from bridge is not called from a bridge adapter
    error OnlyBridgeAdapter();

    /**
     * @dev Swaps currency from the incoming to the outgoing token and executes a transaction with payment.
     * @param instructions The token swap data and payment transaction payload.
     * @param feeData The bridge fee in native, as well as utb fee tokens and amounts.
     * @param signature The ECDSA signature to verify the fee structure.
     */
    function swapAndExecute(
        SwapAndExecuteInstructions memory instructions,
        FeeData memory feeData,
        bytes memory signature
    ) external payable;

    /**
     * @dev Bridges funds in native or ERC20 and a payment transaction payload to the destination chain
     * @param instructions The bridge data, token swap data, and payment transaction payload.
     * @param feeData The bridge fee in native, as well as utb fee tokens and amounts.
     * @param signature The ECDSA signature to verify the fee structure.
     */
    function bridgeAndExecute(
        BridgeInstructions memory instructions,
        FeeData memory feeData,
        bytes memory signature
    ) external payable returns (bytes memory);

    /**
     * @dev Receives funds from the bridge adapter, executes a swap, and executes a payment transaction.
     * @param postBridge The swapper ID and calldata to execute a swap.
     * @param target The address of the target contract for the payment transaction.
     * @param paymentOperator The operator address for payment transfers requiring ERC20 approvals.
     * @param payload The calldata to execute the payment transaction.
     * @param refund The account receiving any refunds, typically the EOA which initiated the transaction.
     */
    function receiveFromBridge(
        SwapInstructions memory postBridge,
        address target,
        address paymentOperator,
        bytes memory payload,
        address refund,
        uint8 bridgeId
    ) external payable;

    /**
     * @dev Registers and maps a bridge adapter to a bridge adapter ID.
     * @param bridge The address of the bridge adapter.
     */
    function registerBridge(address bridge) external;

    /**
     * @dev Registers and maps a swapper to a swapper ID.
     * @param swapper The address of the swapper.
     */
    function registerSwapper(address swapper) external;

    function setExecutor(address _executor) external;

    function setFeeManager(address _feeManager) external;

    function setWrapped(address _wrapped) external;
}

pragma solidity ^0.8.0;

import {SwapInstructions} from "../CommonTypes.sol";

interface IBridgeAdapter {

    error NoDstBridge();

    function getId() external returns (uint8);

    function getBridgeToken(
        bytes calldata additionalArgs
    ) external returns (address);

    function getBridgedAmount(
        uint256 amt2Bridge,
        address preBridgeToken,
        address postBridgeToken,
        bytes calldata additionalArgs
    ) external returns (uint256);

    function bridge(
        uint256 amt2Bridge,
        SwapInstructions memory postBridge,
        uint256 dstChainId,
        address target,
        address paymentOperator,
        bytes memory payload,
        bytes calldata additionalArgs,
        address refund
    ) external payable returns (bytes memory);
}

File 5 of 18 : CommonTypes.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;

struct SwapInstructions {
    uint8 swapperId;
    bytes swapPayload;
}

struct FeeData {
    bytes4 appId;
    bytes4 affiliateId;
    uint bridgeFee;
    Fee[] appFees;
}

struct Fee {
    address recipient;
    address token;
    uint amount;
}

struct SwapAndExecuteInstructions {
    SwapInstructions swapInstructions;
    address target;
    address paymentOperator;
    address refund;
    bytes payload;
}

struct BridgeInstructions {
    SwapInstructions preBridge;
    SwapInstructions postBridge;
    uint8 bridgeId;
    uint256 dstChainId;
    address target;
    address paymentOperator;
    address refund;
    bytes payload;
    bytes additionalArgs;
}

File 6 of 18 : SwapParams.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;

library SwapDirection {
    uint8 constant EXACT_IN = 0;
    uint8 constant EXACT_OUT = 1;
}

struct SwapParams {
    uint256 amountIn;
    uint256 amountOut;
    address tokenIn;
    address tokenOut;
    uint8 direction;
    // if direction is exactAmountIn
    // then amount out will be the minimum amount out
    // if direction is exactAmountOutA
    // then amount in is maximum amount in
    bytes path;
}

pragma solidity ^0.8.0;

interface IDecentEthRouter {

    event ReceivedDecentEth(
        uint8 msgType,
        uint16 _srcChainId,
        address from,
        address _to,
        uint amount,
        bytes payload
    );
    
    error OnlyLzApp();

    error OnlyEthChain();

    error OnlyBridgeOperator();

    error NotEnoughReserves();

    error InsufficientBalance();

    function MT_ETH_TRANSFER() external view returns (uint8);

    function MT_ETH_TRANSFER_WITH_PAYLOAD() external view returns (uint8);

    /**
     * @dev Sets dcntEth to the router
     * @param _addr The address of the deployed DcntEth token
     */
    function registerDcntEth(address _addr) external;

    /**
     * @dev Adds a destination bridge for the bridge
     * @param _dstChainId The lz chainId
     * @param _routerAddress The router address on the dst chain
     */
    function addDestinationBridge(
        uint16 _dstChainId,
        address _routerAddress
    ) external;

    function estimateSendAndCallFee(
        uint8 msgType,
        uint16 _dstChainId,
        address _toAddress,
        address _refundAddress,
        uint _amount,
        uint64 _dstGasForCall,
        bool deliverEth,
        bytes memory payload
    ) external view returns (uint nativeFee, uint zroFee);

    /**
     * @param _dstChainId lz endpoint
     * @param _toAddress the destination address (i.e. dst bridge)
     * @param _refundAddress the refund address
     * @param _amount the amount being bridged
     * @param deliverEth if false, delivers WETH
     * @param _dstGasForCall the amount of dst gas
     * @param additionalPayload contains the refundAddress, zroPaymentAddress, and adapterParams
     */
    function bridgeWithPayload(
        uint16 _dstChainId,
        address _toAddress,
        address _refundAddress,
        uint _amount,
        bool deliverEth,
        uint64 _dstGasForCall,
        bytes memory additionalPayload
    ) external payable;

    /**
     * @param _dstChainId lz endpoint
     * @param _toAddress destination address
     * @param _refundAddress the address to be refunded
     * @param _amount the amount being bridge
     * @param _dstGasForCall the amount of dst gas
     * @param deliverEth if false, delivers WETH
     */
    function bridge(
        uint16 _dstChainId,
        address _toAddress,
        address _refundAddress,
        uint _amount,
        uint64 _dstGasForCall,
        bool deliverEth // if false, delivers WETH
    ) external payable;

    /**
     * @dev allows users to redeem their dcntEth for ETH
     * @param amount the amount to be redeemed
     */
    function redeemEth(uint256 amount) external;

    /**
     * @dev allows users to redeem their dcntEth for WETH
     * @param amount the amount to be redeemed
     */
    function redeemWeth(uint256 amount) external;

    /**
     * @dev adds bridge liquidity by paying ETH
     */
    function addLiquidityEth() external payable;

    /**
     * @dev withdraws a users bridge liquidity for ETH
     * @param amount the amount to be redeemed
     */
    function removeLiquidityEth(uint256 amount) external;

    /**
     * @dev adds bridge liquidity by providing WETH
     * @param amount the amount to be added
     */
    function addLiquidityWeth(uint256 amount) external payable;

    /**
     * @dev withdraws a users bridge liquidity for WETH
     * @param amount the amount to be redeemed
     */
    function removeLiquidityWeth(uint256 amount) external;
}

// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;

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

contract BaseAdapter is UTBOwned {
    address public bridgeExecutor;

    constructor() UTBOwned() {}

    error OnlyExecutor();
    modifier onlyExecutor() {
        if (msg.sender != address(bridgeExecutor)) revert OnlyExecutor();
        _;
    }

    function setBridgeExecutor(address _executor) public onlyAdmin {
        bridgeExecutor = _executor;
    }
}

// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;

import {Roles} from "decent-bridge/src/utils/Roles.sol";

contract UTBOwned is Roles {
    address payable public utb;

    constructor() Roles(msg.sender) {}

    /**
     * @dev Limit access to the approved UTB.
     */
    modifier onlyUtb() {
        require(msg.sender == utb, "Only utb");
        _;
    }

    /**
     * @dev Sets the approved UTB.
     * @param _utb The address of the UTB.
     */
    function setUtb(address _utb) public onlyAdmin {
        utb = payable(_utb);
    }
}

File 10 of 18 : Roles.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.13;
import {AccessControl} from "@openzeppelin/contracts/access/AccessControl.sol";

abstract contract Roles is AccessControl {
    constructor(address admin) {
        _grantRole(DEFAULT_ADMIN_ROLE, admin);
    }

    modifier onlyAdmin() {
        require(hasRole(DEFAULT_ADMIN_ROLE, msg.sender), "Only admin");
        _;
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/AccessControl.sol)

pragma solidity ^0.8.0;

import "./IAccessControl.sol";
import "../utils/Context.sol";
import "../utils/Strings.sol";
import "../utils/introspection/ERC165.sol";

/**
 * @dev Contract module that allows children to implement role-based access
 * control mechanisms. This is a lightweight version that doesn't allow enumerating role
 * members except through off-chain means by accessing the contract event logs. Some
 * applications may benefit from on-chain enumerability, for those cases see
 * {AccessControlEnumerable}.
 *
 * Roles are referred to by their `bytes32` identifier. These should be exposed
 * in the external API and be unique. The best way to achieve this is by
 * using `public constant` hash digests:
 *
 * ```solidity
 * bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
 * ```
 *
 * Roles can be used to represent a set of permissions. To restrict access to a
 * function call, use {hasRole}:
 *
 * ```solidity
 * function foo() public {
 *     require(hasRole(MY_ROLE, msg.sender));
 *     ...
 * }
 * ```
 *
 * Roles can be granted and revoked dynamically via the {grantRole} and
 * {revokeRole} functions. Each role has an associated admin role, and only
 * accounts that have a role's admin role can call {grantRole} and {revokeRole}.
 *
 * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
 * that only accounts with this role will be able to grant or revoke other
 * roles. More complex role relationships can be created by using
 * {_setRoleAdmin}.
 *
 * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
 * grant and revoke this role. Extra precautions should be taken to secure
 * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}
 * to enforce additional security measures for this role.
 */
abstract contract AccessControl is Context, IAccessControl, ERC165 {
    struct RoleData {
        mapping(address => bool) members;
        bytes32 adminRole;
    }

    mapping(bytes32 => RoleData) private _roles;

    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;

    /**
     * @dev Modifier that checks that an account has a specific role. Reverts
     * with a standardized message including the required role.
     *
     * The format of the revert reason is given by the following regular expression:
     *
     *  /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
     *
     * _Available since v4.1._
     */
    modifier onlyRole(bytes32 role) {
        _checkRole(role);
        _;
    }

    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);
    }

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) public view virtual override returns (bool) {
        return _roles[role].members[account];
    }

    /**
     * @dev Revert with a standard message if `_msgSender()` is missing `role`.
     * Overriding this function changes the behavior of the {onlyRole} modifier.
     *
     * Format of the revert message is described in {_checkRole}.
     *
     * _Available since v4.6._
     */
    function _checkRole(bytes32 role) internal view virtual {
        _checkRole(role, _msgSender());
    }

    /**
     * @dev Revert with a standard message if `account` is missing `role`.
     *
     * The format of the revert reason is given by the following regular expression:
     *
     *  /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
     */
    function _checkRole(bytes32 role, address account) internal view virtual {
        if (!hasRole(role, account)) {
            revert(
                string(
                    abi.encodePacked(
                        "AccessControl: account ",
                        Strings.toHexString(account),
                        " is missing role ",
                        Strings.toHexString(uint256(role), 32)
                    )
                )
            );
        }
    }

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {
        return _roles[role].adminRole;
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     *
     * May emit a {RoleGranted} event.
     */
    function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
        _grantRole(role, account);
    }

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     *
     * May emit a {RoleRevoked} event.
     */
    function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
        _revokeRole(role, account);
    }

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been revoked `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `account`.
     *
     * May emit a {RoleRevoked} event.
     */
    function renounceRole(bytes32 role, address account) public virtual override {
        require(account == _msgSender(), "AccessControl: can only renounce roles for self");

        _revokeRole(role, account);
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event. Note that unlike {grantRole}, this function doesn't perform any
     * checks on the calling account.
     *
     * May emit a {RoleGranted} event.
     *
     * [WARNING]
     * ====
     * This function should only be called from the constructor when setting
     * up the initial roles for the system.
     *
     * Using this function in any other way is effectively circumventing the admin
     * system imposed by {AccessControl}.
     * ====
     *
     * NOTE: This function is deprecated in favor of {_grantRole}.
     */
    function _setupRole(bytes32 role, address account) internal virtual {
        _grantRole(role, account);
    }

    /**
     * @dev Sets `adminRole` as ``role``'s admin role.
     *
     * Emits a {RoleAdminChanged} event.
     */
    function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
        bytes32 previousAdminRole = getRoleAdmin(role);
        _roles[role].adminRole = adminRole;
        emit RoleAdminChanged(role, previousAdminRole, adminRole);
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * Internal function without access restriction.
     *
     * May emit a {RoleGranted} event.
     */
    function _grantRole(bytes32 role, address account) internal virtual {
        if (!hasRole(role, account)) {
            _roles[role].members[account] = true;
            emit RoleGranted(role, account, _msgSender());
        }
    }

    /**
     * @dev Revokes `role` from `account`.
     *
     * Internal function without access restriction.
     *
     * May emit a {RoleRevoked} event.
     */
    function _revokeRole(bytes32 role, address account) internal virtual {
        if (hasRole(role, account)) {
            _roles[role].members[account] = false;
            emit RoleRevoked(role, account, _msgSender());
        }
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)

pragma solidity ^0.8.0;

/**
 * @dev External interface of AccessControl declared to support ERC165 detection.
 */
interface IAccessControl {
    /**
     * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
     *
     * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
     * {RoleAdminChanged} not being emitted signaling this.
     *
     * _Available since v3.1._
     */
    event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);

    /**
     * @dev Emitted when `account` is granted `role`.
     *
     * `sender` is the account that originated the contract call, an admin role
     * bearer except when using {AccessControl-_setupRole}.
     */
    event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Emitted when `account` is revoked `role`.
     *
     * `sender` is the account that originated the contract call:
     *   - if using `revokeRole`, it is the admin role bearer
     *   - if using `renounceRole`, it is the role bearer (i.e. `account`)
     */
    event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) external view returns (bool);

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {AccessControl-_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) external view returns (bytes32);

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function grantRole(bytes32 role, address account) external;

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function revokeRole(bytes32 role, address account) external;

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been granted `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `account`.
     */
    function renounceRole(bytes32 role, address account) external;
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;

/**
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)

pragma solidity ^0.8.0;

import "./math/Math.sol";
import "./math/SignedMath.sol";

/**
 * @dev String operations.
 */
library Strings {
    bytes16 private constant _SYMBOLS = "0123456789abcdef";
    uint8 private constant _ADDRESS_LENGTH = 20;

    /**
     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
     */
    function toString(uint256 value) internal pure returns (string memory) {
        unchecked {
            uint256 length = Math.log10(value) + 1;
            string memory buffer = new string(length);
            uint256 ptr;
            /// @solidity memory-safe-assembly
            assembly {
                ptr := add(buffer, add(32, length))
            }
            while (true) {
                ptr--;
                /// @solidity memory-safe-assembly
                assembly {
                    mstore8(ptr, byte(mod(value, 10), _SYMBOLS))
                }
                value /= 10;
                if (value == 0) break;
            }
            return buffer;
        }
    }

    /**
     * @dev Converts a `int256` to its ASCII `string` decimal representation.
     */
    function toString(int256 value) internal pure returns (string memory) {
        return string(abi.encodePacked(value < 0 ? "-" : "", toString(SignedMath.abs(value))));
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
     */
    function toHexString(uint256 value) internal pure returns (string memory) {
        unchecked {
            return toHexString(value, Math.log256(value) + 1);
        }
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
     */
    function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
        bytes memory buffer = new bytes(2 * length + 2);
        buffer[0] = "0";
        buffer[1] = "x";
        for (uint256 i = 2 * length + 1; i > 1; --i) {
            buffer[i] = _SYMBOLS[value & 0xf];
            value >>= 4;
        }
        require(value == 0, "Strings: hex length insufficient");
        return string(buffer);
    }

    /**
     * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.
     */
    function toHexString(address addr) internal pure returns (string memory) {
        return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
    }

    /**
     * @dev Returns true if the two strings are equal.
     */
    function equal(string memory a, string memory b) internal pure returns (bool) {
        return keccak256(bytes(a)) == keccak256(bytes(b));
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)

pragma solidity ^0.8.0;

import "./IERC165.sol";

/**
 * @dev Implementation of the {IERC165} interface.
 *
 * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
 * for the additional interface id that will be supported. For example:
 *
 * ```solidity
 * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
 *     return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
 * }
 * ```
 *
 * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
 */
abstract contract ERC165 is IERC165 {
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IERC165).interfaceId;
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)

pragma solidity ^0.8.0;

/**
 * @dev Standard math utilities missing in the Solidity language.
 */
library Math {
    enum Rounding {
        Down, // Toward negative infinity
        Up, // Toward infinity
        Zero // Toward zero
    }

    /**
     * @dev Returns the largest of two numbers.
     */
    function max(uint256 a, uint256 b) internal pure returns (uint256) {
        return a > b ? a : b;
    }

    /**
     * @dev Returns the smallest of two numbers.
     */
    function min(uint256 a, uint256 b) internal pure returns (uint256) {
        return a < b ? a : b;
    }

    /**
     * @dev Returns the average of two numbers. The result is rounded towards
     * zero.
     */
    function average(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b) / 2 can overflow.
        return (a & b) + (a ^ b) / 2;
    }

    /**
     * @dev Returns the ceiling of the division of two numbers.
     *
     * This differs from standard division with `/` in that it rounds up instead
     * of rounding down.
     */
    function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b - 1) / b can overflow on addition, so we distribute.
        return a == 0 ? 0 : (a - 1) / b + 1;
    }

    /**
     * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
     * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)
     * with further edits by Uniswap Labs also under MIT license.
     */
    function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {
        unchecked {
            // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
            // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
            // variables such that product = prod1 * 2^256 + prod0.
            uint256 prod0; // Least significant 256 bits of the product
            uint256 prod1; // Most significant 256 bits of the product
            assembly {
                let mm := mulmod(x, y, not(0))
                prod0 := mul(x, y)
                prod1 := sub(sub(mm, prod0), lt(mm, prod0))
            }

            // Handle non-overflow cases, 256 by 256 division.
            if (prod1 == 0) {
                // Solidity will revert if denominator == 0, unlike the div opcode on its own.
                // The surrounding unchecked block does not change this fact.
                // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.
                return prod0 / denominator;
            }

            // Make sure the result is less than 2^256. Also prevents denominator == 0.
            require(denominator > prod1, "Math: mulDiv overflow");

            ///////////////////////////////////////////////
            // 512 by 256 division.
            ///////////////////////////////////////////////

            // Make division exact by subtracting the remainder from [prod1 prod0].
            uint256 remainder;
            assembly {
                // Compute remainder using mulmod.
                remainder := mulmod(x, y, denominator)

                // Subtract 256 bit number from 512 bit number.
                prod1 := sub(prod1, gt(remainder, prod0))
                prod0 := sub(prod0, remainder)
            }

            // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.
            // See https://cs.stackexchange.com/q/138556/92363.

            // Does not overflow because the denominator cannot be zero at this stage in the function.
            uint256 twos = denominator & (~denominator + 1);
            assembly {
                // Divide denominator by twos.
                denominator := div(denominator, twos)

                // Divide [prod1 prod0] by twos.
                prod0 := div(prod0, twos)

                // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
                twos := add(div(sub(0, twos), twos), 1)
            }

            // Shift in bits from prod1 into prod0.
            prod0 |= prod1 * twos;

            // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
            // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
            // four bits. That is, denominator * inv = 1 mod 2^4.
            uint256 inverse = (3 * denominator) ^ 2;

            // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works
            // in modular arithmetic, doubling the correct bits in each step.
            inverse *= 2 - denominator * inverse; // inverse mod 2^8
            inverse *= 2 - denominator * inverse; // inverse mod 2^16
            inverse *= 2 - denominator * inverse; // inverse mod 2^32
            inverse *= 2 - denominator * inverse; // inverse mod 2^64
            inverse *= 2 - denominator * inverse; // inverse mod 2^128
            inverse *= 2 - denominator * inverse; // inverse mod 2^256

            // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
            // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
            // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
            // is no longer required.
            result = prod0 * inverse;
            return result;
        }
    }

    /**
     * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
     */
    function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {
        uint256 result = mulDiv(x, y, denominator);
        if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {
            result += 1;
        }
        return result;
    }

    /**
     * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.
     *
     * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
     */
    function sqrt(uint256 a) internal pure returns (uint256) {
        if (a == 0) {
            return 0;
        }

        // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
        //
        // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
        // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
        //
        // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
        // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
        // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
        //
        // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
        uint256 result = 1 << (log2(a) >> 1);

        // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
        // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
        // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
        // into the expected uint128 result.
        unchecked {
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            return min(result, a / result);
        }
    }

    /**
     * @notice Calculates sqrt(a), following the selected rounding direction.
     */
    function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = sqrt(a);
            return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 2, rounded down, of a positive value.
     * Returns 0 if given 0.
     */
    function log2(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 128;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 64;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 32;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 16;
            }
            if (value >> 8 > 0) {
                value >>= 8;
                result += 8;
            }
            if (value >> 4 > 0) {
                value >>= 4;
                result += 4;
            }
            if (value >> 2 > 0) {
                value >>= 2;
                result += 2;
            }
            if (value >> 1 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 2, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log2(value);
            return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 10, rounded down, of a positive value.
     * Returns 0 if given 0.
     */
    function log10(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >= 10 ** 64) {
                value /= 10 ** 64;
                result += 64;
            }
            if (value >= 10 ** 32) {
                value /= 10 ** 32;
                result += 32;
            }
            if (value >= 10 ** 16) {
                value /= 10 ** 16;
                result += 16;
            }
            if (value >= 10 ** 8) {
                value /= 10 ** 8;
                result += 8;
            }
            if (value >= 10 ** 4) {
                value /= 10 ** 4;
                result += 4;
            }
            if (value >= 10 ** 2) {
                value /= 10 ** 2;
                result += 2;
            }
            if (value >= 10 ** 1) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 10, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log10(value);
            return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 256, rounded down, of a positive value.
     * Returns 0 if given 0.
     *
     * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
     */
    function log256(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 16;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 8;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 4;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 2;
            }
            if (value >> 8 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 256, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log256(value);
            return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);
        }
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)

pragma solidity ^0.8.0;

/**
 * @dev Standard signed math utilities missing in the Solidity language.
 */
library SignedMath {
    /**
     * @dev Returns the largest of two signed numbers.
     */
    function max(int256 a, int256 b) internal pure returns (int256) {
        return a > b ? a : b;
    }

    /**
     * @dev Returns the smallest of two signed numbers.
     */
    function min(int256 a, int256 b) internal pure returns (int256) {
        return a < b ? a : b;
    }

    /**
     * @dev Returns the average of two signed numbers without overflow.
     * The result is rounded towards zero.
     */
    function average(int256 a, int256 b) internal pure returns (int256) {
        // Formula from the book "Hacker's Delight"
        int256 x = (a & b) + ((a ^ b) >> 1);
        return x + (int256(uint256(x) >> 255) & (a ^ b));
    }

    /**
     * @dev Returns the absolute unsigned value of a signed value.
     */
    function abs(int256 n) internal pure returns (uint256) {
        unchecked {
            // must be unchecked in order to support `n = type(int256).min`
            return uint256(n >= 0 ? n : -n);
        }
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC165 standard, as defined in the
 * https://eips.ethereum.org/EIPS/eip-165[EIP].
 *
 * Implementers can declare support of contract interfaces, which can then be
 * queried by others ({ERC165Checker}).
 *
 * For an implementation, see {ERC165}.
 */
interface IERC165 {
    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) external view returns (bool);
}

Settings
{
  "remappings": [
    "forge-std/=lib/forge-std/src/",
    "solmate/=lib/solmate/src/",
    "@uniswap/v3-periphery/=lib/v3-periphery/",
    "@uniswap/v3-core/=lib/v3-core/",
    "@uniswap/swap-contracts/=lib/swap-router-contracts/contracts/",
    "decent-bridge/=lib/decent-bridge/",
    "better-deployer/=lib/decent-bridge/lib/better-deployer/src/",
    "forge-toolkit/=lib/forge-toolkit/src/",
    "openzeppelin-contracts/=lib/decent-bridge/lib/openzeppelin-contracts/contracts/",
    "solidity-examples/=lib/solidity-examples/contracts/",
    "@openzeppelin/=lib/decent-bridge/lib/openzeppelin-contracts/",
    "@openzeppelin/contracts/=lib/decent-bridge/lib/openzeppelin-contracts/contracts/",
    "LayerZero/=lib/forge-toolkit/lib/LayerZero/contracts/",
    "ds-test/=lib/forge-std/lib/ds-test/src/",
    "erc4626-tests/=lib/decent-bridge/lib/openzeppelin-contracts/lib/erc4626-tests/",
    "openzeppelin/=lib/decent-bridge/lib/openzeppelin-contracts/contracts/",
    "solidity-stringutils/=lib/decent-bridge/lib/solidity-stringutils/",
    "swap-router-contracts/=lib/swap-router-contracts/contracts/",
    "v3-core/=lib/v3-core/",
    "v3-periphery/=lib/v3-periphery/contracts/",
    "lib/forge-std:ds-test/=lib/decent-bridge/lib/forge-std/lib/ds-test/src/",
    "lib/openzeppelin-contracts:ds-test/=lib/decent-bridge/lib/openzeppelin-contracts/lib/forge-std/lib/ds-test/src/",
    "lib/openzeppelin-contracts:erc4626-tests/=lib/decent-bridge/lib/openzeppelin-contracts/lib/erc4626-tests/",
    "lib/openzeppelin-contracts:forge-std/=lib/decent-bridge/lib/openzeppelin-contracts/lib/forge-std/src/",
    "lib/openzeppelin-contracts:openzeppelin/=lib/decent-bridge/lib/openzeppelin-contracts/contracts/"
  ],
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "metadata": {
    "useLiteralContent": false,
    "bytecodeHash": "ipfs",
    "appendCBOR": true
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "evmVersion": "paris",
  "viaIR": false,
  "libraries": {}
}

Contract Security Audit

Contract ABI

API
[{"inputs":[{"internalType":"bool","name":"_gasIsEth","type":"bool"},{"internalType":"address","name":"_bridgeToken","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"NoDstBridge","type":"error"},{"inputs":[],"name":"OnlyExecutor","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"stateMutability":"payable","type":"fallback"},{"inputs":[],"name":"BRIDGE_ID","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amt2Bridge","type":"uint256"},{"components":[{"internalType":"uint8","name":"swapperId","type":"uint8"},{"internalType":"bytes","name":"swapPayload","type":"bytes"}],"internalType":"struct SwapInstructions","name":"postBridge","type":"tuple"},{"internalType":"uint256","name":"dstChainId","type":"uint256"},{"internalType":"address","name":"target","type":"address"},{"internalType":"address","name":"paymentOperator","type":"address"},{"internalType":"bytes","name":"payload","type":"bytes"},{"internalType":"bytes","name":"additionalArgs","type":"bytes"},{"internalType":"address","name":"refund","type":"address"}],"name":"bridge","outputs":[{"internalType":"bytes","name":"bridgePayload","type":"bytes"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"bridgeExecutor","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"bridgeToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"","type":"uint16"}],"name":"chainIdLookup","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"destinationBridgeAdapter","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"uint8","name":"swapperId","type":"uint8"},{"internalType":"bytes","name":"swapPayload","type":"bytes"}],"internalType":"struct SwapInstructions","name":"postBridge","type":"tuple"},{"internalType":"uint256","name":"dstChainId","type":"uint256"},{"internalType":"address","name":"target","type":"address"},{"internalType":"uint64","name":"dstGas","type":"uint64"},{"internalType":"bytes","name":"payload","type":"bytes"}],"name":"estimateFees","outputs":[{"internalType":"uint256","name":"nativeFee","type":"uint256"},{"internalType":"uint256","name":"zroFee","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"gasIsEth","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"","type":"bytes"}],"name":"getBridgeToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amt2Bridge","type":"uint256"},{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"getBridgedAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"getId","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"lzIdLookup","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"uint8","name":"swapperId","type":"uint8"},{"internalType":"bytes","name":"swapPayload","type":"bytes"}],"internalType":"struct SwapInstructions","name":"postBridge","type":"tuple"},{"internalType":"address","name":"target","type":"address"},{"internalType":"address","name":"paymentOperator","type":"address"},{"internalType":"bytes","name":"payload","type":"bytes"},{"internalType":"address","name":"refund","type":"address"}],"name":"receiveFromBridge","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"dstChainId","type":"uint256"},{"internalType":"uint16","name":"dstLzId","type":"uint16"},{"internalType":"address","name":"decentBridgeAdapter","type":"address"}],"name":"registerRemoteBridgeAdapter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"router","outputs":[{"internalType":"contract IDecentEthRouter","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_executor","type":"address"}],"name":"setBridgeExecutor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_router","type":"address"}],"name":"setRouter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_utb","type":"address"}],"name":"setUtb","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"utb","outputs":[{"internalType":"address payable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]

60806040523480156200001157600080fd5b5060405162001c6e38038062001c6e833981016040819052620000349162000120565b33620000426000826200007f565b50600780546001600160a81b031916921515610100600160a81b031916929092176101006001600160a01b0392909216919091021790556200016e565b6000828152602081815260408083206001600160a01b038516845290915290205460ff166200011c576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055620000db3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45b5050565b600080604083850312156200013457600080fd5b825180151581146200014557600080fd5b60208401519092506001600160a01b03811681146200016357600080fd5b809150509250929050565b611af0806200017e6000396000f3fe6080604052600436106101735760003560e01c8063a217fddf116100c8578063cba25e4b11610084578063d547741f11610061578063d547741f146104ca578063eb33ca7d146104ea578063f4734b0c1461051f578063f887ea401461054457005b8063cba25e4b14610446578063ccfd4c9c14610466578063d37ea4e4146104aa57005b8063a217fddf14610386578063af4482af1461039b578063b1d456bf146103b0578063b5bcae44146103d0578063c0d7865514610406578063c41a77631461042657005b80633882321c1161012f57806391d148541161010c57806391d14854146103025780639a43334c14610322578063a075661014610346578063a10bab0b1461036657005b80633882321c146102935780634dee98c1146102c05780635d1ca631146102e057005b806301ffc9a71461017c57806310449f7f146101b15780631c624af5146101cb578063248a9ca3146102155780632f2ff15d1461025357806336568abe1461027357005b3661017a57005b005b34801561018857600080fd5b5061019c610197366004611082565b610564565b60405190151581526020015b60405180910390f35b3480156101bd57600080fd5b5060075461019c9060ff1681565b3480156101d757600080fd5b506101fd6101e63660046110f4565b60075461010090046001600160a01b031692915050565b6040516001600160a01b0390911681526020016101a8565b34801561022157600080fd5b50610245610230366004611135565b60009081526020819052604090206001015490565b6040519081526020016101a8565b34801561025f57600080fd5b5061017a61026e366004611173565b61059b565b34801561027f57600080fd5b5061017a61028e366004611173565b6105c5565b34801561029f57600080fd5b506102456102ae3660046111b5565b60066020526000908152604090205481565b6102d36102ce366004611343565b610648565b6040516101a89190611466565b3480156102ec57600080fd5b5060005b60405160ff90911681526020016101a8565b34801561030e57600080fd5b5061019c61031d366004611173565b6108f6565b34801561032e57600080fd5b5061024561033d366004611479565b50929392505050565b34801561035257600080fd5b506001546101fd906001600160a01b031681565b34801561037257600080fd5b506002546101fd906001600160a01b031681565b34801561039257600080fd5b50610245600081565b3480156103a757600080fd5b506102f0600081565b3480156103bc57600080fd5b5061017a6103cb3660046114eb565b61091f565b3480156103dc57600080fd5b506101fd6103eb366004611135565b6003602052600090815260409020546001600160a01b031681565b34801561041257600080fd5b5061017a6104213660046114eb565b610968565b34801561043257600080fd5b5061017a610441366004611508565b6109b1565b34801561045257600080fd5b5061017a6104613660046114eb565b610b6d565b34801561047257600080fd5b50610497610481366004611135565b60056020526000908152604090205461ffff1681565b60405161ffff90911681526020016101a8565b3480156104b657600080fd5b5061017a6104c53660046115a9565b610bb6565b3480156104d657600080fd5b5061017a6104e5366004611173565b610c37565b3480156104f657600080fd5b5061050a610505366004611600565b610c5c565b604080519283526020830191909152016101a8565b34801561052b57600080fd5b506007546101fd9061010090046001600160a01b031681565b34801561055057600080fd5b506004546101fd906001600160a01b031681565b60006001600160e01b03198216637965db0b60e01b148061059557506301ffc9a760e01b6001600160e01b03198316145b92915050565b6000828152602081905260409020600101546105b681610d7f565b6105c08383610d8c565b505050565b6001600160a01b038116331461063a5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b6106448282610e10565b5050565b6001546060906001600160a01b031633146106905760405162461bcd60e51b815260206004820152600860248201526727b7363c903aba3160c11b6044820152606401610631565b6000888152600360205260409020546001600160a01b03166106c557604051632e2f6d5960e11b815260040160405180910390fd5b60006106d384860186611693565b9050306001600160a01b031663c41a77638b8a8a8a886040516024016106fd9594939291906116d8565b604051602081830303815290604052915060e01b6020820180516001600160e01b038381831617835250505050915060008a602001518060200190518101906107469190611770565b60075490915060ff16610858576007546040516323b872dd60e01b8152336004820152306024820152604481018e90526101009091046001600160a01b0316906323b872dd906064016020604051808303816000875af11580156107ae573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107d29190611829565b506007546004805460405163095ea7b360e01b81526001600160a01b0391821692810192909252602482018f90526101009092049091169063095ea7b3906044016020604051808303816000875af1158015610832573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108569190611829565b505b6004805460008c81526005602090815260408083205460039092528083205486519151630e7006f760e31b81526001600160a01b039586169663738037b89634966108b59661ffff169594909116938d9390928c918e910161184b565b6000604051808303818588803b1580156108ce57600080fd5b505af11580156108e2573d6000803e3d6000fd5b505050505050509998505050505050505050565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b61092a6000336108f6565b6109465760405162461bcd60e51b8152600401610631906118ac565b600180546001600160a01b0319166001600160a01b0392909216919091179055565b6109736000336108f6565b61098f5760405162461bcd60e51b8152600401610631906118ac565b600480546001600160a01b0319166001600160a01b0392909216919091179055565b6002546001600160a01b031633146109dc57604051633fdb5f0160e11b815260040160405180910390fd5b600085602001518060200190518101906109f69190611770565b604081810151825191516323b872dd60e01b815233600482015230602482015260448101929092529192506001600160a01b03909116906323b872dd906064016020604051808303816000875af1158015610a55573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a799190611829565b506040818101516001548351925163095ea7b360e01b81526001600160a01b0391821660048201526024810193909352169063095ea7b3906044016020604051808303816000875af1158015610ad3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610af79190611829565b50600154604051633c7aee0560e21b81526001600160a01b039091169063f1ebb81490610b3390899089908990899089906000906004016118d0565b600060405180830381600087803b158015610b4d57600080fd5b505af1158015610b61573d6000803e3d6000fd5b50505050505050505050565b610b786000336108f6565b610b945760405162461bcd60e51b8152600401610631906118ac565b600280546001600160a01b0319166001600160a01b0392909216919091179055565b610bc16000336108f6565b610bdd5760405162461bcd60e51b8152600401610631906118ac565b6000838152600560209081526040808320805461ffff191661ffff969096169586179055938252600681528382208590559381526003909352912080546001600160a01b0319166001600160a01b03909216919091179055565b600082815260208190526040902060010154610c5281610d7f565b6105c08383610e10565b60008060008760200151806020019051810190610c799190611770565b60048054604080516355a3bfa360e11b815290519394506001600160a01b03909116926395b167d892849263ab477f4692818301926020928290030181865afa158015610cca573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cee919061192a565b60008a81526005602052604080822054865191516001600160e01b031960e087901b168152610d30949361ffff909216928d9233928e91908e90600401611947565b6040805180830381865afa158015610d4c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d7091906119b4565b92509250509550959350505050565b610d898133610e75565b50565b610d9682826108f6565b610644576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055610dcc3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b610e1a82826108f6565b15610644576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b610e7f82826108f6565b61064457610e8c81610ece565b610e97836020610ee0565b604051602001610ea89291906119d8565b60408051601f198184030181529082905262461bcd60e51b825261063191600401611466565b60606105956001600160a01b03831660145b60606000610eef836002611a63565b610efa906002611a7a565b6001600160401b03811115610f1157610f116111d0565b6040519080825280601f01601f191660200182016040528015610f3b576020820181803683370190505b509050600360fc1b81600081518110610f5657610f56611a8d565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110610f8557610f85611a8d565b60200101906001600160f81b031916908160001a9053506000610fa9846002611a63565b610fb4906001611a7a565b90505b600181111561102c576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110610fe857610fe8611a8d565b1a60f81b828281518110610ffe57610ffe611a8d565b60200101906001600160f81b031916908160001a90535060049490941c9361102581611aa3565b9050610fb7565b50831561107b5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610631565b9392505050565b60006020828403121561109457600080fd5b81356001600160e01b03198116811461107b57600080fd5b60008083601f8401126110be57600080fd5b5081356001600160401b038111156110d557600080fd5b6020830191508360208285010111156110ed57600080fd5b9250929050565b6000806020838503121561110757600080fd5b82356001600160401b0381111561111d57600080fd5b611129858286016110ac565b90969095509350505050565b60006020828403121561114757600080fd5b5035919050565b6001600160a01b0381168114610d8957600080fd5b803561116e8161114e565b919050565b6000806040838503121561118657600080fd5b8235915060208301356111988161114e565b809150509250929050565b803561ffff8116811461116e57600080fd5b6000602082840312156111c757600080fd5b61107b826111a3565b634e487b7160e01b600052604160045260246000fd5b60405160c081016001600160401b0381118282101715611208576112086111d0565b60405290565b604051601f8201601f191681016001600160401b0381118282101715611236576112366111d0565b604052919050565b60ff81168114610d8957600080fd5b60006001600160401b03821115611266576112666111d0565b50601f01601f191660200190565b600082601f83011261128557600080fd5b81356112986112938261124d565b61120e565b8181528460208386010111156112ad57600080fd5b816020850160208301376000918101602001919091529392505050565b6000604082840312156112dc57600080fd5b604051604081016001600160401b0382821081831117156112ff576112ff6111d0565b81604052829350843591506113138261123e565b9082526020840135908082111561132957600080fd5b5061133685828601611274565b6020830152505092915050565b60008060008060008060008060006101008a8c03121561136257600080fd5b8935985060208a01356001600160401b038082111561138057600080fd5b61138c8d838e016112ca565b995060408c013598506113a160608d01611163565b97506113af60808d01611163565b965060a08c01359150808211156113c557600080fd5b6113d18d838e01611274565b955060c08c01359150808211156113e757600080fd5b506113f48c828d016110ac565b9094509250611407905060e08b01611163565b90509295985092959850929598565b60005b83811015611431578181015183820152602001611419565b50506000910152565b60008151808452611452816020860160208601611416565b601f01601f19169290920160200192915050565b60208152600061107b602083018461143a565b60008060008060006080868803121561149157600080fd5b8535945060208601356114a38161114e565b935060408601356114b38161114e565b925060608601356001600160401b038111156114ce57600080fd5b6114da888289016110ac565b969995985093965092949392505050565b6000602082840312156114fd57600080fd5b813561107b8161114e565b600080600080600060a0868803121561152057600080fd5b85356001600160401b038082111561153757600080fd5b61154389838a016112ca565b9650602088013591506115558261114e565b9094506040870135906115678261114e565b9093506060870135908082111561157d57600080fd5b5061158a88828901611274565b925050608086013561159b8161114e565b809150509295509295909350565b6000806000606084860312156115be57600080fd5b833592506115ce602085016111a3565b915060408401356115de8161114e565b809150509250925092565b80356001600160401b038116811461116e57600080fd5b600080600080600060a0868803121561161857600080fd5b85356001600160401b038082111561162f57600080fd5b61163b89838a016112ca565b965060208801359550604088013591506116548261114e565b819450611663606089016115e9565b9350608088013591508082111561167957600080fd5b5061168688828901611274565b9150509295509295909350565b6000602082840312156116a557600080fd5b61107b826115e9565b60ff815116825260006020820151604060208501526116d0604085018261143a565b949350505050565b60a0815260006116eb60a08301886116ae565b6001600160a01b03878116602085015286811660408501528382036060850152611715828761143a565b9250808516608085015250509695505050505050565b600082601f83011261173c57600080fd5b815161174a6112938261124d565b81815284602083860101111561175f57600080fd5b6116d0826020830160208701611416565b60006020828403121561178257600080fd5b81516001600160401b038082111561179957600080fd5b9083019060c082860312156117ad57600080fd5b6117b56111e6565b825181526020830151602082015260408301516117d18161114e565b604082015260608301516117e48161114e565b606082015260808301516117f78161123e565b608082015260a08301518281111561180e57600080fd5b61181a8782860161172b565b60a08301525095945050505050565b60006020828403121561183b57600080fd5b8151801515811461107b57600080fd5b61ffff881681526001600160a01b038781166020830152861660408201526060810185905283151560808201526001600160401b03831660a082015260e060c0820181905260009061189f9083018461143a565b9998505050505050505050565b6020808252600a908201526927b7363c9030b236b4b760b11b604082015260600190565b60c0815260006118e360c08301896116ae565b6001600160a01b0388811660208501528781166040850152838203606085015261190d828861143a565b95166080840152505060ff9190911660a090910152949350505050565b60006020828403121561193c57600080fd5b815161107b8161123e565b60ff8916815261ffff881660208201526001600160a01b03878116604083015286166060820152608081018590526001600160401b03841660a082015282151560c082015261010060e082018190526000906119a58382018561143a565b9b9a5050505050505050505050565b600080604083850312156119c757600080fd5b505080516020909101519092909150565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351611a10816017850160208801611416565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351611a41816028840160208801611416565b01602801949350505050565b634e487b7160e01b600052601160045260246000fd5b808202811582820484141761059557610595611a4d565b8082018082111561059557610595611a4d565b634e487b7160e01b600052603260045260246000fd5b600081611ab257611ab2611a4d565b50600019019056fea26469706673582212204e3f93b096e8ad771cfb40a2647f45dce274377402cc4eca66d551d3ecaeefa864736f6c6343000814003300000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000

Deployed Bytecode

0x6080604052600436106101735760003560e01c8063a217fddf116100c8578063cba25e4b11610084578063d547741f11610061578063d547741f146104ca578063eb33ca7d146104ea578063f4734b0c1461051f578063f887ea401461054457005b8063cba25e4b14610446578063ccfd4c9c14610466578063d37ea4e4146104aa57005b8063a217fddf14610386578063af4482af1461039b578063b1d456bf146103b0578063b5bcae44146103d0578063c0d7865514610406578063c41a77631461042657005b80633882321c1161012f57806391d148541161010c57806391d14854146103025780639a43334c14610322578063a075661014610346578063a10bab0b1461036657005b80633882321c146102935780634dee98c1146102c05780635d1ca631146102e057005b806301ffc9a71461017c57806310449f7f146101b15780631c624af5146101cb578063248a9ca3146102155780632f2ff15d1461025357806336568abe1461027357005b3661017a57005b005b34801561018857600080fd5b5061019c610197366004611082565b610564565b60405190151581526020015b60405180910390f35b3480156101bd57600080fd5b5060075461019c9060ff1681565b3480156101d757600080fd5b506101fd6101e63660046110f4565b60075461010090046001600160a01b031692915050565b6040516001600160a01b0390911681526020016101a8565b34801561022157600080fd5b50610245610230366004611135565b60009081526020819052604090206001015490565b6040519081526020016101a8565b34801561025f57600080fd5b5061017a61026e366004611173565b61059b565b34801561027f57600080fd5b5061017a61028e366004611173565b6105c5565b34801561029f57600080fd5b506102456102ae3660046111b5565b60066020526000908152604090205481565b6102d36102ce366004611343565b610648565b6040516101a89190611466565b3480156102ec57600080fd5b5060005b60405160ff90911681526020016101a8565b34801561030e57600080fd5b5061019c61031d366004611173565b6108f6565b34801561032e57600080fd5b5061024561033d366004611479565b50929392505050565b34801561035257600080fd5b506001546101fd906001600160a01b031681565b34801561037257600080fd5b506002546101fd906001600160a01b031681565b34801561039257600080fd5b50610245600081565b3480156103a757600080fd5b506102f0600081565b3480156103bc57600080fd5b5061017a6103cb3660046114eb565b61091f565b3480156103dc57600080fd5b506101fd6103eb366004611135565b6003602052600090815260409020546001600160a01b031681565b34801561041257600080fd5b5061017a6104213660046114eb565b610968565b34801561043257600080fd5b5061017a610441366004611508565b6109b1565b34801561045257600080fd5b5061017a6104613660046114eb565b610b6d565b34801561047257600080fd5b50610497610481366004611135565b60056020526000908152604090205461ffff1681565b60405161ffff90911681526020016101a8565b3480156104b657600080fd5b5061017a6104c53660046115a9565b610bb6565b3480156104d657600080fd5b5061017a6104e5366004611173565b610c37565b3480156104f657600080fd5b5061050a610505366004611600565b610c5c565b604080519283526020830191909152016101a8565b34801561052b57600080fd5b506007546101fd9061010090046001600160a01b031681565b34801561055057600080fd5b506004546101fd906001600160a01b031681565b60006001600160e01b03198216637965db0b60e01b148061059557506301ffc9a760e01b6001600160e01b03198316145b92915050565b6000828152602081905260409020600101546105b681610d7f565b6105c08383610d8c565b505050565b6001600160a01b038116331461063a5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b6106448282610e10565b5050565b6001546060906001600160a01b031633146106905760405162461bcd60e51b815260206004820152600860248201526727b7363c903aba3160c11b6044820152606401610631565b6000888152600360205260409020546001600160a01b03166106c557604051632e2f6d5960e11b815260040160405180910390fd5b60006106d384860186611693565b9050306001600160a01b031663c41a77638b8a8a8a886040516024016106fd9594939291906116d8565b604051602081830303815290604052915060e01b6020820180516001600160e01b038381831617835250505050915060008a602001518060200190518101906107469190611770565b60075490915060ff16610858576007546040516323b872dd60e01b8152336004820152306024820152604481018e90526101009091046001600160a01b0316906323b872dd906064016020604051808303816000875af11580156107ae573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107d29190611829565b506007546004805460405163095ea7b360e01b81526001600160a01b0391821692810192909252602482018f90526101009092049091169063095ea7b3906044016020604051808303816000875af1158015610832573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108569190611829565b505b6004805460008c81526005602090815260408083205460039092528083205486519151630e7006f760e31b81526001600160a01b039586169663738037b89634966108b59661ffff169594909116938d9390928c918e910161184b565b6000604051808303818588803b1580156108ce57600080fd5b505af11580156108e2573d6000803e3d6000fd5b505050505050509998505050505050505050565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b61092a6000336108f6565b6109465760405162461bcd60e51b8152600401610631906118ac565b600180546001600160a01b0319166001600160a01b0392909216919091179055565b6109736000336108f6565b61098f5760405162461bcd60e51b8152600401610631906118ac565b600480546001600160a01b0319166001600160a01b0392909216919091179055565b6002546001600160a01b031633146109dc57604051633fdb5f0160e11b815260040160405180910390fd5b600085602001518060200190518101906109f69190611770565b604081810151825191516323b872dd60e01b815233600482015230602482015260448101929092529192506001600160a01b03909116906323b872dd906064016020604051808303816000875af1158015610a55573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a799190611829565b506040818101516001548351925163095ea7b360e01b81526001600160a01b0391821660048201526024810193909352169063095ea7b3906044016020604051808303816000875af1158015610ad3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610af79190611829565b50600154604051633c7aee0560e21b81526001600160a01b039091169063f1ebb81490610b3390899089908990899089906000906004016118d0565b600060405180830381600087803b158015610b4d57600080fd5b505af1158015610b61573d6000803e3d6000fd5b50505050505050505050565b610b786000336108f6565b610b945760405162461bcd60e51b8152600401610631906118ac565b600280546001600160a01b0319166001600160a01b0392909216919091179055565b610bc16000336108f6565b610bdd5760405162461bcd60e51b8152600401610631906118ac565b6000838152600560209081526040808320805461ffff191661ffff969096169586179055938252600681528382208590559381526003909352912080546001600160a01b0319166001600160a01b03909216919091179055565b600082815260208190526040902060010154610c5281610d7f565b6105c08383610e10565b60008060008760200151806020019051810190610c799190611770565b60048054604080516355a3bfa360e11b815290519394506001600160a01b03909116926395b167d892849263ab477f4692818301926020928290030181865afa158015610cca573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cee919061192a565b60008a81526005602052604080822054865191516001600160e01b031960e087901b168152610d30949361ffff909216928d9233928e91908e90600401611947565b6040805180830381865afa158015610d4c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d7091906119b4565b92509250509550959350505050565b610d898133610e75565b50565b610d9682826108f6565b610644576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055610dcc3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b610e1a82826108f6565b15610644576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b610e7f82826108f6565b61064457610e8c81610ece565b610e97836020610ee0565b604051602001610ea89291906119d8565b60408051601f198184030181529082905262461bcd60e51b825261063191600401611466565b60606105956001600160a01b03831660145b60606000610eef836002611a63565b610efa906002611a7a565b6001600160401b03811115610f1157610f116111d0565b6040519080825280601f01601f191660200182016040528015610f3b576020820181803683370190505b509050600360fc1b81600081518110610f5657610f56611a8d565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110610f8557610f85611a8d565b60200101906001600160f81b031916908160001a9053506000610fa9846002611a63565b610fb4906001611a7a565b90505b600181111561102c576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110610fe857610fe8611a8d565b1a60f81b828281518110610ffe57610ffe611a8d565b60200101906001600160f81b031916908160001a90535060049490941c9361102581611aa3565b9050610fb7565b50831561107b5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610631565b9392505050565b60006020828403121561109457600080fd5b81356001600160e01b03198116811461107b57600080fd5b60008083601f8401126110be57600080fd5b5081356001600160401b038111156110d557600080fd5b6020830191508360208285010111156110ed57600080fd5b9250929050565b6000806020838503121561110757600080fd5b82356001600160401b0381111561111d57600080fd5b611129858286016110ac565b90969095509350505050565b60006020828403121561114757600080fd5b5035919050565b6001600160a01b0381168114610d8957600080fd5b803561116e8161114e565b919050565b6000806040838503121561118657600080fd5b8235915060208301356111988161114e565b809150509250929050565b803561ffff8116811461116e57600080fd5b6000602082840312156111c757600080fd5b61107b826111a3565b634e487b7160e01b600052604160045260246000fd5b60405160c081016001600160401b0381118282101715611208576112086111d0565b60405290565b604051601f8201601f191681016001600160401b0381118282101715611236576112366111d0565b604052919050565b60ff81168114610d8957600080fd5b60006001600160401b03821115611266576112666111d0565b50601f01601f191660200190565b600082601f83011261128557600080fd5b81356112986112938261124d565b61120e565b8181528460208386010111156112ad57600080fd5b816020850160208301376000918101602001919091529392505050565b6000604082840312156112dc57600080fd5b604051604081016001600160401b0382821081831117156112ff576112ff6111d0565b81604052829350843591506113138261123e565b9082526020840135908082111561132957600080fd5b5061133685828601611274565b6020830152505092915050565b60008060008060008060008060006101008a8c03121561136257600080fd5b8935985060208a01356001600160401b038082111561138057600080fd5b61138c8d838e016112ca565b995060408c013598506113a160608d01611163565b97506113af60808d01611163565b965060a08c01359150808211156113c557600080fd5b6113d18d838e01611274565b955060c08c01359150808211156113e757600080fd5b506113f48c828d016110ac565b9094509250611407905060e08b01611163565b90509295985092959850929598565b60005b83811015611431578181015183820152602001611419565b50506000910152565b60008151808452611452816020860160208601611416565b601f01601f19169290920160200192915050565b60208152600061107b602083018461143a565b60008060008060006080868803121561149157600080fd5b8535945060208601356114a38161114e565b935060408601356114b38161114e565b925060608601356001600160401b038111156114ce57600080fd5b6114da888289016110ac565b969995985093965092949392505050565b6000602082840312156114fd57600080fd5b813561107b8161114e565b600080600080600060a0868803121561152057600080fd5b85356001600160401b038082111561153757600080fd5b61154389838a016112ca565b9650602088013591506115558261114e565b9094506040870135906115678261114e565b9093506060870135908082111561157d57600080fd5b5061158a88828901611274565b925050608086013561159b8161114e565b809150509295509295909350565b6000806000606084860312156115be57600080fd5b833592506115ce602085016111a3565b915060408401356115de8161114e565b809150509250925092565b80356001600160401b038116811461116e57600080fd5b600080600080600060a0868803121561161857600080fd5b85356001600160401b038082111561162f57600080fd5b61163b89838a016112ca565b965060208801359550604088013591506116548261114e565b819450611663606089016115e9565b9350608088013591508082111561167957600080fd5b5061168688828901611274565b9150509295509295909350565b6000602082840312156116a557600080fd5b61107b826115e9565b60ff815116825260006020820151604060208501526116d0604085018261143a565b949350505050565b60a0815260006116eb60a08301886116ae565b6001600160a01b03878116602085015286811660408501528382036060850152611715828761143a565b9250808516608085015250509695505050505050565b600082601f83011261173c57600080fd5b815161174a6112938261124d565b81815284602083860101111561175f57600080fd5b6116d0826020830160208701611416565b60006020828403121561178257600080fd5b81516001600160401b038082111561179957600080fd5b9083019060c082860312156117ad57600080fd5b6117b56111e6565b825181526020830151602082015260408301516117d18161114e565b604082015260608301516117e48161114e565b606082015260808301516117f78161123e565b608082015260a08301518281111561180e57600080fd5b61181a8782860161172b565b60a08301525095945050505050565b60006020828403121561183b57600080fd5b8151801515811461107b57600080fd5b61ffff881681526001600160a01b038781166020830152861660408201526060810185905283151560808201526001600160401b03831660a082015260e060c0820181905260009061189f9083018461143a565b9998505050505050505050565b6020808252600a908201526927b7363c9030b236b4b760b11b604082015260600190565b60c0815260006118e360c08301896116ae565b6001600160a01b0388811660208501528781166040850152838203606085015261190d828861143a565b95166080840152505060ff9190911660a090910152949350505050565b60006020828403121561193c57600080fd5b815161107b8161123e565b60ff8916815261ffff881660208201526001600160a01b03878116604083015286166060820152608081018590526001600160401b03841660a082015282151560c082015261010060e082018190526000906119a58382018561143a565b9b9a5050505050505050505050565b600080604083850312156119c757600080fd5b505080516020909101519092909150565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351611a10816017850160208801611416565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351611a41816028840160208801611416565b01602801949350505050565b634e487b7160e01b600052601160045260246000fd5b808202811582820484141761059557610595611a4d565b8082018082111561059557610595611a4d565b634e487b7160e01b600052603260045260246000fd5b600081611ab257611ab2611a4d565b50600019019056fea26469706673582212204e3f93b096e8ad771cfb40a2647f45dce274377402cc4eca66d551d3ecaeefa864736f6c63430008140033

Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)

00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000

-----Decoded View---------------
Arg [0] : _gasIsEth (bool): True
Arg [1] : _bridgeToken (address): 0x0000000000000000000000000000000000000000

-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000001
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000000


Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export  ]
[ 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.