ETH Price: $3,441.90 (+3.37%)

Contract

0xa01D9bc8343016C7DDD39852e49890a8361B2884
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Grant Role169604482023-04-02 9:14:11601 days ago1680426851IN
0xa01D9bc8...8361B2884
0 ETH0.0010955421.46112941
Grant Role169604422023-04-02 9:12:59601 days ago1680426779IN
0xa01D9bc8...8361B2884
0 ETH0.0010213819.85888891
Set Curve Pool168740522023-03-21 5:51:47613 days ago1679377907IN
0xa01D9bc8...8361B2884
0 ETH0.0005647212.18137858
Set Peg Price168740482023-03-21 5:50:59613 days ago1679377859IN
0xa01D9bc8...8361B2884
0 ETH0.0005350211.6373314
Grant Role168617822023-03-19 12:30:59615 days ago1679229059IN
0xa01D9bc8...8361B2884
0 ETH0.0007589214.75929984
Set Vault168485562023-03-17 15:56:23617 days ago1679068583IN
0xa01D9bc8...8361B2884
0 ETH0.0010108121.79363013
Set Redeem Thres...168485392023-03-17 15:52:59617 days ago1679068379IN
0xa01D9bc8...8361B2884
0 ETH0.0011283624.49452407
Set Mint Thresho...168485382023-03-17 15:52:47617 days ago1679068367IN
0xa01D9bc8...8361B2884
0 ETH0.0011261124.49452407
0x60806040168485332023-03-17 15:51:47617 days ago1679068307IN
 Create: Treasury
0 ETH0.0493714323.24507828

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Treasury

Compiler Version
v0.8.7+commit.e28d00a7

Optimization Enabled:
Yes with 1000 runs

Other Settings:
default evmVersion
File 1 of 17 : Treasury.sol
pragma solidity ^0.8.0;

import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";

import "./interface/ICurve.sol";
import "./interface/AggregatorInterface.sol";
import "./interface/IVault.sol";

contract Treasury is AccessControl {
	using SafeERC20 for IERC20;
	using SafeMath for uint256;

	bytes32 public constant ADMIN_ROLE = keccak256("ADMIN_ROLE");
	bytes32 public constant MANAGER_ROLE = keccak256("MANAGER_ROLE");
	bytes32 public constant WTBTPOOL_ROLE = keccak256("WTBTPOOL_ROLE");

	// used to mint stbt
	address public mpMintPool;
	// used to redeem stbt
	address public mpRedeemPool;
	// vault address
	IVault public vault;
	// stbt address
	IERC20 public stbt;
	// underlying token address
	IERC20 public underlying;
	// STBT curve pool
	// Mainnet: 0x892D701d94a43bDBCB5eA28891DaCA2Fa22A690b
	ICurve curvePool;

	// mint threshold for underlying token
	uint256 public mintThreshold;
	// redeem threshold for STBT
	uint256 public redeemThreshold;
	// convert a amount from underlying token to stbt
	uint256 public basis;
	// target price
	int256 public targetPrice;
	// recovery fund wallet
	address public recovery;
	// priceFeed be using check USDC is pegged
	AggregatorInterface public priceFeed;
	// coins , [DAI, USDC, USDT]
	// see https://etherscan.io/address/0x892D701d94a43bDBCB5eA28891DaCA2Fa22A690b#code
	address[3] coins;

	constructor(
		address _admin,
		address _mpMintPool,
		address _mpRedeemPool,
		address _stbt,
		address _underlying,
		address _recovery,
		address _priceFeed,
		address[3] memory _coins
	) {
		require(_admin != address(0), "!_admin");
		_setupRole(DEFAULT_ADMIN_ROLE, _admin);
		_setRoleAdmin(ADMIN_ROLE, ADMIN_ROLE);
		_setRoleAdmin(MANAGER_ROLE, ADMIN_ROLE);

		_setupRole(ADMIN_ROLE, _admin);
		_setupRole(MANAGER_ROLE, _admin);

		require(_mpMintPool != address(0), "!_mpMintPool");
		require(_mpRedeemPool != address(0), "!_mpRedeemPool");
		require(_stbt != address(0), "!_stbt");
		require(_underlying != address(0), "!_underlying");
		require(_recovery != address(0), "!_recovery");
		require(_priceFeed != address(0), "!_priceFeed");
		mpMintPool = _mpMintPool;
		mpRedeemPool = _mpRedeemPool;
		recovery = _recovery;
		stbt = IERC20(_stbt);
		underlying = IERC20(_underlying);
		priceFeed = AggregatorInterface(_priceFeed);

		uint256 underlyingDecimals = ERC20(_underlying).decimals();

		basis = 10 ** (uint256(ERC20(_stbt).decimals() - underlyingDecimals));
		coins = _coins;
	}

	/**
	 * @dev to set the vault address
	 * @param _vault the address of vault
	 */
	function setVault(address _vault) external onlyRole(ADMIN_ROLE) {
		require(_vault != address(0), "!_vault");
		vault = IVault(_vault);
	}

	/**
	 * @dev to set the mint pool
	 * @param _mintPool the address of mint pool
	 */
	function setMintPool(address _mintPool) external onlyRole(ADMIN_ROLE) {
		require(_mintPool != address(0), "!_mintPool");
		mpMintPool = _mintPool;
	}

	/**
	 * @dev to set the redeem pool
	 * @param _redeemPool the address of redeem pool
	 */
	function setRedeemPool(address _redeemPool) external onlyRole(ADMIN_ROLE) {
		require(_redeemPool != address(0), "!_redeemPool");
		mpRedeemPool = _redeemPool;
	}

	/**
	 * @dev to set the stbt curve pool
	 * @param _curvePool the address of curve pool
	 */
	function setCurvePool(address _curvePool) external onlyRole(ADMIN_ROLE) {
		require(_curvePool != address(0), "!_curvePool");
		curvePool = ICurve(_curvePool);
	}

	/**
	 * @dev to set the mint threshold
	 * @param amount the amount of mint threshold
	 */
	function setMintThreshold(uint256 amount) external onlyRole(MANAGER_ROLE) {
		mintThreshold = amount;
	}

	/**
	 * @dev to set the redeem threshold
	 * @param amount the amount of redeem threshold
	 */
	function setRedeemThreshold(uint256 amount) external onlyRole(MANAGER_ROLE) {
		redeemThreshold = amount;
	}

	/**
	 * @dev to set the price
	 * @param _targetPrice the target price of usdc
	 */
	function setPegPrice(int256 _targetPrice) external onlyRole(MANAGER_ROLE) {
		targetPrice = _targetPrice;
	}

	/**
	 * @dev convert underlying amount to stbt
	 */
	function getSTBTbyUnderlyingAmount(uint256 amount) public view returns (uint256) {
		return amount.mul(basis);
	}

	/**
	 * @dev get the exchange amount out from curve
	 * @param amount amount of cToken
	 * @param j token of index for curve pool
	 */
	function getRedeemAmountOutFromCurve(uint256 amount, int128 j) public view returns (uint256) {
		uint256 stbtAmount = amount.mul(basis);
		// From stbt to others
		return curvePool.get_dy_underlying(0, j, stbtAmount);
	}

	/// @notice get price feed answer
	/// @return The answer of price from priceFeed
	function latestAnswer() public view returns (int256) {
		return priceFeed.latestAnswer();
	}

	/**
	 * @dev if over than mint threshold, transfer all balance of underlying to mpMintPool
	 */
	function mintSTBT() external onlyRole(WTBTPOOL_ROLE) {
		require(priceFeed.latestAnswer() >= targetPrice, "depeg");
		uint256 balance = underlying.balanceOf(address(this));
		if (balance >= mintThreshold) {
			underlying.safeTransfer(mpMintPool, balance);
		}
	}

	/**
	 * @dev Transfer a give amout of stbt to matrixport's mint pool
	 * @param amount the amout of underlying token
	 */
	function redeemSTBT(uint256 amount) external onlyRole(WTBTPOOL_ROLE) {
		// convert to stbt amount
		uint256 stbtAmount = amount.mul(basis);
		require(priceFeed.latestAnswer() >= targetPrice, "depeg");
		require(stbtAmount >= redeemThreshold, "less than redeemThreshold");
		stbt.safeTransfer(address(vault), stbtAmount);
		vault.redeemSTBT(mpRedeemPool, stbtAmount);
	}

	/**
	 * @dev Transfer a give amout of stbt to matrixport's mint pool
	 * @param amount the amout of underlying token
	 * @param j token of index for curve pool
	 * @param minReturn the minimum amount of return
	 * @param receiver used to receive token
	 * @param feeRate redeem fee rate
	 * @param feeCoefficient redeem fee rate coefficient
	 * @param feeCollector fee collector
	 */
	function redeemSTBTByCurveWithFee(
		uint256 amount,
		int128 j,
		uint256 minReturn,
		address receiver,
		uint256 feeRate,
		uint256 feeCoefficient,
		address feeCollector
	) external onlyRole(WTBTPOOL_ROLE) {
		// convert to stbt amount
		uint256 stbtAmount = amount.mul(basis);
		// From stbt to others
		uint256 dy = curvePool.get_dy_underlying(0, j, stbtAmount);
		require(dy >= minReturn, "!minReturn");
		stbt.approve(address(curvePool), stbtAmount);
		curvePool.exchange_underlying(0, j, stbtAmount, dy);
		IERC20 targetToken = IERC20(coins[uint256(int256(j - 1))]);

		uint256 feeAmount = dy.mul(feeRate).div(feeCoefficient);
		uint256 amountAfterFee = dy.sub(feeAmount);
		targetToken.safeTransfer(receiver, amountAfterFee);
		targetToken.safeTransfer(feeCollector, feeAmount);
	}

	/**
	 * @dev Transfer all balance of stbt to matrixport's redeem pool
	 */
	function redeemAllSTBT() external onlyRole(WTBTPOOL_ROLE) {
		uint256 balance = stbt.balanceOf(address(this));
		require(balance >= redeemThreshold, "less than redeemThreshold");
		stbt.safeTransfer(mpRedeemPool, balance);
	}

	/**
	 * @dev claim manager fee with stbt
	 * @param target Used to receive
	 * @param amountToTarget Amount of underlying to transfer
	 */
	function claimManagementFee(
		address target,
		uint256 amountToTarget
	) external onlyRole(WTBTPOOL_ROLE) {
		uint256 stbtAmount = amountToTarget.mul(basis);
		stbt.safeTransfer(target, stbtAmount);
	}

	/**
	 * @dev Allows to recovery any ERC20 token
	 * @param tokenAddress Address of the token to recovery
	 * @param amountToRecover Amount of collateral to transfer
	 */
	function recoverERC20(
		address tokenAddress,
		uint256 amountToRecover
	) external onlyRole(ADMIN_ROLE) {
		IERC20(tokenAddress).safeTransfer(recovery, amountToRecover);
	}
}

File 2 of 17 : ICurve.sol
pragma solidity ^0.8.0;

interface ICurve {
	function exchange(int128 i, int128 j, uint256 dx, uint256 min_dy) external;

	function exchange_underlying(int128 i, int128 j, uint256 dx, uint256 min_dy) external;

	function get_dy(int128 i, int128 j, uint256 dx) external view returns (uint256);

	function get_dy_underlying(int128 i, int128 j, uint256 dx) external view returns (uint256);

	function coins(uint256 i) external view returns (address);
}

File 3 of 17 : AggregatorInterface.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface AggregatorInterface {
	function latestAnswer() external view returns (int256);

	function latestTimestamp() external view returns (uint256);

	function latestRound() external view returns (uint256);

	function getAnswer(uint256 roundId) external view returns (int256);

	function getTimestamp(uint256 roundId) external view returns (uint256);

	event AnswerUpdated(int256 indexed current, uint256 indexed roundId, uint256 updatedAt);

	event NewRound(uint256 indexed roundId, address indexed startedBy, uint256 startedAt);
}

File 4 of 17 : IVault.sol
pragma solidity ^0.8.0;

interface IVault {
	function withdrawToUser(address, uint256) external;

	function recoverERC20(address, uint256) external;

	function redeemSTBT(address, uint256) external;
}

File 5 of 17 : AccessControl.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (access/AccessControl.sol)

pragma solidity ^0.8.0;

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

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

    mapping(bytes32 => RoleData) private _roles;

    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;

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

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

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

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

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

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

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

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

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

        _revokeRole(role, account);
    }

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

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

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

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

File 6 of 17 : SafeMath.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (utils/math/SafeMath.sol)

pragma solidity ^0.8.0;

// CAUTION
// This version of SafeMath should only be used with Solidity 0.8 or later,
// because it relies on the compiler's built in overflow checks.

/**
 * @dev Wrappers over Solidity's arithmetic operations.
 *
 * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler
 * now has built in overflow checking.
 */
library SafeMath {
    /**
     * @dev Returns the addition of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            uint256 c = a + b;
            if (c < a) return (false, 0);
            return (true, c);
        }
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b > a) return (false, 0);
            return (true, a - b);
        }
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
            // benefit is lost if 'b' is also tested.
            // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
            if (a == 0) return (true, 0);
            uint256 c = a * b;
            if (c / a != b) return (false, 0);
            return (true, c);
        }
    }

    /**
     * @dev Returns the division of two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a / b);
        }
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a % b);
        }
    }

    /**
     * @dev Returns the addition of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `+` operator.
     *
     * Requirements:
     *
     * - Addition cannot overflow.
     */
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        return a + b;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting on
     * overflow (when the result is negative).
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b) internal pure returns (uint256) {
        return a - b;
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `*` operator.
     *
     * Requirements:
     *
     * - Multiplication cannot overflow.
     */
    function mul(uint256 a, uint256 b) internal pure returns (uint256) {
        return a * b;
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator.
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        return a / b;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting when dividing by zero.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b) internal pure returns (uint256) {
        return a % b;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on
     * overflow (when the result is negative).
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {trySub}.
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        unchecked {
            require(b <= a, errorMessage);
            return a - b;
        }
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting with custom message on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        unchecked {
            require(b > 0, errorMessage);
            return a / b;
        }
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting with custom message when dividing by zero.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryMod}.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        unchecked {
            require(b > 0, errorMessage);
            return a % b;
        }
    }
}

File 7 of 17 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

import "../IERC20.sol";
import "../extensions/draft-IERC20Permit.sol";
import "../../../utils/Address.sol";

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

    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));
        }
    }

    function safePermit(
        IERC20Permit token,
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal {
        uint256 nonceBefore = token.nonces(owner);
        token.permit(owner, spender, value, deadline, v, r, s);
        uint256 nonceAfter = token.nonces(owner);
        require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
    }

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

        bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
        if (returndata.length > 0) {
            // Return data is optional
            require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
        }
    }
}

File 8 of 17 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(address indexed owner, address indexed spender, uint256 value);

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

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

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

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

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

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

File 9 of 17 : ERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/ERC20.sol)

pragma solidity ^0.8.0;

import "./IERC20.sol";
import "./extensions/IERC20Metadata.sol";
import "../../utils/Context.sol";

/**
 * @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 Contracts guidelines: functions revert
 * instead 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:
     *
     * - `to` cannot be the zero address.
     * - the caller must have a balance of at least `amount`.
     */
    function transfer(address to, uint256 amount) public virtual override returns (bool) {
        address owner = _msgSender();
        _transfer(owner, to, 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}.
     *
     * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on
     * `transferFrom`. This is semantically equivalent to an infinite approval.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function approve(address spender, uint256 amount) public virtual override returns (bool) {
        address owner = _msgSender();
        _approve(owner, 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}.
     *
     * NOTE: Does not update the allowance if the current allowance
     * is the maximum `uint256`.
     *
     * Requirements:
     *
     * - `from` and `to` cannot be the zero address.
     * - `from` must have a balance of at least `amount`.
     * - the caller must have allowance for ``from``'s tokens of at least
     * `amount`.
     */
    function transferFrom(
        address from,
        address to,
        uint256 amount
    ) public virtual override returns (bool) {
        address spender = _msgSender();
        _spendAllowance(from, spender, amount);
        _transfer(from, to, 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) {
        address owner = _msgSender();
        _approve(owner, spender, allowance(owner, 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) {
        address owner = _msgSender();
        uint256 currentAllowance = allowance(owner, spender);
        require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
        unchecked {
            _approve(owner, spender, currentAllowance - subtractedValue);
        }

        return true;
    }

    /**
     * @dev Moves `amount` of tokens from `from` to `to`.
     *
     * 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:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `from` must have a balance of at least `amount`.
     */
    function _transfer(
        address from,
        address to,
        uint256 amount
    ) internal virtual {
        require(from != address(0), "ERC20: transfer from the zero address");
        require(to != address(0), "ERC20: transfer to the zero address");

        _beforeTokenTransfer(from, to, amount);

        uint256 fromBalance = _balances[from];
        require(fromBalance >= amount, "ERC20: transfer amount exceeds balance");
        unchecked {
            _balances[from] = fromBalance - amount;
        }
        _balances[to] += amount;

        emit Transfer(from, to, amount);

        _afterTokenTransfer(from, to, 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 Updates `owner` s allowance for `spender` based on spent `amount`.
     *
     * Does not update the allowance amount in case of infinite allowance.
     * Revert if not enough allowance is available.
     *
     * Might emit an {Approval} event.
     */
    function _spendAllowance(
        address owner,
        address spender,
        uint256 amount
    ) internal virtual {
        uint256 currentAllowance = allowance(owner, spender);
        if (currentAllowance != type(uint256).max) {
            require(currentAllowance >= amount, "ERC20: insufficient allowance");
            unchecked {
                _approve(owner, spender, currentAllowance - 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 {}
}

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.0;

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

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

File 12 of 17 : Strings.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)

pragma solidity ^0.8.0;

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

    /**
     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
     */
    function toString(uint256 value) internal pure returns (string memory) {
        // Inspired by OraclizeAPI's implementation - MIT licence
        // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol

        if (value == 0) {
            return "0";
        }
        uint256 temp = value;
        uint256 digits;
        while (temp != 0) {
            digits++;
            temp /= 10;
        }
        bytes memory buffer = new bytes(digits);
        while (value != 0) {
            digits -= 1;
            buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
            value /= 10;
        }
        return string(buffer);
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
     */
    function toHexString(uint256 value) internal pure returns (string memory) {
        if (value == 0) {
            return "0x00";
        }
        uint256 temp = value;
        uint256 length = 0;
        while (temp != 0) {
            length++;
            temp >>= 8;
        }
        return toHexString(value, length);
    }

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

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

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

pragma solidity ^0.8.0;

import "./IERC165.sol";

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

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

pragma solidity ^0.8.0;

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

File 15 of 17 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)

pragma solidity ^0.8.1;

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

        return account.code.length > 0;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

File 16 of 17 : draft-IERC20Permit.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)

pragma solidity ^0.8.0;

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

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

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

File 17 of 17 : IERC20Metadata.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)

pragma solidity ^0.8.0;

import "../IERC20.sol";

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

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_admin","type":"address"},{"internalType":"address","name":"_mpMintPool","type":"address"},{"internalType":"address","name":"_mpRedeemPool","type":"address"},{"internalType":"address","name":"_stbt","type":"address"},{"internalType":"address","name":"_underlying","type":"address"},{"internalType":"address","name":"_recovery","type":"address"},{"internalType":"address","name":"_priceFeed","type":"address"},{"internalType":"address[3]","name":"_coins","type":"address[3]"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"inputs":[],"name":"ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MANAGER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"WTBTPOOL_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"basis","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"target","type":"address"},{"internalType":"uint256","name":"amountToTarget","type":"uint256"}],"name":"claimManagementFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"int128","name":"j","type":"int128"}],"name":"getRedeemAmountOutFromCurve","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"getSTBTbyUnderlyingAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"latestAnswer","outputs":[{"internalType":"int256","name":"","type":"int256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"mintSTBT","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"mintThreshold","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"mpMintPool","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"mpRedeemPool","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"priceFeed","outputs":[{"internalType":"contract AggregatorInterface","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"tokenAddress","type":"address"},{"internalType":"uint256","name":"amountToRecover","type":"uint256"}],"name":"recoverERC20","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"recovery","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"redeemAllSTBT","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"redeemSTBT","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"int128","name":"j","type":"int128"},{"internalType":"uint256","name":"minReturn","type":"uint256"},{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint256","name":"feeRate","type":"uint256"},{"internalType":"uint256","name":"feeCoefficient","type":"uint256"},{"internalType":"address","name":"feeCollector","type":"address"}],"name":"redeemSTBTByCurveWithFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"redeemThreshold","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_curvePool","type":"address"}],"name":"setCurvePool","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_mintPool","type":"address"}],"name":"setMintPool","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"setMintThreshold","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"int256","name":"_targetPrice","type":"int256"}],"name":"setPegPrice","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_redeemPool","type":"address"}],"name":"setRedeemPool","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"setRedeemThreshold","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_vault","type":"address"}],"name":"setVault","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"stbt","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"targetPrice","outputs":[{"internalType":"int256","name":"","type":"int256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"underlying","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"vault","outputs":[{"internalType":"contract IVault","name":"","type":"address"}],"stateMutability":"view","type":"function"}]

60806040523480156200001157600080fd5b50604051620026fe380380620026fe8339810160408190526200003491620005d6565b6001600160a01b0388166200007a5760405162461bcd60e51b815260206004820152600760248201526610afb0b236b4b760c91b60448201526064015b60405180910390fd5b6200008760008962000437565b620000a2600080516020620026de8339815191528062000447565b620000cc600080516020620026be833981519152600080516020620026de83398151915262000447565b620000e7600080516020620026de8339815191528962000437565b62000102600080516020620026be8339815191528962000437565b6001600160a01b038716620001495760405162461bcd60e51b815260206004820152600c60248201526b0857db5c135a5b9d141bdbdb60a21b604482015260640162000071565b6001600160a01b038616620001925760405162461bcd60e51b815260206004820152600e60248201526d0857db5c14995919595b541bdbdb60921b604482015260640162000071565b6001600160a01b038516620001d35760405162461bcd60e51b81526020600482015260066024820152650857dcdd189d60d21b604482015260640162000071565b6001600160a01b0384166200021a5760405162461bcd60e51b815260206004820152600c60248201526b215f756e6465726c79696e6760a01b604482015260640162000071565b6001600160a01b0383166200025f5760405162461bcd60e51b815260206004820152600a602482015269215f7265636f7665727960b01b604482015260640162000071565b6001600160a01b038216620002a55760405162461bcd60e51b815260206004820152600b60248201526a0857dc1c9a58d95199595960aa1b604482015260640162000071565b600180546001600160a01b03199081166001600160a01b038a811691909117909255600280548216898416179055600b80548216868416179055600480548216888416178155600580548316888516908117909155600c8054909316938616939093179091556040805163313ce56760e01b815290516000939263313ce56792808201926020929091829003018186803b1580156200034357600080fd5b505afa15801562000358573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200037e9190620006f4565b60ff16905080866001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b158015620003be57600080fd5b505afa158015620003d3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620003f99190620006f4565b60ff1662000408919062000825565b6200041590600a62000769565b60095562000427600d83600362000545565b505050505050505050506200086b565b62000443828262000492565b5050565b600082815260208190526040808220600101805490849055905190918391839186917fbd79b86ffe0ab8e8776151514217cd7cacd52c909f66475c3af44e129f0b00ff9190a4505050565b6200049e82826200051a565b62000443576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055620004d63390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000828152602081815260408083206001600160a01b038516845290915290205460ff165b92915050565b826003810192821562000590579160200282015b828111156200059057825182546001600160a01b0319166001600160a01b0390911617825560209092019160019091019062000559565b506200059e929150620005a2565b5090565b5b808211156200059e5760008155600101620005a3565b80516001600160a01b0381168114620005d157600080fd5b919050565b600080600080600080600080610140808a8c031215620005f557600080fd5b620006008a620005b9565b9850602062000611818c01620005b9565b98506200062160408c01620005b9565b97506200063160608c01620005b9565b96506200064160808c01620005b9565b95506200065160a08c01620005b9565b94506200066160c08c01620005b9565b93508b60ff8c01126200067357600080fd5b604051606081016001600160401b038111828210171562000698576200069862000855565b6040528060e08d01848e018f1015620006b057600080fd5b600094505b6003851015620006df57620006ca81620005b9565b825260019490940193908301908301620006b5565b50508093505050509295985092959890939650565b6000602082840312156200070757600080fd5b815160ff811681146200071957600080fd5b9392505050565b600181815b80851115620007615781600019048211156200074557620007456200083f565b808516156200075357918102915b93841c939080029062000725565b509250929050565b600062000719838360008262000782575060016200053f565b8162000791575060006200053f565b8160018114620007aa5760028114620007b557620007d5565b60019150506200053f565b60ff841115620007c957620007c96200083f565b50506001821b6200053f565b5060208310610133831016604e8410600b8410161715620007fa575081810a6200053f565b62000806838362000720565b80600019048211156200081d576200081d6200083f565b029392505050565b6000828210156200083a576200083a6200083f565b500390565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b611e43806200087b6000396000f3fe608060405234801561001057600080fd5b50600436106102775760003560e01c806382efd72c11610160578063a217fddf116100d8578063dc38679c1161008c578063ec87621c11610071578063ec87621c14610551578063f385cecb14610578578063fbfa77cf1461058157600080fd5b8063dc38679c14610535578063ddceafa91461053e57600080fd5b8063cd02bd7f116100bd578063cd02bd7f146104fc578063d547741f1461050f578063d75e95271461052257600080fd5b8063a217fddf146104e1578063c0798943146104e957600080fd5b806391d148541161012f5780639c8dead2116101145780639c8dead2146104bd5780639d1ba4b1146104c6578063a1c9f5bc146104ce57600080fd5b806391d148541461047357806393c1911b146104aa57600080fd5b806382efd72c1461041d57806384e00faf146104305780638980f11f1461045757806390f2ca871461046a57600080fd5b806350d25bcd116101f35780636e08a855116101c2578063741bef1a116101a7578063741bef1a146103db57806375b238fc146103ee5780637eb117171461041557600080fd5b80636e08a855146103b55780636f307dc3146103c857600080fd5b806350d25bcd14610374578063561294b61461037c57806366f53b951461038f5780636817031b146103a257600080fd5b806326eb66421161024a57806331f6c1c11161022f57806331f6c1c11461033b57806336568abe1461034e57806347a4efc71461036157600080fd5b806326eb6642146103155780632f2ff15d1461032857600080fd5b806301ffc9a71461027c5780630bde2947146102a4578063212f5cef146102cf578063248a9ca3146102e4575b600080fd5b61028f61028a366004611aef565b610594565b60405190151581526020015b60405180910390f35b6002546102b7906001600160a01b031681565b6040516001600160a01b03909116815260200161029b565b6102e26102dd366004611a43565b61062d565b005b6103076102f2366004611aaa565b60009081526020819052604090206001015490565b60405190815260200161029b565b6102e2610323366004611b6d565b6106e2565b6102e2610336366004611ac3565b6109c8565b6102e2610349366004611a5e565b6109f2565b6102e261035c366004611ac3565b610a53565b6102e261036f366004611a43565b610adf565b610307610b8f565b6102e261038a366004611aaa565b610c2a565b6001546102b7906001600160a01b031681565b6102e26103b0366004611a43565b610c5a565b6102e26103c3366004611aaa565b610d0a565b6005546102b7906001600160a01b031681565b600c546102b7906001600160a01b031681565b6103077fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c2177581565b6102e2610f01565b6004546102b7906001600160a01b031681565b6103077fca195b3ec482486f4bfbd43dcbc2deda4baf20e490d6fb18bda0087b876ba91481565b6102e2610465366004611a5e565b61101d565b61030760085481565b61028f610481366004611ac3565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b6103076104b8366004611aaa565b611061565b61030760075481565b6102e2611078565b6103076104dc366004611b4a565b611205565b610307600081565b6102e26104f7366004611a43565b6112b3565b6102e261050a366004611aaa565b611363565b6102e261051d366004611ac3565b611393565b6102e2610530366004611aaa565b6113b8565b610307600a5481565b600b546102b7906001600160a01b031681565b6103077f241ecf16d79d0f8dbfb92cbc07fe17840425976cf0667f022fe9877caa831b0881565b61030760095481565b6003546102b7906001600160a01b031681565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b00000000000000000000000000000000000000000000000000000000148061062757507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b92915050565b7fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c21775610657816113e8565b6001600160a01b0382166106b25760405162461bcd60e51b815260206004820152600b60248201527f215f6375727665506f6f6c00000000000000000000000000000000000000000060448201526064015b60405180910390fd5b506006805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b7fca195b3ec482486f4bfbd43dcbc2deda4baf20e490d6fb18bda0087b876ba91461070c816113e8565b60006107236009548a6113f590919063ffffffff16565b6006546040516307211ef760e01b8152600060048201819052600f8c900b6024830152604482018490529293506001600160a01b03909116906307211ef79060640160206040518083038186803b15801561077d57600080fd5b505afa158015610791573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107b59190611b31565b9050878110156108075760405162461bcd60e51b815260206004820152600a60248201527f216d696e52657475726e0000000000000000000000000000000000000000000060448201526064016106a9565b600480546006546040517f095ea7b30000000000000000000000000000000000000000000000000000000081526001600160a01b039182169381019390935260248301859052169063095ea7b390604401602060405180830381600087803b15801561087257600080fd5b505af1158015610886573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108aa9190611a88565b506006546040517fa6417ed600000000000000000000000000000000000000000000000000000000815260006004820152600f8b900b602482015260448101849052606481018390526001600160a01b039091169063a6417ed690608401600060405180830381600087803b15801561092257600080fd5b505af1158015610936573d6000803e3d6000fd5b505050506000600d60018b61094b9190611d00565b600f0b6003811061095e5761095e611de1565b01546001600160a01b0316905060006109818761097b858b6113f5565b90611408565b9050600061098f8483611414565b90506109a56001600160a01b0384168b83611420565b6109b96001600160a01b0384168884611420565b50505050505050505050505050565b6000828152602081905260409020600101546109e3816113e8565b6109ed83836114a0565b505050565b7fca195b3ec482486f4bfbd43dcbc2deda4baf20e490d6fb18bda0087b876ba914610a1c816113e8565b6000610a33600954846113f590919063ffffffff16565b600454909150610a4d906001600160a01b03168583611420565b50505050565b6001600160a01b0381163314610ad15760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c66000000000000000000000000000000000060648201526084016106a9565b610adb828261153e565b5050565b7fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c21775610b09816113e8565b6001600160a01b038216610b5f5760405162461bcd60e51b815260206004820152600a60248201527f215f6d696e74506f6f6c0000000000000000000000000000000000000000000060448201526064016106a9565b506001805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b600c54604080517f50d25bcd00000000000000000000000000000000000000000000000000000000815290516000926001600160a01b0316916350d25bcd916004808301926020929190829003018186803b158015610bed57600080fd5b505afa158015610c01573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c259190611b31565b905090565b7f241ecf16d79d0f8dbfb92cbc07fe17840425976cf0667f022fe9877caa831b08610c54816113e8565b50600a55565b7fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c21775610c84816113e8565b6001600160a01b038216610cda5760405162461bcd60e51b815260206004820152600760248201527f215f7661756c740000000000000000000000000000000000000000000000000060448201526064016106a9565b506003805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b7fca195b3ec482486f4bfbd43dcbc2deda4baf20e490d6fb18bda0087b876ba914610d34816113e8565b6000610d4b600954846113f590919063ffffffff16565b9050600a54600c60009054906101000a90046001600160a01b03166001600160a01b03166350d25bcd6040518163ffffffff1660e01b815260040160206040518083038186803b158015610d9e57600080fd5b505afa158015610db2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dd69190611b31565b1215610e0c5760405162461bcd60e51b8152602060048201526005602482015264646570656760d81b60448201526064016106a9565b600854811015610e5e5760405162461bcd60e51b815260206004820152601960248201527f6c657373207468616e2072656465656d5468726573686f6c640000000000000060448201526064016106a9565b600354600454610e7b916001600160a01b03918216911683611420565b6003546002546040517f7db0e8e80000000000000000000000000000000000000000000000000000000081526001600160a01b03918216600482015260248101849052911690637db0e8e890604401600060405180830381600087803b158015610ee457600080fd5b505af1158015610ef8573d6000803e3d6000fd5b50505050505050565b7fca195b3ec482486f4bfbd43dcbc2deda4baf20e490d6fb18bda0087b876ba914610f2b816113e8565b600480546040516370a0823160e01b815230928101929092526000916001600160a01b03909116906370a082319060240160206040518083038186803b158015610f7457600080fd5b505afa158015610f88573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fac9190611b31565b90506008548110156110005760405162461bcd60e51b815260206004820152601960248201527f6c657373207468616e2072656465656d5468726573686f6c640000000000000060448201526064016106a9565b600254600454610adb916001600160a01b03918216911683611420565b7fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c21775611047816113e8565b600b546109ed906001600160a01b03858116911684611420565b6000610627600954836113f590919063ffffffff16565b7fca195b3ec482486f4bfbd43dcbc2deda4baf20e490d6fb18bda0087b876ba9146110a2816113e8565b600a54600c60009054906101000a90046001600160a01b03166001600160a01b03166350d25bcd6040518163ffffffff1660e01b815260040160206040518083038186803b1580156110f357600080fd5b505afa158015611107573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061112b9190611b31565b12156111615760405162461bcd60e51b8152602060048201526005602482015264646570656760d81b60448201526064016106a9565b6005546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a082319060240160206040518083038186803b1580156111a557600080fd5b505afa1580156111b9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111dd9190611b31565b90506007548110610adb57600154600554610adb916001600160a01b03918216911683611420565b60008061121d600954856113f590919063ffffffff16565b6006546040516307211ef760e01b815260006004820152600f86900b6024820152604481018390529192506001600160a01b0316906307211ef79060640160206040518083038186803b15801561127357600080fd5b505afa158015611287573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112ab9190611b31565b949350505050565b7fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c217756112dd816113e8565b6001600160a01b0382166113335760405162461bcd60e51b815260206004820152600c60248201527f215f72656465656d506f6f6c000000000000000000000000000000000000000060448201526064016106a9565b506002805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b7f241ecf16d79d0f8dbfb92cbc07fe17840425976cf0667f022fe9877caa831b0861138d816113e8565b50600755565b6000828152602081905260409020600101546113ae816113e8565b6109ed838361153e565b7f241ecf16d79d0f8dbfb92cbc07fe17840425976cf0667f022fe9877caa831b086113e2816113e8565b50600855565b6113f281336115bd565b50565b60006114018284611ce1565b9392505050565b60006114018284611cbf565b60006114018284611d71565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb000000000000000000000000000000000000000000000000000000001790526109ed90849061163b565b6000828152602081815260408083206001600160a01b038516845290915290205460ff16610adb576000828152602081815260408083206001600160a01b03851684529091529020805460ff191660011790556114fa3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000828152602081815260408083206001600160a01b038516845290915290205460ff1615610adb576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6000828152602081815260408083206001600160a01b038516845290915290205460ff16610adb576115f9816001600160a01b03166014611720565b611604836020611720565b604051602001611615929190611bf3565b60408051601f198184030181529082905262461bcd60e51b82526106a991600401611c74565b6000611690826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166119019092919063ffffffff16565b8051909150156109ed57808060200190518101906116ae9190611a88565b6109ed5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f7420737563636565640000000000000000000000000000000000000000000060648201526084016106a9565b6060600061172f836002611ce1565b61173a906002611ca7565b67ffffffffffffffff81111561175257611752611df7565b6040519080825280601f01601f19166020018201604052801561177c576020820181803683370190505b5090507f3000000000000000000000000000000000000000000000000000000000000000816000815181106117b3576117b3611de1565b60200101906001600160f81b031916908160001a9053507f7800000000000000000000000000000000000000000000000000000000000000816001815181106117fe576117fe611de1565b60200101906001600160f81b031916908160001a9053506000611822846002611ce1565b61182d906001611ca7565b90505b60018111156118b2577f303132333435363738396162636465660000000000000000000000000000000085600f166010811061186e5761186e611de1565b1a60f81b82828151811061188457611884611de1565b60200101906001600160f81b031916908160001a90535060049490941c936118ab81611db4565b9050611830565b5083156114015760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016106a9565b60606112ab8484600085856001600160a01b0385163b6119635760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016106a9565b600080866001600160a01b0316858760405161197f9190611bd7565b60006040518083038185875af1925050503d80600081146119bc576040519150601f19603f3d011682016040523d82523d6000602084013e6119c1565b606091505b50915091506119d18282866119dc565b979650505050505050565b606083156119eb575081611401565b8251156119fb5782518084602001fd5b8160405162461bcd60e51b81526004016106a99190611c74565b80356001600160a01b0381168114611a2c57600080fd5b919050565b8035600f81900b8114611a2c57600080fd5b600060208284031215611a5557600080fd5b61140182611a15565b60008060408385031215611a7157600080fd5b611a7a83611a15565b946020939093013593505050565b600060208284031215611a9a57600080fd5b8151801515811461140157600080fd5b600060208284031215611abc57600080fd5b5035919050565b60008060408385031215611ad657600080fd5b82359150611ae660208401611a15565b90509250929050565b600060208284031215611b0157600080fd5b81357fffffffff000000000000000000000000000000000000000000000000000000008116811461140157600080fd5b600060208284031215611b4357600080fd5b5051919050565b60008060408385031215611b5d57600080fd5b82359150611ae660208401611a31565b600080600080600080600060e0888a031215611b8857600080fd5b87359650611b9860208901611a31565b955060408801359450611bad60608901611a15565b93506080880135925060a08801359150611bc960c08901611a15565b905092959891949750929550565b60008251611be9818460208701611d88565b9190910192915050565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351611c2b816017850160208801611d88565b7f206973206d697373696e6720726f6c65200000000000000000000000000000006017918401918201528351611c68816028840160208801611d88565b01602801949350505050565b6020815260008251806020840152611c93816040850160208701611d88565b601f01601f19169190910160400192915050565b60008219821115611cba57611cba611dcb565b500190565b600082611cdc57634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611cfb57611cfb611dcb565b500290565b600081600f0b83600f0b60008112817fffffffffffffffffffffffffffffffff8000000000000000000000000000000001831281151615611d4357611d43611dcb565b816f7fffffffffffffffffffffffffffffff018313811615611d6757611d67611dcb565b5090039392505050565b600082821015611d8357611d83611dcb565b500390565b60005b83811015611da3578181015183820152602001611d8b565b83811115610a4d5750506000910152565b600081611dc357611dc3611dcb565b506000190190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fdfea2646970667358221220eccc77fc0d02b77900ae6ce1f18943dcf592badf0c45712ac62bd100197e639c64736f6c63430008070033241ecf16d79d0f8dbfb92cbc07fe17840425976cf0667f022fe9877caa831b08a49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c2177500000000000000000000000031b8939c6e55a4ddaf0d6479320a0dfd9766ee9d0000000000000000000000005a47df2aaec5ad2f95a6a353c906559075f94186000000000000000000000000dee9ed3b19d104adbbe255b6befc680b4eaaada3000000000000000000000000530824da86689c9c17cdc2871ff29b058345b44a000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb480000000000000000000000007d273212aed9651797701a9dfb8e636f6ba832b20000000000000000000000008fffffd4afb6115b954bd326cbe7b4ba576818f60000000000000000000000006b175474e89094c44da98b954eedeac495271d0f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec7

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106102775760003560e01c806382efd72c11610160578063a217fddf116100d8578063dc38679c1161008c578063ec87621c11610071578063ec87621c14610551578063f385cecb14610578578063fbfa77cf1461058157600080fd5b8063dc38679c14610535578063ddceafa91461053e57600080fd5b8063cd02bd7f116100bd578063cd02bd7f146104fc578063d547741f1461050f578063d75e95271461052257600080fd5b8063a217fddf146104e1578063c0798943146104e957600080fd5b806391d148541161012f5780639c8dead2116101145780639c8dead2146104bd5780639d1ba4b1146104c6578063a1c9f5bc146104ce57600080fd5b806391d148541461047357806393c1911b146104aa57600080fd5b806382efd72c1461041d57806384e00faf146104305780638980f11f1461045757806390f2ca871461046a57600080fd5b806350d25bcd116101f35780636e08a855116101c2578063741bef1a116101a7578063741bef1a146103db57806375b238fc146103ee5780637eb117171461041557600080fd5b80636e08a855146103b55780636f307dc3146103c857600080fd5b806350d25bcd14610374578063561294b61461037c57806366f53b951461038f5780636817031b146103a257600080fd5b806326eb66421161024a57806331f6c1c11161022f57806331f6c1c11461033b57806336568abe1461034e57806347a4efc71461036157600080fd5b806326eb6642146103155780632f2ff15d1461032857600080fd5b806301ffc9a71461027c5780630bde2947146102a4578063212f5cef146102cf578063248a9ca3146102e4575b600080fd5b61028f61028a366004611aef565b610594565b60405190151581526020015b60405180910390f35b6002546102b7906001600160a01b031681565b6040516001600160a01b03909116815260200161029b565b6102e26102dd366004611a43565b61062d565b005b6103076102f2366004611aaa565b60009081526020819052604090206001015490565b60405190815260200161029b565b6102e2610323366004611b6d565b6106e2565b6102e2610336366004611ac3565b6109c8565b6102e2610349366004611a5e565b6109f2565b6102e261035c366004611ac3565b610a53565b6102e261036f366004611a43565b610adf565b610307610b8f565b6102e261038a366004611aaa565b610c2a565b6001546102b7906001600160a01b031681565b6102e26103b0366004611a43565b610c5a565b6102e26103c3366004611aaa565b610d0a565b6005546102b7906001600160a01b031681565b600c546102b7906001600160a01b031681565b6103077fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c2177581565b6102e2610f01565b6004546102b7906001600160a01b031681565b6103077fca195b3ec482486f4bfbd43dcbc2deda4baf20e490d6fb18bda0087b876ba91481565b6102e2610465366004611a5e565b61101d565b61030760085481565b61028f610481366004611ac3565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b6103076104b8366004611aaa565b611061565b61030760075481565b6102e2611078565b6103076104dc366004611b4a565b611205565b610307600081565b6102e26104f7366004611a43565b6112b3565b6102e261050a366004611aaa565b611363565b6102e261051d366004611ac3565b611393565b6102e2610530366004611aaa565b6113b8565b610307600a5481565b600b546102b7906001600160a01b031681565b6103077f241ecf16d79d0f8dbfb92cbc07fe17840425976cf0667f022fe9877caa831b0881565b61030760095481565b6003546102b7906001600160a01b031681565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b00000000000000000000000000000000000000000000000000000000148061062757507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b92915050565b7fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c21775610657816113e8565b6001600160a01b0382166106b25760405162461bcd60e51b815260206004820152600b60248201527f215f6375727665506f6f6c00000000000000000000000000000000000000000060448201526064015b60405180910390fd5b506006805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b7fca195b3ec482486f4bfbd43dcbc2deda4baf20e490d6fb18bda0087b876ba91461070c816113e8565b60006107236009548a6113f590919063ffffffff16565b6006546040516307211ef760e01b8152600060048201819052600f8c900b6024830152604482018490529293506001600160a01b03909116906307211ef79060640160206040518083038186803b15801561077d57600080fd5b505afa158015610791573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107b59190611b31565b9050878110156108075760405162461bcd60e51b815260206004820152600a60248201527f216d696e52657475726e0000000000000000000000000000000000000000000060448201526064016106a9565b600480546006546040517f095ea7b30000000000000000000000000000000000000000000000000000000081526001600160a01b039182169381019390935260248301859052169063095ea7b390604401602060405180830381600087803b15801561087257600080fd5b505af1158015610886573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108aa9190611a88565b506006546040517fa6417ed600000000000000000000000000000000000000000000000000000000815260006004820152600f8b900b602482015260448101849052606481018390526001600160a01b039091169063a6417ed690608401600060405180830381600087803b15801561092257600080fd5b505af1158015610936573d6000803e3d6000fd5b505050506000600d60018b61094b9190611d00565b600f0b6003811061095e5761095e611de1565b01546001600160a01b0316905060006109818761097b858b6113f5565b90611408565b9050600061098f8483611414565b90506109a56001600160a01b0384168b83611420565b6109b96001600160a01b0384168884611420565b50505050505050505050505050565b6000828152602081905260409020600101546109e3816113e8565b6109ed83836114a0565b505050565b7fca195b3ec482486f4bfbd43dcbc2deda4baf20e490d6fb18bda0087b876ba914610a1c816113e8565b6000610a33600954846113f590919063ffffffff16565b600454909150610a4d906001600160a01b03168583611420565b50505050565b6001600160a01b0381163314610ad15760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c66000000000000000000000000000000000060648201526084016106a9565b610adb828261153e565b5050565b7fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c21775610b09816113e8565b6001600160a01b038216610b5f5760405162461bcd60e51b815260206004820152600a60248201527f215f6d696e74506f6f6c0000000000000000000000000000000000000000000060448201526064016106a9565b506001805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b600c54604080517f50d25bcd00000000000000000000000000000000000000000000000000000000815290516000926001600160a01b0316916350d25bcd916004808301926020929190829003018186803b158015610bed57600080fd5b505afa158015610c01573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c259190611b31565b905090565b7f241ecf16d79d0f8dbfb92cbc07fe17840425976cf0667f022fe9877caa831b08610c54816113e8565b50600a55565b7fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c21775610c84816113e8565b6001600160a01b038216610cda5760405162461bcd60e51b815260206004820152600760248201527f215f7661756c740000000000000000000000000000000000000000000000000060448201526064016106a9565b506003805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b7fca195b3ec482486f4bfbd43dcbc2deda4baf20e490d6fb18bda0087b876ba914610d34816113e8565b6000610d4b600954846113f590919063ffffffff16565b9050600a54600c60009054906101000a90046001600160a01b03166001600160a01b03166350d25bcd6040518163ffffffff1660e01b815260040160206040518083038186803b158015610d9e57600080fd5b505afa158015610db2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dd69190611b31565b1215610e0c5760405162461bcd60e51b8152602060048201526005602482015264646570656760d81b60448201526064016106a9565b600854811015610e5e5760405162461bcd60e51b815260206004820152601960248201527f6c657373207468616e2072656465656d5468726573686f6c640000000000000060448201526064016106a9565b600354600454610e7b916001600160a01b03918216911683611420565b6003546002546040517f7db0e8e80000000000000000000000000000000000000000000000000000000081526001600160a01b03918216600482015260248101849052911690637db0e8e890604401600060405180830381600087803b158015610ee457600080fd5b505af1158015610ef8573d6000803e3d6000fd5b50505050505050565b7fca195b3ec482486f4bfbd43dcbc2deda4baf20e490d6fb18bda0087b876ba914610f2b816113e8565b600480546040516370a0823160e01b815230928101929092526000916001600160a01b03909116906370a082319060240160206040518083038186803b158015610f7457600080fd5b505afa158015610f88573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fac9190611b31565b90506008548110156110005760405162461bcd60e51b815260206004820152601960248201527f6c657373207468616e2072656465656d5468726573686f6c640000000000000060448201526064016106a9565b600254600454610adb916001600160a01b03918216911683611420565b7fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c21775611047816113e8565b600b546109ed906001600160a01b03858116911684611420565b6000610627600954836113f590919063ffffffff16565b7fca195b3ec482486f4bfbd43dcbc2deda4baf20e490d6fb18bda0087b876ba9146110a2816113e8565b600a54600c60009054906101000a90046001600160a01b03166001600160a01b03166350d25bcd6040518163ffffffff1660e01b815260040160206040518083038186803b1580156110f357600080fd5b505afa158015611107573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061112b9190611b31565b12156111615760405162461bcd60e51b8152602060048201526005602482015264646570656760d81b60448201526064016106a9565b6005546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a082319060240160206040518083038186803b1580156111a557600080fd5b505afa1580156111b9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111dd9190611b31565b90506007548110610adb57600154600554610adb916001600160a01b03918216911683611420565b60008061121d600954856113f590919063ffffffff16565b6006546040516307211ef760e01b815260006004820152600f86900b6024820152604481018390529192506001600160a01b0316906307211ef79060640160206040518083038186803b15801561127357600080fd5b505afa158015611287573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112ab9190611b31565b949350505050565b7fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c217756112dd816113e8565b6001600160a01b0382166113335760405162461bcd60e51b815260206004820152600c60248201527f215f72656465656d506f6f6c000000000000000000000000000000000000000060448201526064016106a9565b506002805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b7f241ecf16d79d0f8dbfb92cbc07fe17840425976cf0667f022fe9877caa831b0861138d816113e8565b50600755565b6000828152602081905260409020600101546113ae816113e8565b6109ed838361153e565b7f241ecf16d79d0f8dbfb92cbc07fe17840425976cf0667f022fe9877caa831b086113e2816113e8565b50600855565b6113f281336115bd565b50565b60006114018284611ce1565b9392505050565b60006114018284611cbf565b60006114018284611d71565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb000000000000000000000000000000000000000000000000000000001790526109ed90849061163b565b6000828152602081815260408083206001600160a01b038516845290915290205460ff16610adb576000828152602081815260408083206001600160a01b03851684529091529020805460ff191660011790556114fa3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000828152602081815260408083206001600160a01b038516845290915290205460ff1615610adb576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6000828152602081815260408083206001600160a01b038516845290915290205460ff16610adb576115f9816001600160a01b03166014611720565b611604836020611720565b604051602001611615929190611bf3565b60408051601f198184030181529082905262461bcd60e51b82526106a991600401611c74565b6000611690826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166119019092919063ffffffff16565b8051909150156109ed57808060200190518101906116ae9190611a88565b6109ed5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f7420737563636565640000000000000000000000000000000000000000000060648201526084016106a9565b6060600061172f836002611ce1565b61173a906002611ca7565b67ffffffffffffffff81111561175257611752611df7565b6040519080825280601f01601f19166020018201604052801561177c576020820181803683370190505b5090507f3000000000000000000000000000000000000000000000000000000000000000816000815181106117b3576117b3611de1565b60200101906001600160f81b031916908160001a9053507f7800000000000000000000000000000000000000000000000000000000000000816001815181106117fe576117fe611de1565b60200101906001600160f81b031916908160001a9053506000611822846002611ce1565b61182d906001611ca7565b90505b60018111156118b2577f303132333435363738396162636465660000000000000000000000000000000085600f166010811061186e5761186e611de1565b1a60f81b82828151811061188457611884611de1565b60200101906001600160f81b031916908160001a90535060049490941c936118ab81611db4565b9050611830565b5083156114015760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016106a9565b60606112ab8484600085856001600160a01b0385163b6119635760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016106a9565b600080866001600160a01b0316858760405161197f9190611bd7565b60006040518083038185875af1925050503d80600081146119bc576040519150601f19603f3d011682016040523d82523d6000602084013e6119c1565b606091505b50915091506119d18282866119dc565b979650505050505050565b606083156119eb575081611401565b8251156119fb5782518084602001fd5b8160405162461bcd60e51b81526004016106a99190611c74565b80356001600160a01b0381168114611a2c57600080fd5b919050565b8035600f81900b8114611a2c57600080fd5b600060208284031215611a5557600080fd5b61140182611a15565b60008060408385031215611a7157600080fd5b611a7a83611a15565b946020939093013593505050565b600060208284031215611a9a57600080fd5b8151801515811461140157600080fd5b600060208284031215611abc57600080fd5b5035919050565b60008060408385031215611ad657600080fd5b82359150611ae660208401611a15565b90509250929050565b600060208284031215611b0157600080fd5b81357fffffffff000000000000000000000000000000000000000000000000000000008116811461140157600080fd5b600060208284031215611b4357600080fd5b5051919050565b60008060408385031215611b5d57600080fd5b82359150611ae660208401611a31565b600080600080600080600060e0888a031215611b8857600080fd5b87359650611b9860208901611a31565b955060408801359450611bad60608901611a15565b93506080880135925060a08801359150611bc960c08901611a15565b905092959891949750929550565b60008251611be9818460208701611d88565b9190910192915050565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351611c2b816017850160208801611d88565b7f206973206d697373696e6720726f6c65200000000000000000000000000000006017918401918201528351611c68816028840160208801611d88565b01602801949350505050565b6020815260008251806020840152611c93816040850160208701611d88565b601f01601f19169190910160400192915050565b60008219821115611cba57611cba611dcb565b500190565b600082611cdc57634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611cfb57611cfb611dcb565b500290565b600081600f0b83600f0b60008112817fffffffffffffffffffffffffffffffff8000000000000000000000000000000001831281151615611d4357611d43611dcb565b816f7fffffffffffffffffffffffffffffff018313811615611d6757611d67611dcb565b5090039392505050565b600082821015611d8357611d83611dcb565b500390565b60005b83811015611da3578181015183820152602001611d8b565b83811115610a4d5750506000910152565b600081611dc357611dc3611dcb565b506000190190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fdfea2646970667358221220eccc77fc0d02b77900ae6ce1f18943dcf592badf0c45712ac62bd100197e639c64736f6c63430008070033

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

00000000000000000000000031b8939c6e55a4ddaf0d6479320a0dfd9766ee9d0000000000000000000000005a47df2aaec5ad2f95a6a353c906559075f94186000000000000000000000000dee9ed3b19d104adbbe255b6befc680b4eaaada3000000000000000000000000530824da86689c9c17cdc2871ff29b058345b44a000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb480000000000000000000000007d273212aed9651797701a9dfb8e636f6ba832b20000000000000000000000008fffffd4afb6115b954bd326cbe7b4ba576818f60000000000000000000000006b175474e89094c44da98b954eedeac495271d0f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec7

-----Decoded View---------------
Arg [0] : _admin (address): 0x31b8939C6e55A4DDaF0d6479320A0DFD9766EE9D
Arg [1] : _mpMintPool (address): 0x5a47DF2aaec5ad2F95A6a353c906559075f94186
Arg [2] : _mpRedeemPool (address): 0xDEE9Ed3B19d104ADBbE255B6bEFC680b4eaAAda3
Arg [3] : _stbt (address): 0x530824DA86689C9C17CdC2871Ff29B058345b44a
Arg [4] : _underlying (address): 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48
Arg [5] : _recovery (address): 0x7d273212AED9651797701a9dFb8e636F6Ba832b2
Arg [6] : _priceFeed (address): 0x8fFfFfd4AfB6115b954Bd326cbe7B4BA576818f6
Arg [7] : _coins (address[3]): 0x6B175474E89094C44Da98b954EedeAC495271d0F,0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48,0xdAC17F958D2ee523a2206206994597C13D831ec7

-----Encoded View---------------
10 Constructor Arguments found :
Arg [0] : 00000000000000000000000031b8939c6e55a4ddaf0d6479320a0dfd9766ee9d
Arg [1] : 0000000000000000000000005a47df2aaec5ad2f95a6a353c906559075f94186
Arg [2] : 000000000000000000000000dee9ed3b19d104adbbe255b6befc680b4eaaada3
Arg [3] : 000000000000000000000000530824da86689c9c17cdc2871ff29b058345b44a
Arg [4] : 000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48
Arg [5] : 0000000000000000000000007d273212aed9651797701a9dfb8e636f6ba832b2
Arg [6] : 0000000000000000000000008fffffd4afb6115b954bd326cbe7b4ba576818f6
Arg [7] : 0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f
Arg [8] : 000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48
Arg [9] : 000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec7


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  ]

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.