ETH Price: $3,087.24 (-0.04%)
Gas: 4 Gwei

Contract

0x6D303CEE7959f814042D31E0624fB88Ec6fbcC1d
 
Transaction Hash
Method
Block
From
To
Value
Deposit To App C...202325542024-07-04 10:28:235 days ago1720088903IN
0x6D303CEE...Ec6fbcC1d
0.00043946 ETH0.0019591711.04619896
Deposit To App C...201622822024-06-24 14:57:1115 days ago1719241031IN
0x6D303CEE...Ec6fbcC1d
0.00426053 ETH0.001392227.84961382
Deposit To App C...201622472024-06-24 14:50:1115 days ago1719240611IN
0x6D303CEE...Ec6fbcC1d
0.00426053 ETH0.001360457.4683584
Deposit To App C...201622442024-06-24 14:49:3515 days ago1719240575IN
0x6D303CEE...Ec6fbcC1d
0.00426053 ETH0.000400036.95415363
Deposit To App C...201478852024-06-22 14:36:5917 days ago1719067019IN
0x6D303CEE...Ec6fbcC1d
0.00381228 ETH0.000770494.22970114
Deposit To App C...201388862024-06-21 8:25:3519 days ago1718958335IN
0x6D303CEE...Ec6fbcC1d
0.00397275 ETH0.001034475.67886215
Deposit To App C...201388692024-06-21 8:22:1119 days ago1718958131IN
0x6D303CEE...Ec6fbcC1d
0.00397275 ETH0.00114656.29386728
Deposit To App C...201379672024-06-21 5:20:4719 days ago1718947247IN
0x6D303CEE...Ec6fbcC1d
0.00381786 ETH0.000466692.56199666
Deposit To App C...201200542024-06-18 17:13:1121 days ago1718730791IN
0x6D303CEE...Ec6fbcC1d
0.00438977 ETH0.00163698.98598257
Deposit To App C...201193432024-06-18 14:49:5921 days ago1718722199IN
0x6D303CEE...Ec6fbcC1d
0.00613294 ETH0.0029843616.38302211
Deposit To App C...201193262024-06-18 14:46:3521 days ago1718721995IN
0x6D303CEE...Ec6fbcC1d
0.00613294 ETH0.003310918.16960031
Deposit To App C...201193152024-06-18 14:44:2321 days ago1718721863IN
0x6D303CEE...Ec6fbcC1d
0.00613294 ETH0.0036895220.25410203
Deposit To App C...201122162024-06-17 14:50:4722 days ago1718635847IN
0x6D303CEE...Ec6fbcC1d
0.00438937 ETH0.0023738113.03135179
Deposit To App C...201121872024-06-17 14:44:5922 days ago1718635499IN
0x6D303CEE...Ec6fbcC1d
0.00438937 ETH0.0022747212.48736498
Deposit To App C...199904002024-05-31 14:27:1139 days ago1717165631IN
0x6D303CEE...Ec6fbcC1d
0.00548239 ETH0.0062052934.06470952
Deposit To App C...199896032024-05-31 11:45:3539 days ago1717155935IN
0x6D303CEE...Ec6fbcC1d
0.00449608 ETH0.00157528.6472701
Deposit To App C...199148102024-05-21 0:49:5950 days ago1716252599IN
0x6D303CEE...Ec6fbcC1d
0.00521556 ETH0.0025529214.39483752
Deposit To App C...199140062024-05-20 22:07:2350 days ago1716242843IN
0x6D303CEE...Ec6fbcC1d
0.00521556 ETH0.0063150735.60559346
Deposit To App C...198946812024-05-18 5:14:1153 days ago1716009251IN
0x6D303CEE...Ec6fbcC1d
0.00521556 ETH0.000698663.83540277
Deposit To App C...198463972024-05-11 11:08:5959 days ago1715425739IN
0x6D303CEE...Ec6fbcC1d
0.00521556 ETH0.00096955.46624884
Deposit To App C...198267522024-05-08 17:13:2362 days ago1715188403IN
0x6D303CEE...Ec6fbcC1d
0.00521556 ETH0.00101275.71020804
Deposit To App C...197911192024-05-03 17:36:3567 days ago1714757795IN
0x6D303CEE...Ec6fbcC1d
0.00521556 ETH0.00139937.88954144
Deposit To App C...197740132024-05-01 8:13:2370 days ago1714551203IN
0x6D303CEE...Ec6fbcC1d
0.00603934 ETH0.0030137616.54006787
Deposit To App C...197739422024-05-01 7:59:1170 days ago1714550351IN
0x6D303CEE...Ec6fbcC1d
0.00603934 ETH0.0023550512.92921689
Deposit To App C...197677872024-04-30 11:20:3570 days ago1714476035IN
0x6D303CEE...Ec6fbcC1d
0.00603934 ETH0.0133664473.37670096
View all transactions

Latest 25 internal transactions (View All)

Advanced mode:
Parent Transaction Hash Block From To Value
202737892024-07-10 4:44:354 hrs ago1720586675
0x6D303CEE...Ec6fbcC1d
0.00013104 ETH
202737892024-07-10 4:44:354 hrs ago1720586675
0x6D303CEE...Ec6fbcC1d
0.00013104 ETH
202737062024-07-10 4:27:594 hrs ago1720585679
0x6D303CEE...Ec6fbcC1d
0.00013104 ETH
202737062024-07-10 4:27:594 hrs ago1720585679
0x6D303CEE...Ec6fbcC1d
0.00013104 ETH
202730432024-07-10 2:14:476 hrs ago1720577687
0x6D303CEE...Ec6fbcC1d
0.00013104 ETH
202730432024-07-10 2:14:476 hrs ago1720577687
0x6D303CEE...Ec6fbcC1d
0.00013104 ETH
202661722024-07-09 3:11:4729 hrs ago1720494707
0x6D303CEE...Ec6fbcC1d
0.00013104 ETH
202661722024-07-09 3:11:4729 hrs ago1720494707
0x6D303CEE...Ec6fbcC1d
0.00013104 ETH
202619392024-07-08 12:58:1144 hrs ago1720443491
0x6D303CEE...Ec6fbcC1d
0.00013104 ETH
202619392024-07-08 12:58:1144 hrs ago1720443491
0x6D303CEE...Ec6fbcC1d
0.00013104 ETH
202587012024-07-08 2:06:232 days ago1720404383
0x6D303CEE...Ec6fbcC1d
0.00013104 ETH
202587012024-07-08 2:06:232 days ago1720404383
0x6D303CEE...Ec6fbcC1d
0.00013104 ETH
202585202024-07-08 1:29:592 days ago1720402199
0x6D303CEE...Ec6fbcC1d
0.00013104 ETH
202585202024-07-08 1:29:592 days ago1720402199
0x6D303CEE...Ec6fbcC1d
0.00013104 ETH
202549952024-07-07 13:41:112 days ago1720359671
0x6D303CEE...Ec6fbcC1d
0.00013104 ETH
202549952024-07-07 13:41:112 days ago1720359671
0x6D303CEE...Ec6fbcC1d
0.00013104 ETH
202547902024-07-07 13:00:112 days ago1720357211
0x6D303CEE...Ec6fbcC1d
0.00013104 ETH
202547902024-07-07 13:00:112 days ago1720357211
0x6D303CEE...Ec6fbcC1d
0.00013104 ETH
202539532024-07-07 10:10:592 days ago1720347059
0x6D303CEE...Ec6fbcC1d
0.00013104 ETH
202539532024-07-07 10:10:592 days ago1720347059
0x6D303CEE...Ec6fbcC1d
0.00013104 ETH
202519922024-07-07 3:36:593 days ago1720323419
0x6D303CEE...Ec6fbcC1d
0.00013104 ETH
202519922024-07-07 3:36:593 days ago1720323419
0x6D303CEE...Ec6fbcC1d
0.00013104 ETH
202458422024-07-06 7:00:594 days ago1720249259
0x6D303CEE...Ec6fbcC1d
0.00013104 ETH
202458422024-07-06 7:00:594 days ago1720249259
0x6D303CEE...Ec6fbcC1d
0.00013104 ETH
202407202024-07-05 13:51:474 days ago1720187507
0x6D303CEE...Ec6fbcC1d
0.00013104 ETH
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Vault

Compiler Version
v0.8.13+commit.abaa5c0e

Optimization Enabled:
Yes with 999999 runs

Other Settings:
default evmVersion
File 1 of 15 : Vault.sol
pragma solidity 0.8.13;

import "lib/solmate/src/utils/SafeTransferLib.sol";
import "lib/openzeppelin-contracts/contracts/access/Ownable2Step.sol";
import {Gauge} from "./Gauge.sol";
import {IConnector, IHub} from "./ConnectorPlug.sol";
import {RescueFundsLib} from "./RescueFundsLib.sol";

// @todo: separate our connecter plugs
contract Vault is Gauge, IHub, Ownable2Step {
    using SafeTransferLib for ERC20;
    ERC20 public immutable token__;

    struct UpdateLimitParams {
        bool isLock;
        address connector;
        uint256 maxLimit;
        uint256 ratePerSecond;
    }

    // connector => receiver => pendingUnlock
    mapping(address => mapping(address => uint256)) public pendingUnlocks;

    // connector => amount
    mapping(address => uint256) public connectorPendingUnlocks;

    // connector => lockLimitParams
    mapping(address => LimitParams) _lockLimitParams;

    // connector => unlockLimitParams
    mapping(address => LimitParams) _unlockLimitParams;

    error ConnectorUnavailable();
    error ZeroAmount();

    event LimitParamsUpdated(UpdateLimitParams[] updates);
    event TokensDeposited(
        address connector,
        address depositor,
        address receiver,
        uint256 depositAmount
    );
    event PendingTokensTransferred(
        address connector,
        address receiver,
        uint256 unlockedAmount,
        uint256 pendingAmount
    );
    event TokensPending(
        address connector,
        address receiver,
        uint256 pendingAmount,
        uint256 totalPendingAmount
    );
    event TokensUnlocked(
        address connector,
        address receiver,
        uint256 unlockedAmount
    );

    constructor(address token_) {
        token__ = ERC20(token_);
    }

    function updateLimitParams(
        UpdateLimitParams[] calldata updates_
    ) external onlyOwner {
        for (uint256 i; i < updates_.length; i++) {
            if (updates_[i].isLock) {
                _consumePartLimit(0, _lockLimitParams[updates_[i].connector]); // to keep current limit in sync
                _lockLimitParams[updates_[i].connector].maxLimit = updates_[i]
                    .maxLimit;
                _lockLimitParams[updates_[i].connector]
                    .ratePerSecond = updates_[i].ratePerSecond;
            } else {
                _consumePartLimit(0, _unlockLimitParams[updates_[i].connector]); // to keep current limit in sync
                _unlockLimitParams[updates_[i].connector].maxLimit = updates_[i]
                    .maxLimit;
                _unlockLimitParams[updates_[i].connector]
                    .ratePerSecond = updates_[i].ratePerSecond;
            }
        }

        emit LimitParamsUpdated(updates_);
    }

    function depositToAppChain(
        address receiver_,
        uint256 amount_,
        uint256 msgGasLimit_,
        address connector_
    ) external payable {
        if (amount_ == 0) revert ZeroAmount();

        if (_lockLimitParams[connector_].maxLimit == 0)
            revert ConnectorUnavailable();

        _consumeFullLimit(amount_, _lockLimitParams[connector_]); // reverts on limit hit

        token__.safeTransferFrom(msg.sender, address(this), amount_);

        IConnector(connector_).outbound{value: msg.value}(
            msgGasLimit_,
            abi.encode(receiver_, amount_)
        );

        emit TokensDeposited(connector_, msg.sender, receiver_, amount_);
    }

    function unlockPendingFor(address receiver_, address connector_) external {
        if (_unlockLimitParams[connector_].maxLimit == 0)
            revert ConnectorUnavailable();

        uint256 pendingUnlock = pendingUnlocks[connector_][receiver_];
        (uint256 consumedAmount, uint256 pendingAmount) = _consumePartLimit(
            pendingUnlock,
            _unlockLimitParams[connector_]
        );

        pendingUnlocks[connector_][receiver_] = pendingAmount;
        connectorPendingUnlocks[connector_] -= consumedAmount;

        token__.safeTransfer(receiver_, consumedAmount);

        emit PendingTokensTransferred(
            connector_,
            receiver_,
            consumedAmount,
            pendingAmount
        );
    }

    // receive inbound assuming connector called
    function receiveInbound(bytes memory payload_) external override {
        if (_unlockLimitParams[msg.sender].maxLimit == 0)
            revert ConnectorUnavailable();

        (address receiver, uint256 unlockAmount) = abi.decode(
            payload_,
            (address, uint256)
        );

        (uint256 consumedAmount, uint256 pendingAmount) = _consumePartLimit(
            unlockAmount,
            _unlockLimitParams[msg.sender]
        );

        if (pendingAmount > 0) {
            // add instead of overwrite to handle case where already pending amount is left
            pendingUnlocks[msg.sender][receiver] += pendingAmount;
            connectorPendingUnlocks[msg.sender] += pendingAmount;
            emit TokensPending(
                msg.sender,
                receiver,
                pendingAmount,
                pendingUnlocks[msg.sender][receiver]
            );
        }
        token__.safeTransfer(receiver, consumedAmount);

        emit TokensUnlocked(msg.sender, receiver, consumedAmount);
    }

    function getMinFees(
        address connector_,
        uint256 msgGasLimit_
    ) external view returns (uint256 totalFees) {
        return IConnector(connector_).getMinFees(msgGasLimit_);
    }

    function getCurrentLockLimit(
        address connector_
    ) external view returns (uint256) {
        return _getCurrentLimit(_lockLimitParams[connector_]);
    }

    function getCurrentUnlockLimit(
        address connector_
    ) external view returns (uint256) {
        return _getCurrentLimit(_unlockLimitParams[connector_]);
    }

    function getLockLimitParams(
        address connector_
    ) external view returns (LimitParams memory) {
        return _lockLimitParams[connector_];
    }

    function getUnlockLimitParams(
        address connector_
    ) external view returns (LimitParams memory) {
        return _unlockLimitParams[connector_];
    }

    /**
     * @notice Rescues funds from the contract if they are locked by mistake.
     * @param token_ The address of the token contract.
     * @param rescueTo_ The address where rescued tokens need to be sent.
     * @param amount_ The amount of tokens to be rescued.
     */
    function rescueFunds(
        address token_,
        address rescueTo_,
        uint256 amount_
    ) external onlyOwner {
        RescueFundsLib.rescueFunds(token_, rescueTo_, amount_);
    }
}

File 2 of 15 : IPlug.sol
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity 0.8.13;

/**
 * @title IPlug
 * @notice Interface for a plug contract that executes the message received from a source chain.
 */
interface IPlug {
    /**
     * @dev this should be only executable by socket
     * @notice executes the message received from source chain
     * @notice It is expected to have original sender checks in the destination plugs using payload
     * @param srcChainSlug_ chain slug of source
     * @param payload_ the data which is needed by plug at inbound call on remote
     */
    function inbound(
        uint32 srcChainSlug_,
        bytes calldata payload_
    ) external payable;
}

File 3 of 15 : ISocket.sol
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity 0.8.13;

/**
 * @title ISocket
 * @notice An interface for a cross-chain communication contract
 * @dev This interface provides methods for transmitting and executing messages between chains,
 * connecting a plug to a remote chain and setting up switchboards for the message transmission
 * This interface also emits events for important operations such as message transmission, execution status,
 * and plug connection
 */
interface ISocket {
    /**
     * @notice A struct containing fees required for message transmission and execution
     * @param transmissionFees fees needed for transmission
     * @param switchboardFees fees needed by switchboard
     * @param executionFee fees needed for execution
     */
    struct Fees {
        uint128 transmissionFees;
        uint128 executionFee;
        uint128 switchboardFees;
    }

    /**
     * @title MessageDetails
     * @dev This struct defines the details of a message to be executed in a Decapacitor contract.
     */
    struct MessageDetails {
        // A unique identifier for the message.
        bytes32 msgId;
        // The fee to be paid for executing the message.
        uint256 executionFee;
        // The maximum amount of gas that can be used to execute the message.
        uint256 minMsgGasLimit;
        // The extra params which provides msg value and additional info needed for message exec
        bytes32 executionParams;
        // The payload data to be executed in the message.
        bytes payload;
    }

    /**
     * @title ExecutionDetails
     * @dev This struct defines the execution details
     */
    struct ExecutionDetails {
        // packet id
        bytes32 packetId;
        // proposal count
        uint256 proposalCount;
        // gas limit needed to execute inbound
        uint256 executionGasLimit;
        // proof data required by the Decapacitor contract to verify the message's authenticity
        bytes decapacitorProof;
        // signature of executor
        bytes signature;
    }

    /**
     * @notice emits the message details when a new message arrives at outbound
     * @param localChainSlug local chain slug
     * @param localPlug local plug address
     * @param dstChainSlug remote chain slug
     * @param dstPlug remote plug address
     * @param msgId message id packed with remoteChainSlug and nonce
     * @param minMsgGasLimit gas limit needed to execute the inbound at remote
     * @param payload the data which will be used by inbound at remote
     */
    event MessageOutbound(
        uint32 localChainSlug,
        address localPlug,
        uint32 dstChainSlug,
        address dstPlug,
        bytes32 msgId,
        uint256 minMsgGasLimit,
        bytes32 executionParams,
        bytes32 transmissionParams,
        bytes payload,
        Fees fees
    );

    /**
     * @notice emits the status of message after inbound call
     * @param msgId msg id which is executed
     */
    event ExecutionSuccess(bytes32 msgId);

    /**
     * @notice emits the config set by a plug for a remoteChainSlug
     * @param plug address of plug on current chain
     * @param siblingChainSlug sibling chain slug
     * @param siblingPlug address of plug on sibling chain
     * @param inboundSwitchboard inbound switchboard (select from registered options)
     * @param outboundSwitchboard outbound switchboard (select from registered options)
     * @param capacitor capacitor selected based on outbound switchboard
     * @param decapacitor decapacitor selected based on inbound switchboard
     */
    event PlugConnected(
        address plug,
        uint32 siblingChainSlug,
        address siblingPlug,
        address inboundSwitchboard,
        address outboundSwitchboard,
        address capacitor,
        address decapacitor
    );

    /**
     * @notice registers a message
     * @dev Packs the message and includes it in a packet with capacitor
     * @param remoteChainSlug_ the remote chain slug
     * @param minMsgGasLimit_ the gas limit needed to execute the payload on remote
     * @param payload_ the data which is needed by plug at inbound call on remote
     */
    function outbound(
        uint32 remoteChainSlug_,
        uint256 minMsgGasLimit_,
        bytes32 executionParams_,
        bytes32 transmissionParams_,
        bytes calldata payload_
    ) external payable returns (bytes32 msgId);

    /**
     * @notice executes a message
     * @param executionDetails_ the packet details, proof and signature needed for message execution
     * @param messageDetails_ the message details
     */
    function execute(
        ISocket.ExecutionDetails calldata executionDetails_,
        ISocket.MessageDetails calldata messageDetails_
    ) external payable;

    /**
     * @notice sets the config specific to the plug
     * @param siblingChainSlug_ the sibling chain slug
     * @param siblingPlug_ address of plug present at sibling chain to call inbound
     * @param inboundSwitchboard_ the address of switchboard to use for receiving messages
     * @param outboundSwitchboard_ the address of switchboard to use for sending messages
     */
    function connect(
        uint32 siblingChainSlug_,
        address siblingPlug_,
        address inboundSwitchboard_,
        address outboundSwitchboard_
    ) external;

    /**
     * @notice Retrieves the minimum fees required for a message with a specified gas limit and destination chain.
     * @param minMsgGasLimit_ The gas limit of the message.
     * @param remoteChainSlug_ The slug of the destination chain for the message.
     * @param plug_ The address of the plug through which the message is sent.
     * @return totalFees The minimum fees required for the specified message.
     */
    function getMinFees(
        uint256 minMsgGasLimit_,
        uint256 payloadSize_,
        bytes32 executionParams_,
        bytes32 transmissionParams_,
        uint32 remoteChainSlug_,
        address plug_
    ) external view returns (uint256 totalFees);

    /**
     * @notice returns chain slug
     * @return chainSlug current chain slug
     */
    function chainSlug() external view returns (uint32 chainSlug);

    /**
     * @notice returns the config for given `plugAddress_` and `siblingChainSlug_`
     * @param siblingChainSlug_ the sibling chain slug
     * @param plugAddress_ address of plug present at current chain
     */
    function getPlugConfig(
        address plugAddress_,
        uint32 siblingChainSlug_
    )
        external
        view
        returns (
            address siblingPlug,
            address inboundSwitchboard__,
            address outboundSwitchboard__,
            address capacitor__,
            address decapacitor__
        );
}

File 4 of 15 : ConnectorPlug.sol
pragma solidity 0.8.13;

import "lib/openzeppelin-contracts/contracts/access/Ownable2Step.sol";
import {ISocket} from "../interfaces/ISocket.sol";
import {IPlug} from "../interfaces/IPlug.sol";
import {RescueFundsLib} from "./RescueFundsLib.sol";

interface IHub {
    function receiveInbound(bytes memory payload_) external;
}

interface IConnector {
    function outbound(
        uint256 msgGasLimit_,
        bytes memory payload_
    ) external payable;

    function siblingChainSlug() external view returns (uint32);

    function getMinFees(
        uint256 msgGasLimit_
    ) external view returns (uint256 totalFees);
}

contract ConnectorPlug is IConnector, IPlug, Ownable2Step {
    IHub public immutable hub__;
    ISocket public immutable socket__;
    uint32 public immutable siblingChainSlug;

    error NotHub();
    error NotSocket();

    event ConnectorPlugDisconnected();

    constructor(address hub_, address socket_, uint32 siblingChainSlug_) {
        hub__ = IHub(hub_);
        socket__ = ISocket(socket_);
        siblingChainSlug = siblingChainSlug_;
    }

    function outbound(
        uint256 msgGasLimit_,
        bytes memory payload_
    ) external payable override {
        if (msg.sender != address(hub__)) revert NotHub();

        socket__.outbound{value: msg.value}(
            siblingChainSlug,
            msgGasLimit_,
            bytes32(0),
            bytes32(0),
            payload_
        );
    }

    function inbound(
        uint32 /* siblingChainSlug_ */, // cannot be connected for any other slug, immutable variable
        bytes calldata payload_
    ) external payable override {
        if (msg.sender != address(socket__)) revert NotSocket();
        hub__.receiveInbound(payload_);
    }

    function getMinFees(
        uint256 msgGasLimit_
    ) external view override returns (uint256 totalFees) {
        return
            socket__.getMinFees(
                msgGasLimit_,
                64,
                bytes32(0),
                bytes32(0),
                siblingChainSlug,
                address(this)
            );
    }

    function connect(
        address siblingPlug_,
        address switchboard_
    ) external onlyOwner {
        socket__.connect(
            siblingChainSlug,
            siblingPlug_,
            switchboard_,
            switchboard_
        );
    }

    function disconnect() external onlyOwner {
        (
            ,
            address inboundSwitchboard,
            address outboundSwitchboard,
            ,

        ) = socket__.getPlugConfig(address(this), siblingChainSlug);

        socket__.connect(
            siblingChainSlug,
            address(0),
            inboundSwitchboard,
            outboundSwitchboard
        );

        emit ConnectorPlugDisconnected();
    }

    /**
     * @notice Rescues funds from the contract if they are locked by mistake.
     * @param token_ The address of the token contract.
     * @param rescueTo_ The address where rescued tokens need to be sent.
     * @param amount_ The amount of tokens to be rescued.
     */
    function rescueFunds(
        address token_,
        address rescueTo_,
        uint256 amount_
    ) external onlyOwner {
        RescueFundsLib.rescueFunds(token_, rescueTo_, amount_);
    }
}

File 5 of 15 : Controller.sol
pragma solidity 0.8.13;

import "lib/solmate/src/utils/SafeTransferLib.sol";
import "lib/openzeppelin-contracts/contracts/access/Ownable2Step.sol";
import {IExchangeRate} from "./ExchangeRate.sol";
import {Gauge} from "./Gauge.sol";
import {IConnector, IHub} from "./ConnectorPlug.sol";
import {IMintableERC20} from "./MintableToken.sol";
import {RescueFundsLib} from "./RescueFundsLib.sol";

contract Controller is IHub, Gauge, Ownable2Step {
    using SafeTransferLib for IMintableERC20;
    IMintableERC20 public immutable token__;
    IExchangeRate public exchangeRate__;

    struct UpdateLimitParams {
        bool isMint;
        address connector;
        uint256 maxLimit;
        uint256 ratePerSecond;
    }

    // connectorPoolId => totalLockedAmount
    mapping(uint256 => uint256) public poolLockedAmounts;

    // connector => connectorPoolId
    mapping(address => uint256) public connectorPoolIds;

    // connector => mintLimitParams
    mapping(address => LimitParams) _mintLimitParams;

    // connector => burnLimitParams
    mapping(address => LimitParams) _burnLimitParams;

    // connector => receiver => amount
    mapping(address => mapping(address => uint256)) public pendingMints;

    // connector => amount
    mapping(address => uint256) public connectorPendingMints;

    uint256 public totalMinted;

    error ConnectorUnavailable();
    error InvalidPoolId();
    error ZeroAmount();
    event ExchangeRateUpdated(address exchangeRate);
    event ConnectorPoolIdUpdated(address connector, uint256 poolId);
    event LimitParamsUpdated(UpdateLimitParams[] updates);
    event TokensWithdrawn(
        address connector,
        address withdrawer,
        address receiver,
        uint256 burnAmount
    );
    event PendingTokensMinted(
        address connector,
        address receiver,
        uint256 mintAmount,
        uint256 pendingAmount
    );
    event TokensPending(
        address connecter,
        address receiver,
        uint256 pendingAmount,
        uint256 totalPendingAmount
    );
    event TokensMinted(address connecter, address receiver, uint256 mintAmount);

    constructor(address token_, address exchangeRate_) {
        token__ = IMintableERC20(token_);
        exchangeRate__ = IExchangeRate(exchangeRate_);
    }

    function updateExchangeRate(address exchangeRate_) external onlyOwner {
        exchangeRate__ = IExchangeRate(exchangeRate_);
        emit ExchangeRateUpdated(exchangeRate_);
    }

    function updateConnectorPoolId(
        address[] calldata connectors,
        uint256[] calldata poolIds
    ) external onlyOwner {
        uint256 length = connectors.length;
        for (uint256 i; i < length; i++) {
            if (poolIds[i] == 0) revert InvalidPoolId();
            connectorPoolIds[connectors[i]] = poolIds[i];
            emit ConnectorPoolIdUpdated(connectors[i], poolIds[i]);
        }
    }

    function updateLimitParams(
        UpdateLimitParams[] calldata updates_
    ) external onlyOwner {
        for (uint256 i; i < updates_.length; i++) {
            if (updates_[i].isMint) {
                _consumePartLimit(0, _mintLimitParams[updates_[i].connector]); // to keep current limit in sync
                _mintLimitParams[updates_[i].connector].maxLimit = updates_[i]
                    .maxLimit;
                _mintLimitParams[updates_[i].connector]
                    .ratePerSecond = updates_[i].ratePerSecond;
            } else {
                _consumePartLimit(0, _burnLimitParams[updates_[i].connector]); // to keep current limit in sync
                _burnLimitParams[updates_[i].connector].maxLimit = updates_[i]
                    .maxLimit;
                _burnLimitParams[updates_[i].connector]
                    .ratePerSecond = updates_[i].ratePerSecond;
            }
        }

        emit LimitParamsUpdated(updates_);
    }

    // do we throttle burn amount or unlock amount? burn for now
    function withdrawFromAppChain(
        address receiver_,
        uint256 burnAmount_,
        uint256 msgGasLimit_,
        address connector_
    ) external payable {
        if (burnAmount_ == 0) revert ZeroAmount();

        if (_burnLimitParams[connector_].maxLimit == 0)
            revert ConnectorUnavailable();

        _consumeFullLimit(burnAmount_, _burnLimitParams[connector_]); // reverts on limit hit

        totalMinted -= burnAmount_;
        token__.burn(msg.sender, burnAmount_);

        uint256 connectorPoolId = connectorPoolIds[connector_];
        if (connectorPoolId == 0) revert InvalidPoolId();
        uint256 unlockAmount = exchangeRate__.getUnlockAmount(
            burnAmount_,
            poolLockedAmounts[connectorPoolId]
        );
        poolLockedAmounts[connectorPoolId] -= unlockAmount; // underflow revert expected

        IConnector(connector_).outbound{value: msg.value}(
            msgGasLimit_,
            abi.encode(receiver_, unlockAmount)
        );

        emit TokensWithdrawn(connector_, msg.sender, receiver_, burnAmount_);
    }

    function mintPendingFor(address receiver_, address connector_) external {
        if (_mintLimitParams[connector_].maxLimit == 0)
            revert ConnectorUnavailable();

        uint256 pendingMint = pendingMints[connector_][receiver_];
        (uint256 consumedAmount, uint256 pendingAmount) = _consumePartLimit(
            pendingMint,
            _mintLimitParams[connector_]
        );

        pendingMints[connector_][receiver_] = pendingAmount;
        connectorPendingMints[connector_] -= consumedAmount;
        totalMinted += consumedAmount;

        token__.mint(receiver_, consumedAmount);

        emit PendingTokensMinted(
            connector_,
            receiver_,
            consumedAmount,
            pendingAmount
        );
    }

    // receive inbound assuming connector called
    function receiveInbound(bytes memory payload_) external override {
        if (_mintLimitParams[msg.sender].maxLimit == 0)
            revert ConnectorUnavailable();

        (address receiver, uint256 lockAmount) = abi.decode(
            payload_,
            (address, uint256)
        );
        uint256 connectorPoolId = connectorPoolIds[msg.sender];
        if (connectorPoolId == 0) revert InvalidPoolId();
        poolLockedAmounts[connectorPoolId] += lockAmount;

        uint256 mintAmount = exchangeRate__.getMintAmount(
            lockAmount,
            poolLockedAmounts[connectorPoolId]
        );
        (uint256 consumedAmount, uint256 pendingAmount) = _consumePartLimit(
            mintAmount,
            _mintLimitParams[msg.sender]
        );

        if (pendingAmount > 0) {
            // add instead of overwrite to handle case where already pending amount is left
            pendingMints[msg.sender][receiver] += pendingAmount;
            connectorPendingMints[msg.sender] += pendingAmount;
            emit TokensPending(
                msg.sender,
                receiver,
                pendingAmount,
                pendingMints[msg.sender][receiver]
            );
        }

        totalMinted += consumedAmount;
        token__.mint(receiver, consumedAmount);

        emit TokensMinted(msg.sender, receiver, consumedAmount);
    }

    function getMinFees(
        address connector_,
        uint256 msgGasLimit_
    ) external view returns (uint256 totalFees) {
        return IConnector(connector_).getMinFees(msgGasLimit_);
    }

    function getCurrentMintLimit(
        address connector_
    ) external view returns (uint256) {
        return _getCurrentLimit(_mintLimitParams[connector_]);
    }

    function getCurrentBurnLimit(
        address connector_
    ) external view returns (uint256) {
        return _getCurrentLimit(_burnLimitParams[connector_]);
    }

    function getMintLimitParams(
        address connector_
    ) external view returns (LimitParams memory) {
        return _mintLimitParams[connector_];
    }

    function getBurnLimitParams(
        address connector_
    ) external view returns (LimitParams memory) {
        return _burnLimitParams[connector_];
    }

    /**
     * @notice Rescues funds from the contract if they are locked by mistake.
     * @param token_ The address of the token contract.
     * @param rescueTo_ The address where rescued tokens need to be sent.
     * @param amount_ The amount of tokens to be rescued.
     */
    function rescueFunds(
        address token_,
        address rescueTo_,
        uint256 amount_
    ) external onlyOwner {
        RescueFundsLib.rescueFunds(token_, rescueTo_, amount_);
    }
}

File 6 of 15 : ExchangeRate.sol
pragma solidity 0.8.13;

import "lib/openzeppelin-contracts/contracts/access/Ownable2Step.sol";
import {RescueFundsLib} from "./RescueFundsLib.sol";

interface IExchangeRate {
    // not marked pure, may involve state interactions in future
    function getMintAmount(
        uint256 lockAmount,
        uint256 totalLockedAmount
    ) external returns (uint256 mintAmount);

    // not marked pure, may involve state interactions in future
    function getUnlockAmount(
        uint256 burnAmount,
        uint256 totalLockedAmount
    ) external returns (uint256 unlockAmount);
}

contract ExchangeRate is IExchangeRate, Ownable2Step {
    // chainId input needed? what else? slippage?
    function getMintAmount(
        uint256 lockAmount,
        uint256 /* totalLockedAmount */
    ) external pure returns (uint256 mintAmount) {
        return lockAmount;
    }

    function getUnlockAmount(
        uint256 burnAmount,
        uint256 /* totalLockedAmount */
    ) external pure returns (uint256 unlockAmount) {
        return burnAmount;
    }

    /**
     * @notice Rescues funds from the contract if they are locked by mistake.
     * @param token_ The address of the token contract.
     * @param rescueTo_ The address where rescued tokens need to be sent.
     * @param amount_ The amount of tokens to be rescued.
     */
    function rescueFunds(
        address token_,
        address rescueTo_,
        uint256 amount_
    ) external onlyOwner {
        RescueFundsLib.rescueFunds(token_, rescueTo_, amount_);
    }
}

File 7 of 15 : Gauge.sol
pragma solidity 0.8.13;

abstract contract Gauge {
    struct LimitParams {
        uint256 lastUpdateTimestamp;
        uint256 ratePerSecond;
        uint256 maxLimit;
        uint256 lastUpdateLimit;
    }

    error AmountOutsideLimit();

    function _getCurrentLimit(
        LimitParams storage _params
    ) internal view returns (uint256 _limit) {
        uint256 timeElapsed = block.timestamp - _params.lastUpdateTimestamp;
        uint256 limitIncrease = timeElapsed * _params.ratePerSecond;

        if (limitIncrease + _params.lastUpdateLimit > _params.maxLimit) {
            _limit = _params.maxLimit;
        } else {
            _limit = limitIncrease + _params.lastUpdateLimit;
        }
    }

    function _consumePartLimit(
        uint256 amount_,
        LimitParams storage _params
    ) internal returns (uint256 consumedAmount, uint256 pendingAmount) {
        uint256 currentLimit = _getCurrentLimit(_params);
        _params.lastUpdateTimestamp = block.timestamp;
        if (currentLimit >= amount_) {
            _params.lastUpdateLimit = currentLimit - amount_;
            consumedAmount = amount_;
            pendingAmount = 0;
        } else {
            _params.lastUpdateLimit = 0;
            consumedAmount = currentLimit;
            pendingAmount = amount_ - currentLimit;
        }
    }

    function _consumeFullLimit(
        uint256 amount_,
        LimitParams storage _params
    ) internal {
        uint256 currentLimit = _getCurrentLimit(_params);
        if (currentLimit >= amount_) {
            _params.lastUpdateTimestamp = block.timestamp;
            _params.lastUpdateLimit = currentLimit - amount_;
        } else {
            revert AmountOutsideLimit();
        }
    }
}

File 8 of 15 : MintableToken.sol
pragma solidity 0.8.13;

import "lib/solmate/src/tokens/ERC20.sol";

abstract contract IMintableERC20 is ERC20 {
    function mint(address receiver_, uint256 amount_) external virtual;

    function burn(address burner_, uint256 amount_) external virtual;
}

// this is a mock token used in tests, other projects' token to be used here
contract MintableToken is IMintableERC20 {
    constructor(
        string memory name_,
        string memory symbol_,
        uint8 decimals_
    ) ERC20(name_, symbol_, decimals_) {}

    function mint(address receiver_, uint256 amount_) external override {
        _mint(receiver_, amount_);
    }

    function burn(address burner_, uint256 amount_) external override {
        _burn(burner_, amount_);
    }
}

File 9 of 15 : NonMintableToken.sol
pragma solidity 0.8.13;

import "lib/solmate/src/tokens/ERC20.sol";

contract NonMintableToken is ERC20 {
    // this is a mock token used in tests, other projects' token to be used here
    constructor(
        string memory name_,
        string memory symbol_,
        uint8 decimals_,
        uint256 totalSupply_
    ) ERC20(name_, symbol_, decimals_) {
        _mint(msg.sender, totalSupply_);
    }
}

File 10 of 15 : RescueFundsLib.sol
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity 0.8.13;

import "lib/solmate/src/utils/SafeTransferLib.sol";

error ZeroAddress();

/**
 * @title RescueFundsLib
 * @dev A library that provides a function to rescue funds from a contract.
 */

library RescueFundsLib {
    /**
     * @dev The address used to identify ETH.
     */
    address public constant ETH_ADDRESS =
        address(0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE);

    /**
     * @dev thrown when the given token address don't have any code
     */
    error InvalidTokenAddress();

    /**
     * @dev Rescues funds from a contract.
     * @param token_ The address of the token contract.
     * @param rescueTo_ The address of the user.
     * @param amount_ The amount of tokens to be rescued.
     */
    function rescueFunds(
        address token_,
        address rescueTo_,
        uint256 amount_
    ) internal {
        if (rescueTo_ == address(0)) revert ZeroAddress();

        if (token_ == ETH_ADDRESS) {
            SafeTransferLib.safeTransferETH(rescueTo_, amount_);
        } else {
            if (token_.code.length == 0) revert InvalidTokenAddress();
            SafeTransferLib.safeTransfer(ERC20(token_), rescueTo_, amount_);
        }
    }
}

File 11 of 15 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)

pragma solidity ^0.8.0;

import "../utils/Context.sol";

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract Ownable is Context {
    address private _owner;

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor() {
        _transferOwnership(_msgSender());
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        _checkOwner();
        _;
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby disabling any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _transferOwnership(address(0));
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}

File 12 of 15 : Ownable2Step.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable2Step.sol)

pragma solidity ^0.8.0;

import "./Ownable.sol";

/**
 * @dev Contract module which provides access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership} and {acceptOwnership}.
 *
 * This module is used through inheritance. It will make available all functions
 * from parent (Ownable).
 */
abstract contract Ownable2Step is Ownable {
    address private _pendingOwner;

    event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Returns the address of the pending owner.
     */
    function pendingOwner() public view virtual returns (address) {
        return _pendingOwner;
    }

    /**
     * @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one.
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual override onlyOwner {
        _pendingOwner = newOwner;
        emit OwnershipTransferStarted(owner(), newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner.
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual override {
        delete _pendingOwner;
        super._transferOwnership(newOwner);
    }

    /**
     * @dev The new owner accepts the ownership transfer.
     */
    function acceptOwnership() public virtual {
        address sender = _msgSender();
        require(pendingOwner() == sender, "Ownable2Step: caller is not the new owner");
        _transferOwnership(sender);
    }
}

File 13 of 15 : Context.sol
// 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;
    }
}

File 14 of 15 : ERC20.sol
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity >=0.8.0;

/// @notice Modern and gas efficient ERC20 + EIP-2612 implementation.
/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/tokens/ERC20.sol)
/// @author Modified from Uniswap (https://github.com/Uniswap/uniswap-v2-core/blob/master/contracts/UniswapV2ERC20.sol)
/// @dev Do not manually set balances without updating totalSupply, as the sum of all user balances must not exceed it.
abstract contract ERC20 {
    /*//////////////////////////////////////////////////////////////
                                 EVENTS
    //////////////////////////////////////////////////////////////*/

    event Transfer(address indexed from, address indexed to, uint256 amount);

    event Approval(address indexed owner, address indexed spender, uint256 amount);

    /*//////////////////////////////////////////////////////////////
                            METADATA STORAGE
    //////////////////////////////////////////////////////////////*/

    string public name;

    string public symbol;

    uint8 public immutable decimals;

    /*//////////////////////////////////////////////////////////////
                              ERC20 STORAGE
    //////////////////////////////////////////////////////////////*/

    uint256 public totalSupply;

    mapping(address => uint256) public balanceOf;

    mapping(address => mapping(address => uint256)) public allowance;

    /*//////////////////////////////////////////////////////////////
                            EIP-2612 STORAGE
    //////////////////////////////////////////////////////////////*/

    uint256 internal immutable INITIAL_CHAIN_ID;

    bytes32 internal immutable INITIAL_DOMAIN_SEPARATOR;

    mapping(address => uint256) public nonces;

    /*//////////////////////////////////////////////////////////////
                               CONSTRUCTOR
    //////////////////////////////////////////////////////////////*/

    constructor(
        string memory _name,
        string memory _symbol,
        uint8 _decimals
    ) {
        name = _name;
        symbol = _symbol;
        decimals = _decimals;

        INITIAL_CHAIN_ID = block.chainid;
        INITIAL_DOMAIN_SEPARATOR = computeDomainSeparator();
    }

    /*//////////////////////////////////////////////////////////////
                               ERC20 LOGIC
    //////////////////////////////////////////////////////////////*/

    function approve(address spender, uint256 amount) public virtual returns (bool) {
        allowance[msg.sender][spender] = amount;

        emit Approval(msg.sender, spender, amount);

        return true;
    }

    function transfer(address to, uint256 amount) public virtual returns (bool) {
        balanceOf[msg.sender] -= amount;

        // Cannot overflow because the sum of all user
        // balances can't exceed the max uint256 value.
        unchecked {
            balanceOf[to] += amount;
        }

        emit Transfer(msg.sender, to, amount);

        return true;
    }

    function transferFrom(
        address from,
        address to,
        uint256 amount
    ) public virtual returns (bool) {
        uint256 allowed = allowance[from][msg.sender]; // Saves gas for limited approvals.

        if (allowed != type(uint256).max) allowance[from][msg.sender] = allowed - amount;

        balanceOf[from] -= amount;

        // Cannot overflow because the sum of all user
        // balances can't exceed the max uint256 value.
        unchecked {
            balanceOf[to] += amount;
        }

        emit Transfer(from, to, amount);

        return true;
    }

    /*//////////////////////////////////////////////////////////////
                             EIP-2612 LOGIC
    //////////////////////////////////////////////////////////////*/

    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) public virtual {
        require(deadline >= block.timestamp, "PERMIT_DEADLINE_EXPIRED");

        // Unchecked because the only math done is incrementing
        // the owner's nonce which cannot realistically overflow.
        unchecked {
            address recoveredAddress = ecrecover(
                keccak256(
                    abi.encodePacked(
                        "\x19\x01",
                        DOMAIN_SEPARATOR(),
                        keccak256(
                            abi.encode(
                                keccak256(
                                    "Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)"
                                ),
                                owner,
                                spender,
                                value,
                                nonces[owner]++,
                                deadline
                            )
                        )
                    )
                ),
                v,
                r,
                s
            );

            require(recoveredAddress != address(0) && recoveredAddress == owner, "INVALID_SIGNER");

            allowance[recoveredAddress][spender] = value;
        }

        emit Approval(owner, spender, value);
    }

    function DOMAIN_SEPARATOR() public view virtual returns (bytes32) {
        return block.chainid == INITIAL_CHAIN_ID ? INITIAL_DOMAIN_SEPARATOR : computeDomainSeparator();
    }

    function computeDomainSeparator() internal view virtual returns (bytes32) {
        return
            keccak256(
                abi.encode(
                    keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"),
                    keccak256(bytes(name)),
                    keccak256("1"),
                    block.chainid,
                    address(this)
                )
            );
    }

    /*//////////////////////////////////////////////////////////////
                        INTERNAL MINT/BURN LOGIC
    //////////////////////////////////////////////////////////////*/

    function _mint(address to, uint256 amount) internal virtual {
        totalSupply += amount;

        // Cannot overflow because the sum of all user
        // balances can't exceed the max uint256 value.
        unchecked {
            balanceOf[to] += amount;
        }

        emit Transfer(address(0), to, amount);
    }

    function _burn(address from, uint256 amount) internal virtual {
        balanceOf[from] -= amount;

        // Cannot underflow because a user's balance
        // will never be larger than the total supply.
        unchecked {
            totalSupply -= amount;
        }

        emit Transfer(from, address(0), amount);
    }
}

File 15 of 15 : SafeTransferLib.sol
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity >=0.8.0;

import {ERC20} from "../tokens/ERC20.sol";

/// @notice Safe ETH and ERC20 transfer library that gracefully handles missing return values.
/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/SafeTransferLib.sol)
/// @dev Use with caution! Some functions in this library knowingly create dirty bits at the destination of the free memory pointer.
/// @dev Note that none of the functions in this library check that a token has code at all! That responsibility is delegated to the caller.
library SafeTransferLib {
    /*//////////////////////////////////////////////////////////////
                             ETH OPERATIONS
    //////////////////////////////////////////////////////////////*/

    function safeTransferETH(address to, uint256 amount) internal {
        bool success;

        /// @solidity memory-safe-assembly
        assembly {
            // Transfer the ETH and store if it succeeded or not.
            success := call(gas(), to, amount, 0, 0, 0, 0)
        }

        require(success, "ETH_TRANSFER_FAILED");
    }

    /*//////////////////////////////////////////////////////////////
                            ERC20 OPERATIONS
    //////////////////////////////////////////////////////////////*/

    function safeTransferFrom(
        ERC20 token,
        address from,
        address to,
        uint256 amount
    ) internal {
        bool success;

        /// @solidity memory-safe-assembly
        assembly {
            // Get a pointer to some free memory.
            let freeMemoryPointer := mload(0x40)

            // Write the abi-encoded calldata into memory, beginning with the function selector.
            mstore(freeMemoryPointer, 0x23b872dd00000000000000000000000000000000000000000000000000000000)
            mstore(add(freeMemoryPointer, 4), and(from, 0xffffffffffffffffffffffffffffffffffffffff)) // Append and mask the "from" argument.
            mstore(add(freeMemoryPointer, 36), and(to, 0xffffffffffffffffffffffffffffffffffffffff)) // Append and mask the "to" argument.
            mstore(add(freeMemoryPointer, 68), amount) // Append the "amount" argument. Masking not required as it's a full 32 byte type.

            success := and(
                // Set success to whether the call reverted, if not we check it either
                // returned exactly 1 (can't just be non-zero data), or had no return data.
                or(and(eq(mload(0), 1), gt(returndatasize(), 31)), iszero(returndatasize())),
                // We use 100 because the length of our calldata totals up like so: 4 + 32 * 3.
                // We use 0 and 32 to copy up to 32 bytes of return data into the scratch space.
                // Counterintuitively, this call must be positioned second to the or() call in the
                // surrounding and() call or else returndatasize() will be zero during the computation.
                call(gas(), token, 0, freeMemoryPointer, 100, 0, 32)
            )
        }

        require(success, "TRANSFER_FROM_FAILED");
    }

    function safeTransfer(
        ERC20 token,
        address to,
        uint256 amount
    ) internal {
        bool success;

        /// @solidity memory-safe-assembly
        assembly {
            // Get a pointer to some free memory.
            let freeMemoryPointer := mload(0x40)

            // Write the abi-encoded calldata into memory, beginning with the function selector.
            mstore(freeMemoryPointer, 0xa9059cbb00000000000000000000000000000000000000000000000000000000)
            mstore(add(freeMemoryPointer, 4), and(to, 0xffffffffffffffffffffffffffffffffffffffff)) // Append and mask the "to" argument.
            mstore(add(freeMemoryPointer, 36), amount) // Append the "amount" argument. Masking not required as it's a full 32 byte type.

            success := and(
                // Set success to whether the call reverted, if not we check it either
                // returned exactly 1 (can't just be non-zero data), or had no return data.
                or(and(eq(mload(0), 1), gt(returndatasize(), 31)), iszero(returndatasize())),
                // We use 68 because the length of our calldata totals up like so: 4 + 32 * 2.
                // We use 0 and 32 to copy up to 32 bytes of return data into the scratch space.
                // Counterintuitively, this call must be positioned second to the or() call in the
                // surrounding and() call or else returndatasize() will be zero during the computation.
                call(gas(), token, 0, freeMemoryPointer, 68, 0, 32)
            )
        }

        require(success, "TRANSFER_FAILED");
    }

    function safeApprove(
        ERC20 token,
        address to,
        uint256 amount
    ) internal {
        bool success;

        /// @solidity memory-safe-assembly
        assembly {
            // Get a pointer to some free memory.
            let freeMemoryPointer := mload(0x40)

            // Write the abi-encoded calldata into memory, beginning with the function selector.
            mstore(freeMemoryPointer, 0x095ea7b300000000000000000000000000000000000000000000000000000000)
            mstore(add(freeMemoryPointer, 4), and(to, 0xffffffffffffffffffffffffffffffffffffffff)) // Append and mask the "to" argument.
            mstore(add(freeMemoryPointer, 36), amount) // Append the "amount" argument. Masking not required as it's a full 32 byte type.

            success := and(
                // Set success to whether the call reverted, if not we check it either
                // returned exactly 1 (can't just be non-zero data), or had no return data.
                or(and(eq(mload(0), 1), gt(returndatasize(), 31)), iszero(returndatasize())),
                // We use 68 because the length of our calldata totals up like so: 4 + 32 * 2.
                // We use 0 and 32 to copy up to 32 bytes of return data into the scratch space.
                // Counterintuitively, this call must be positioned second to the or() call in the
                // surrounding and() call or else returndatasize() will be zero during the computation.
                call(gas(), token, 0, freeMemoryPointer, 68, 0, 32)
            )
        }

        require(success, "APPROVE_FAILED");
    }
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"token_","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AmountOutsideLimit","type":"error"},{"inputs":[],"name":"ConnectorUnavailable","type":"error"},{"inputs":[],"name":"InvalidTokenAddress","type":"error"},{"inputs":[],"name":"ZeroAddress","type":"error"},{"inputs":[],"name":"ZeroAmount","type":"error"},{"anonymous":false,"inputs":[{"components":[{"internalType":"bool","name":"isLock","type":"bool"},{"internalType":"address","name":"connector","type":"address"},{"internalType":"uint256","name":"maxLimit","type":"uint256"},{"internalType":"uint256","name":"ratePerSecond","type":"uint256"}],"indexed":false,"internalType":"struct Vault.UpdateLimitParams[]","name":"updates","type":"tuple[]"}],"name":"LimitParamsUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferStarted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"connector","type":"address"},{"indexed":false,"internalType":"address","name":"receiver","type":"address"},{"indexed":false,"internalType":"uint256","name":"unlockedAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"pendingAmount","type":"uint256"}],"name":"PendingTokensTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"connector","type":"address"},{"indexed":false,"internalType":"address","name":"depositor","type":"address"},{"indexed":false,"internalType":"address","name":"receiver","type":"address"},{"indexed":false,"internalType":"uint256","name":"depositAmount","type":"uint256"}],"name":"TokensDeposited","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"connector","type":"address"},{"indexed":false,"internalType":"address","name":"receiver","type":"address"},{"indexed":false,"internalType":"uint256","name":"pendingAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalPendingAmount","type":"uint256"}],"name":"TokensPending","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"connector","type":"address"},{"indexed":false,"internalType":"address","name":"receiver","type":"address"},{"indexed":false,"internalType":"uint256","name":"unlockedAmount","type":"uint256"}],"name":"TokensUnlocked","type":"event"},{"inputs":[],"name":"acceptOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"connectorPendingUnlocks","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"receiver_","type":"address"},{"internalType":"uint256","name":"amount_","type":"uint256"},{"internalType":"uint256","name":"msgGasLimit_","type":"uint256"},{"internalType":"address","name":"connector_","type":"address"}],"name":"depositToAppChain","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"connector_","type":"address"}],"name":"getCurrentLockLimit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"connector_","type":"address"}],"name":"getCurrentUnlockLimit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"connector_","type":"address"}],"name":"getLockLimitParams","outputs":[{"components":[{"internalType":"uint256","name":"lastUpdateTimestamp","type":"uint256"},{"internalType":"uint256","name":"ratePerSecond","type":"uint256"},{"internalType":"uint256","name":"maxLimit","type":"uint256"},{"internalType":"uint256","name":"lastUpdateLimit","type":"uint256"}],"internalType":"struct Gauge.LimitParams","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"connector_","type":"address"},{"internalType":"uint256","name":"msgGasLimit_","type":"uint256"}],"name":"getMinFees","outputs":[{"internalType":"uint256","name":"totalFees","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"connector_","type":"address"}],"name":"getUnlockLimitParams","outputs":[{"components":[{"internalType":"uint256","name":"lastUpdateTimestamp","type":"uint256"},{"internalType":"uint256","name":"ratePerSecond","type":"uint256"},{"internalType":"uint256","name":"maxLimit","type":"uint256"},{"internalType":"uint256","name":"lastUpdateLimit","type":"uint256"}],"internalType":"struct Gauge.LimitParams","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"pendingUnlocks","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"payload_","type":"bytes"}],"name":"receiveInbound","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token_","type":"address"},{"internalType":"address","name":"rescueTo_","type":"address"},{"internalType":"uint256","name":"amount_","type":"uint256"}],"name":"rescueFunds","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"token__","outputs":[{"internalType":"contract ERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"receiver_","type":"address"},{"internalType":"address","name":"connector_","type":"address"}],"name":"unlockPendingFor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"bool","name":"isLock","type":"bool"},{"internalType":"address","name":"connector","type":"address"},{"internalType":"uint256","name":"maxLimit","type":"uint256"},{"internalType":"uint256","name":"ratePerSecond","type":"uint256"}],"internalType":"struct Vault.UpdateLimitParams[]","name":"updates_","type":"tuple[]"}],"name":"updateLimitParams","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60a06040523480156200001157600080fd5b5060405162001c6738038062001c678339810160408190526200003491620000cb565b6200003f3362000051565b6001600160a01b0316608052620000fd565b600180546001600160a01b031916905562000078816200007b602090811b6200107f17901c565b50565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600060208284031215620000de57600080fd5b81516001600160a01b0381168114620000f657600080fd5b9392505050565b608051611b396200012e6000396000818161021a0152818161059101528181610c590152610f4c0152611b396000f3fe6080604052600436106101295760003560e01c806379ba5097116100a55780638da5cb5b11610074578063e30c397811610059578063e30c39781461039c578063f2b7c5cd146103c7578063f2fde38b146103e757600080fd5b80638da5cb5b146103515780639b4cd9401461037c57600080fd5b806379ba5097146102e95780638367080f146102fe57806384f289cc1461031e578063864f6a7a1461033e57600080fd5b80634603f9f4116100fc5780636ccae054116100e15780636ccae05414610261578063715018a614610281578063755e1e241461029657600080fd5b80634603f9f4146101e857806349eec51e1461020857600080fd5b806310c56ed91461012e578063186669e8146101505780632bc9c08a1461019b5780632fef4a8b146101bb575b600080fd5b34801561013a57600080fd5b5061014e610149366004611619565b610407565b005b34801561015c57600080fd5b5061018861016b36600461170a565b600260209081526000928352604080842090915290825290205481565b6040519081526020015b60405180910390f35b3480156101a757600080fd5b5061014e6101b6366004611743565b610616565b3480156101c757600080fd5b506101886101d63660046117b8565b60036020526000908152604090205481565b3480156101f457600080fd5b506101886102033660046117b8565b61090d565b34801561021457600080fd5b5061023c7f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610192565b34801561026d57600080fd5b5061014e61027c3660046117d5565b610941565b34801561028d57600080fd5b5061014e610959565b3480156102a257600080fd5b506102b66102b13660046117b8565b61096d565b60405161019291908151815260208083015190820152604080830151908201526060918201519181019190915260800190565b3480156102f557600080fd5b5061014e6109f3565b34801561030a57600080fd5b50610188610319366004611816565b610aad565b34801561032a57600080fd5b506101886103393660046117b8565b610b46565b61014e61034c366004611842565b610b74565b34801561035d57600080fd5b5060005473ffffffffffffffffffffffffffffffffffffffff1661023c565b34801561038857600080fd5b506102b66103973660046117b8565b610d9f565b3480156103a857600080fd5b5060015473ffffffffffffffffffffffffffffffffffffffff1661023c565b3480156103d357600080fd5b5061014e6103e236600461170a565b610e25565b3480156103f357600080fd5b5061014e6104023660046117b8565b610fcf565b336000908152600560205260408120600201549003610452576040517fb1efb84a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008082806020019051810190610469919061188c565b33600090815260056020526040812092945090925090819061048c9084906110f4565b909250905080156105775733600090815260026020908152604080832073ffffffffffffffffffffffffffffffffffffffff88168452909152812080548392906104d79084906118e9565b909155505033600090815260036020526040812080548392906104fb9084906118e9565b909155505033600081815260026020908152604080832073ffffffffffffffffffffffffffffffffffffffff891680855290835292819020548151948552918401929092528282018490526060830152517ffef75efa635291b302f2c3dfcc6ec92874e699d186cee8bd68c36c86ad35232c9181900360800190a15b6105b873ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168584611148565b6040805133815273ffffffffffffffffffffffffffffffffffffffff861660208201529081018390527fece684e11f49f06d351439e63189ad1703238b8040d90cf994901ca2b3da8d44906060015b60405180910390a15050505050565b61061e61121d565b60005b818110156108cf5782828281811061063b5761063b611901565b6106519260206080909202019081019150611945565b156107b7576106c860006004600086868681811061067157610671611901565b905060800201602001602081019061068991906117b8565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206110f4565b50508282828181106106dc576106dc611901565b90506080020160400135600460008585858181106106fc576106fc611901565b905060800201602001602081019061071491906117b8565b73ffffffffffffffffffffffffffffffffffffffff16815260208101919091526040016000206002015582828281811061075057610750611901565b905060800201606001356004600085858581811061077057610770611901565b905060800201602001602081019061078891906117b8565b73ffffffffffffffffffffffffffffffffffffffff1681526020810191909152604001600020600101556108bd565b6107d260006005600086868681811061067157610671611901565b50508282828181106107e6576107e6611901565b905060800201604001356005600085858581811061080657610806611901565b905060800201602001602081019061081e91906117b8565b73ffffffffffffffffffffffffffffffffffffffff16815260208101919091526040016000206002015582828281811061085a5761085a611901565b905060800201606001356005600085858581811061087a5761087a611901565b905060800201602001602081019061089291906117b8565b73ffffffffffffffffffffffffffffffffffffffff1681526020810191909152604001600020600101555b806108c781611960565b915050610621565b507f19863caed14ed012a54f927e56250018b7ac3c04fd197e0edf23369f75a6ccd48282604051610901929190611998565b60405180910390a15050565b73ffffffffffffffffffffffffffffffffffffffff8116600090815260046020526040812061093b9061129e565b92915050565b61094961121d565b610954838383611305565b505050565b61096161121d565b61096b60006113f5565b565b6109986040518060800160405280600081526020016000815260200160008152602001600081525090565b5073ffffffffffffffffffffffffffffffffffffffff16600090815260046020908152604091829020825160808101845281548152600182015492810192909252600281015492820192909252600390910154606082015290565b600154339073ffffffffffffffffffffffffffffffffffffffff168114610aa1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f74207468652060448201527f6e6577206f776e6572000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b610aaa816113f5565b50565b6040517f89c1cf9a0000000000000000000000000000000000000000000000000000000081526004810182905260009073ffffffffffffffffffffffffffffffffffffffff8416906389c1cf9a90602401602060405180830381865afa158015610b1b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b3f9190611a1b565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff8116600090815260056020526040812061093b9061129e565b82600003610bae576040517f1f2a200500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff81166000908152600460205260408120600201549003610c0f576040517fb1efb84a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff81166000908152600460205260409020610c3f908490611426565b610c8173ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016333086611483565b8073ffffffffffffffffffffffffffffffffffffffff16631cbdf12b34848787604051602001610cd392919073ffffffffffffffffffffffffffffffffffffffff929092168252602082015260400190565b6040516020818303038152906040526040518463ffffffff1660e01b8152600401610cff929190611a34565b6000604051808303818588803b158015610d1857600080fd5b505af1158015610d2c573d6000803e3d6000fd5b50506040805173ffffffffffffffffffffffffffffffffffffffff8087168252336020830152891691810191909152606081018790527f9474e087d8a0e83962ac44e292b4aba027426203ea66adfb1dd9f65795ff599a93506080019150610d919050565b60405180910390a150505050565b610dca6040518060800160405280600081526020016000815260200160008152602001600081525090565b5073ffffffffffffffffffffffffffffffffffffffff16600090815260056020908152604091829020825160808101845281548152600182015492810192909252600281015492820192909252600390910154606082015290565b73ffffffffffffffffffffffffffffffffffffffff81166000908152600560205260408120600201549003610e86576040517fb1efb84a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8082166000818152600260209081526040808320948716835293815283822054928252600590529182209091908190610ed59084906110f4565b73ffffffffffffffffffffffffffffffffffffffff8087166000818152600260209081526040808320948c168352938152838220859055918152600390915290812080549395509193508492610f2c908490611aaf565b90915550610f73905073ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168684611148565b6040805173ffffffffffffffffffffffffffffffffffffffff808716825287166020820152908101839052606081018290527fc77b48bb4899bc689b5733d1b7b8bfc0f70e7660295ad5f94841902db16ddae290608001610607565b610fd761121d565b6001805473ffffffffffffffffffffffffffffffffffffffff83167fffffffffffffffffffffffff0000000000000000000000000000000000000000909116811790915561103a60005473ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60008060006111028461129e565b4285559050848110611129576111188582611aaf565b600385015584925060009150611140565b6000600385015591508161113d8186611aaf565b91505b509250929050565b60006040517fa9059cbb00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff84166004820152826024820152602060006044836000895af13d15601f3d1160016000511416171691505080611217576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f5452414e534645525f4641494c454400000000000000000000000000000000006044820152606401610a98565b50505050565b60005473ffffffffffffffffffffffffffffffffffffffff16331461096b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610a98565b805460009081906112af9042611aaf565b905060008360010154826112c39190611ac6565b905083600201548460030154826112da91906118e9565b11156112ec57836002015492506112fe565b60038401546112fb90826118e9565b92505b5050919050565b73ffffffffffffffffffffffffffffffffffffffff8216611352576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7fffffffffffffffffffffffff111111111111111111111111111111111111111273ffffffffffffffffffffffffffffffffffffffff841601611399576109548282611575565b8273ffffffffffffffffffffffffffffffffffffffff163b6000036113ea576040517f1eb00b0600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610954838383611148565b600180547fffffffffffffffffffffffff0000000000000000000000000000000000000000169055610aaa8161107f565b60006114318261129e565b9050828110611451574282556114478382611aaf565b6003830155505050565b6040517f47ebad2000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006040517f23b872dd00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8516600482015273ffffffffffffffffffffffffffffffffffffffff841660248201528260448201526020600060648360008a5af13d15601f3d116001600051141617169150508061156e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f5452414e534645525f46524f4d5f4641494c45440000000000000000000000006044820152606401610a98565b5050505050565b600080600080600085875af1905080610954576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4554485f5452414e534645525f4641494c4544000000000000000000000000006044820152606401610a98565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60006020828403121561162b57600080fd5b813567ffffffffffffffff8082111561164357600080fd5b818401915084601f83011261165757600080fd5b813581811115611669576116696115ea565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f011681019083821181831017156116af576116af6115ea565b816040528281528760208487010111156116c857600080fd5b826020860160208301376000928101602001929092525095945050505050565b73ffffffffffffffffffffffffffffffffffffffff81168114610aaa57600080fd5b6000806040838503121561171d57600080fd5b8235611728816116e8565b91506020830135611738816116e8565b809150509250929050565b6000806020838503121561175657600080fd5b823567ffffffffffffffff8082111561176e57600080fd5b818501915085601f83011261178257600080fd5b81358181111561179157600080fd5b8660208260071b85010111156117a657600080fd5b60209290920196919550909350505050565b6000602082840312156117ca57600080fd5b8135610b3f816116e8565b6000806000606084860312156117ea57600080fd5b83356117f5816116e8565b92506020840135611805816116e8565b929592945050506040919091013590565b6000806040838503121561182957600080fd5b8235611834816116e8565b946020939093013593505050565b6000806000806080858703121561185857600080fd5b8435611863816116e8565b935060208501359250604085013591506060850135611881816116e8565b939692955090935050565b6000806040838503121561189f57600080fd5b82516118aa816116e8565b6020939093015192949293505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600082198211156118fc576118fc6118ba565b500190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b8035801515811461194057600080fd5b919050565b60006020828403121561195757600080fd5b610b3f82611930565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203611991576119916118ba565b5060010190565b6020808252818101839052600090604080840186845b87811015611a0e576119bf82611930565b15158352848201356119d0816116e8565b73ffffffffffffffffffffffffffffffffffffffff1683860152818401358484015260608083013590840152608092830192909101906001016119ae565b5090979650505050505050565b600060208284031215611a2d57600080fd5b5051919050565b82815260006020604081840152835180604085015260005b81811015611a6857858101830151858201606001528201611a4c565b81811115611a7a576000606083870101525b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01692909201606001949350505050565b600082821015611ac157611ac16118ba565b500390565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615611afe57611afe6118ba565b50029056fea2646970667358221220b72039dcd3aecad422bf4f5f8d626e8d46a4d5dc77e0a29b7c6419a7bd4be71b64736f6c634300080d0033000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48

Deployed Bytecode

0x6080604052600436106101295760003560e01c806379ba5097116100a55780638da5cb5b11610074578063e30c397811610059578063e30c39781461039c578063f2b7c5cd146103c7578063f2fde38b146103e757600080fd5b80638da5cb5b146103515780639b4cd9401461037c57600080fd5b806379ba5097146102e95780638367080f146102fe57806384f289cc1461031e578063864f6a7a1461033e57600080fd5b80634603f9f4116100fc5780636ccae054116100e15780636ccae05414610261578063715018a614610281578063755e1e241461029657600080fd5b80634603f9f4146101e857806349eec51e1461020857600080fd5b806310c56ed91461012e578063186669e8146101505780632bc9c08a1461019b5780632fef4a8b146101bb575b600080fd5b34801561013a57600080fd5b5061014e610149366004611619565b610407565b005b34801561015c57600080fd5b5061018861016b36600461170a565b600260209081526000928352604080842090915290825290205481565b6040519081526020015b60405180910390f35b3480156101a757600080fd5b5061014e6101b6366004611743565b610616565b3480156101c757600080fd5b506101886101d63660046117b8565b60036020526000908152604090205481565b3480156101f457600080fd5b506101886102033660046117b8565b61090d565b34801561021457600080fd5b5061023c7f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4881565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610192565b34801561026d57600080fd5b5061014e61027c3660046117d5565b610941565b34801561028d57600080fd5b5061014e610959565b3480156102a257600080fd5b506102b66102b13660046117b8565b61096d565b60405161019291908151815260208083015190820152604080830151908201526060918201519181019190915260800190565b3480156102f557600080fd5b5061014e6109f3565b34801561030a57600080fd5b50610188610319366004611816565b610aad565b34801561032a57600080fd5b506101886103393660046117b8565b610b46565b61014e61034c366004611842565b610b74565b34801561035d57600080fd5b5060005473ffffffffffffffffffffffffffffffffffffffff1661023c565b34801561038857600080fd5b506102b66103973660046117b8565b610d9f565b3480156103a857600080fd5b5060015473ffffffffffffffffffffffffffffffffffffffff1661023c565b3480156103d357600080fd5b5061014e6103e236600461170a565b610e25565b3480156103f357600080fd5b5061014e6104023660046117b8565b610fcf565b336000908152600560205260408120600201549003610452576040517fb1efb84a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008082806020019051810190610469919061188c565b33600090815260056020526040812092945090925090819061048c9084906110f4565b909250905080156105775733600090815260026020908152604080832073ffffffffffffffffffffffffffffffffffffffff88168452909152812080548392906104d79084906118e9565b909155505033600090815260036020526040812080548392906104fb9084906118e9565b909155505033600081815260026020908152604080832073ffffffffffffffffffffffffffffffffffffffff891680855290835292819020548151948552918401929092528282018490526060830152517ffef75efa635291b302f2c3dfcc6ec92874e699d186cee8bd68c36c86ad35232c9181900360800190a15b6105b873ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48168584611148565b6040805133815273ffffffffffffffffffffffffffffffffffffffff861660208201529081018390527fece684e11f49f06d351439e63189ad1703238b8040d90cf994901ca2b3da8d44906060015b60405180910390a15050505050565b61061e61121d565b60005b818110156108cf5782828281811061063b5761063b611901565b6106519260206080909202019081019150611945565b156107b7576106c860006004600086868681811061067157610671611901565b905060800201602001602081019061068991906117b8565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206110f4565b50508282828181106106dc576106dc611901565b90506080020160400135600460008585858181106106fc576106fc611901565b905060800201602001602081019061071491906117b8565b73ffffffffffffffffffffffffffffffffffffffff16815260208101919091526040016000206002015582828281811061075057610750611901565b905060800201606001356004600085858581811061077057610770611901565b905060800201602001602081019061078891906117b8565b73ffffffffffffffffffffffffffffffffffffffff1681526020810191909152604001600020600101556108bd565b6107d260006005600086868681811061067157610671611901565b50508282828181106107e6576107e6611901565b905060800201604001356005600085858581811061080657610806611901565b905060800201602001602081019061081e91906117b8565b73ffffffffffffffffffffffffffffffffffffffff16815260208101919091526040016000206002015582828281811061085a5761085a611901565b905060800201606001356005600085858581811061087a5761087a611901565b905060800201602001602081019061089291906117b8565b73ffffffffffffffffffffffffffffffffffffffff1681526020810191909152604001600020600101555b806108c781611960565b915050610621565b507f19863caed14ed012a54f927e56250018b7ac3c04fd197e0edf23369f75a6ccd48282604051610901929190611998565b60405180910390a15050565b73ffffffffffffffffffffffffffffffffffffffff8116600090815260046020526040812061093b9061129e565b92915050565b61094961121d565b610954838383611305565b505050565b61096161121d565b61096b60006113f5565b565b6109986040518060800160405280600081526020016000815260200160008152602001600081525090565b5073ffffffffffffffffffffffffffffffffffffffff16600090815260046020908152604091829020825160808101845281548152600182015492810192909252600281015492820192909252600390910154606082015290565b600154339073ffffffffffffffffffffffffffffffffffffffff168114610aa1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f74207468652060448201527f6e6577206f776e6572000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b610aaa816113f5565b50565b6040517f89c1cf9a0000000000000000000000000000000000000000000000000000000081526004810182905260009073ffffffffffffffffffffffffffffffffffffffff8416906389c1cf9a90602401602060405180830381865afa158015610b1b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b3f9190611a1b565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff8116600090815260056020526040812061093b9061129e565b82600003610bae576040517f1f2a200500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff81166000908152600460205260408120600201549003610c0f576040517fb1efb84a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff81166000908152600460205260409020610c3f908490611426565b610c8173ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4816333086611483565b8073ffffffffffffffffffffffffffffffffffffffff16631cbdf12b34848787604051602001610cd392919073ffffffffffffffffffffffffffffffffffffffff929092168252602082015260400190565b6040516020818303038152906040526040518463ffffffff1660e01b8152600401610cff929190611a34565b6000604051808303818588803b158015610d1857600080fd5b505af1158015610d2c573d6000803e3d6000fd5b50506040805173ffffffffffffffffffffffffffffffffffffffff8087168252336020830152891691810191909152606081018790527f9474e087d8a0e83962ac44e292b4aba027426203ea66adfb1dd9f65795ff599a93506080019150610d919050565b60405180910390a150505050565b610dca6040518060800160405280600081526020016000815260200160008152602001600081525090565b5073ffffffffffffffffffffffffffffffffffffffff16600090815260056020908152604091829020825160808101845281548152600182015492810192909252600281015492820192909252600390910154606082015290565b73ffffffffffffffffffffffffffffffffffffffff81166000908152600560205260408120600201549003610e86576040517fb1efb84a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8082166000818152600260209081526040808320948716835293815283822054928252600590529182209091908190610ed59084906110f4565b73ffffffffffffffffffffffffffffffffffffffff8087166000818152600260209081526040808320948c168352938152838220859055918152600390915290812080549395509193508492610f2c908490611aaf565b90915550610f73905073ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48168684611148565b6040805173ffffffffffffffffffffffffffffffffffffffff808716825287166020820152908101839052606081018290527fc77b48bb4899bc689b5733d1b7b8bfc0f70e7660295ad5f94841902db16ddae290608001610607565b610fd761121d565b6001805473ffffffffffffffffffffffffffffffffffffffff83167fffffffffffffffffffffffff0000000000000000000000000000000000000000909116811790915561103a60005473ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60008060006111028461129e565b4285559050848110611129576111188582611aaf565b600385015584925060009150611140565b6000600385015591508161113d8186611aaf565b91505b509250929050565b60006040517fa9059cbb00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff84166004820152826024820152602060006044836000895af13d15601f3d1160016000511416171691505080611217576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f5452414e534645525f4641494c454400000000000000000000000000000000006044820152606401610a98565b50505050565b60005473ffffffffffffffffffffffffffffffffffffffff16331461096b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610a98565b805460009081906112af9042611aaf565b905060008360010154826112c39190611ac6565b905083600201548460030154826112da91906118e9565b11156112ec57836002015492506112fe565b60038401546112fb90826118e9565b92505b5050919050565b73ffffffffffffffffffffffffffffffffffffffff8216611352576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7fffffffffffffffffffffffff111111111111111111111111111111111111111273ffffffffffffffffffffffffffffffffffffffff841601611399576109548282611575565b8273ffffffffffffffffffffffffffffffffffffffff163b6000036113ea576040517f1eb00b0600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610954838383611148565b600180547fffffffffffffffffffffffff0000000000000000000000000000000000000000169055610aaa8161107f565b60006114318261129e565b9050828110611451574282556114478382611aaf565b6003830155505050565b6040517f47ebad2000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006040517f23b872dd00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8516600482015273ffffffffffffffffffffffffffffffffffffffff841660248201528260448201526020600060648360008a5af13d15601f3d116001600051141617169150508061156e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f5452414e534645525f46524f4d5f4641494c45440000000000000000000000006044820152606401610a98565b5050505050565b600080600080600085875af1905080610954576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4554485f5452414e534645525f4641494c4544000000000000000000000000006044820152606401610a98565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60006020828403121561162b57600080fd5b813567ffffffffffffffff8082111561164357600080fd5b818401915084601f83011261165757600080fd5b813581811115611669576116696115ea565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f011681019083821181831017156116af576116af6115ea565b816040528281528760208487010111156116c857600080fd5b826020860160208301376000928101602001929092525095945050505050565b73ffffffffffffffffffffffffffffffffffffffff81168114610aaa57600080fd5b6000806040838503121561171d57600080fd5b8235611728816116e8565b91506020830135611738816116e8565b809150509250929050565b6000806020838503121561175657600080fd5b823567ffffffffffffffff8082111561176e57600080fd5b818501915085601f83011261178257600080fd5b81358181111561179157600080fd5b8660208260071b85010111156117a657600080fd5b60209290920196919550909350505050565b6000602082840312156117ca57600080fd5b8135610b3f816116e8565b6000806000606084860312156117ea57600080fd5b83356117f5816116e8565b92506020840135611805816116e8565b929592945050506040919091013590565b6000806040838503121561182957600080fd5b8235611834816116e8565b946020939093013593505050565b6000806000806080858703121561185857600080fd5b8435611863816116e8565b935060208501359250604085013591506060850135611881816116e8565b939692955090935050565b6000806040838503121561189f57600080fd5b82516118aa816116e8565b6020939093015192949293505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600082198211156118fc576118fc6118ba565b500190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b8035801515811461194057600080fd5b919050565b60006020828403121561195757600080fd5b610b3f82611930565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203611991576119916118ba565b5060010190565b6020808252818101839052600090604080840186845b87811015611a0e576119bf82611930565b15158352848201356119d0816116e8565b73ffffffffffffffffffffffffffffffffffffffff1683860152818401358484015260608083013590840152608092830192909101906001016119ae565b5090979650505050505050565b600060208284031215611a2d57600080fd5b5051919050565b82815260006020604081840152835180604085015260005b81811015611a6857858101830151858201606001528201611a4c565b81811115611a7a576000606083870101525b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01692909201606001949350505050565b600082821015611ac157611ac16118ba565b500390565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615611afe57611afe6118ba565b50029056fea2646970667358221220b72039dcd3aecad422bf4f5f8d626e8d46a4d5dc77e0a29b7c6419a7bd4be71b64736f6c634300080d0033

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

000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48

-----Decoded View---------------
Arg [0] : token_ (address): 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48

-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading
[ Download: CSV Export  ]
[ 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.