OriginalTokenVaultV2

Description:

Multi-signature wallet contract requiring multiple confirmations for transaction execution.

Blockchain: Ethereum

Source Code: View Code On The Blockchain

Solidity Source Code:

{{
  "language": "Solidity",
  "sources": {
    "@openzeppelin/contracts/security/Pausable.sol": {
      "content": "// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (security/Pausable.sol)

pragma solidity ^0.8.0;

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

/**
 * @dev Contract module which allows children to implement an emergency stop
 * mechanism that can be triggered by an authorized account.
 *
 * This module is used through inheritance. It will make available the
 * modifiers `whenNotPaused` and `whenPaused`, which can be applied to
 * the functions of your contract. Note that they will not be pausable by
 * simply including this module, only once the modifiers are put in place.
 */
abstract contract Pausable is Context {
    /**
     * @dev Emitted when the pause is triggered by `account`.
     */
    event Paused(address account);

    /**
     * @dev Emitted when the pause is lifted by `account`.
     */
    event Unpaused(address account);

    bool private _paused;

    /**
     * @dev Initializes the contract in unpaused state.
     */
    constructor() {
        _paused = false;
    }

    /**
     * @dev Returns true if the contract is paused, and false otherwise.
     */
    function paused() public view virtual returns (bool) {
        return _paused;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is not paused.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    modifier whenNotPaused() {
        require(!paused(), "Pausable: paused");
        _;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is paused.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    modifier whenPaused() {
        require(paused(), "Pausable: not paused");
        _;
    }

    /**
     * @dev Triggers stopped state.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    function _pause() internal virtual whenNotPaused {
        _paused = true;
        emit Paused(_msgSender());
    }

    /**
     * @dev Returns to normal state.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    function _unpause() internal virtual whenPaused {
        _paused = false;
        emit Unpaused(_msgSender());
    }
}
"
    },
    "@openzeppelin/contracts/security/ReentrancyGuard.sol": {
      "content": "// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)

pragma solidity ^0.8.0;

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

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

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and making it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        // On the first call to nonReentrant, _notEntered will be true
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

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

        _;

        // By storing the original value once again, a refund is triggered (see
        // https://eips.ethereum.org/EIPS/eip-2200)
        _status = _NOT_ENTERED;
    }
}
"
    },
    "@openzeppelin/contracts/token/ERC20/IERC20.sol": {
      "content": "// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

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

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

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

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

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

    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(address indexed owner, address indexed spender, uint256 value);
}
"
    },
    "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol": {
      "content": "// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

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

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

    function safeTransfer(
        IERC20 token,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
    }

    function safeTransferFrom(
        IERC20 token,
        address from,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
    }

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

    function safeIncreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        uint256 newAllowance = token.allowance(address(this), spender) + value;
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
    }

    function safeDecreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        unchecked {
            uint256 oldAllowance = token.allowance(address(this), spender);
            require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
            uint256 newAllowance = oldAllowance - value;
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
        }
    }

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

        bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
        if (returndata.length > 0) {
            // Return data is optional
            require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
        }
    }
}
"
    },
    "@openzeppelin/contracts/utils/Address.sol": {
      "content": "// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol)

pragma solidity ^0.8.1;

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

        return account.code.length > 0;
    }

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

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

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

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

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

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

        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

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

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        require(isContract(target), "Address: static call to non-contract");

        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

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

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(isContract(target), "Address: delegate call to non-contract");

        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly

                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}
"
    },
    "@openzeppelin/contracts/utils/Context.sol": {
      "content": "// 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;
    }
}
"
    },
    "contracts/interfaces/ISigsVerifier.sol": {
      "content": "// SPDX-License-Identifier: GPL-3.0-only\r
\r
pragma solidity >=0.8.0;\r
\r
interface ISigsVerifier {\r
    /**\r
     * @notice Verifies that a message is signed by a quorum among the signers.\r
     * @param _msg signed message\r
     * @param _sigs list of signatures sorted by signer addresses in ascending order\r
     * @param _signers sorted list of current signers\r
     * @param _powers powers of current signers\r
     */\r
    function verifySigs(\r
        bytes memory _msg,\r
        bytes[] calldata _sigs,\r
        address[] calldata _signers,\r
        uint256[] calldata _powers\r
    ) external view;\r
}\r
"
    },
    "contracts/interfaces/IWETH.sol": {
      "content": "// SPDX-License-Identifier: GPL-3.0-only\r
\r
pragma solidity >=0.8.0;\r
\r
interface IWETH {\r
    function deposit() external payable;\r
\r
    function withdraw(uint256) external;\r
}\r
"
    },
    "contracts/libraries/Pb.sol": {
      "content": "// SPDX-License-Identifier: GPL-3.0-only\r
\r
pragma solidity 0.8.17;\r
\r
// runtime proto sol library\r
library Pb {\r
    enum WireType {\r
        Varint,\r
        Fixed64,\r
        LengthDelim,\r
        StartGroup,\r
        EndGroup,\r
        Fixed32\r
    }\r
\r
    struct Buffer {\r
        uint256 idx; // the start index of next read. when idx=b.length, we're done\r
        bytes b; // hold serialized proto msg, readonly\r
    }\r
\r
    // create a new in-memory Buffer object from raw msg bytes\r
    function fromBytes(bytes memory raw) internal pure returns (Buffer memory buf) {\r
        buf.b = raw;\r
        buf.idx = 0;\r
    }\r
\r
    // whether there are unread bytes\r
    function hasMore(Buffer memory buf) internal pure returns (bool) {\r
        return buf.idx < buf.b.length;\r
    }\r
\r
    // decode current field number and wiretype\r
    function decKey(Buffer memory buf) internal pure returns (uint256 tag, WireType wiretype) {\r
        uint256 v = decVarint(buf);\r
        tag = v / 8;\r
        wiretype = WireType(v & 7);\r
    }\r
\r
    // count tag occurrences, return an array due to no memory map support\r
    // have to create array for (maxtag+1) size. cnts[tag] = occurrences\r
    // should keep buf.idx unchanged because this is only a count function\r
    function cntTags(Buffer memory buf, uint256 maxtag) internal pure returns (uint256[] memory cnts) {\r
        uint256 originalIdx = buf.idx;\r
        cnts = new uint256[](maxtag + 1); // protobuf's tags are from 1 rather than 0\r
        uint256 tag;\r
        WireType wire;\r
        while (hasMore(buf)) {\r
            (tag, wire) = decKey(buf);\r
            cnts[tag] += 1;\r
            skipValue(buf, wire);\r
        }\r
        buf.idx = originalIdx;\r
    }\r
\r
    // read varint from current buf idx, move buf.idx to next read, return the int value\r
    function decVarint(Buffer memory buf) internal pure returns (uint256 v) {\r
        bytes10 tmp; // proto int is at most 10 bytes (7 bits can be used per byte)\r
        bytes memory bb = buf.b; // get buf.b mem addr to use in assembly\r
        v = buf.idx; // use v to save one additional uint variable\r
        assembly {\r
            tmp := mload(add(add(bb, 32), v)) // load 10 bytes from buf.b[buf.idx] to tmp\r
        }\r
        uint256 b; // store current byte content\r
        v = 0; // reset to 0 for return value\r
        for (uint256 i = 0; i < 10; i++) {\r
            assembly {\r
                b := byte(i, tmp) // don't use tmp[i] because it does bound check and costs extra\r
            }\r
            v |= (b & 0x7F) << (i * 7);\r
            if (b & 0x80 == 0) {\r
                buf.idx += i + 1;\r
                return v;\r
            }\r
        }\r
        revert(); // i=10, invalid varint stream\r
    }\r
\r
    // read length delimited field and return bytes\r
    function decBytes(Buffer memory buf) internal pure returns (bytes memory b) {\r
        uint256 len = decVarint(buf);\r
        uint256 end = buf.idx + len;\r
        require(end <= buf.b.length); // avoid overflow\r
        b = new bytes(len);\r
        bytes memory bufB = buf.b; // get buf.b mem addr to use in assembly\r
        uint256 bStart;\r
        uint256 bufBStart = buf.idx;\r
        assembly {\r
            bStart := add(b, 32)\r
            bufBStart := add(add(bufB, 32), bufBStart)\r
        }\r
        for (uint256 i = 0; i < len; i += 32) {\r
            assembly {\r
                mstore(add(bStart, i), mload(add(bufBStart, i)))\r
            }\r
        }\r
        buf.idx = end;\r
    }\r
\r
    // return packed ints\r
    function decPacked(Buffer memory buf) internal pure returns (uint256[] memory t) {\r
        uint256 len = decVarint(buf);\r
        uint256 end = buf.idx + len;\r
        require(end <= buf.b.length); // avoid overflow\r
        // array in memory must be init w/ known length\r
        // so we have to create a tmp array w/ max possible len first\r
        uint256[] memory tmp = new uint256[](len);\r
        uint256 i = 0; // count how many ints are there\r
        while (buf.idx < end) {\r
            tmp[i] = decVarint(buf);\r
            i++;\r
        }\r
        t = new uint256[](i); // init t with correct length\r
        for (uint256 j = 0; j < i; j++) {\r
            t[j] = tmp[j];\r
        }\r
        return t;\r
    }\r
\r
    // move idx pass current value field, to beginning of next tag or msg end\r
    function skipValue(Buffer memory buf, WireType wire) internal pure {\r
        if (wire == WireType.Varint) {\r
            decVarint(buf);\r
        } else if (wire == WireType.LengthDelim) {\r
            uint256 len = decVarint(buf);\r
            buf.idx += len; // skip len bytes value data\r
            require(buf.idx <= buf.b.length); // avoid overflow\r
        } else {\r
            revert();\r
        } // unsupported wiretype\r
    }\r
\r
    // type conversion help utils\r
    function _bool(uint256 x) internal pure returns (bool v) {\r
        return x != 0;\r
    }\r
\r
    function _uint256(bytes memory b) internal pure returns (uint256 v) {\r
        require(b.length <= 32); // b's length must be smaller than or equal to 32\r
        assembly {\r
            v := mload(add(b, 32))\r
        } // load all 32bytes to v\r
        v = v >> (8 * (32 - b.length)); // only first b.length is valid\r
    }\r
\r
    function _address(bytes memory b) internal pure returns (address v) {\r
        v = _addressPayable(b);\r
    }\r
\r
    function _addressPayable(bytes memory b) internal pure returns (address payable v) {\r
        require(b.length == 20);\r
        //load 32bytes then shift right 12 bytes\r
        assembly {\r
            v := div(mload(add(b, 32)), 0x1000000000000000000000000)\r
        }\r
    }\r
\r
    function _bytes32(bytes memory b) internal pure returns (bytes32 v) {\r
        require(b.length == 32);\r
        assembly {\r
            v := mload(add(b, 32))\r
        }\r
    }\r
\r
    // uint[] to uint8[]\r
    function uint8s(uint256[] memory arr) internal pure returns (uint8[] memory t) {\r
        t = new uint8[](arr.length);\r
        for (uint256 i = 0; i < t.length; i++) {\r
            t[i] = uint8(arr[i]);\r
        }\r
    }\r
\r
    function uint32s(uint256[] memory arr) internal pure returns (uint32[] memory t) {\r
        t = new uint32[](arr.length);\r
        for (uint256 i = 0; i < t.length; i++) {\r
            t[i] = uint32(arr[i]);\r
        }\r
    }\r
\r
    function uint64s(uint256[] memory arr) internal pure returns (uint64[] memory t) {\r
        t = new uint64[](arr.length);\r
        for (uint256 i = 0; i < t.length; i++) {\r
            t[i] = uint64(arr[i]);\r
        }\r
    }\r
\r
    function bools(uint256[] memory arr) internal pure returns (bool[] memory t) {\r
        t = new bool[](arr.length);\r
        for (uint256 i = 0; i < t.length; i++) {\r
            t[i] = arr[i] != 0;\r
        }\r
    }\r
}\r
"
    },
    "contracts/libraries/PbPegged.sol": {
      "content": "// SPDX-License-Identifier: GPL-3.0-only\r
\r
// Code generated by protoc-gen-sol. DO NOT EDIT.\r
// source: contracts/libraries/proto/pegged.proto\r
pragma solidity 0.8.17;\r
import "./Pb.sol";\r
\r
library PbPegged {\r
    using Pb for Pb.Buffer; // so we can call Pb funcs on Buffer obj\r
\r
    struct Mint {\r
        address token; // tag: 1\r
        address account; // tag: 2\r
        uint256 amount; // tag: 3\r
        address depositor; // tag: 4\r
        uint64 refChainId; // tag: 5\r
        bytes32 refId; // tag: 6\r
    } // end struct Mint\r
\r
    function decMint(bytes memory raw) internal pure returns (Mint memory m) {\r
        Pb.Buffer memory buf = Pb.fromBytes(raw);\r
\r
        uint256 tag;\r
        Pb.WireType wire;\r
        while (buf.hasMore()) {\r
            (tag, wire) = buf.decKey();\r
            if (false) {}\r
            // solidity has no switch/case\r
            else if (tag == 1) {\r
                m.token = Pb._address(buf.decBytes());\r
            } else if (tag == 2) {\r
                m.account = Pb._address(buf.decBytes());\r
            } else if (tag == 3) {\r
                m.amount = Pb._uint256(buf.decBytes());\r
            } else if (tag == 4) {\r
                m.depositor = Pb._address(buf.decBytes());\r
            } else if (tag == 5) {\r
                m.refChainId = uint64(buf.decVarint());\r
            } else if (tag == 6) {\r
                m.refId = Pb._bytes32(buf.decBytes());\r
            } else {\r
                buf.skipValue(wire);\r
            } // skip value of unknown tag\r
        }\r
    } // end decoder Mint\r
\r
    struct Withdraw {\r
        address token; // tag: 1\r
        address receiver; // tag: 2\r
        uint256 amount; // tag: 3\r
        address burnAccount; // tag: 4\r
        uint64 refChainId; // tag: 5\r
        bytes32 refId; // tag: 6\r
    } // end struct Withdraw\r
\r
    function decWithdraw(bytes memory raw) internal pure returns (Withdraw memory m) {\r
        Pb.Buffer memory buf = Pb.fromBytes(raw);\r
\r
        uint256 tag;\r
        Pb.WireType wire;\r
        while (buf.hasMore()) {\r
            (tag, wire) = buf.decKey();\r
            if (false) {}\r
            // solidity has no switch/case\r
            else if (tag == 1) {\r
                m.token = Pb._address(buf.decBytes());\r
            } else if (tag == 2) {\r
                m.receiver = Pb._address(buf.decBytes());\r
            } else if (tag == 3) {\r
                m.amount = Pb._uint256(buf.decBytes());\r
            } else if (tag == 4) {\r
                m.burnAccount = Pb._address(buf.decBytes());\r
            } else if (tag == 5) {\r
                m.refChainId = uint64(buf.decVarint());\r
            } else if (tag == 6) {\r
                m.refId = Pb._bytes32(buf.decBytes());\r
            } else {\r
                buf.skipValue(wire);\r
            } // skip value of unknown tag\r
        }\r
    } // end decoder Withdraw\r
}\r
"
    },
    "contracts/pegged-bridge/OriginalTokenVaultV2.sol": {
      "content": "// SPDX-License-Identifier: GPL-3.0-only\r
\r
pragma solidity 0.8.17;\r
\r
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";\r
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";\r
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";\r
import "../interfaces/ISigsVerifier.sol";\r
import "../interfaces/IWETH.sol";\r
import "../libraries/PbPegged.sol";\r
import "../safeguard/Pauser.sol";\r
import "../safeguard/VolumeControl.sol";\r
import "../safeguard/DelayedTransfer.sol";\r
\r
/**\r
 * @title the vault to deposit and withdraw original tokens\r
 * @dev Work together with PeggedTokenBridge contracts deployed at remote chains\r
 */\r
contract OriginalTokenVaultV2 is ReentrancyGuard, Pauser, VolumeControl, DelayedTransfer {\r
    using SafeERC20 for IERC20;\r
\r
    ISigsVerifier public immutable sigsVerifier;\r
\r
    mapping(bytes32 => bool) public records;\r
\r
    mapping(address => uint256) public minDeposit;\r
    mapping(address => uint256) public maxDeposit;\r
\r
    address public nativeWrap;\r
    uint256 public nativeTokenTransferGas = 50000;\r
\r
    event Deposited(\r
        bytes32 depositId,\r
        address depositor,\r
        address token,\r
        uint256 amount,\r
        uint64 mintChainId,\r
        address mintAccount,\r
        uint64 nonce\r
    );\r
    event Withdrawn(\r
        bytes32 withdrawId,\r
        address receiver,\r
        address token,\r
        uint256 amount,\r
        // ref_chain_id defines the reference chain ID, taking values of:\r
        // 1. The common case of burn-withdraw: the chain ID on which the corresponding burn happened;\r
        // 2. Pegbridge fee claim: zero / not applicable;\r
        // 3. Refund for wrong deposit: this chain ID on which the deposit happened\r
        uint64 refChainId,\r
        // ref_id defines a unique reference ID, taking values of:\r
        // 1. The common case of burn-withdraw: the burn ID on the remote chain;\r
        // 2. Pegbridge fee claim: a per-account nonce;\r
        // 3. Refund for wrong deposit: the deposit ID on this chain\r
        bytes32 refId,\r
        address burnAccount\r
    );\r
    event MinDepositUpdated(address token, uint256 amount);\r
    event MaxDepositUpdated(address token, uint256 amount);\r
\r
    constructor(ISigsVerifier _sigsVerifier) {\r
        sigsVerifier = _sigsVerifier;\r
    }\r
\r
    /**\r
     * @notice Lock original tokens to trigger cross-chain mint of pegged tokens at a remote chain's PeggedTokenBridge.\r
     * NOTE: This function DOES NOT SUPPORT fee-on-transfer / rebasing tokens.\r
     * @param _token The original token address.\r
     * @param _amount The amount to deposit.\r
     * @param _mintChainId The destination chain ID to mint tokens.\r
     * @param _mintAccount The destination account to receive the minted pegged tokens.\r
     * @param _nonce A number input to guarantee unique depositId. Can be timestamp in practice.\r
     */\r
    function deposit(\r
        address _token,\r
        uint256 _amount,\r
        uint64 _mintChainId,\r
        address _mintAccount,\r
        uint64 _nonce\r
    ) external nonReentrant whenNotPaused returns (bytes32) {\r
        bytes32 depId = _deposit(_token, _amount, _mintChainId, _mintAccount, _nonce);\r
        IERC20(_token).safeTransferFrom(msg.sender, address(this), _amount);\r
        emit Deposited(depId, msg.sender, _token, _amount, _mintChainId, _mintAccount, _nonce);\r
        return depId;\r
    }\r
\r
    /**\r
     * @notice Lock native token as original token to trigger cross-chain mint of pegged tokens at a remote chain's\r
     * PeggedTokenBridge.\r
     * @param _amount The amount to deposit.\r
     * @param _mintChainId The destination chain ID to mint tokens.\r
     * @param _mintAccount The destination account to receive the minted pegged tokens.\r
     * @param _nonce A number input to guarantee unique depositId. Can be timestamp in practice.\r
     */\r
    function depositNative(\r
        uint256 _amount,\r
        uint64 _mintChainId,\r
        address _mintAccount,\r
        uint64 _nonce\r
    ) external payable nonReentrant whenNotPaused returns (bytes32) {\r
        require(msg.value == _amount, "Amount mismatch");\r
        require(nativeWrap != address(0), "Native wrap not set");\r
        bytes32 depId = _deposit(nativeWrap, _amount, _mintChainId, _mintAccount, _nonce);\r
        IWETH(nativeWrap).deposit{value: _amount}();\r
        emit Deposited(depId, msg.sender, nativeWrap, _amount, _mintChainId, _mintAccount, _nonce);\r
        return depId;\r
    }\r
\r
    function _deposit(\r
        address _token,\r
        uint256 _amount,\r
        uint64 _mintChainId,\r
        address _mintAccount,\r
        uint64 _nonce\r
    ) private returns (bytes32) {\r
        require(_amount > minDeposit[_token], "amount too small");\r
        require(maxDeposit[_token] == 0 || _amount <= maxDeposit[_token], "amount too large");\r
        bytes32 depId = keccak256(\r
            // len = 20 + 20 + 32 + 8 + 20 + 8 + 8 + 20 = 136\r
            abi.encodePacked(\r
                msg.sender,\r
                _token,\r
                _amount,\r
                _mintChainId,\r
                _mintAccount,\r
                _nonce,\r
                uint64(block.chainid),\r
                address(this)\r
            )\r
        );\r
        require(records[depId] == false, "record exists");\r
        records[depId] = true;\r
        return depId;\r
    }\r
\r
    /**\r
     * @notice Withdraw locked original tokens triggered by a burn at a remote chain's PeggedTokenBridge.\r
     * @param _request The serialized Withdraw protobuf.\r
     * @param _sigs The list of signatures sorted by signing addresses in ascending order. A relay must be signed-off by\r
     * +2/3 of the bridge's current signing power to be delivered.\r
     * @param _signers The sorted list of signers.\r
     * @param _powers The signing powers of the signers.\r
     */\r
    function withdraw(\r
        bytes calldata _request,\r
        bytes[] calldata _sigs,\r
        address[] calldata _signers,\r
        uint256[] calldata _powers\r
    ) external whenNotPaused returns (bytes32) {\r
        bytes32 domain = keccak256(abi.encodePacked(block.chainid, address(this), "Withdraw"));\r
        sigsVerifier.verifySigs(abi.encodePacked(domain, _request), _sigs, _signers, _powers);\r
        PbPegged.Withdraw memory request = PbPegged.decWithdraw(_request);\r
        bytes32 wdId = keccak256(\r
            // len = 20 + 20 + 32 + 20 + 8 + 32 + 20 = 152\r
            abi.encodePacked(\r
                request.receiver,\r
                request.token,\r
                request.amount,\r
                request.burnAccount,\r
                request.refChainId,\r
                request.refId,\r
                address(this)\r
            )\r
        );\r
        require(records[wdId] == false, "record exists");\r
        records[wdId] = true;\r
        _updateVolume(request.token, request.amount);\r
        uint256 delayThreshold = delayThresholds[request.token];\r
        if (delayThreshold > 0 && request.amount > delayThreshold) {\r
            _addDelayedTransfer(wdId, request.receiver, request.token, request.amount);\r
        } else {\r
            _sendToken(request.receiver, request.token, request.amount);\r
        }\r
        emit Withdrawn(\r
            wdId,\r
            request.receiver,\r
            request.token,\r
            request.amount,\r
            request.refChainId,\r
            request.refId,\r
            request.burnAccount\r
        );\r
        return wdId;\r
    }\r
\r
    function executeDelayedTransfer(bytes32 id) external whenNotPaused {\r
        delayedTransfer memory transfer = _executeDelayedTransfer(id);\r
        _sendToken(transfer.receiver, transfer.token, transfer.amount);\r
    }\r
\r
    function setMinDeposit(address[] calldata _tokens, uint256[] calldata _amounts) external onlyGovernor {\r
        require(_tokens.length == _amounts.length, "length mismatch");\r
        for (uint256 i = 0; i < _tokens.length; i++) {\r
            minDeposit[_tokens[i]] = _amounts[i];\r
            emit MinDepositUpdated(_tokens[i], _amounts[i]);\r
        }\r
    }\r
\r
    function setMaxDeposit(address[] calldata _tokens, uint256[] calldata _amounts) external onlyGovernor {\r
        require(_tokens.length == _amounts.length, "length mismatch");\r
        for (uint256 i = 0; i < _tokens.length; i++) {\r
            maxDeposit[_tokens[i]] = _amounts[i];\r
            emit MaxDepositUpdated(_tokens[i], _amounts[i]);\r
        }\r
    }\r
\r
    function setWrap(address _weth) external onlyOwner {\r
        nativeWrap = _weth;\r
    }\r
\r
    function _sendToken(\r
        address _receiver,\r
        address _token,\r
        uint256 _amount\r
    ) private {\r
        if (_token == nativeWrap) {\r
            // withdraw then transfer native to receiver\r
            IWETH(nativeWrap).withdraw(_amount);\r
            (bool sent, ) = _receiver.call{value: _amount, gas: nativeTokenTransferGas}("");\r
            require(sent, "failed to send native token");\r
        } else {\r
            IERC20(_token).safeTransfer(_receiver, _amount);\r
        }\r
    }\r
\r
    function setNativeTokenTransferGas(uint256 _gasUsed) external onlyGovernor {\r
        nativeTokenTransferGas = _gasUsed;\r
    }\r
\r
    receive() external payable {}\r
}\r
"
    },
    "contracts/safeguard/DelayedTransfer.sol": {
      "content": "// SPDX-License-Identifier: GPL-3.0-only\r
\r
pragma solidity 0.8.17;\r
\r
import "./Governor.sol";\r
\r
abstract contract DelayedTransfer is Governor {\r
    struct delayedTransfer {\r
        address receiver;\r
        address token;\r
        uint256 amount;\r
        uint256 timestamp;\r
    }\r
    mapping(bytes32 => delayedTransfer) public delayedTransfers;\r
    mapping(address => uint256) public delayThresholds;\r
    uint256 public delayPeriod; // in seconds\r
\r
    event DelayedTransferAdded(bytes32 id);\r
    event DelayedTransferExecuted(bytes32 id, address receiver, address token, uint256 amount);\r
\r
    event DelayPeriodUpdated(uint256 period);\r
    event DelayThresholdUpdated(address token, uint256 threshold);\r
\r
    function setDelayThresholds(address[] calldata _tokens, uint256[] calldata _thresholds) external onlyGovernor {\r
        require(_tokens.length == _thresholds.length, "length mismatch");\r
        for (uint256 i = 0; i < _tokens.length; i++) {\r
            delayThresholds[_tokens[i]] = _thresholds[i];\r
            emit DelayThresholdUpdated(_tokens[i], _thresholds[i]);\r
        }\r
    }\r
\r
    function setDelayPeriod(uint256 _period) external onlyGovernor {\r
        delayPeriod = _period;\r
        emit DelayPeriodUpdated(_period);\r
    }\r
\r
    function _addDelayedTransfer(\r
        bytes32 id,\r
        address receiver,\r
        address token,\r
        uint256 amount\r
    ) internal {\r
        require(delayedTransfers[id].timestamp == 0, "delayed transfer already exists");\r
        delayedTransfers[id] = delayedTransfer({\r
            receiver: receiver,\r
            token: token,\r
            amount: amount,\r
            timestamp: block.timestamp\r
        });\r
        emit DelayedTransferAdded(id);\r
    }\r
\r
    // caller needs to do the actual token transfer\r
    function _executeDelayedTransfer(bytes32 id) internal returns (delayedTransfer memory) {\r
        delayedTransfer memory transfer = delayedTransfers[id];\r
        require(transfer.timestamp > 0, "delayed transfer not exist");\r
        require(block.timestamp > transfer.timestamp + delayPeriod, "delayed transfer still locked");\r
        delete delayedTransfers[id];\r
        emit DelayedTransferExecuted(id, transfer.receiver, transfer.token, transfer.amount);\r
        return transfer;\r
    }\r
}\r
"
    },
    "contracts/safeguard/Governor.sol": {
      "content": "// SPDX-License-Identifier: GPL-3.0-only\r
\r
pragma solidity 0.8.17;\r
\r
import "./Ownable.sol";\r
\r
abstract contract Governor is Ownable {\r
    mapping(address => bool) public governors;\r
\r
    event GovernorAdded(address account);\r
    event GovernorRemoved(address account);\r
\r
    modifier onlyGovernor() {\r
        require(isGovernor(msg.sender), "Caller is not governor");\r
        _;\r
    }\r
\r
    constructor() {\r
        _addGovernor(msg.sender);\r
    }\r
\r
    function isGovernor(address _account) public view returns (bool) {\r
        return governors[_account];\r
    }\r
\r
    function addGovernor(address _account) public onlyOwner {\r
        _addGovernor(_account);\r
    }\r
\r
    function removeGovernor(address _account) public onlyOwner {\r
        _removeGovernor(_account);\r
    }\r
\r
    function renounceGovernor() public {\r
        _removeGovernor(msg.sender);\r
    }\r
\r
    function _addGovernor(address _account) private {\r
        require(!isGovernor(_account), "Account is already governor");\r
        governors[_account] = true;\r
        emit GovernorAdded(_account);\r
    }\r
\r
    function _removeGovernor(address _account) private {\r
        require(isGovernor(_account), "Account is not governor");\r
        governors[_account] = false;\r
        emit GovernorRemoved(_account);\r
    }\r
}\r
"
    },
    "contracts/safeguard/Ownable.sol": {
      "content": "// SPDX-License-Identifier: GPL-3.0-only\r
\r
pragma solidity ^0.8.0;\r
\r
/**\r
 * @dev Contract module which provides a basic access control mechanism, where\r
 * there is an account (an owner) that can be granted exclusive access to\r
 * specific functions.\r
 *\r
 * By default, the owner account will be the one that deploys the contract. This\r
 * can later be changed with {transferOwnership}.\r
 *\r
 * This module is used through inheritance. It will make available the modifier\r
 * `onlyOwner`, which can be applied to your functions to restrict their use to\r
 * the owner.\r
 *\r
 * This adds a normal func that setOwner if _owner is address(0). So we can't allow\r
 * renounceOwnership. So we can support Proxy based upgradable contract\r
 */\r
abstract contract Ownable {\r
    address private _owner;\r
\r
    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\r
\r
    /**\r
     * @dev Initializes the contract setting the deployer as the initial owner.\r
     */\r
    constructor() {\r
        _setOwner(msg.sender);\r
    }\r
\r
    /**\r
     * @dev Only to be called by inherit contracts, in their init func called by Proxy\r
     * we require _owner == address(0), which is only possible when it's a delegateCall\r
     * because constructor sets _owner in contract state.\r
     */\r
    function initOwner() internal {\r
        require(_owner == address(0), "owner already set");\r
        _setOwner(msg.sender);\r
    }\r
\r
    /**\r
     * @dev Returns the address of the current owner.\r
     */\r
    function owner() public view virtual returns (address) {\r
        return _owner;\r
    }\r
\r
    /**\r
     * @dev Throws if called by any account other than the owner.\r
     */\r
    modifier onlyOwner() {\r
        require(owner() == msg.sender, "Ownable: caller is not the owner");\r
        _;\r
    }\r
\r
    /**\r
     * @dev Transfers ownership of the contract to a new account (`newOwner`).\r
     * Can only be called by the current owner.\r
     */\r
    function transferOwnership(address newOwner) public virtual onlyOwner {\r
        require(newOwner != address(0), "Ownable: new owner is the zero address");\r
        _setOwner(newOwner);\r
    }\r
\r
    function _setOwner(address newOwner) private {\r
        address oldOwner = _owner;\r
        _owner = newOwner;\r
        emit OwnershipTransferred(oldOwner, newOwner);\r
    }\r
}\r
"
    },
    "contracts/safeguard/Pauser.sol": {
      "content": "// SPDX-License-Identifier: GPL-3.0-only\r
\r
pragma solidity 0.8.17;\r
\r
import "@openzeppelin/contracts/security/Pausable.sol";\r
import "./Ownable.sol";\r
\r
abstract contract Pauser is Ownable, Pausable {\r
    mapping(address => bool) public pausers;\r
\r
    event PauserAdded(address account);\r
    event PauserRemoved(address account);\r
\r
    constructor() {\r
        _addPauser(msg.sender);\r
    }\r
\r
    modifier onlyPauser() {\r
        require(isPauser(msg.sender), "Caller is not pauser");\r
        _;\r
    }\r
\r
    function pause() public onlyPauser {\r
        _pause();\r
    }\r
\r
    function unpause() public onlyPauser {\r
        _unpause();\r
    }\r
\r
    function isPauser(address account) public view returns (bool) {\r
        return pausers[account];\r
    }\r
\r
    function addPauser(address account) public onlyOwner {\r
        _addPauser(account);\r
    }\r
\r
    function removePauser(address account) public onlyOwner {\r
        _removePauser(account);\r
    }\r
\r
    function renouncePauser() public {\r
        _removePauser(msg.sender);\r
    }\r
\r
    function _addPauser(address account) private {\r
        require(!isPauser(account), "Account is already pauser");\r
        pausers[account] = true;\r
        emit PauserAdded(account);\r
    }\r
\r
    function _removePauser(address account) private {\r
        require(isPauser(account), "Account is not pauser");\r
        pausers[account] = false;\r
        emit PauserRemoved(account);\r
    }\r
}\r
"
    },
    "contracts/safeguard/VolumeControl.sol": {
      "content": "// SPDX-License-Identifier: GPL-3.0-only\r
\r
pragma solidity 0.8.17;\r
\r
import "./Governor.sol";\r
\r
abstract contract VolumeControl is Governor {\r
    uint256 public epochLength; // seconds\r
    mapping(address => uint256) public epochVolumes; // key is token\r
    mapping(address => uint256) public epochVolumeCaps; // key is token\r
    mapping(address => uint256) public lastOpTimestamps; // key is token\r
\r
    event EpochLengthUpdated(uint256 length);\r
    event EpochVolumeUpdated(address token, uint256 cap);\r
\r
    function setEpochLength(uint256 _length) external onlyGovernor {\r
        epochLength = _length;\r
        emit EpochLengthUpdated(_length);\r
    }\r
\r
    function setEpochVolumeCaps(address[] calldata _tokens, uint256[] calldata _caps) external onlyGovernor {\r
        require(_tokens.length == _caps.length, "length mismatch");\r
        for (uint256 i = 0; i < _tokens.length; i++) {\r
            epochVolumeCaps[_tokens[i]] = _caps[i];\r
            emit EpochVolumeUpdated(_tokens[i], _caps[i]);\r
        }\r
    }\r
\r
    function _updateVolume(address _token, uint256 _amount) internal {\r
        if (epochLength == 0) {\r
            return;\r
        }\r
        uint256 cap = epochVolumeCaps[_token];\r
        if (cap == 0) {\r
            return;\r
        }\r
        uint256 volume = epochVolumes[_token];\r
        uint256 timestamp = block.timestamp;\r
        uint256 epochStartTime = (timestamp / epochLength) * epochLength;\r
        if (lastOpTimestamps[_token] < epochStartTime) {\r
            volume = _amount;\r
        } else {\r
            volume += _amount;\r
        }\r
        require(volume <= cap, "volume exceeds cap");\r
        epochVolumes[_token] = volume;\r
        lastOpTimestamps[_token] = timestamp;\r
    }\r
}\r
"
    }
  },
  "settings": {
    "optimizer": {
      "enabled": true,
      "runs": 800
    },
    "outputSelection": {
      "*": {
        "*": [
          "evm.bytecode",
          "evm.deployedBytecode",
          "devdoc",
          "userdoc",
          "metadata",
          "abi"
        ]
      }
    },
    "metadata": {
      "useLiteralContent": true
    }
  }
}}

Tags:
ERC20, Multisig, Pausable, Voting, Upgradeable, Multi-Signature, Factory|addr:0x038ceb34fe309bca14f92aade2e34a955b318f4c|verified:true|block:23726538|tx:0x9c11be009872876c7ac6d7c41994aca2c914e1ffe9706f85b250b40d4efd07c2|first_check:1762269966

Submitted on: 2025-11-04 16:26:08

Comments

Log in to comment.

No comments yet.