ETH Price: $3,116.73 (+0.50%)

Contract

0x9e733e5cE6406399ce072d427069a66F706B4374
 

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Burn204526172024-08-04 3:52:23104 days ago1722743543IN
0x9e733e5c...F706B4374
0 ETH0.000437263.58510366
Burn202084412024-07-01 1:39:11138 days ago1719797951IN
0x9e733e5c...F706B4374
0 ETH0.000861146.19224573
Burn198306912024-05-09 6:27:47191 days ago1715236067IN
0x9e733e5c...F706B4374
0 ETH0.000567774.84670232
Burn198306852024-05-09 6:26:35191 days ago1715235995IN
0x9e733e5c...F706B4374
0 ETH0.000649544.67073254
Burn192972482024-02-24 11:48:23265 days ago1708775303IN
0x9e733e5c...F706B4374
0 ETH0.0033386324.86734288
Burn192968962024-02-24 10:37:59265 days ago1708771079IN
0x9e733e5c...F706B4374
0 ETH0.00273823.36583418
Burn186491712023-11-25 14:01:11356 days ago1700920871IN
0x9e733e5c...F706B4374
0 ETH0.0035811429.35800798
Burn186488442023-11-25 12:54:59356 days ago1700916899IN
0x9e733e5c...F706B4374
0 ETH0.0023046719.66579299
Burn185746552023-11-15 3:36:11367 days ago1700019371IN
0x9e733e5c...F706B4374
0 ETH0.0039618129.5041004
Burn184814162023-11-02 2:25:35380 days ago1698891935IN
0x9e733e5c...F706B4374
0 ETH0.0039165128.16013234
Burn183455242023-10-14 2:04:11399 days ago1697249051IN
0x9e733e5c...F706B4374
0 ETH0.001064767.65642164
Burn182522652023-10-01 1:00:23412 days ago1696122023IN
0x9e733e5c...F706B4374
0 ETH0.00129097.72728052
Burn179753512023-08-23 5:34:23451 days ago1692768863IN
0x9e733e5c...F706B4374
0 ETH0.0022405816.68742615
Transfer171299272023-04-26 10:52:59569 days ago1682506379IN
0x9e733e5c...F706B4374
0 ETH0.0014970831.97810292
Burn169678802023-04-03 10:23:11592 days ago1680517391IN
0x9e733e5c...F706B4374
0 ETH0.002828421.06346357
Burn168117822023-03-12 11:54:59614 days ago1678622099IN
0x9e733e5c...F706B4374
0 ETH0.0023301719.88915416
Burn166383812023-02-16 2:41:47639 days ago1676515307IN
0x9e733e5c...F706B4374
0 ETH0.0049037236.52188272
Burn162369442022-12-22 1:26:23695 days ago1671672383IN
0x9e733e5c...F706B4374
0 ETH0.001848113.76307956
Burn162273912022-12-20 17:26:35696 days ago1671557195IN
0x9e733e5c...F706B4374
0 ETH0.0025034418
Burn160173302022-11-21 8:55:35726 days ago1669020935IN
0x9e733e5c...F706B4374
0 ETH0.0017783412.78648675
Burn160015092022-11-19 3:55:23728 days ago1668830123IN
0x9e733e5c...F706B4374
0 ETH0.0017295512.88133568
Burn158519712022-10-29 6:36:59749 days ago1667025419IN
0x9e733e5c...F706B4374
0 ETH0.0014298610.28173445
Burn155527472022-09-17 10:36:23790 days ago1663410983IN
0x9e733e5c...F706B4374
0 ETH0.000585444.8
Burn155280242022-09-13 16:49:38794 days ago1663087778IN
0x9e733e5c...F706B4374
0 ETH0.0024636118.34654061
Burn155257632022-09-13 7:50:28795 days ago1663055428IN
0x9e733e5c...F706B4374
0 ETH0.000792846.76659378
View all transactions

Latest 1 internal transaction

Advanced mode:
Parent Transaction Hash Block From To
130227712021-08-14 10:41:021189 days ago1628937662  Contract Creation0 ETH
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
BToken

Compiler Version
v0.8.6+commit.11564f7e

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion, None license

Contract Source Code (Solidity)

/**
 *Submitted for verification at Etherscan.io on 2021-08-20
*/

// SPDX-License-Identifier: BUSL-1.1

pragma solidity 0.8.6;



// Part: IBetaBank

interface IBetaBank {
  /// @dev Returns the address of BToken of the given underlying token, or 0 if not exists.
  function bTokens(address _underlying) external view returns (address);

  /// @dev Returns the address of the underlying of the given BToken, or 0 if not exists.
  function underlyings(address _bToken) external view returns (address);

  /// @dev Returns the address of the oracle contract.
  function oracle() external view returns (address);

  /// @dev Returns the address of the config contract.
  function config() external view returns (address);

  /// @dev Returns the interest rate model smart contract.
  function interestModel() external view returns (address);

  /// @dev Returns the position's collateral token and AmToken.
  function getPositionTokens(address _owner, uint _pid)
    external
    view
    returns (address _collateral, address _bToken);

  /// @dev Returns the debt of the given position. Can't be view as it needs to call accrue.
  function fetchPositionDebt(address _owner, uint _pid) external returns (uint);

  /// @dev Returns the LTV of the given position. Can't be view as it needs to call accrue.
  function fetchPositionLTV(address _owner, uint _pid) external returns (uint);

  /// @dev Opens a new position in the Beta smart contract.
  function open(
    address _owner,
    address _underlying,
    address _collateral
  ) external returns (uint pid);

  /// @dev Borrows tokens on the given position.
  function borrow(
    address _owner,
    uint _pid,
    uint _amount
  ) external;

  /// @dev Repays tokens on the given position.
  function repay(
    address _owner,
    uint _pid,
    uint _amount
  ) external;

  /// @dev Puts more collateral to the given position.
  function put(
    address _owner,
    uint _pid,
    uint _amount
  ) external;

  /// @dev Takes some collateral out of the position.
  function take(
    address _owner,
    uint _pid,
    uint _amount
  ) external;

  /// @dev Liquidates the given position.
  function liquidate(
    address _owner,
    uint _pid,
    uint _amount
  ) external;
}

// Part: IBetaConfig

interface IBetaConfig {
  /// @dev Returns the risk level for the given asset.
  function getRiskLevel(address token) external view returns (uint);

  /// @dev Returns the rate of interest collected to be distributed to the protocol reserve.
  function reserveRate() external view returns (uint);

  /// @dev Returns the beneficiary to receive a portion interest rate for the protocol.
  function reserveBeneficiary() external view returns (address);

  /// @dev Returns the ratio of which the given token consider for collateral value.
  function getCollFactor(address token) external view returns (uint);

  /// @dev Returns the max amount of collateral to accept globally.
  function getCollMaxAmount(address token) external view returns (uint);

  /// @dev Returns max ltv of collateral / debt to allow a new position.
  function getSafetyLTV(address token) external view returns (uint);

  /// @dev Returns max ltv of collateral / debt to liquidate a position of the given token.
  function getLiquidationLTV(address token) external view returns (uint);

  /// @dev Returns the bonus incentive reward factor for liquidators.
  function getKillBountyRate(address token) external view returns (uint);
}

// Part: IBetaInterestModel

interface IBetaInterestModel {
  /// @dev Returns the initial interest rate per year (times 1e18).
  function initialRate() external view returns (uint);

  /// @dev Returns the next interest rate for the market.
  /// @param prevRate The current interest rate.
  /// @param totalAvailable The current available liquidity.
  /// @param totalLoan The current outstanding loan.
  /// @param timePast The time past since last interest rate rebase in seconds.
  function getNextInterestRate(
    uint prevRate,
    uint totalAvailable,
    uint totalLoan,
    uint timePast
  ) external view returns (uint);
}

// Part: OpenZeppelin/[email protected]/Address

/**
 * @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
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

        uint256 size;
        assembly {
            size := extcodesize(account)
        }
        return size > 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);
    }

    function _verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) private 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);
            }
        }
    }
}

// Part: OpenZeppelin/[email protected]/Context

/*
 * @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;
    }
}

// Part: OpenZeppelin/[email protected]/Counters

/**
 * @title Counters
 * @author Matt Condon (@shrugs)
 * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number
 * of elements in a mapping, issuing ERC721 ids, or counting request ids.
 *
 * Include with `using Counters for Counters.Counter;`
 */
library Counters {
    struct Counter {
        // This variable should never be directly accessed by users of the library: interactions must be restricted to
        // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add
        // this feature: see https://github.com/ethereum/solidity/issues/4637
        uint256 _value; // default: 0
    }

    function current(Counter storage counter) internal view returns (uint256) {
        return counter._value;
    }

    function increment(Counter storage counter) internal {
        unchecked {
            counter._value += 1;
        }
    }

    function decrement(Counter storage counter) internal {
        uint256 value = counter._value;
        require(value > 0, "Counter: decrement overflow");
        unchecked {
            counter._value = value - 1;
        }
    }

    function reset(Counter storage counter) internal {
        counter._value = 0;
    }
}

// Part: OpenZeppelin/[email protected]/ECDSA

/**
 * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.
 *
 * These functions can be used to verify that a message was signed by the holder
 * of the private keys of a given address.
 */
library ECDSA {
    /**
     * @dev Returns the address that signed a hashed message (`hash`) with
     * `signature`. This address can then be used for verification purposes.
     *
     * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
     * this function rejects them by requiring the `s` value to be in the lower
     * half order, and the `v` value to be either 27 or 28.
     *
     * IMPORTANT: `hash` _must_ be the result of a hash operation for the
     * verification to be secure: it is possible to craft signatures that
     * recover to arbitrary addresses for non-hashed data. A safe way to ensure
     * this is by receiving a hash of the original message (which may otherwise
     * be too long), and then calling {toEthSignedMessageHash} on it.
     *
     * Documentation for signature generation:
     * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]
     * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]
     */
    function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {
        // Check the signature length
        // - case 65: r,s,v signature (standard)
        // - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098) _Available since v4.1._
        if (signature.length == 65) {
            bytes32 r;
            bytes32 s;
            uint8 v;
            // ecrecover takes the signature parameters, and the only way to get them
            // currently is to use assembly.
            assembly {
                r := mload(add(signature, 0x20))
                s := mload(add(signature, 0x40))
                v := byte(0, mload(add(signature, 0x60)))
            }
            return recover(hash, v, r, s);
        } else if (signature.length == 64) {
            bytes32 r;
            bytes32 vs;
            // ecrecover takes the signature parameters, and the only way to get them
            // currently is to use assembly.
            assembly {
                r := mload(add(signature, 0x20))
                vs := mload(add(signature, 0x40))
            }
            return recover(hash, r, vs);
        } else {
            revert("ECDSA: invalid signature length");
        }
    }

    /**
     * @dev Overload of {ECDSA-recover} that receives the `r` and `vs` short-signature fields separately.
     *
     * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]
     *
     * _Available since v4.2._
     */
    function recover(
        bytes32 hash,
        bytes32 r,
        bytes32 vs
    ) internal pure returns (address) {
        bytes32 s;
        uint8 v;
        assembly {
            s := and(vs, 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff)
            v := add(shr(255, vs), 27)
        }
        return recover(hash, v, r, s);
    }

    /**
     * @dev Overload of {ECDSA-recover} that receives the `v`, `r` and `s` signature fields separately.
     */
    function recover(
        bytes32 hash,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal pure returns (address) {
        // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature
        // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines
        // the valid range for s in (281): 0 < s < secp256k1n ÷ 2 + 1, and for v in (282): v ∈ {27, 28}. Most
        // signatures from current libraries generate a unique signature with an s-value in the lower half order.
        //
        // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value
        // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or
        // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept
        // these malleable signatures as well.
        require(
            uint256(s) <= 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0,
            "ECDSA: invalid signature 's' value"
        );
        require(v == 27 || v == 28, "ECDSA: invalid signature 'v' value");

        // If the signature is valid (and not malleable), return the signer address
        address signer = ecrecover(hash, v, r, s);
        require(signer != address(0), "ECDSA: invalid signature");

        return signer;
    }

    /**
     * @dev Returns an Ethereum Signed Message, created from a `hash`. This
     * produces hash corresponding to the one signed with the
     * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
     * JSON-RPC method as part of EIP-191.
     *
     * See {recover}.
     */
    function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {
        // 32 is the length in bytes of hash,
        // enforced by the type signature above
        return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash));
    }

    /**
     * @dev Returns an Ethereum Signed Typed Data, created from a
     * `domainSeparator` and a `structHash`. This produces hash corresponding
     * to the one signed with the
     * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]
     * JSON-RPC method as part of EIP-712.
     *
     * See {recover}.
     */
    function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {
        return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
    }
}

// Part: OpenZeppelin/[email protected]/IERC20

/**
 * @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 `recipient`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address recipient, 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 `sender` to `recipient` 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 sender,
        address recipient,
        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);
}

// Part: OpenZeppelin/[email protected]/IERC20Permit

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

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

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

// Part: OpenZeppelin/[email protected]/Math

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

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

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

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

// Part: OpenZeppelin/[email protected]/ReentrancyGuard

/**
 * @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 make 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;
    }
}

// Part: OpenZeppelin/[email protected]/EIP712

/**
 * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data.
 *
 * The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible,
 * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding
 * they need in their contracts using a combination of `abi.encode` and `keccak256`.
 *
 * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding
 * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA
 * ({_hashTypedDataV4}).
 *
 * The implementation of the domain separator was designed to be as efficient as possible while still properly updating
 * the chain id to protect against replay attacks on an eventual fork of the chain.
 *
 * NOTE: This contract implements the version of the encoding known as "v4", as implemented by the JSON RPC method
 * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask].
 *
 * _Available since v3.4._
 */
abstract contract EIP712 {
    /* solhint-disable var-name-mixedcase */
    // Cache the domain separator as an immutable value, but also store the chain id that it corresponds to, in order to
    // invalidate the cached domain separator if the chain id changes.
    bytes32 private immutable _CACHED_DOMAIN_SEPARATOR;
    uint256 private immutable _CACHED_CHAIN_ID;

    bytes32 private immutable _HASHED_NAME;
    bytes32 private immutable _HASHED_VERSION;
    bytes32 private immutable _TYPE_HASH;

    /* solhint-enable var-name-mixedcase */

    /**
     * @dev Initializes the domain separator and parameter caches.
     *
     * The meaning of `name` and `version` is specified in
     * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]:
     *
     * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol.
     * - `version`: the current major version of the signing domain.
     *
     * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart
     * contract upgrade].
     */
    constructor(string memory name, string memory version) {
        bytes32 hashedName = keccak256(bytes(name));
        bytes32 hashedVersion = keccak256(bytes(version));
        bytes32 typeHash = keccak256(
            "EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"
        );
        _HASHED_NAME = hashedName;
        _HASHED_VERSION = hashedVersion;
        _CACHED_CHAIN_ID = block.chainid;
        _CACHED_DOMAIN_SEPARATOR = _buildDomainSeparator(typeHash, hashedName, hashedVersion);
        _TYPE_HASH = typeHash;
    }

    /**
     * @dev Returns the domain separator for the current chain.
     */
    function _domainSeparatorV4() internal view returns (bytes32) {
        if (block.chainid == _CACHED_CHAIN_ID) {
            return _CACHED_DOMAIN_SEPARATOR;
        } else {
            return _buildDomainSeparator(_TYPE_HASH, _HASHED_NAME, _HASHED_VERSION);
        }
    }

    function _buildDomainSeparator(
        bytes32 typeHash,
        bytes32 nameHash,
        bytes32 versionHash
    ) private view returns (bytes32) {
        return keccak256(abi.encode(typeHash, nameHash, versionHash, block.chainid, address(this)));
    }

    /**
     * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this
     * function returns the hash of the fully encoded EIP712 message for this domain.
     *
     * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example:
     *
     * ```solidity
     * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(
     *     keccak256("Mail(address to,string contents)"),
     *     mailTo,
     *     keccak256(bytes(mailContents))
     * )));
     * address signer = ECDSA.recover(digest, signature);
     * ```
     */
    function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) {
        return ECDSA.toTypedDataHash(_domainSeparatorV4(), structHash);
    }
}

// Part: OpenZeppelin/[email protected]/IERC20Metadata

/**
 * @dev Interface for the optional metadata functions from the ERC20 standard.
 *
 * _Available since v4.1._
 */
interface IERC20Metadata is IERC20 {
    /**
     * @dev Returns the name of the token.
     */
    function name() external view returns (string memory);

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

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

// Part: OpenZeppelin/[email protected]/Pausable

/**
 * @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());
    }
}

// Part: OpenZeppelin/[email protected]/SafeERC20

/**
 * @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");
        }
    }
}

// Part: OpenZeppelin/[email protected]/ERC20

/**
 * @dev Implementation of the {IERC20} interface.
 *
 * This implementation is agnostic to the way tokens are created. This means
 * that a supply mechanism has to be added in a derived contract using {_mint}.
 * For a generic mechanism see {ERC20PresetMinterPauser}.
 *
 * TIP: For a detailed writeup see our guide
 * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
 * to implement supply mechanisms].
 *
 * We have followed general OpenZeppelin guidelines: functions revert instead
 * of returning `false` on failure. This behavior is nonetheless conventional
 * and does not conflict with the expectations of ERC20 applications.
 *
 * Additionally, an {Approval} event is emitted on calls to {transferFrom}.
 * This allows applications to reconstruct the allowance for all accounts just
 * by listening to said events. Other implementations of the EIP may not emit
 * these events, as it isn't required by the specification.
 *
 * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
 * functions have been added to mitigate the well-known issues around setting
 * allowances. See {IERC20-approve}.
 */
contract ERC20 is Context, IERC20, IERC20Metadata {
    mapping(address => uint256) private _balances;

    mapping(address => mapping(address => uint256)) private _allowances;

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;

    /**
     * @dev Sets the values for {name} and {symbol}.
     *
     * The default value of {decimals} is 18. To select a different value for
     * {decimals} you should overload it.
     *
     * All two of these values are immutable: they can only be set once during
     * construction.
     */
    constructor(string memory name_, string memory symbol_) {
        _name = name_;
        _symbol = symbol_;
    }

    /**
     * @dev Returns the name of the token.
     */
    function name() public view virtual override returns (string memory) {
        return _name;
    }

    /**
     * @dev Returns the symbol of the token, usually a shorter version of the
     * name.
     */
    function symbol() public view virtual override returns (string memory) {
        return _symbol;
    }

    /**
     * @dev Returns the number of decimals used to get its user representation.
     * For example, if `decimals` equals `2`, a balance of `505` tokens should
     * be displayed to a user as `5,05` (`505 / 10 ** 2`).
     *
     * Tokens usually opt for a value of 18, imitating the relationship between
     * Ether and Wei. This is the value {ERC20} uses, unless this function is
     * overridden;
     *
     * NOTE: This information is only used for _display_ purposes: it in
     * no way affects any of the arithmetic of the contract, including
     * {IERC20-balanceOf} and {IERC20-transfer}.
     */
    function decimals() public view virtual override returns (uint8) {
        return 18;
    }

    /**
     * @dev See {IERC20-totalSupply}.
     */
    function totalSupply() public view virtual override returns (uint256) {
        return _totalSupply;
    }

    /**
     * @dev See {IERC20-balanceOf}.
     */
    function balanceOf(address account) public view virtual override returns (uint256) {
        return _balances[account];
    }

    /**
     * @dev See {IERC20-transfer}.
     *
     * Requirements:
     *
     * - `recipient` cannot be the zero address.
     * - the caller must have a balance of at least `amount`.
     */
    function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
        _transfer(_msgSender(), recipient, amount);
        return true;
    }

    /**
     * @dev See {IERC20-allowance}.
     */
    function allowance(address owner, address spender) public view virtual override returns (uint256) {
        return _allowances[owner][spender];
    }

    /**
     * @dev See {IERC20-approve}.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function approve(address spender, uint256 amount) public virtual override returns (bool) {
        _approve(_msgSender(), spender, amount);
        return true;
    }

    /**
     * @dev See {IERC20-transferFrom}.
     *
     * Emits an {Approval} event indicating the updated allowance. This is not
     * required by the EIP. See the note at the beginning of {ERC20}.
     *
     * Requirements:
     *
     * - `sender` and `recipient` cannot be the zero address.
     * - `sender` must have a balance of at least `amount`.
     * - the caller must have allowance for ``sender``'s tokens of at least
     * `amount`.
     */
    function transferFrom(
        address sender,
        address recipient,
        uint256 amount
    ) public virtual override returns (bool) {
        _transfer(sender, recipient, amount);

        uint256 currentAllowance = _allowances[sender][_msgSender()];
        require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
        unchecked {
            _approve(sender, _msgSender(), currentAllowance - amount);
        }

        return true;
    }

    /**
     * @dev Atomically increases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
        _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);
        return true;
    }

    /**
     * @dev Atomically decreases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `spender` must have allowance for the caller of at least
     * `subtractedValue`.
     */
    function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
        uint256 currentAllowance = _allowances[_msgSender()][spender];
        require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
        unchecked {
            _approve(_msgSender(), spender, currentAllowance - subtractedValue);
        }

        return true;
    }

    /**
     * @dev Moves `amount` of tokens from `sender` to `recipient`.
     *
     * This internal function is equivalent to {transfer}, and can be used to
     * e.g. implement automatic token fees, slashing mechanisms, etc.
     *
     * Emits a {Transfer} event.
     *
     * Requirements:
     *
     * - `sender` cannot be the zero address.
     * - `recipient` cannot be the zero address.
     * - `sender` must have a balance of at least `amount`.
     */
    function _transfer(
        address sender,
        address recipient,
        uint256 amount
    ) internal virtual {
        require(sender != address(0), "ERC20: transfer from the zero address");
        require(recipient != address(0), "ERC20: transfer to the zero address");

        _beforeTokenTransfer(sender, recipient, amount);

        uint256 senderBalance = _balances[sender];
        require(senderBalance >= amount, "ERC20: transfer amount exceeds balance");
        unchecked {
            _balances[sender] = senderBalance - amount;
        }
        _balances[recipient] += amount;

        emit Transfer(sender, recipient, amount);

        _afterTokenTransfer(sender, recipient, amount);
    }

    /** @dev Creates `amount` tokens and assigns them to `account`, increasing
     * the total supply.
     *
     * Emits a {Transfer} event with `from` set to the zero address.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     */
    function _mint(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: mint to the zero address");

        _beforeTokenTransfer(address(0), account, amount);

        _totalSupply += amount;
        _balances[account] += amount;
        emit Transfer(address(0), account, amount);

        _afterTokenTransfer(address(0), account, amount);
    }

    /**
     * @dev Destroys `amount` tokens from `account`, reducing the
     * total supply.
     *
     * Emits a {Transfer} event with `to` set to the zero address.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     * - `account` must have at least `amount` tokens.
     */
    function _burn(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: burn from the zero address");

        _beforeTokenTransfer(account, address(0), amount);

        uint256 accountBalance = _balances[account];
        require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
        unchecked {
            _balances[account] = accountBalance - amount;
        }
        _totalSupply -= amount;

        emit Transfer(account, address(0), amount);

        _afterTokenTransfer(account, address(0), amount);
    }

    /**
     * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
     *
     * This internal function is equivalent to `approve`, and can be used to
     * e.g. set automatic allowances for certain subsystems, etc.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `owner` cannot be the zero address.
     * - `spender` cannot be the zero address.
     */
    function _approve(
        address owner,
        address spender,
        uint256 amount
    ) internal virtual {
        require(owner != address(0), "ERC20: approve from the zero address");
        require(spender != address(0), "ERC20: approve to the zero address");

        _allowances[owner][spender] = amount;
        emit Approval(owner, spender, amount);
    }

    /**
     * @dev Hook that is called before any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * will be transferred to `to`.
     * - when `from` is zero, `amount` tokens will be minted for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens will be burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 amount
    ) internal virtual {}

    /**
     * @dev Hook that is called after any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * has been transferred to `to`.
     * - when `from` is zero, `amount` tokens have been minted for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens have been burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _afterTokenTransfer(
        address from,
        address to,
        uint256 amount
    ) internal virtual {}
}

// Part: OpenZeppelin/[email protected]/ERC20Permit

/**
 * @dev Implementation of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
 * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
 *
 * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
 * presenting a message signed by the account. By not relying on `{IERC20-approve}`, the token holder account doesn't
 * need to send a transaction, and thus is not required to hold Ether at all.
 *
 * _Available since v3.4._
 */
abstract contract ERC20Permit is ERC20, IERC20Permit, EIP712 {
    using Counters for Counters.Counter;

    mapping(address => Counters.Counter) private _nonces;

    // solhint-disable-next-line var-name-mixedcase
    bytes32 private immutable _PERMIT_TYPEHASH =
        keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)");

    /**
     * @dev Initializes the {EIP712} domain separator using the `name` parameter, and setting `version` to `"1"`.
     *
     * It's a good idea to use the same `name` that is defined as the ERC20 token name.
     */
    constructor(string memory name) EIP712(name, "1") {}

    /**
     * @dev See {IERC20Permit-permit}.
     */
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) public virtual override {
        require(block.timestamp <= deadline, "ERC20Permit: expired deadline");

        bytes32 structHash = keccak256(abi.encode(_PERMIT_TYPEHASH, owner, spender, value, _useNonce(owner), deadline));

        bytes32 hash = _hashTypedDataV4(structHash);

        address signer = ECDSA.recover(hash, v, r, s);
        require(signer == owner, "ERC20Permit: invalid signature");

        _approve(owner, spender, value);
    }

    /**
     * @dev See {IERC20Permit-nonces}.
     */
    function nonces(address owner) public view virtual override returns (uint256) {
        return _nonces[owner].current();
    }

    /**
     * @dev See {IERC20Permit-DOMAIN_SEPARATOR}.
     */
    // solhint-disable-next-line func-name-mixedcase
    function DOMAIN_SEPARATOR() external view override returns (bytes32) {
        return _domainSeparatorV4();
    }

    /**
     * @dev "Consume a nonce": return the current value and increment.
     *
     * _Available since v4.1._
     */
    function _useNonce(address owner) internal virtual returns (uint256 current) {
        Counters.Counter storage nonce = _nonces[owner];
        current = nonce.current();
        nonce.increment();
    }
}

// File: BToken.sol

contract BToken is ERC20Permit, ReentrancyGuard {
  using SafeERC20 for IERC20;

  event Accrue(uint interest);
  event Mint(address indexed caller, address indexed to, uint amount, uint credit);
  event Burn(address indexed caller, address indexed to, uint amount, uint credit);

  uint public constant MINIMUM_LIQUIDITY = 10**6; // minimum liquidity to be locked in the pool when first mint occurs

  address public immutable betaBank; // BetaBank address
  address public immutable underlying; // the underlying token

  uint public interestRate; // current interest rate
  uint public lastAccrueTime; // last interest accrual timestamp
  uint public totalLoanable; // total asset amount available to be borrowed
  uint public totalLoan; // total amount of loan
  uint public totalDebtShare; // total amount of debt share

  /// @dev Initializes the BToken contract.
  /// @param _betaBank BetaBank address.
  /// @param _underlying The underlying token address for the bToken.
  constructor(address _betaBank, address _underlying)
    ERC20Permit('B Token')
    ERC20('B Token', 'bTOKEN')
  {
    require(_betaBank != address(0), 'constructor/betabank-zero-address');
    require(_underlying != address(0), 'constructor/underlying-zero-address');
    betaBank = _betaBank;
    underlying = _underlying;
    interestRate = IBetaInterestModel(IBetaBank(_betaBank).interestModel()).initialRate();
    lastAccrueTime = block.timestamp;
  }

  /// @dev Returns the name of the token.
  function name() public view override returns (string memory) {
    try IERC20Metadata(underlying).name() returns (string memory data) {
      return string(abi.encodePacked('B ', data));
    } catch (bytes memory) {
      return ERC20.name();
    }
  }

  /// @dev Returns the symbol of the token.
  function symbol() public view override returns (string memory) {
    try IERC20Metadata(underlying).symbol() returns (string memory data) {
      return string(abi.encodePacked('b', data));
    } catch (bytes memory) {
      return ERC20.symbol();
    }
  }

  /// @dev Returns the decimal places of the token.
  function decimals() public view override returns (uint8) {
    try IERC20Metadata(underlying).decimals() returns (uint8 data) {
      return data;
    } catch (bytes memory) {
      return ERC20.decimals();
    }
  }

  /// @dev Accrues interest rate and adjusts the rate. Can be called by anyone at any time.
  function accrue() public {
    // 1. Check time past condition
    uint timePassed = block.timestamp - lastAccrueTime;
    if (timePassed == 0) return;
    lastAccrueTime = block.timestamp;
    // 2. Check bank pause condition
    require(!Pausable(betaBank).paused(), 'BetaBank/paused');
    // 3. Compute the accrued interest value over the past time
    (uint totalLoan_, uint totalLoanable_, uint interestRate_) = (
      totalLoan,
      totalLoanable,
      interestRate
    ); // gas saving by avoiding multiple SLOADs
    IBetaConfig config = IBetaConfig(IBetaBank(betaBank).config());
    IBetaInterestModel model = IBetaInterestModel(IBetaBank(betaBank).interestModel());
    uint interest = (interestRate_ * totalLoan_ * timePassed) / (365 days) / 1e18;
    // 4. Update total loan and next interest rate
    totalLoan_ += interest;
    totalLoan = totalLoan_;
    interestRate = model.getNextInterestRate(interestRate_, totalLoanable_, totalLoan_, timePassed);
    // 5. Send a portion of collected interest to the beneficiary
    if (interest > 0) {
      uint reserveRate = config.reserveRate();
      if (reserveRate > 0) {
        uint toReserve = (interest * reserveRate) / 1e18;
        _mint(
          config.reserveBeneficiary(),
          (toReserve * totalSupply()) / (totalLoan_ + totalLoanable_ - toReserve)
        );
      }
      emit Accrue(interest);
    }
  }

  /// @dev Returns the debt value for the given debt share. Automatically calls accrue.
  function fetchDebtShareValue(uint _debtShare) external returns (uint) {
    accrue();
    if (_debtShare == 0) {
      return 0;
    }
    return Math.ceilDiv(_debtShare * totalLoan, totalDebtShare); // round up
  }

  /// @dev Mints new bToken to the given address.
  /// @param _to The address to mint new bToken for.
  /// @param _amount The amount of underlying tokens to deposit via `transferFrom`.
  /// @return credit The amount of bToken minted.
  function mint(address _to, uint _amount) external nonReentrant returns (uint credit) {
    accrue();
    uint amount;
    {
      uint balBefore = IERC20(underlying).balanceOf(address(this));
      IERC20(underlying).safeTransferFrom(msg.sender, address(this), _amount);
      uint balAfter = IERC20(underlying).balanceOf(address(this));
      amount = balAfter - balBefore;
    }
    uint supply = totalSupply();
    if (supply == 0) {
      credit = amount - MINIMUM_LIQUIDITY;
      // Permanently lock the first MINIMUM_LIQUIDITY tokens
      totalLoanable += credit;
      totalLoan += MINIMUM_LIQUIDITY;
      totalDebtShare += MINIMUM_LIQUIDITY;
      _mint(address(1), MINIMUM_LIQUIDITY); // OpenZeppelin ERC20 does not allow minting to 0
    } else {
      credit = (amount * supply) / (totalLoanable + totalLoan);
      totalLoanable += amount;
    }
    require(credit > 0, 'mint/no-credit-minted');
    _mint(_to, credit);
    emit Mint(msg.sender, _to, _amount, credit);
  }

  /// @dev Burns the given bToken for the proportional amount of underlying tokens.
  /// @param _to The address to send the underlying tokens to.
  /// @param _credit The amount of bToken to burn.
  /// @return amount The amount of underlying tokens getting transferred out.
  function burn(address _to, uint _credit) external nonReentrant returns (uint amount) {
    accrue();
    uint supply = totalSupply();
    amount = (_credit * (totalLoanable + totalLoan)) / supply;
    require(amount > 0, 'burn/no-amount-returned');
    totalLoanable -= amount;
    _burn(msg.sender, _credit);
    IERC20(underlying).safeTransfer(_to, amount);
    emit Burn(msg.sender, _to, amount, _credit);
  }

  /// @dev Borrows the funds for the given address. Must only be called by BetaBank.
  /// @param _to The address to borrow the funds for.
  /// @param _amount The amount to borrow.
  /// @return debtShare The amount of new debt share minted.
  function borrow(address _to, uint _amount) external nonReentrant returns (uint debtShare) {
    require(msg.sender == betaBank, 'borrow/not-BetaBank');
    accrue();
    IERC20(underlying).safeTransfer(_to, _amount);
    debtShare = Math.ceilDiv(_amount * totalDebtShare, totalLoan); // round up
    totalLoanable -= _amount;
    totalLoan += _amount;
    totalDebtShare += debtShare;
  }

  /// @dev Repays the debt using funds from the given address. Must only be called by BetaBank.
  /// @param _from The address to drain the funds to repay.
  /// @param _amount The amount of funds to call via `transferFrom`.
  /// @return debtShare The amount of debt share repaid.
  function repay(address _from, uint _amount) external nonReentrant returns (uint debtShare) {
    require(msg.sender == betaBank, 'repay/not-BetaBank');
    accrue();
    uint amount;
    {
      uint balBefore = IERC20(underlying).balanceOf(address(this));
      IERC20(underlying).safeTransferFrom(_from, address(this), _amount);
      uint balAfter = IERC20(underlying).balanceOf(address(this));
      amount = balAfter - balBefore;
    }
    require(amount <= totalLoan, 'repay/amount-too-high');
    debtShare = (amount * totalDebtShare) / totalLoan; // round down
    totalLoanable += amount;
    totalLoan -= amount;
    totalDebtShare -= debtShare;
    require(totalDebtShare >= MINIMUM_LIQUIDITY, 'repay/too-low-sum-debt-share');
  }

  /// @dev Recovers tokens in this contract. EMERGENCY ONLY. Full trust in BetaBank.
  /// @param _token The token to recover, can even be underlying so please be careful.
  /// @param _to The address to recover tokens to.
  /// @param _amount The amount of tokens to recover, or MAX_UINT256 if whole balance.
  function recover(
    address _token,
    address _to,
    uint _amount
  ) external nonReentrant {
    require(msg.sender == betaBank, 'recover/not-BetaBank');
    if (_amount == type(uint).max) {
      _amount = IERC20(_token).balanceOf(address(this));
    }
    IERC20(_token).safeTransfer(_to, _amount);
  }
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_betaBank","type":"address"},{"internalType":"address","name":"_underlying","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"interest","type":"uint256"}],"name":"Accrue","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"caller","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"credit","type":"uint256"}],"name":"Burn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"caller","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"credit","type":"uint256"}],"name":"Mint","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[],"name":"DOMAIN_SEPARATOR","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MINIMUM_LIQUIDITY","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"accrue","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"betaBank","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"borrow","outputs":[{"internalType":"uint256","name":"debtShare","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_credit","type":"uint256"}],"name":"burn","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_debtShare","type":"uint256"}],"name":"fetchDebtShareValue","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"interestRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastAccrueTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"mint","outputs":[{"internalType":"uint256","name":"credit","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"nonces","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"permit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"recover","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_from","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"repay","outputs":[{"internalType":"uint256","name":"debtShare","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalDebtShare","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalLoan","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalLoanable","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"underlying","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}]

6101806040527f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9610120523480156200003757600080fd5b5060405162002f7938038062002f798339810160408190526200005a9162000461565b6040518060400160405280600781526020016621102a37b5b2b760c91b81525080604051806040016040528060018152602001603160f81b8152506040518060400160405280600781526020016621102a37b5b2b760c91b81525060405180604001604052806006815260200165312a27a5a2a760d11b8152508160039080519060200190620000ec92919062000379565b5080516200010290600490602084019062000379565b5050825160209384012082519284019290922060c083815260e08290524660a0818152604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f818a0181905281830198909852606081019590955260808086019390935230858301528051808603909201825293909201909252805194019390932090925261010052505060016006556001600160a01b038216620001fa5760405162461bcd60e51b815260206004820152602160248201527f636f6e7374727563746f722f6265746162616e6b2d7a65726f2d6164647265736044820152607360f81b60648201526084015b60405180910390fd5b6001600160a01b0381166200025e5760405162461bcd60e51b815260206004820152602360248201527f636f6e7374727563746f722f756e6465726c79696e672d7a65726f2d6164647260448201526265737360e81b6064820152608401620001f1565b6001600160601b0319606083811b82166101405282901b16610160526040805163560b2ebd60e11b815290516001600160a01b0384169163ac165d7a916004808301926020929190829003018186803b158015620002bb57600080fd5b505afa158015620002d0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620002f691906200043c565b6001600160a01b0316639e51051f6040518163ffffffff1660e01b815260040160206040518083038186803b1580156200032f57600080fd5b505afa15801562000344573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200036a919062000499565b600755505042600855620004f0565b8280546200038790620004b3565b90600052602060002090601f016020900481019282620003ab5760008555620003f6565b82601f10620003c657805160ff1916838001178555620003f6565b82800160010185558215620003f6579182015b82811115620003f6578251825591602001919060010190620003d9565b506200040492915062000408565b5090565b5b8082111562000404576000815560010162000409565b80516001600160a01b03811681146200043757600080fd5b919050565b6000602082840312156200044f57600080fd5b6200045a826200041f565b9392505050565b600080604083850312156200047557600080fd5b62000480836200041f565b915062000490602084016200041f565b90509250929050565b600060208284031215620004ac57600080fd5b5051919050565b600181811c90821680620004c857607f821691505b60208210811415620004ea57634e487b7160e01b600052602260045260246000fd5b50919050565b60805160a05160c05160e05161010051610120516101405160601c6101605160601c6129a6620005d360003960008181610326015281816104420152818161074f015281816107d80152818161081801528181610a6a01528181610bd001528181610c5901528181610c9901528181610f3f0152818161102d01526111eb0152600081816102cb01528181610588015281816106c301528181610ec70152818161149101528181611585015261160a0152600061135e01526000611d7f01526000611dce01526000611da901526000611d2d01526000611d5601526129a66000f3fe608060405234801561001057600080fd5b50600436106101cf5760003560e01c8063684b51d4116101045780639ffe7973116100a2578063d505accf11610071578063d505accf146103e1578063d8a0ac26146103f4578063dd62ed3e146103fd578063f8ba4cff1461043657600080fd5b80639ffe7973146103a8578063a457c2d7146103b1578063a9059cbb146103c4578063ba9a7a56146103d757600080fd5b80637c3a00fd116100de5780637c3a00fd146103715780637ecebe001461037a57806395d89b411461038d5780639dc29fac1461039557600080fd5b8063684b51d4146103185780636f307dc31461032157806370a082311461034857600080fd5b80633644e51511610171578063453b1a8b1161014b578063453b1a8b146102aa5780634b8a3529146102b3578063550ba367146102c65780635dd925851461030557600080fd5b80633644e5151461027c578063395093511461028457806340c10f191461029757600080fd5b80631ec82cb8116101ad5780631ec82cb81461022757806322867d781461023c57806323b872dd1461024f578063313ce5671461026257600080fd5b806306fdde03146101d4578063095ea7b3146101f257806318160ddd14610215575b600080fd5b6101dc61043e565b6040516101e991906127c6565b60405180910390f35b610205610200366004612618565b610536565b60405190151581526020016101e9565b6002545b6040519081526020016101e9565b61023a610235366004612566565b61054c565b005b61021961024a366004612618565b61068e565b61020561025d366004612566565b6109ba565b61026a610a66565b60405160ff90911681526020016101e9565b610219610b31565b610205610292366004612618565b610b40565b6102196102a5366004612618565b610b7c565b610219600a5481565b6102196102c1366004612618565b610e92565b6102ed7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016101e9565b610219610313366004612708565b610fd5565b610219600b5481565b6102ed7f000000000000000000000000000000000000000000000000000000000000000081565b6102196103563660046124f3565b6001600160a01b031660009081526020819052604090205490565b61021960075481565b6102196103883660046124f3565b61100b565b6101dc611029565b6102196103a3366004612618565b611106565b61021960085481565b6102056103bf366004612618565b611264565b6102056103d2366004612618565b6112fd565b610219620f424081565b61023a6103ef3660046125a7565b61130a565b61021960095481565b61021961040b36600461252d565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b61023a61146e565b60607f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166306fdde036040518163ffffffff1660e01b815260040160006040518083038186803b15801561049957600080fd5b505afa9250505080156104ce57506040513d6000823e601f3d908101601f191682016040526104cb9190810190612666565b60015b610510573d8080156104fc576040519150601f19603f3d011682016040523d82523d6000602084013e610501565b606091505b5061050a6118ff565b91505090565b80604051602001610521919061279c565b60405160208183030381529060405291505090565b6000610543338484611991565b50600192915050565b600260065414156105785760405162461bcd60e51b815260040161056f906127f9565b60405180910390fd5b6002600655336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146105ec5760405162461bcd60e51b81526020600482015260146024820152737265636f7665722f6e6f742d4265746142616e6b60601b604482015260640161056f565b600019811415610670576040516370a0823160e01b81523060048201526001600160a01b038416906370a082319060240160206040518083038186803b15801561063557600080fd5b505afa158015610649573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061066d9190612721565b90505b6106846001600160a01b0384168383611ab5565b5050600160065550565b6000600260065414156106b35760405162461bcd60e51b815260040161056f906127f9565b6002600655336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146107255760405162461bcd60e51b815260206004820152601260248201527172657061792f6e6f742d4265746142616e6b60701b604482015260640161056f565b61072d61146e565b6040516370a0823160e01b815230600482015260009081906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906370a082319060240160206040518083038186803b15801561079157600080fd5b505afa1580156107a5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107c99190612721565b90506108006001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016863087611b1d565b6040516370a0823160e01b81523060048201526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a082319060240160206040518083038186803b15801561086257600080fd5b505afa158015610876573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061089a9190612721565b90506108a6828261287b565b92505050600a548111156108f45760405162461bcd60e51b81526020600482015260156024820152740e4cae0c2f25ec2dadeeadce85ae8dede5ad0d2ced605b1b604482015260640161056f565b600a54600b54610904908361285c565b61090e9190612848565b915080600960008282546109229190612830565b9250508190555080600a600082825461093b919061287b565b9250508190555081600b6000828254610954919061287b565b9091555050600b54620f424011156109ae5760405162461bcd60e51b815260206004820152601c60248201527f72657061792f746f6f2d6c6f772d73756d2d646562742d736861726500000000604482015260640161056f565b50600160065592915050565b60006109c7848484611b5b565b6001600160a01b038416600090815260016020908152604080832033845290915290205482811015610a4c5760405162461bcd60e51b815260206004820152602860248201527f45524332303a207472616e7366657220616d6f756e74206578636565647320616044820152676c6c6f77616e636560c01b606482015260840161056f565b610a598533858403611991565b60019150505b9392505050565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b158015610ac157600080fd5b505afa925050508015610af1575060408051601f3d908101601f19168201909252610aee9181019061273a565b60015b610b2c573d808015610b1f576040519150601f19603f3d011682016040523d82523d6000602084013e610b24565b606091505b50601261050a565b919050565b6000610b3b611d29565b905090565b3360008181526001602090815260408083206001600160a01b03871684529091528120549091610543918590610b77908690612830565b611991565b600060026006541415610ba15760405162461bcd60e51b815260040161056f906127f9565b6002600655610bae61146e565b6040516370a0823160e01b815230600482015260009081906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906370a082319060240160206040518083038186803b158015610c1257600080fd5b505afa158015610c26573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c4a9190612721565b9050610c816001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016333087611b1d565b6040516370a0823160e01b81523060048201526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a082319060240160206040518083038186803b158015610ce357600080fd5b505afa158015610cf7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d1b9190612721565b9050610d27828261287b565b925050506000610d3660025490565b905080610daf57610d4a620f42408361287b565b92508260096000828254610d5e9190612830565b92505081905550620f4240600a6000828254610d7a9190612830565b92505081905550620f4240600b6000828254610d969190612830565b90915550610daa90506001620f4240611e1c565b610ded565b600a54600954610dbf9190612830565b610dc9828461285c565b610dd39190612848565b92508160096000828254610de79190612830565b90915550505b60008311610e355760405162461bcd60e51b81526020600482015260156024820152741b5a5b9d0bdb9bcb58dc99591a5d0b5b5a5b9d1959605a1b604482015260640161056f565b610e3f8584611e1c565b60408051858152602081018590526001600160a01b0387169133917f2f00e3cdd69a77be7ed215ec7b2a36784dd158f921fca79ac29deffa353fe6ee910160405180910390a35050600160065592915050565b600060026006541415610eb75760405162461bcd60e51b815260040161056f906127f9565b6002600655336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614610f2a5760405162461bcd60e51b8152602060048201526013602482015272626f72726f772f6e6f742d4265746142616e6b60681b604482015260640161056f565b610f3261146e565b610f666001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168484611ab5565b610f7f600b5483610f77919061285c565b600a54611efb565b90508160096000828254610f93919061287b565b9250508190555081600a6000828254610fac9190612830565b9250508190555080600b6000828254610fc59190612830565b9091555050600160065592915050565b6000610fdf61146e565b81610fec57506000919050565b611005600a5483610ffd919061285c565b600b54611efb565b92915050565b6001600160a01b038116600090815260056020526040812054611005565b60607f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166395d89b416040518163ffffffff1660e01b815260040160006040518083038186803b15801561108457600080fd5b505afa9250505080156110b957506040513d6000823e601f3d908101601f191682016040526110b69190810190612666565b60015b6110f5573d8080156110e7576040519150601f19603f3d011682016040523d82523d6000602084013e6110ec565b606091505b5061050a611f2d565b806040516020016105219190612773565b60006002600654141561112b5760405162461bcd60e51b815260040161056f906127f9565b600260065561113861146e565b600061114360025490565b905080600a546009546111569190612830565b611160908561285c565b61116a9190612848565b9150600082116111bc5760405162461bcd60e51b815260206004820152601760248201527f6275726e2f6e6f2d616d6f756e742d72657475726e6564000000000000000000604482015260640161056f565b81600960008282546111ce919061287b565b909155506111de90503384611f3c565b6112126001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168584611ab5565b60408051838152602081018590526001600160a01b0386169133917f5d624aa9c148153ab3446c1b154f660ee7701e549fe9b62dab7171b1c80e6fa2910160405180910390a350600160065592915050565b3360009081526001602090815260408083206001600160a01b0386168452909152812054828110156112e65760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b606482015260840161056f565b6112f33385858403611991565b5060019392505050565b6000610543338484611b5b565b8342111561135a5760405162461bcd60e51b815260206004820152601d60248201527f45524332305065726d69743a206578706972656420646561646c696e65000000604482015260640161056f565b60007f00000000000000000000000000000000000000000000000000000000000000008888886113898c61208a565b6040805160208101969096526001600160a01b0394851690860152929091166060840152608083015260a082015260c0810186905260e00160405160208183030381529060405280519060200120905060006113e4826120b2565b905060006113f482878787612100565b9050896001600160a01b0316816001600160a01b0316146114575760405162461bcd60e51b815260206004820152601e60248201527f45524332305065726d69743a20696e76616c6964207369676e61747572650000604482015260640161056f565b6114628a8a8a611991565b50505050505050505050565b60006008544261147e919061287b565b9050806114885750565b426008819055507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316635c975abb6040518163ffffffff1660e01b815260040160206040518083038186803b1580156114e857600080fd5b505afa1580156114fc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115209190612644565b1561155f5760405162461bcd60e51b815260206004820152600f60248201526e10995d1850985b9acbdc185d5cd959608a1b604482015260640161056f565b600a54600954600754604080516379502c5560e01b815290516000916001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016916379502c5591600480820192602092909190829003018186803b1580156115cc57600080fd5b505afa1580156115e0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116049190612510565b905060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663ac165d7a6040518163ffffffff1660e01b815260040160206040518083038186803b15801561166157600080fd5b505afa158015611675573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116999190612510565b90506000670de0b6b3a76400006301e13380886116b6898861285c565b6116c0919061285c565b6116ca9190612848565b6116d49190612848565b90506116e08187612830565b600a81905560405163fae7f00d60e01b8152600481018690526024810187905260448101829052606481018990529096506001600160a01b0383169063fae7f00d9060840160206040518083038186803b15801561173d57600080fd5b505afa158015611751573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117759190612721565b60075580156118f6576000836001600160a01b03166358d7bf806040518163ffffffff1660e01b815260040160206040518083038186803b1580156117b957600080fd5b505afa1580156117cd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117f19190612721565b905080156118c1576000670de0b6b3a764000061180e838561285c565b6118189190612848565b90506118bf856001600160a01b031663914870eb6040518163ffffffff1660e01b815260040160206040518083038186803b15801561185657600080fd5b505afa15801561186a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061188e9190612510565b826118998a8c612830565b6118a3919061287b565b6002546118b0908561285c565b6118ba9190612848565b611e1c565b505b6040518281527f184f65042d0acee3fe9a2216428397968211b66a6f53244a44eb13ae62bc72359060200160405180910390a1505b50505050505050565b60606003805461190e906128be565b80601f016020809104026020016040519081016040528092919081815260200182805461193a906128be565b80156119875780601f1061195c57610100808354040283529160200191611987565b820191906000526020600020905b81548152906001019060200180831161196a57829003601f168201915b5050505050905090565b6001600160a01b0383166119f35760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161056f565b6001600160a01b038216611a545760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161056f565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6040516001600160a01b038316602482015260448101829052611b1890849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526122a9565b505050565b6040516001600160a01b0380851660248301528316604482015260648101829052611b559085906323b872dd60e01b90608401611ae1565b50505050565b6001600160a01b038316611bbf5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161056f565b6001600160a01b038216611c215760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161056f565b6001600160a01b03831660009081526020819052604090205481811015611c995760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b606482015260840161056f565b6001600160a01b03808516600090815260208190526040808220858503905591851681529081208054849290611cd0908490612830565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051611d1c91815260200190565b60405180910390a3611b55565b60007f0000000000000000000000000000000000000000000000000000000000000000461415611d7857507f000000000000000000000000000000000000000000000000000000000000000090565b50604080517f00000000000000000000000000000000000000000000000000000000000000006020808301919091527f0000000000000000000000000000000000000000000000000000000000000000828401527f000000000000000000000000000000000000000000000000000000000000000060608301524660808301523060a0808401919091528351808403909101815260c0909201909252805191012090565b6001600160a01b038216611e725760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015260640161056f565b8060026000828254611e849190612830565b90915550506001600160a01b03821660009081526020819052604081208054839290611eb1908490612830565b90915550506040518181526001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a35050565b6000611f0782846128f3565b15611f13576001611f16565b60005b60ff16611f238385612848565b610a5f9190612830565b60606004805461190e906128be565b6001600160a01b038216611f9c5760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b606482015260840161056f565b6001600160a01b038216600090815260208190526040902054818110156120105760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b606482015260840161056f565b6001600160a01b038316600090815260208190526040812083830390556002805484929061203f90849061287b565b90915550506040518281526000906001600160a01b038516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a3505050565b6001600160a01b03811660009081526005602052604090208054600181018255905b50919050565b60006110056120bf611d29565b8360405161190160f01b6020820152602281018390526042810182905260009060620160405160208183030381529060405280519060200120905092915050565b60007f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a082111561217d5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b606482015260840161056f565b8360ff16601b148061219257508360ff16601c145b6121e95760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604482015261756560f01b606482015260840161056f565b6040805160008082526020820180845288905260ff871692820192909252606081018590526080810184905260019060a0016020604051602081039080840390855afa15801561223d573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166122a05760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e61747572650000000000000000604482015260640161056f565b95945050505050565b60006122fe826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661237b9092919063ffffffff16565b805190915015611b18578080602001905181019061231c9190612644565b611b185760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161056f565b606061238a8484600085612392565b949350505050565b6060824710156123f35760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161056f565b843b6124415760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161056f565b600080866001600160a01b0316858760405161245d9190612757565b60006040518083038185875af1925050503d806000811461249a576040519150601f19603f3d011682016040523d82523d6000602084013e61249f565b606091505b50915091506124af8282866124ba565b979650505050505050565b606083156124c9575081610a5f565b8251156124d95782518084602001fd5b8160405162461bcd60e51b815260040161056f91906127c6565b60006020828403121561250557600080fd5b8135610a5f81612949565b60006020828403121561252257600080fd5b8151610a5f81612949565b6000806040838503121561254057600080fd5b823561254b81612949565b9150602083013561255b81612949565b809150509250929050565b60008060006060848603121561257b57600080fd5b833561258681612949565b9250602084013561259681612949565b929592945050506040919091013590565b600080600080600080600060e0888a0312156125c257600080fd5b87356125cd81612949565b965060208801356125dd81612949565b9550604088013594506060880135935060808801356125fb81612961565b9699959850939692959460a0840135945060c09093013592915050565b6000806040838503121561262b57600080fd5b823561263681612949565b946020939093013593505050565b60006020828403121561265657600080fd5b81518015158114610a5f57600080fd5b60006020828403121561267857600080fd5b815167ffffffffffffffff8082111561269057600080fd5b818401915084601f8301126126a457600080fd5b8151818111156126b6576126b6612933565b604051601f8201601f19908116603f011681019083821181831017156126de576126de612933565b816040528281528760208487010111156126f757600080fd5b6124af836020830160208801612892565b60006020828403121561271a57600080fd5b5035919050565b60006020828403121561273357600080fd5b5051919050565b60006020828403121561274c57600080fd5b8151610a5f81612961565b60008251612769818460208701612892565b9190910192915050565b603160f91b81526000825161278f816001850160208701612892565b9190910160010192915050565b61021160f51b8152600082516127b9816002850160208701612892565b9190910160020192915050565b60208152600082518060208401526127e5816040850160208701612892565b601f01601f19169190910160400192915050565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b6000821982111561284357612843612907565b500190565b6000826128575761285761291d565b500490565b600081600019048311821515161561287657612876612907565b500290565b60008282101561288d5761288d612907565b500390565b60005b838110156128ad578181015183820152602001612895565b83811115611b555750506000910152565b600181811c908216806128d257607f821691505b602082108114156120ac57634e487b7160e01b600052602260045260246000fd5b6000826129025761290261291d565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461295e57600080fd5b50565b60ff8116811461295e57600080fdfea264697066735822122055383071d6786d3f31f38890e7dc3c03e9e58d3333aad272946e13e25f93318f64736f6c63430008060033000000000000000000000000972a785b390d05123497169a04c72de652493be10000000000000000000000001f9840a85d5af5bf1d1762f925bdaddc4201f984

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106101cf5760003560e01c8063684b51d4116101045780639ffe7973116100a2578063d505accf11610071578063d505accf146103e1578063d8a0ac26146103f4578063dd62ed3e146103fd578063f8ba4cff1461043657600080fd5b80639ffe7973146103a8578063a457c2d7146103b1578063a9059cbb146103c4578063ba9a7a56146103d757600080fd5b80637c3a00fd116100de5780637c3a00fd146103715780637ecebe001461037a57806395d89b411461038d5780639dc29fac1461039557600080fd5b8063684b51d4146103185780636f307dc31461032157806370a082311461034857600080fd5b80633644e51511610171578063453b1a8b1161014b578063453b1a8b146102aa5780634b8a3529146102b3578063550ba367146102c65780635dd925851461030557600080fd5b80633644e5151461027c578063395093511461028457806340c10f191461029757600080fd5b80631ec82cb8116101ad5780631ec82cb81461022757806322867d781461023c57806323b872dd1461024f578063313ce5671461026257600080fd5b806306fdde03146101d4578063095ea7b3146101f257806318160ddd14610215575b600080fd5b6101dc61043e565b6040516101e991906127c6565b60405180910390f35b610205610200366004612618565b610536565b60405190151581526020016101e9565b6002545b6040519081526020016101e9565b61023a610235366004612566565b61054c565b005b61021961024a366004612618565b61068e565b61020561025d366004612566565b6109ba565b61026a610a66565b60405160ff90911681526020016101e9565b610219610b31565b610205610292366004612618565b610b40565b6102196102a5366004612618565b610b7c565b610219600a5481565b6102196102c1366004612618565b610e92565b6102ed7f000000000000000000000000972a785b390d05123497169a04c72de652493be181565b6040516001600160a01b0390911681526020016101e9565b610219610313366004612708565b610fd5565b610219600b5481565b6102ed7f0000000000000000000000001f9840a85d5af5bf1d1762f925bdaddc4201f98481565b6102196103563660046124f3565b6001600160a01b031660009081526020819052604090205490565b61021960075481565b6102196103883660046124f3565b61100b565b6101dc611029565b6102196103a3366004612618565b611106565b61021960085481565b6102056103bf366004612618565b611264565b6102056103d2366004612618565b6112fd565b610219620f424081565b61023a6103ef3660046125a7565b61130a565b61021960095481565b61021961040b36600461252d565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b61023a61146e565b60607f0000000000000000000000001f9840a85d5af5bf1d1762f925bdaddc4201f9846001600160a01b03166306fdde036040518163ffffffff1660e01b815260040160006040518083038186803b15801561049957600080fd5b505afa9250505080156104ce57506040513d6000823e601f3d908101601f191682016040526104cb9190810190612666565b60015b610510573d8080156104fc576040519150601f19603f3d011682016040523d82523d6000602084013e610501565b606091505b5061050a6118ff565b91505090565b80604051602001610521919061279c565b60405160208183030381529060405291505090565b6000610543338484611991565b50600192915050565b600260065414156105785760405162461bcd60e51b815260040161056f906127f9565b60405180910390fd5b6002600655336001600160a01b037f000000000000000000000000972a785b390d05123497169a04c72de652493be116146105ec5760405162461bcd60e51b81526020600482015260146024820152737265636f7665722f6e6f742d4265746142616e6b60601b604482015260640161056f565b600019811415610670576040516370a0823160e01b81523060048201526001600160a01b038416906370a082319060240160206040518083038186803b15801561063557600080fd5b505afa158015610649573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061066d9190612721565b90505b6106846001600160a01b0384168383611ab5565b5050600160065550565b6000600260065414156106b35760405162461bcd60e51b815260040161056f906127f9565b6002600655336001600160a01b037f000000000000000000000000972a785b390d05123497169a04c72de652493be116146107255760405162461bcd60e51b815260206004820152601260248201527172657061792f6e6f742d4265746142616e6b60701b604482015260640161056f565b61072d61146e565b6040516370a0823160e01b815230600482015260009081906001600160a01b037f0000000000000000000000001f9840a85d5af5bf1d1762f925bdaddc4201f98416906370a082319060240160206040518083038186803b15801561079157600080fd5b505afa1580156107a5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107c99190612721565b90506108006001600160a01b037f0000000000000000000000001f9840a85d5af5bf1d1762f925bdaddc4201f98416863087611b1d565b6040516370a0823160e01b81523060048201526000907f0000000000000000000000001f9840a85d5af5bf1d1762f925bdaddc4201f9846001600160a01b0316906370a082319060240160206040518083038186803b15801561086257600080fd5b505afa158015610876573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061089a9190612721565b90506108a6828261287b565b92505050600a548111156108f45760405162461bcd60e51b81526020600482015260156024820152740e4cae0c2f25ec2dadeeadce85ae8dede5ad0d2ced605b1b604482015260640161056f565b600a54600b54610904908361285c565b61090e9190612848565b915080600960008282546109229190612830565b9250508190555080600a600082825461093b919061287b565b9250508190555081600b6000828254610954919061287b565b9091555050600b54620f424011156109ae5760405162461bcd60e51b815260206004820152601c60248201527f72657061792f746f6f2d6c6f772d73756d2d646562742d736861726500000000604482015260640161056f565b50600160065592915050565b60006109c7848484611b5b565b6001600160a01b038416600090815260016020908152604080832033845290915290205482811015610a4c5760405162461bcd60e51b815260206004820152602860248201527f45524332303a207472616e7366657220616d6f756e74206578636565647320616044820152676c6c6f77616e636560c01b606482015260840161056f565b610a598533858403611991565b60019150505b9392505050565b60007f0000000000000000000000001f9840a85d5af5bf1d1762f925bdaddc4201f9846001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b158015610ac157600080fd5b505afa925050508015610af1575060408051601f3d908101601f19168201909252610aee9181019061273a565b60015b610b2c573d808015610b1f576040519150601f19603f3d011682016040523d82523d6000602084013e610b24565b606091505b50601261050a565b919050565b6000610b3b611d29565b905090565b3360008181526001602090815260408083206001600160a01b03871684529091528120549091610543918590610b77908690612830565b611991565b600060026006541415610ba15760405162461bcd60e51b815260040161056f906127f9565b6002600655610bae61146e565b6040516370a0823160e01b815230600482015260009081906001600160a01b037f0000000000000000000000001f9840a85d5af5bf1d1762f925bdaddc4201f98416906370a082319060240160206040518083038186803b158015610c1257600080fd5b505afa158015610c26573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c4a9190612721565b9050610c816001600160a01b037f0000000000000000000000001f9840a85d5af5bf1d1762f925bdaddc4201f98416333087611b1d565b6040516370a0823160e01b81523060048201526000907f0000000000000000000000001f9840a85d5af5bf1d1762f925bdaddc4201f9846001600160a01b0316906370a082319060240160206040518083038186803b158015610ce357600080fd5b505afa158015610cf7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d1b9190612721565b9050610d27828261287b565b925050506000610d3660025490565b905080610daf57610d4a620f42408361287b565b92508260096000828254610d5e9190612830565b92505081905550620f4240600a6000828254610d7a9190612830565b92505081905550620f4240600b6000828254610d969190612830565b90915550610daa90506001620f4240611e1c565b610ded565b600a54600954610dbf9190612830565b610dc9828461285c565b610dd39190612848565b92508160096000828254610de79190612830565b90915550505b60008311610e355760405162461bcd60e51b81526020600482015260156024820152741b5a5b9d0bdb9bcb58dc99591a5d0b5b5a5b9d1959605a1b604482015260640161056f565b610e3f8584611e1c565b60408051858152602081018590526001600160a01b0387169133917f2f00e3cdd69a77be7ed215ec7b2a36784dd158f921fca79ac29deffa353fe6ee910160405180910390a35050600160065592915050565b600060026006541415610eb75760405162461bcd60e51b815260040161056f906127f9565b6002600655336001600160a01b037f000000000000000000000000972a785b390d05123497169a04c72de652493be11614610f2a5760405162461bcd60e51b8152602060048201526013602482015272626f72726f772f6e6f742d4265746142616e6b60681b604482015260640161056f565b610f3261146e565b610f666001600160a01b037f0000000000000000000000001f9840a85d5af5bf1d1762f925bdaddc4201f984168484611ab5565b610f7f600b5483610f77919061285c565b600a54611efb565b90508160096000828254610f93919061287b565b9250508190555081600a6000828254610fac9190612830565b9250508190555080600b6000828254610fc59190612830565b9091555050600160065592915050565b6000610fdf61146e565b81610fec57506000919050565b611005600a5483610ffd919061285c565b600b54611efb565b92915050565b6001600160a01b038116600090815260056020526040812054611005565b60607f0000000000000000000000001f9840a85d5af5bf1d1762f925bdaddc4201f9846001600160a01b03166395d89b416040518163ffffffff1660e01b815260040160006040518083038186803b15801561108457600080fd5b505afa9250505080156110b957506040513d6000823e601f3d908101601f191682016040526110b69190810190612666565b60015b6110f5573d8080156110e7576040519150601f19603f3d011682016040523d82523d6000602084013e6110ec565b606091505b5061050a611f2d565b806040516020016105219190612773565b60006002600654141561112b5760405162461bcd60e51b815260040161056f906127f9565b600260065561113861146e565b600061114360025490565b905080600a546009546111569190612830565b611160908561285c565b61116a9190612848565b9150600082116111bc5760405162461bcd60e51b815260206004820152601760248201527f6275726e2f6e6f2d616d6f756e742d72657475726e6564000000000000000000604482015260640161056f565b81600960008282546111ce919061287b565b909155506111de90503384611f3c565b6112126001600160a01b037f0000000000000000000000001f9840a85d5af5bf1d1762f925bdaddc4201f984168584611ab5565b60408051838152602081018590526001600160a01b0386169133917f5d624aa9c148153ab3446c1b154f660ee7701e549fe9b62dab7171b1c80e6fa2910160405180910390a350600160065592915050565b3360009081526001602090815260408083206001600160a01b0386168452909152812054828110156112e65760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b606482015260840161056f565b6112f33385858403611991565b5060019392505050565b6000610543338484611b5b565b8342111561135a5760405162461bcd60e51b815260206004820152601d60248201527f45524332305065726d69743a206578706972656420646561646c696e65000000604482015260640161056f565b60007f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98888886113898c61208a565b6040805160208101969096526001600160a01b0394851690860152929091166060840152608083015260a082015260c0810186905260e00160405160208183030381529060405280519060200120905060006113e4826120b2565b905060006113f482878787612100565b9050896001600160a01b0316816001600160a01b0316146114575760405162461bcd60e51b815260206004820152601e60248201527f45524332305065726d69743a20696e76616c6964207369676e61747572650000604482015260640161056f565b6114628a8a8a611991565b50505050505050505050565b60006008544261147e919061287b565b9050806114885750565b426008819055507f000000000000000000000000972a785b390d05123497169a04c72de652493be16001600160a01b0316635c975abb6040518163ffffffff1660e01b815260040160206040518083038186803b1580156114e857600080fd5b505afa1580156114fc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115209190612644565b1561155f5760405162461bcd60e51b815260206004820152600f60248201526e10995d1850985b9acbdc185d5cd959608a1b604482015260640161056f565b600a54600954600754604080516379502c5560e01b815290516000916001600160a01b037f000000000000000000000000972a785b390d05123497169a04c72de652493be116916379502c5591600480820192602092909190829003018186803b1580156115cc57600080fd5b505afa1580156115e0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116049190612510565b905060007f000000000000000000000000972a785b390d05123497169a04c72de652493be16001600160a01b031663ac165d7a6040518163ffffffff1660e01b815260040160206040518083038186803b15801561166157600080fd5b505afa158015611675573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116999190612510565b90506000670de0b6b3a76400006301e13380886116b6898861285c565b6116c0919061285c565b6116ca9190612848565b6116d49190612848565b90506116e08187612830565b600a81905560405163fae7f00d60e01b8152600481018690526024810187905260448101829052606481018990529096506001600160a01b0383169063fae7f00d9060840160206040518083038186803b15801561173d57600080fd5b505afa158015611751573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117759190612721565b60075580156118f6576000836001600160a01b03166358d7bf806040518163ffffffff1660e01b815260040160206040518083038186803b1580156117b957600080fd5b505afa1580156117cd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117f19190612721565b905080156118c1576000670de0b6b3a764000061180e838561285c565b6118189190612848565b90506118bf856001600160a01b031663914870eb6040518163ffffffff1660e01b815260040160206040518083038186803b15801561185657600080fd5b505afa15801561186a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061188e9190612510565b826118998a8c612830565b6118a3919061287b565b6002546118b0908561285c565b6118ba9190612848565b611e1c565b505b6040518281527f184f65042d0acee3fe9a2216428397968211b66a6f53244a44eb13ae62bc72359060200160405180910390a1505b50505050505050565b60606003805461190e906128be565b80601f016020809104026020016040519081016040528092919081815260200182805461193a906128be565b80156119875780601f1061195c57610100808354040283529160200191611987565b820191906000526020600020905b81548152906001019060200180831161196a57829003601f168201915b5050505050905090565b6001600160a01b0383166119f35760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161056f565b6001600160a01b038216611a545760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161056f565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6040516001600160a01b038316602482015260448101829052611b1890849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526122a9565b505050565b6040516001600160a01b0380851660248301528316604482015260648101829052611b559085906323b872dd60e01b90608401611ae1565b50505050565b6001600160a01b038316611bbf5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161056f565b6001600160a01b038216611c215760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161056f565b6001600160a01b03831660009081526020819052604090205481811015611c995760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b606482015260840161056f565b6001600160a01b03808516600090815260208190526040808220858503905591851681529081208054849290611cd0908490612830565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051611d1c91815260200190565b60405180910390a3611b55565b60007f0000000000000000000000000000000000000000000000000000000000000001461415611d7857507fde8c59b0107d603aa67f2b1e89b1072a93058f0f881290b268eb197b7b7c03b990565b50604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f6020808301919091527ff298fc33cba3cfdbf2454e2f19b4a97c9207157f8eeee7439da2c9ce4b540bbb828401527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608301524660808301523060a0808401919091528351808403909101815260c0909201909252805191012090565b6001600160a01b038216611e725760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015260640161056f565b8060026000828254611e849190612830565b90915550506001600160a01b03821660009081526020819052604081208054839290611eb1908490612830565b90915550506040518181526001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a35050565b6000611f0782846128f3565b15611f13576001611f16565b60005b60ff16611f238385612848565b610a5f9190612830565b60606004805461190e906128be565b6001600160a01b038216611f9c5760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b606482015260840161056f565b6001600160a01b038216600090815260208190526040902054818110156120105760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b606482015260840161056f565b6001600160a01b038316600090815260208190526040812083830390556002805484929061203f90849061287b565b90915550506040518281526000906001600160a01b038516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a3505050565b6001600160a01b03811660009081526005602052604090208054600181018255905b50919050565b60006110056120bf611d29565b8360405161190160f01b6020820152602281018390526042810182905260009060620160405160208183030381529060405280519060200120905092915050565b60007f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a082111561217d5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b606482015260840161056f565b8360ff16601b148061219257508360ff16601c145b6121e95760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604482015261756560f01b606482015260840161056f565b6040805160008082526020820180845288905260ff871692820192909252606081018590526080810184905260019060a0016020604051602081039080840390855afa15801561223d573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166122a05760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e61747572650000000000000000604482015260640161056f565b95945050505050565b60006122fe826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661237b9092919063ffffffff16565b805190915015611b18578080602001905181019061231c9190612644565b611b185760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161056f565b606061238a8484600085612392565b949350505050565b6060824710156123f35760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161056f565b843b6124415760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161056f565b600080866001600160a01b0316858760405161245d9190612757565b60006040518083038185875af1925050503d806000811461249a576040519150601f19603f3d011682016040523d82523d6000602084013e61249f565b606091505b50915091506124af8282866124ba565b979650505050505050565b606083156124c9575081610a5f565b8251156124d95782518084602001fd5b8160405162461bcd60e51b815260040161056f91906127c6565b60006020828403121561250557600080fd5b8135610a5f81612949565b60006020828403121561252257600080fd5b8151610a5f81612949565b6000806040838503121561254057600080fd5b823561254b81612949565b9150602083013561255b81612949565b809150509250929050565b60008060006060848603121561257b57600080fd5b833561258681612949565b9250602084013561259681612949565b929592945050506040919091013590565b600080600080600080600060e0888a0312156125c257600080fd5b87356125cd81612949565b965060208801356125dd81612949565b9550604088013594506060880135935060808801356125fb81612961565b9699959850939692959460a0840135945060c09093013592915050565b6000806040838503121561262b57600080fd5b823561263681612949565b946020939093013593505050565b60006020828403121561265657600080fd5b81518015158114610a5f57600080fd5b60006020828403121561267857600080fd5b815167ffffffffffffffff8082111561269057600080fd5b818401915084601f8301126126a457600080fd5b8151818111156126b6576126b6612933565b604051601f8201601f19908116603f011681019083821181831017156126de576126de612933565b816040528281528760208487010111156126f757600080fd5b6124af836020830160208801612892565b60006020828403121561271a57600080fd5b5035919050565b60006020828403121561273357600080fd5b5051919050565b60006020828403121561274c57600080fd5b8151610a5f81612961565b60008251612769818460208701612892565b9190910192915050565b603160f91b81526000825161278f816001850160208701612892565b9190910160010192915050565b61021160f51b8152600082516127b9816002850160208701612892565b9190910160020192915050565b60208152600082518060208401526127e5816040850160208701612892565b601f01601f19169190910160400192915050565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b6000821982111561284357612843612907565b500190565b6000826128575761285761291d565b500490565b600081600019048311821515161561287657612876612907565b500290565b60008282101561288d5761288d612907565b500390565b60005b838110156128ad578181015183820152602001612895565b83811115611b555750506000910152565b600181811c908216806128d257607f821691505b602082108114156120ac57634e487b7160e01b600052602260045260246000fd5b6000826129025761290261291d565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461295e57600080fd5b50565b60ff8116811461295e57600080fdfea264697066735822122055383071d6786d3f31f38890e7dc3c03e9e58d3333aad272946e13e25f93318f64736f6c63430008060033

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

000000000000000000000000972a785b390D05123497169a04c72dE652493BE10000000000000000000000001f9840a85d5aF5bf1D1762F925BDADdC4201F984

-----Decoded View---------------
Arg [0] : _betaBank (address): 0x972a785b390D05123497169a04c72dE652493BE1
Arg [1] : _underlying (address): 0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984

-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 000000000000000000000000972a785b390D05123497169a04c72dE652493BE1
Arg [1] : 0000000000000000000000001f9840a85d5aF5bf1D1762F925BDADdC4201F984


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.