**Maintenance in progress, block data might not be up to date**

Contract 0x6B4eb33B504D4f3b4D6c6c7bE75E048aA32fF190

 

Contract Overview

Balance:
0 BNB

BNB Value:
$0.00

Token:
 
Txn Hash Method
Block
From
To
Value [Txn Fee]
0x913f9538a6020ed60be9b2faf8db54bdeac976c1dec5761e21622efdf8e5d2ecToggle Minting101046202021-08-17 9:47:4965 days 18 hrs ago0x62ca555de2d65f8e9d45a9b3d5c1b92ac1a64ecc IN  0x6b4eb33b504d4f3b4d6c6c7be75e048aa32ff1900 BNB0.00014
0x08895a0c808df0338bce33f973dece5df3f08d449fcd1e3b2cc2d1a1180d099cToggle Redeeming101046182021-08-17 9:47:4365 days 18 hrs ago0x62ca555de2d65f8e9d45a9b3d5c1b92ac1a64ecc IN  0x6b4eb33b504d4f3b4d6c6c7be75e048aa32ff1900 BNB0.0002151
0x69ecf7dd642f64b109f14cecbd69a74f2e8f546d1d1acca3f6831a473fdcb7d2Collect Redempti...88604222021-07-04 11:15:31109 days 16 hrs ago0xf312d9890f78ee62fe42f9d6e289d5e503d2ab10 IN  0x6b4eb33b504d4f3b4d6c6c7be75e048aa32ff1900 BNB0.00034616
0x5a7f0471aff8653d4708eefff8004c164c3eaccf507513055c6e2b5474c0d04fRedeem88604002021-07-04 11:14:25109 days 16 hrs ago0xf312d9890f78ee62fe42f9d6e289d5e503d2ab10 IN  0x6b4eb33b504d4f3b4d6c6c7be75e048aa32ff1900 BNB0.000786815
0x6c79d62ead36933137eb55244cca0c2a1ab159731f6bafe6ddeaad55edc2fbdfCollect Redempti...86931862021-06-28 14:36:36115 days 13 hrs ago0x8e808f0dfb9a47a93451ca39f29a1e2b2541a86e IN  0x6b4eb33b504d4f3b4d6c6c7be75e048aa32ff1900 BNB0.00034616
0x70b3e89702558e342f5407a2b00c8f1e4487fd8fe38c43d0a5d142996f38b6bbRedeem86931832021-06-28 14:36:18115 days 13 hrs ago0x8e808f0dfb9a47a93451ca39f29a1e2b2541a86e IN  0x6b4eb33b504d4f3b4d6c6c7be75e048aa32ff1900 BNB0.000711935
0x0e943cdd3b467c1ce6ec739f953d989c99b20edc002fbe8b805b21cd7091ea11Collect Redempti...86907332021-06-28 12:32:28115 days 15 hrs ago0x8286688b8fbc82d5a86f15eddb83c977fda527e8 IN  0x6b4eb33b504d4f3b4d6c6c7be75e048aa32ff1900 BNB0.00034616
0xf4e51153e9cc0ef8fecacebc25fcfd9e5237291308f6c2700fa22efbd888e569Collect Redempti...86801642021-06-28 3:42:23116 days 20 mins ago0xd15f9dd97d83fe09847b9991eb9cbb37fc7699c8 IN  0x6b4eb33b504d4f3b4d6c6c7be75e048aa32ff1900 BNB0.00034616
0x8d3de7d7ec601d32ba080b74fdfe3e828af4b8a50d4e01ab94ba95250f7e621eRedeem86801552021-06-28 3:41:56116 days 21 mins ago0xd15f9dd97d83fe09847b9991eb9cbb37fc7699c8 IN  0x6b4eb33b504d4f3b4d6c6c7be75e048aa32ff1900 BNB0.000711995
0xa938a70e65d3efb1a2449405739e8d29b8a54dd14e7e129ff4c760a0938565b8Redeem86780732021-06-28 1:57:27116 days 2 hrs ago0x8286688b8fbc82d5a86f15eddb83c977fda527e8 IN  0x6b4eb33b504d4f3b4d6c6c7be75e048aa32ff1900 BNB0.000711995
0xf0f309053229d807cbb0d96be26dbbe6d6532ef905e608540470edc4a118e6edMint86197332021-06-26 1:11:08118 days 2 hrs ago0x8e808f0dfb9a47a93451ca39f29a1e2b2541a86e IN  0x6b4eb33b504d4f3b4d6c6c7be75e048aa32ff1900 BNB0.00069591
0x49d14bb6d884c1980fafdb6a0f862ea4061a5cb0d33ada73b59720f1db459eacMint86188462021-06-26 0:26:41118 days 3 hrs ago0xd15f9dd97d83fe09847b9991eb9cbb37fc7699c8 IN  0x6b4eb33b504d4f3b4d6c6c7be75e048aa32ff1900 BNB0.00062109
0xf75bafa7206cb1ac68d6d23573bce5ec28f8c8b9bb54292d5504b85f44c4b3e2Mint86188292021-06-26 0:25:50118 days 3 hrs ago0xd15f9dd97d83fe09847b9991eb9cbb37fc7699c8 IN  0x6b4eb33b504d4f3b4d6c6c7be75e048aa32ff1900 BNB0.00062103
0x86bc6ab27d6f970f132483135dcc496285602531289fef7a1aee8161ea4ca842Mint86167072021-06-25 22:39:44118 days 5 hrs ago0x0a24ef6450b10e434b33cafa2a8fbe78f96bfb1a IN  0x6b4eb33b504d4f3b4d6c6c7be75e048aa32ff1900 BNB0.00062091
0xb1ae2d2d5f8663e4a12ce0170dd25bece6cf1437bd1b795afc8e96777009c647Mint86123692021-06-25 19:02:50118 days 9 hrs ago0x8e808f0dfb9a47a93451ca39f29a1e2b2541a86e IN  0x6b4eb33b504d4f3b4d6c6c7be75e048aa32ff1900 BNB0.00062073
0xea32663bf212349bcd1201672a1ddf3dd1bc951f5cf566c40ffea2c35520908aMint85948662021-06-25 4:24:37118 days 23 hrs ago0x8e808f0dfb9a47a93451ca39f29a1e2b2541a86e IN  0x6b4eb33b504d4f3b4d6c6c7be75e048aa32ff1900 BNB0.00069603
0x80e2df314b5e2e4f7fbc4669e95a007c273e59a06ad9d1f617a37fdd35e495d7Mint85892172021-06-24 23:41:19119 days 4 hrs ago0x0a24ef6450b10e434b33cafa2a8fbe78f96bfb1a IN  0x6b4eb33b504d4f3b4d6c6c7be75e048aa32ff1900 BNB0.00069591
0x18aca4037dab069fe1c9e87a1fac74192115faea590a04386d733e2e9aa9a4a8Mint85891542021-06-24 23:38:10119 days 4 hrs ago0x0a24ef6450b10e434b33cafa2a8fbe78f96bfb1a IN  0x6b4eb33b504d4f3b4d6c6c7be75e048aa32ff1900 BNB0.00062079
0xd006a6acd8b8f4ff9e9df2536d476e4b1e9398ab6e424eedd58d478a670b47d4Mint85828712021-06-24 18:23:30119 days 9 hrs ago0x8e808f0dfb9a47a93451ca39f29a1e2b2541a86e IN  0x6b4eb33b504d4f3b4d6c6c7be75e048aa32ff1900 BNB0.00069597
0x042abc77b4844b84a5d25f29be6e3ebb038efae22a54b5032149bbbee006063aMint85805632021-06-24 16:27:39119 days 11 hrs ago0x8e808f0dfb9a47a93451ca39f29a1e2b2541a86e IN  0x6b4eb33b504d4f3b4d6c6c7be75e048aa32ff1900 BNB0.00069597
0xabe8f38f5aae7b851a04aefdc72f5b9689fe45a7d3f8f8c897d53e556de56611Mint85685902021-06-24 6:27:51119 days 21 hrs ago0x0a24ef6450b10e434b33cafa2a8fbe78f96bfb1a IN  0x6b4eb33b504d4f3b4d6c6c7be75e048aa32ff1900 BNB0.00062067
0x943bb9ec4ee4deb2aa1443fd73af4c58fbe63c4ef7c3a333c3e9b878fb430a9cMint85684962021-06-24 6:23:09119 days 21 hrs ago0x0a24ef6450b10e434b33cafa2a8fbe78f96bfb1a IN  0x6b4eb33b504d4f3b4d6c6c7be75e048aa32ff1900 BNB0.00062067
0xcad5ef667f61d1c8036998f19dc74ad8bb3f3d4f4e1a047a475eec98c695a34cMint85410642021-06-23 7:26:50120 days 20 hrs ago0x0a24ef6450b10e434b33cafa2a8fbe78f96bfb1a IN  0x6b4eb33b504d4f3b4d6c6c7be75e048aa32ff1900 BNB0.00062067
0x221b176f193764d68ec115afa900e964b0f90cf1129f54d9a46592ccfbcf5b2cCollect Redempti...85156622021-06-22 10:06:27121 days 17 hrs ago0xb12f75b5f95022a54e6bbdd1086691635571911e IN  0x6b4eb33b504d4f3b4d6c6c7be75e048aa32ff1900 BNB0.00042116
0x831bf23bf0f865468bd52014c40b7a3a4bbbc1184d55e2cf0c9ae1c051609a4bRedeem85155822021-06-22 10:02:27121 days 18 hrs ago0xb12f75b5f95022a54e6bbdd1086691635571911e IN  0x6b4eb33b504d4f3b4d6c6c7be75e048aa32ff1900 BNB0.000786995
[ Download CSV Export 
Parent Txn Hash Block From To Value
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Pool

Compiler Version
v0.7.6+commit.7338295f

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion, MIT license

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 16 : Context.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

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

File 2 of 16 : Ownable.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

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

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

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor () internal {
        address msgSender = _msgSender();
        _owner = msgSender;
        emit OwnershipTransferred(address(0), msgSender);
    }

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

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
        _;
    }

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

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

File 3 of 16 : SafeMath.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

/**
 * @dev Wrappers over Solidity's arithmetic operations with added overflow
 * checks.
 *
 * Arithmetic operations in Solidity wrap on overflow. This can easily result
 * in bugs, because programmers usually assume that an overflow raises an
 * error, which is the standard behavior in high level programming languages.
 * `SafeMath` restores this intuition by reverting the transaction when an
 * operation overflows.
 *
 * Using this library instead of the unchecked operations eliminates an entire
 * class of bugs, so it's recommended to use it always.
 */
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) {
        uint256 c = a + b;
        if (c < a) return (false, 0);
        return (true, c);
    }

    /**
     * @dev Returns the substraction of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        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) {
        // 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) {
        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) {
        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) {
        uint256 c = a + b;
        require(c >= a, "SafeMath: addition overflow");
        return c;
    }

    /**
     * @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) {
        require(b <= a, "SafeMath: subtraction overflow");
        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) {
        if (a == 0) return 0;
        uint256 c = a * b;
        require(c / a == b, "SafeMath: multiplication overflow");
        return c;
    }

    /**
     * @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. 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) internal pure returns (uint256) {
        require(b > 0, "SafeMath: division by zero");
        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) {
        require(b > 0, "SafeMath: modulo by zero");
        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) {
        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.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryDiv}.
     *
     * 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) {
        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) {
        require(b > 0, errorMessage);
        return a % b;
    }
}

File 4 of 16 : ERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

import "../../utils/Context.sol";
import "./IERC20.sol";
import "../../math/SafeMath.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 guidelines: functions revert instead
 * of returning `false` on failure. This behavior is nonetheless conventional
 * and does not conflict with the expectations of ERC20 applications.
 *
 * Additionally, an {Approval} event is emitted on calls to {transferFrom}.
 * This allows applications to reconstruct the allowance for all accounts just
 * by listening to said events. Other implementations of the EIP may not emit
 * these events, as it isn't required by the specification.
 *
 * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
 * functions have been added to mitigate the well-known issues around setting
 * allowances. See {IERC20-approve}.
 */
contract ERC20 is Context, IERC20 {
    using SafeMath for uint256;

    mapping (address => uint256) private _balances;

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

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;
    uint8 private _decimals;

    /**
     * @dev Sets the values for {name} and {symbol}, initializes {decimals} with
     * a default value of 18.
     *
     * To select a different value for {decimals}, use {_setupDecimals}.
     *
     * All three of these values are immutable: they can only be set once during
     * construction.
     */
    constructor (string memory name_, string memory symbol_) public {
        _name = name_;
        _symbol = symbol_;
        _decimals = 18;
    }

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

    /**
     * @dev Returns the symbol of the token, usually a shorter version of the
     * name.
     */
    function symbol() public view virtual 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 {_setupDecimals} is
     * called.
     *
     * 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 returns (uint8) {
        return _decimals;
    }

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

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

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

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

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

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

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

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

        _beforeTokenTransfer(sender, recipient, amount);

        _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
        _balances[recipient] = _balances[recipient].add(amount);
        emit Transfer(sender, recipient, amount);
    }

    /** @dev Creates `amount` tokens and assigns them to `account`, increasing
     * the total supply.
     *
     * Emits a {Transfer} event with `from` set to the zero address.
     *
     * Requirements:
     *
     * - `to` 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 = _totalSupply.add(amount);
        _balances[account] = _balances[account].add(amount);
        emit Transfer(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);

        _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
        _totalSupply = _totalSupply.sub(amount);
        emit Transfer(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 Sets {decimals} to a value other than the default one of 18.
     *
     * WARNING: This function should only be called from the constructor. Most
     * applications that interact with token contracts will not expect
     * {decimals} to ever change, and may work incorrectly if it does.
     */
    function _setupDecimals(uint8 decimals_) internal virtual {
        _decimals = decimals_;
    }

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

File 5 of 16 : IERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

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

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

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

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

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

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

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

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

File 6 of 16 : SafeERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

import "./IERC20.sol";
import "../../math/SafeMath.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 SafeMath for uint256;
    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'
        // solhint-disable-next-line max-line-length
        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).add(value);
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
    }

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

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

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

File 7 of 16 : Address.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.2 <0.8.0;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

        uint256 size;
        // solhint-disable-next-line no-inline-assembly
        assembly { size := extcodesize(account) }
        return size > 0;
    }

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

        // solhint-disable-next-line avoid-low-level-calls, avoid-call-value
        (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");

        // solhint-disable-next-line avoid-low-level-calls
        (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");

        // solhint-disable-next-line avoid-low-level-calls
        (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");

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return _verifyCallResult(success, returndata, errorMessage);
    }

    function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {
        if (success) {
            return returndata;
        } else {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly

                // solhint-disable-next-line no-inline-assembly
                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

File 8 of 16 : Context.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <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 GSN 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 payable) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes memory) {
        this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
        return msg.data;
    }
}

File 9 of 16 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

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

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

    uint256 private _status;

    constructor () internal {
        _status = _NOT_ENTERED;
    }

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

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

        _;

        // By storing the original value once again, a refund is triggered (see
        // https://eips.ethereum.org/EIPS/eip-2200)
        _status = _NOT_ENTERED;
    }
}

File 10 of 16 : Operator.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.7.6;

import "@openzeppelin/contracts/GSN/Context.sol";
import "@openzeppelin/contracts/access/Ownable.sol";

abstract contract Operator is Context, Ownable {
    address private _operator;

    event OperatorTransferred(address indexed previousOperator, address indexed newOperator);

    constructor() {
        _operator = _msgSender();
        emit OperatorTransferred(address(0), _operator);
    }

    function operator() public view returns (address) {
        return _operator;
    }

    modifier onlyOperator() {
        require(_operator == msg.sender, "operator: caller is not the operator");
        _;
    }

    function isOperator() public view returns (bool) {
        return _msgSender() == _operator;
    }

    function transferOperator(address newOperator_) public onlyOwner {
        _transferOperator(newOperator_);
    }

    function _transferOperator(address newOperator_) internal {
        require(newOperator_ != address(0), "operator: zero address given for new operator");
        emit OperatorTransferred(address(0), newOperator_);
        _operator = newOperator_;
    }
}

File 11 of 16 : Pool.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.7.6;
pragma experimental ABIEncoderV2;

import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";

import "./interfaces/IDiamond.sol";
import "./interfaces/IDToken.sol";
import "./interfaces/ITreasury.sol";
import "./interfaces/IOracle.sol";
import "./interfaces/IPool.sol";
import "./Operator.sol";

contract Pool is Operator, ReentrancyGuard, IPool {
    using SafeMath for uint256;
    using SafeERC20 for ERC20;

    /* ========== STATE VARIABLES ========== */

    address public immutable override collateral;
    address public immutable override dToken;
    address public override diamond;
    address public oracleDiamond;
    address public oracleDToken;
    address public treasury;

    mapping(address => uint256) public redeem_diamond_balances;
    mapping(address => uint256) public redeem_collateral_balances;

    uint256 public override unclaimed_pool_collateral;
    uint256 public override unclaimed_pool_diamond;

    mapping(address => uint256) public last_redeemed;

    // Constants for various precisions
    uint256 private constant PRICE_PRECISION = 1e6;

    // Number of decimals needed to get to 18
    uint256 private immutable missing_decimals;

    // Pool_ceiling is the total units of collateral that a pool contract can hold
    uint256 public pool_ceiling = 0;

    // Number of blocks to wait before being able to collectRedemption()
    uint256 public redemption_delay = 1;

    // AccessControl state variables
    bool public mint_paused = false;
    bool public redeem_paused = false;
    bool public migrated = false;

    // Collateral ratio
    uint256 public last_refresh_cr_timestamp;
    uint256 public target_collateral_ratio = 1000000;
    uint256 public effective_collateral_ratio = 1000000;
    bool public target_collateral_ratio_paused = false;
    bool public effective_collateral_ratio_paused = false;
    uint256 public refresh_cooldown;
    uint256 public ratio_step;
    uint256 public price_target;
    uint256 public price_band;
    uint256 private constant COLLATERAL_RATIO_PRECISION = 1e6;
    uint256 private constant COLLATERAL_RATIO_MAX = 1e6;

    // fee
    uint256 public redemption_fee;
    uint256 public minting_fee;

    /* ========== MODIFIERS ========== */

    modifier notMigrated() {
        require(!migrated, "migrated");
        _;
    }

    /* ========== CONSTRUCTOR ========== */

    constructor(
        address _dToken,
        address _diamond,
        address _collateral,
        uint256 _pool_ceiling,
        address _treasury
    ) {
        dToken = _dToken;
        diamond = _diamond;
        collateral = _collateral;
        treasury = _treasury;
        pool_ceiling = _pool_ceiling;
        missing_decimals = uint256(18).sub(ERC20(_collateral).decimals());
        ratio_step = 2500;
        refresh_cooldown = 3600;
        price_target = 1000000; // match exactly 100%
        price_band = 1500; // 0.5% of diff
        redemption_fee = 3000;
        minting_fee = 1000;
    }

    /* ========== VIEWS ========== */

    function collateralReserve() public view returns (address) {
        return ITreasury(treasury).collateralReserve();
    }

    function globalCollateralBalance() public view returns (uint256) {
        return ITreasury(treasury).globalCollateralValue(collateral);
    }

    function collateralBalance() public view override returns (uint256) {
        return (ERC20(collateral).balanceOf(collateralReserve()).sub(unclaimed_pool_collateral)).mul(10**missing_decimals);
    }

    function info()
        external
        view
        override
        returns (
            uint256,
            uint256,
            uint256,
            uint256,
            uint256,
            uint256,
            bool,
            bool,
            address,
            address,
            string memory,
            string memory,
            uint256,
            uint256
        )
    {
        return (pool_ceiling, collateralBalance(), unclaimed_pool_collateral, unclaimed_pool_diamond, minting_fee, redemption_fee, mint_paused, redeem_paused, collateral, dToken, ERC20(collateral).symbol(), ERC20(dToken).symbol(), target_collateral_ratio, effective_collateral_ratio);
    }

    function diamondToCollateralPrice() public view override returns (uint256) {
        return IOracle(oracleDiamond).consult();
    }

    function dTokenToCollateralPrice() public view override returns (uint256) {
        return IOracle(oracleDToken).consult();
    }

    function calcEffectiveCollateralRatio() public view returns (uint256) {
        if (effective_collateral_ratio_paused) {
            return target_collateral_ratio;
        }
        uint256 total_collateral = globalCollateralBalance();
        uint256 total_supply_dToken = IERC20(dToken).totalSupply();
        uint256 ecr = total_collateral.mul(PRICE_PRECISION).div(total_supply_dToken);
        if (ecr > COLLATERAL_RATIO_MAX) {
            return COLLATERAL_RATIO_MAX;
        }
        return ecr;
    }

    /* ========== PUBLIC FUNCTIONS ========== */

    function mint(
        uint256 _collateral_amount,
        uint256 _diamond_amount,
        uint256 _dtoken_out_min
    ) external override notMigrated {
        require(!mint_paused, "Minting is paused");
        require(collateralBalance().add(_collateral_amount) <= pool_ceiling, "Pool ceiling was reached");

        uint256 _diamond_relative_price = diamondToCollateralPrice();
        uint256 _total_value = 0;
        uint256 _required_diamond_amount = 0;
        if (target_collateral_ratio > 0) {
            _total_value = _collateral_amount.mul(10**missing_decimals).mul(COLLATERAL_RATIO_PRECISION).div(target_collateral_ratio);
            if (target_collateral_ratio < COLLATERAL_RATIO_MAX) {
                _required_diamond_amount = _total_value.sub(_collateral_amount).mul(PRICE_PRECISION).div(_diamond_relative_price);
            }
        } else {
            _total_value = _diamond_amount.mul(_diamond_relative_price).div(PRICE_PRECISION);
            _required_diamond_amount = _diamond_amount;
        }
        uint256 _actual_output_amount = _total_value.sub((_total_value.mul(minting_fee)).div(PRICE_PRECISION));
        require(_dtoken_out_min <= _actual_output_amount, ">slippage");

        if (_required_diamond_amount > 0) {
            require(_required_diamond_amount <= _diamond_amount, "<shareBalance");
            IDiamond(diamond).poolBurnFrom(msg.sender, _required_diamond_amount);
        }
        if (_collateral_amount > 0) {
            _transferCollateralToReserve(msg.sender, _collateral_amount);
        }
        IDToken(dToken).poolMint(msg.sender, _actual_output_amount);
    }

    function redeem(
        uint256 _dToken_amount,
        uint256 _diamond_out_min,
        uint256 _collateral_out_min
    ) external notMigrated {
        require(!redeem_paused, "Redeeming is paused");
        uint256 _diamond_relative_price = diamondToCollateralPrice();
        uint256 _dtoken_amount_post_fee = _dToken_amount.sub((_dToken_amount.mul(redemption_fee)).div(PRICE_PRECISION));
        uint256 _collateral_output_amount = 0;
        uint256 _diamond_output_amount = 0;

        if (effective_collateral_ratio < COLLATERAL_RATIO_MAX) {
            uint256 _diamond_output_value = _dtoken_amount_post_fee.sub(_dtoken_amount_post_fee.mul(effective_collateral_ratio).div(PRICE_PRECISION));
            _diamond_output_amount = _diamond_output_value.mul(PRICE_PRECISION).div(_diamond_relative_price);
        }

        if (effective_collateral_ratio > 0) {
            _collateral_output_amount = _dtoken_amount_post_fee.div(10**missing_decimals).mul(effective_collateral_ratio).div(PRICE_PRECISION);
        }

        if (_collateral_output_amount > 0) {
            redeem_collateral_balances[msg.sender] = redeem_collateral_balances[msg.sender].add(_collateral_output_amount);
            unclaimed_pool_collateral = unclaimed_pool_collateral.add(_collateral_output_amount);
        }

        if (_diamond_output_amount > 0) {
            redeem_diamond_balances[msg.sender] = redeem_diamond_balances[msg.sender].add(_diamond_output_amount);
            unclaimed_pool_diamond = unclaimed_pool_diamond.add(_diamond_output_amount);
        }

        last_redeemed[msg.sender] = block.number;

        // Check if collateral balance meets and meet output expectation
        require(ERC20(collateral).balanceOf(collateralReserve()) >= unclaimed_pool_collateral, "<collateralBalance");
        require(_collateral_out_min <= _collateral_output_amount && _diamond_out_min <= _diamond_output_amount, ">slippage");

        // Move all external functions to the end
        IDToken(dToken).poolBurnFrom(msg.sender, _dToken_amount);
        if (_diamond_output_amount > 0) {
            _mintDiamondToCollateralReserve(_diamond_output_amount);
        }
    }

    function collectRedemption() external {
        // Redeem and Collect cannot happen in the same transaction to avoid flash loan attack
        require((last_redeemed[msg.sender].add(redemption_delay)) <= block.number, "<redemption_delay");

        bool _send_diamond = false;
        bool _send_collateral = false;
        uint256 _share_amount;
        uint256 _collateral_amount;

        if (redeem_diamond_balances[msg.sender] > 0) {
            _share_amount = redeem_diamond_balances[msg.sender];
            redeem_diamond_balances[msg.sender] = 0;
            unclaimed_pool_diamond = unclaimed_pool_diamond.sub(_share_amount);
            _send_diamond = true;
        }

        if (redeem_collateral_balances[msg.sender] > 0) {
            _collateral_amount = redeem_collateral_balances[msg.sender];
            redeem_collateral_balances[msg.sender] = 0;
            unclaimed_pool_collateral = unclaimed_pool_collateral.sub(_collateral_amount);
            _send_collateral = true;
        }

        if (_send_diamond) {
            _requestTransferDiamond(msg.sender, _share_amount);
        }

        if (_send_collateral) {
            _requestTransferCollateral(msg.sender, _collateral_amount);
        }
    }

    function refreshCollateralRatio() public {
        require(!target_collateral_ratio_paused, "Target Collateral Ratio has been paused");
        require(block.timestamp - last_refresh_cr_timestamp >= refresh_cooldown, "Must wait for the refresh cooldown since last refresh");

        uint256 current_dtoken_price = dTokenToCollateralPrice();

        if (current_dtoken_price > price_target.add(price_band)) {
            if (target_collateral_ratio <= ratio_step) {
                target_collateral_ratio = 0;
            } else {
                target_collateral_ratio = target_collateral_ratio.sub(ratio_step);
            }
        } else if (current_dtoken_price < price_target.sub(price_band)) {
            if (target_collateral_ratio.add(ratio_step) >= COLLATERAL_RATIO_MAX) {
                target_collateral_ratio = COLLATERAL_RATIO_MAX;
            } else {
                target_collateral_ratio = target_collateral_ratio.add(ratio_step);
            }
        }

        // If using ECR, then calcECR. If not, update ECR = TCR
        if (!effective_collateral_ratio_paused) {
            effective_collateral_ratio = calcEffectiveCollateralRatio();
        } else {
            effective_collateral_ratio = target_collateral_ratio;
        }

        last_refresh_cr_timestamp = block.timestamp;
    }

    /* ========== INTERNAL FUNCTIONS ========== */

    function _transferCollateralToReserve(address _sender, uint256 _amount) internal {
        address _reserve = collateralReserve();
        require(_reserve != address(0), "Invalid reserve address");
        ERC20(collateral).safeTransferFrom(_sender, _reserve, _amount);
    }

    function _mintDiamondToCollateralReserve(uint256 _amount) internal {
        address _reserve = collateralReserve();
        require(_reserve != address(0), "Invalid reserve address");
        IDiamond(diamond).poolMint(_reserve, _amount);
    }

    function _requestTransferCollateral(address _receiver, uint256 _amount) internal {
        ITreasury(treasury).requestTransfer(collateral, _receiver, _amount);
    }

    function _requestTransferDiamond(address _receiver, uint256 _amount) internal {
        ITreasury(treasury).requestTransfer(diamond, _receiver, _amount);
    }

    /* ========== RESTRICTED FUNCTIONS ========== */

    function setOracleDToken(address _oracleDToken) public onlyOperator {
        oracleDToken = _oracleDToken;
    }

    function setOracleDiamond(address _oracleDiamond) public onlyOperator {
        oracleDiamond = _oracleDiamond;
    }

    function resetCollateralRatios(uint256 _tcr, uint256 _ecr) external onlyOperator {
        target_collateral_ratio = _tcr;
        effective_collateral_ratio = _ecr;
    }

    function toggleMinting() external onlyOperator {
        mint_paused = !mint_paused;
    }

    function toggleRedeeming() external onlyOperator {
        redeem_paused = !redeem_paused;
    }

    function setPoolCeiling(uint256 _pool_ceiling) external onlyOperator {
        pool_ceiling = _pool_ceiling;
    }

    function setRedemptionDelay(uint256 _redemption_delay) external onlyOperator {
        redemption_delay = _redemption_delay;
    }

    function setRedemptionFee(uint256 _redemption_fee) public onlyOperator {
        redemption_fee = _redemption_fee;
        emit RedemptionFeeChanged(redemption_fee);
    }

    function setMintingFee(uint256 _minting_fee) public onlyOperator {
        minting_fee = _minting_fee;
        emit MintingFeeChanged(minting_fee);
    }

    function setRatioStep(uint256 _ratio_step) public onlyOperator {
        ratio_step = _ratio_step;
        emit RatioStepChanged(ratio_step);
    }

    function setPriceTarget(uint256 _price_target) public onlyOperator {
        price_target = _price_target;
    }

    function setRefreshCooldown(uint256 _refresh_cooldown) public onlyOperator {
        refresh_cooldown = _refresh_cooldown;
    }

    function setPriceBand(uint256 _price_band) external onlyOperator {
        require(_price_band > 0, "Invalid Price Band");
        price_band = _price_band;
        emit PriceBandChanged(price_band);
    }

    function toggleCollateralRatio() public onlyOperator {
        target_collateral_ratio_paused = !target_collateral_ratio_paused;
    }

    function toggleEffectiveCollateralRatio() public onlyOperator {
        effective_collateral_ratio_paused = !effective_collateral_ratio_paused;
    }

    function setDiamondAddress(address _diamond) public onlyOperator {
        require(_diamond != address(0), "invalidAddress");
        diamond = _diamond;
        emit DiamondAddressChanged(_diamond);
    }

    function setTreasury(address _treasury) public onlyOperator {
        require(_treasury != address(0), "invalidAddress");
        treasury = _treasury;
        emit TreasuryChanged(treasury);
    }

    /* =============== EVENTS ==================== */

    event TreasuryChanged(address indexed newTreasury);
    event DiamondAddressChanged(address indexed newDiamondAddress);
    event PriceBandChanged(uint256 newPriceBand);
    event MintingFeeChanged(uint256 newPriceBand);
    event RedemptionFeeChanged(uint256 newPriceBand);
    event RatioStepChanged(uint256 newPriceBand);
}

File 12 of 16 : IDToken.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.7.6;
pragma experimental ABIEncoderV2;

interface IDToken {
    function poolBurnFrom(address _address, uint256 _amount) external;

    function poolMint(address _address, uint256 m_amount) external;
}

File 13 of 16 : IDiamond.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.7.6;
pragma experimental ABIEncoderV2;

interface IDiamond {
    function poolBurnFrom(address _address, uint256 _amount) external;

    function poolMint(address _address, uint256 m_amount) external;
}

File 14 of 16 : IOracle.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.7.6;
pragma experimental ABIEncoderV2;

interface IOracle {
    function consult() external view returns (uint256);
}

File 15 of 16 : IPool.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.7.6;
pragma experimental ABIEncoderV2;

interface IPool {
    function diamond() external view returns (address);

    function dToken() external view returns (address);

    function collateral() external view returns (address);

    function collateralBalance() external view returns (uint256);

    function diamondToCollateralPrice() external view returns (uint256);

    function dTokenToCollateralPrice() external view returns (uint256);

    function unclaimed_pool_collateral() external view returns (uint256);

    function unclaimed_pool_diamond() external view returns (uint256);

    function info()
        external
        view
        returns (
            uint256 pool_ceiling,
            uint256 collateral_balance,
            uint256 _unclaimed_pool_collateral,
            uint256 _unclaimed_pool_diamond,
            uint256 minting_fee,
            uint256 redemption_fee,
            bool mint_paused,
            bool redeem_paused,
            address _collateral,
            address d_token,
            string memory collateral_symbol,
            string memory d_token_symbol,
            uint256 target_collateral_ratio,
            uint256 effective_collateral_ratio
        );

    function mint(
        uint256 _collateral_amount,
        uint256 _diamond_amount,
        uint256 _dtoken_out_min
    ) external;
}

File 16 of 16 : ITreasury.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.7.6;
pragma experimental ABIEncoderV2;

interface ITreasury {
    function collateralReserve() external view returns (address);

    function isPool(address _address) external view returns (bool);

    function isMintingPool(address _poolAddress, address _dToken) external view returns (bool);

    function epoch() external view returns (uint256);

    function nextEpochTimestamp() external view returns (uint256);

    function epochInfo()
        external
        view
        returns (
            uint256 _epoch,
            uint256 lastEpochTimestamp,
            uint256 epochDuration
        );

    function utilizationRatio(address foundry) external view returns (uint256);

    function globalCollateralValue(address _collateral) external view returns (uint256);

    function requestTransfer(
        address token,
        address receiver,
        uint256 amount
    ) external;

    event PoolAdded(address pool);
    event PoolRemoved(address pool);
    event EpochDurationChanged(uint256 epochDuration);
    event FoundryAdded(address foundry, address pool);
    event FoundryRemoved(address foundry, address pool);
    event UtilizationRatioChanged(address pool, uint256 ratio);
    event CollateralReserveChanged(address collateralReserve);
}

Settings
{
  "evmVersion": "istanbul",
  "libraries": {},
  "metadata": {
    "bytecodeHash": "ipfs",
    "useLiteralContent": true
  },
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "remappings": [],
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "abi"
      ]
    }
  }
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_dToken","type":"address"},{"internalType":"address","name":"_diamond","type":"address"},{"internalType":"address","name":"_collateral","type":"address"},{"internalType":"uint256","name":"_pool_ceiling","type":"uint256"},{"internalType":"address","name":"_treasury","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"newDiamondAddress","type":"address"}],"name":"DiamondAddressChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newPriceBand","type":"uint256"}],"name":"MintingFeeChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOperator","type":"address"},{"indexed":true,"internalType":"address","name":"newOperator","type":"address"}],"name":"OperatorTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newPriceBand","type":"uint256"}],"name":"PriceBandChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newPriceBand","type":"uint256"}],"name":"RatioStepChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newPriceBand","type":"uint256"}],"name":"RedemptionFeeChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"newTreasury","type":"address"}],"name":"TreasuryChanged","type":"event"},{"inputs":[],"name":"calcEffectiveCollateralRatio","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"collateral","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"collateralBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"collateralReserve","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"collectRedemption","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"dToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"dTokenToCollateralPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"diamond","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"diamondToCollateralPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"effective_collateral_ratio","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"effective_collateral_ratio_paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"globalCollateralBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"info","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bool","name":"","type":"bool"},{"internalType":"bool","name":"","type":"bool"},{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"string","name":"","type":"string"},{"internalType":"string","name":"","type":"string"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isOperator","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"last_redeemed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"last_refresh_cr_timestamp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"migrated","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_collateral_amount","type":"uint256"},{"internalType":"uint256","name":"_diamond_amount","type":"uint256"},{"internalType":"uint256","name":"_dtoken_out_min","type":"uint256"}],"name":"mint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"mint_paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minting_fee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"operator","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"oracleDToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"oracleDiamond","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pool_ceiling","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"price_band","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"price_target","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ratio_step","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_dToken_amount","type":"uint256"},{"internalType":"uint256","name":"_diamond_out_min","type":"uint256"},{"internalType":"uint256","name":"_collateral_out_min","type":"uint256"}],"name":"redeem","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"redeem_collateral_balances","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"redeem_diamond_balances","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"redeem_paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"redemption_delay","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"redemption_fee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"refreshCollateralRatio","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"refresh_cooldown","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tcr","type":"uint256"},{"internalType":"uint256","name":"_ecr","type":"uint256"}],"name":"resetCollateralRatios","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_diamond","type":"address"}],"name":"setDiamondAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_minting_fee","type":"uint256"}],"name":"setMintingFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_oracleDToken","type":"address"}],"name":"setOracleDToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_oracleDiamond","type":"address"}],"name":"setOracleDiamond","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pool_ceiling","type":"uint256"}],"name":"setPoolCeiling","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_price_band","type":"uint256"}],"name":"setPriceBand","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_price_target","type":"uint256"}],"name":"setPriceTarget","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_ratio_step","type":"uint256"}],"name":"setRatioStep","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_redemption_delay","type":"uint256"}],"name":"setRedemptionDelay","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_redemption_fee","type":"uint256"}],"name":"setRedemptionFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_refresh_cooldown","type":"uint256"}],"name":"setRefreshCooldown","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_treasury","type":"address"}],"name":"setTreasury","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"target_collateral_ratio","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"target_collateral_ratio_paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"toggleCollateralRatio","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"toggleEffectiveCollateralRatio","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"toggleMinting","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"toggleRedeeming","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOperator_","type":"address"}],"name":"transferOperator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"treasury","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"unclaimed_pool_collateral","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"unclaimed_pool_diamond","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]

60e06040526000600c556001600d55600e805462ffffff19169055620f424060108190556011556012805461ffff191690553480156200003e57600080fd5b5060405162003037380380620030378339810160408190526200006191620002a6565b60006200006d62000227565b600080546001600160a01b0319166001600160a01b0383169081178255604051929350917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a350620000c162000227565b600180546001600160a01b0319166001600160a01b0392831617908190556040519116906000907f74da04524d50c64947f5dd5381ef1a4dca5cba8ed1d816243f9e48aa0b5617ed908290a360016002556001600160601b0319606086811b821660a052600380546001600160a01b038881166001600160a01b0319928316179092559186901b909216608052600680548484169216919091179055600c8390556040805163313ce56760e01b81529051620001f49286169163313ce567916004808301926020929190829003018186803b158015620001a057600080fd5b505afa158015620001b5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620001db91906200030c565b60ff1660126200022b60201b62001f501790919060201c565b60c05250506109c46014555050610e1060135550620f42406015556105dc601655610bb86017556103e860185562000336565b3390565b60008282111562000283576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b80516001600160a01b0381168114620002a157600080fd5b919050565b600080600080600060a08688031215620002be578081fd5b620002c98662000289565b9450620002d96020870162000289565b9350620002e96040870162000289565b925060608601519150620003006080870162000289565b90509295509295909350565b6000602082840312156200031e578081fd5b815160ff811681146200032f578182fd5b9392505050565b60805160601c60a05160601c60c051612c8d620003aa6000398061077a52806118365280611b025250806108ec5280610e2e5280610ebd52806116745280611a055280611c11525080610e0c528061140152806119035280611b2c5280611bed528061211252806121d55250612c8d6000f3fe608060405234801561001057600080fd5b50600436106103af5760003560e01c80636ae74488116101f4578063c7d272281161011a578063e86bc619116100ad578063f1a9ee031161007c578063f1a9ee0314610683578063f2fde38b14610696578063fe51d458146106a9578063ff626c5f146106bc576103af565b8063e86bc6191461064d578063e963058d14610660578063f0b7db4e14610668578063f0f4426014610670576103af565b8063d8dfeb45116100e9578063d8dfeb4514610622578063d9d7858a1461062a578063daa5048514610632578063dc0d2a981461063a576103af565b8063c7d27228146105f7578063c98c05b7146105ff578063cb73999f14610607578063d0d132f31461060f576103af565b806391322a6611610192578063b819220511610161578063b8192205146105cc578063bef40ec8146105df578063c03f7be3146105e7578063c3355b8d146105ef576103af565b806391322a66146105ac578063a445c445146105b4578063ac4f843e146105bc578063af83136e146105c4576103af565b80637dbc1df0116101ce5780637dbc1df01461058157806380a66d0514610594578063864359e51461059c5780638da5cb5b146105a4576103af565b80636ae7448814610569578063715018a6146105715780637d55094d14610579576103af565b80634006311b116102d957806356bd91f31161027757806361d027b31161024657806361d027b3146105495780636526a12a1461055157806365505b6c146105595780636912cb4314610561576103af565b806356bd91f314610508578063570ca7351461051b5780635ccaf3b0146105235780636140133b14610536576103af565b80634456eda2116102b35780634456eda2146104db5780634482eedb146104e3578063465b0c41146104f85780634d5447c814610500576103af565b80634006311b146104b85780634013124a146104c0578063408ab10f146104c8576103af565b806326eb8b06116103515780632c678c64116103205780632c678c64146104715780632cb4f63e1461048657806333e2fb241461048e578063370158ea14610496576103af565b806326eb8b061461043b5780632853fb101461044e578063291878a81461045657806329605e771461045e576103af565b8063151284251161038d57806315128425146103e4578063186d9b2e146104025780631c5df1e514610415578063238a470914610428576103af565b806302acc94b146103b4578063073d4f6e146103c957806312ace5a2146103dc575b600080fd5b6103c76103c2366004612748565b6106c4565b005b6103c76103d7366004612727565b61095e565b6103c76109b2565b6103ec610a9b565b6040516103f99190612a87565b60405180910390f35b6103c76104103660046126f7565b610aa1565b6103c76104233660046126f7565b610b2a565b6103c76104363660046126f7565b610b78565b6103c7610449366004612628565b610bf6565b6103ec610caf565b6103c7610cb5565b6103c761046c366004612628565b610d1b565b610479610d9b565b6040516103f99190612803565b6103ec610daa565b610479610db0565b61049e610dbe565b6040516103f99e9d9c9b9a99989796959493929190612a90565b6103ec610f82565b6103c7610f88565b6103c76104d63660046126f7565b6110aa565b6104796110f8565b6104eb61111f565b6040516103f991906127b2565b6104eb61112e565b6104796111b0565b6103c7610516366004612628565b6111b9565b6104eb611224565b6103c7610531366004612628565b611233565b6103c76105443660046126f7565b61129e565b6104eb61133c565b6103ec61134b565b6103ec611351565b6103ec6113d9565b6103ec611441565b6103c7611447565b6103c7611505565b6103c761058f3660046126f7565b611562565b6104796115e0565b6103ec6115ee565b6104eb611633565b6103ec611642565b6103ec611648565b6103ec61173a565b6103ec611740565b6103c76105da366004612748565b611746565b6103c7611a89565b6103ec611ae6565b6103ec611aec565b610479611af2565b6103ec611afb565b6103ec611bd3565b6103ec61061d366004612628565b611bd9565b6104eb611beb565b6104eb611c0f565b6103c7611c33565b6103ec610648366004612628565b611c99565b6103c761065b3660046126f7565b611cab565b6104eb611cf9565b6104eb611d08565b6103c761067e366004612628565b611d17565b6103c76106913660046126f7565b611dd6565b6103c76106a4366004612628565b611e24565b6103ec6106b7366004612628565b611f38565b6103ec611f4a565b600e5462010000900460ff16156106f65760405162461bcd60e51b81526004016106ed90612914565b60405180910390fd5b600e5460ff16156107195760405162461bcd60e51b81526004016106ed90612a07565b600c5461072e84610728611afb565b90611fb2565b111561074c5760405162461bcd60e51b81526004016106ed90612989565b6000610756611351565b9050600080600060105411156107d9576010546107ad906107a7620f42406107a18a7f0000000000000000000000000000000000000000000000000000000000000000600a0a612013565b90612013565b9061206c565b9150620f424060105410156107d4576107d1836107a7620f42406107a1868b611f50565b90505b6107f0565b6107ea620f42406107a78786612013565b91508490505b6000610818610811620f42406107a76018548761201390919063ffffffff16565b8490611f50565b90508085111561083a5760405162461bcd60e51b81526004016106ed906128f1565b81156108c557858211156108605760405162461bcd60e51b81526004016106ed9061289e565b6003546040516305060b2d60e11b81526001600160a01b0390911690630a0c165a9061089290339086906004016127c6565b600060405180830381600087803b1580156108ac57600080fd5b505af11580156108c0573d6000803e3d6000fd5b505050505b86156108d5576108d533886120d3565b6040516306203eab60e11b81526001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690630c407d569061092390339085906004016127c6565b600060405180830381600087803b15801561093d57600080fd5b505af1158015610951573d6000803e3d6000fd5b5050505050505050505050565b6001546001600160a01b031633146109a75760405162461bcd60e51b8152600401808060200182810382526024815260200180612c0a6024913960400191505060405180910390fd5b601091909155601155565b600d54336000908152600b602052604090205443916109d19190611fb2565b11156109ef5760405162461bcd60e51b81526004016106ed90612936565b3360009081526007602052604081205481908190819015610a36573360009081526007602052604081208054919055600a54909250610a2e9083611f50565b600a55600193505b3360009081526008602052604090205415610a7557503360009081526008602052604081208054919055600954610a6d9082611f50565b600955600192505b8315610a8557610a85338361213f565b8215610a9557610a9533826121ad565b50505050565b600d5481565b6001546001600160a01b03163314610aea5760405162461bcd60e51b8152600401808060200182810382526024815260200180612c0a6024913960400191505060405180910390fd5b60148190556040517fdc5d6bd19db3bd5f69b76525ccfb285fde1db6af144534fd4763d130557ea3c990610b1f908390612a87565b60405180910390a150565b6001546001600160a01b03163314610b735760405162461bcd60e51b8152600401808060200182810382526024815260200180612c0a6024913960400191505060405180910390fd5b601355565b6001546001600160a01b03163314610bc15760405162461bcd60e51b8152600401808060200182810382526024815260200180612c0a6024913960400191505060405180910390fd5b60188190556040517f7b96548969d8300725edaec0ef4f9b32997f67531162336066d67eb6f55dbb4f90610b1f908390612a87565b6001546001600160a01b03163314610c3f5760405162461bcd60e51b8152600401808060200182810382526024815260200180612c0a6024913960400191505060405180910390fd5b6001600160a01b038116610c655760405162461bcd60e51b81526004016106ed90612961565b600380546001600160a01b0319166001600160a01b0383169081179091556040517f32fb5e21169b007c425922278fc40dbb86d3631d3891a8edc3509cfbb7e328c890600090a250565b60165481565b6001546001600160a01b03163314610cfe5760405162461bcd60e51b8152600401808060200182810382526024815260200180612c0a6024913960400191505060405180910390fd5b6012805461ff001981166101009182900460ff1615909102179055565b610d23612201565b6001600160a01b0316610d34611633565b6001600160a01b031614610d8f576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b610d9881612205565b50565b600e5462010000900460ff1681565b60155481565b601254610100900460ff1681565b600080600080600080600080600080606080600080600c54610dde611afb565b600954600a54601854601754600e54604080516395d89b4160e01b8152905160ff80841693610100900416917f0000000000000000000000000000000000000000000000000000000000000000917f0000000000000000000000000000000000000000000000000000000000000000916001600160a01b038416916395d89b4191600480820192600092909190829003018186803b158015610e7f57600080fd5b505afa158015610e93573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610ebb9190810190612660565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166395d89b416040518163ffffffff1660e01b815260040160006040518083038186803b158015610f1457600080fd5b505afa158015610f28573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610f509190810190612660565b6010546011549d509d509d509d509d509d509d509d509d509d509d509d509d509d50909192939495969798999a9b9c9d565b60105481565b60125460ff1615610fab5760405162461bcd60e51b81526004016106ed906129c0565b601354600f5442031015610fd15760405162461bcd60e51b81526004016106ed90612a32565b6000610fdb6115ee565b9050610ff4601654601554611fb290919063ffffffff16565b8111156110285760145460105411611010576000601055611023565b60145460105461101f91611f50565b6010555b61107d565b60165460155461103791611f50565b81101561107d57620f4240611059601454601054611fb290919063ffffffff16565b1061106a57620f424060105561107d565b60145460105461107991611fb2565b6010555b601254610100900460ff1661109c57611094611648565b6011556110a3565b6010546011555b5042600f55565b6001546001600160a01b031633146110f35760405162461bcd60e51b8152600401808060200182810382526024815260200180612c0a6024913960400191505060405180910390fd5b601555565b6001546000906001600160a01b031661110f612201565b6001600160a01b03161490505b90565b6004546001600160a01b031681565b6006546040805163465b0c4160e01b815290516000926001600160a01b03169163465b0c41916004808301926020929190829003018186803b15801561117357600080fd5b505afa158015611187573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111ab9190612644565b905090565b60125460ff1681565b6001546001600160a01b031633146112025760405162461bcd60e51b8152600401808060200182810382526024815260200180612c0a6024913960400191505060405180910390fd5b600580546001600160a01b0319166001600160a01b0392909216919091179055565b6001546001600160a01b031690565b6001546001600160a01b0316331461127c5760405162461bcd60e51b8152600401808060200182810382526024815260200180612c0a6024913960400191505060405180910390fd5b600480546001600160a01b0319166001600160a01b0392909216919091179055565b6001546001600160a01b031633146112e75760405162461bcd60e51b8152600401808060200182810382526024815260200180612c0a6024913960400191505060405180910390fd5b600081116113075760405162461bcd60e51b81526004016106ed906128c5565b60168190556040517ff4d0449488705c7106833bd2499b0ad50618d17a8366e154425390624c3ddcda90610b1f908390612a87565b6006546001600160a01b031681565b600c5481565b6000600460009054906101000a90046001600160a01b03166001600160a01b0316637eeda7036040518163ffffffff1660e01b815260040160206040518083038186803b1580156113a157600080fd5b505afa1580156113b5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111ab919061270f565b600654604051620861f560ea1b81526000916001600160a01b031690632187d40090611429907f0000000000000000000000000000000000000000000000000000000000000000906004016127b2565b60206040518083038186803b1580156113a157600080fd5b600f5481565b61144f612201565b6001600160a01b0316611460611633565b6001600160a01b0316146114bb576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6001546001600160a01b0316331461154e5760405162461bcd60e51b8152600401808060200182810382526024815260200180612c0a6024913960400191505060405180910390fd5b600e805460ff19811660ff90911615179055565b6001546001600160a01b031633146115ab5760405162461bcd60e51b8152600401808060200182810382526024815260200180612c0a6024913960400191505060405180910390fd5b60178190556040517f4dbf9634a3aaf3bc15ab627faeaac7c6b0a4754ead77206f1c11277356f2878f90610b1f908390612a87565b600e54610100900460ff1681565b60055460408051637eeda70360e01b815290516000926001600160a01b031691637eeda703916004808301926020929190829003018186803b1580156113a157600080fd5b6000546001600160a01b031690565b600a5481565b601254600090610100900460ff1615611664575060105461111c565b600061166e6113d9565b905060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b1580156116cb57600080fd5b505afa1580156116df573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611703919061270f565b90506000611718826107a785620f4240612013565b9050620f424081111561173357620f4240935050505061111c565b9250505090565b60145481565b60115481565b600e5462010000900460ff161561176f5760405162461bcd60e51b81526004016106ed90612914565b600e54610100900460ff16156117975760405162461bcd60e51b81526004016106ed90612845565b60006117a1611351565b905060006117cb6117c4620f42406107a76017548961201390919063ffffffff16565b8690611f50565b9050600080620f4240601154101561181c5760006118056117fe620f42406107a76011548861201390919063ffffffff16565b8590611f50565b9050611818856107a783620f4240612013565b9150505b6011541561186a57611867620f42406107a76011546107a17f0000000000000000000000000000000000000000000000000000000000000000600a0a8861206c90919063ffffffff16565b91505b81156118ab573360009081526008602052604090205461188a9083611fb2565b336000908152600860205260409020556009546118a79083611fb2565b6009555b80156118ec57336000908152600760205260409020546118cb9082611fb2565b33600090815260076020526040902055600a546118e89082611fb2565b600a555b336000908152600b602052604090204390556009547f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166370a0823161193861112e565b6040518263ffffffff1660e01b815260040161195491906127b2565b60206040518083038186803b15801561196c57600080fd5b505afa158015611980573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119a4919061270f565b10156119c25760405162461bcd60e51b81526004016106ed90612872565b8185111580156119d25750808611155b6119ee5760405162461bcd60e51b81526004016106ed906128f1565b6040516305060b2d60e11b81526001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690630a0c165a90611a3c9033908b906004016127c6565b600060405180830381600087803b158015611a5657600080fd5b505af1158015611a6a573d6000803e3d6000fd5b505050506000811115611a8057611a80816122a2565b50505050505050565b6001546001600160a01b03163314611ad25760405162461bcd60e51b8152600401808060200182810382526024815260200180612c0a6024913960400191505060405180910390fd5b6012805460ff19811660ff90911615179055565b60135481565b60185481565b600e5460ff1681565b60006111ab7f0000000000000000000000000000000000000000000000000000000000000000600a0a6107a16009547f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166370a08231611b6161112e565b6040518263ffffffff1660e01b8152600401611b7d91906127b2565b60206040518083038186803b158015611b9557600080fd5b505afa158015611ba9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bcd919061270f565b90611f50565b60175481565b60086020526000908152604090205481565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b6001546001600160a01b03163314611c7c5760405162461bcd60e51b8152600401808060200182810382526024815260200180612c0a6024913960400191505060405180910390fd5b600e805461ff001981166101009182900460ff1615909102179055565b600b6020526000908152604090205481565b6001546001600160a01b03163314611cf45760405162461bcd60e51b8152600401808060200182810382526024815260200180612c0a6024913960400191505060405180910390fd5b600c55565b6005546001600160a01b031681565b6003546001600160a01b031681565b6001546001600160a01b03163314611d605760405162461bcd60e51b8152600401808060200182810382526024815260200180612c0a6024913960400191505060405180910390fd5b6001600160a01b038116611d865760405162461bcd60e51b81526004016106ed90612961565b600680546001600160a01b0319166001600160a01b0383811691909117918290556040519116907fc714d22a2f08b695f81e7c707058db484aa5b4d6b4c9fd64beb10fe85832f60890600090a250565b6001546001600160a01b03163314611e1f5760405162461bcd60e51b8152600401808060200182810382526024815260200180612c0a6024913960400191505060405180910390fd5b600d55565b611e2c612201565b6001600160a01b0316611e3d611633565b6001600160a01b031614611e98576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b038116611edd5760405162461bcd60e51b8152600401808060200182810382526026815260200180612b706026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b60076020526000908152604090205481565b60095481565b600082821115611fa7576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b508082035b92915050565b60008282018381101561200c576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b60008261202257506000611fac565b8282028284828161202f57fe5b041461200c5760405162461bcd60e51b8152600401808060200182810382526021815260200180612be96021913960400191505060405180910390fd5b60008082116120c2576040805162461bcd60e51b815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b8183816120cb57fe5b049392505050565b60006120dd61112e565b90506001600160a01b0381166121055760405162461bcd60e51b81526004016106ed9061280e565b61213a6001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016848385612306565b505050565b60065460035460405163a4293ead60e01b81526001600160a01b039283169263a4293ead9261217792911690869086906004016127df565b600060405180830381600087803b15801561219157600080fd5b505af11580156121a5573d6000803e3d6000fd5b505050505050565b60065460405163a4293ead60e01b81526001600160a01b039091169063a4293ead90612177907f000000000000000000000000000000000000000000000000000000000000000090869086906004016127df565b3390565b6001600160a01b03811661224a5760405162461bcd60e51b815260040180806020018281038252602d815260200180612bbc602d913960400191505060405180910390fd5b6040516001600160a01b038216906000907f74da04524d50c64947f5dd5381ef1a4dca5cba8ed1d816243f9e48aa0b5617ed908290a3600180546001600160a01b0319166001600160a01b0392909216919091179055565b60006122ac61112e565b90506001600160a01b0381166122d45760405162461bcd60e51b81526004016106ed9061280e565b6003546040516306203eab60e11b81526001600160a01b0390911690630c407d569061217790849086906004016127c6565b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052610a9590859060006123b0826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661240c9092919063ffffffff16565b80519091501561213a578080602001905160208110156123cf57600080fd5b505161213a5760405162461bcd60e51b815260040180806020018281038252602a815260200180612c2e602a913960400191505060405180910390fd5b606061241b8484600085612423565b949350505050565b6060824710156124645760405162461bcd60e51b8152600401808060200182810382526026815260200180612b966026913960400191505060405180910390fd5b61246d8561257e565b6124be576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b600080866001600160a01b031685876040518082805190602001908083835b602083106124fc5780518252601f1990920191602091820191016124dd565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d806000811461255e576040519150601f19603f3d011682016040523d82523d6000602084013e612563565b606091505b5091509150612573828286612584565b979650505050505050565b3b151590565b6060831561259357508161200c565b8251156125a35782518084602001fd5b8160405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156125ed5781810151838201526020016125d5565b50505050905090810190601f16801561261a5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b600060208284031215612639578081fd5b813561200c81612b5a565b600060208284031215612655578081fd5b815161200c81612b5a565b600060208284031215612671578081fd5b815167ffffffffffffffff80821115612688578283fd5b818401915084601f83011261269b578283fd5b8151818111156126a757fe5b604051601f8201601f1916810160200183811182821017156126c557fe5b6040528181528382016020018710156126dc578485fd5b6126ed826020830160208701612b2e565b9695505050505050565b600060208284031215612708578081fd5b5035919050565b600060208284031215612720578081fd5b5051919050565b60008060408385031215612739578081fd5b50508035926020909101359150565b60008060006060848603121561275c578081fd5b505081359360208301359350604090920135919050565b6001600160a01b03169052565b15159052565b6000815180845261279e816020860160208601612b2e565b601f01601f19169290920160200192915050565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b901515815260200190565b60208082526017908201527f496e76616c696420726573657276652061646472657373000000000000000000604082015260600190565b60208082526013908201527214995919595b5a5b99c81a5cc81c185d5cd959606a1b604082015260600190565b6020808252601290820152713c636f6c6c61746572616c42616c616e636560701b604082015260600190565b6020808252600d908201526c3c736861726542616c616e636560981b604082015260600190565b602080825260129082015271125b9d985b1a5908141c9a58d94810985b9960721b604082015260600190565b6020808252600990820152683e736c69707061676560b81b604082015260600190565b6020808252600890820152671b5a59dc985d195960c21b604082015260600190565b6020808252601190820152703c726564656d7074696f6e5f64656c617960781b604082015260600190565b6020808252600e908201526d696e76616c69644164647265737360901b604082015260600190565b60208082526018908201527f506f6f6c206365696c696e672077617320726561636865640000000000000000604082015260600190565b60208082526027908201527f54617267657420436f6c6c61746572616c20526174696f20686173206265656e604082015266081c185d5cd95960ca1b606082015260800190565b602080825260119082015270135a5b9d1a5b99c81a5cc81c185d5cd959607a1b604082015260600190565b60208082526035908201527f4d757374207761697420666f7220746865207265667265736820636f6f6c646f6040820152740eedc40e6d2dcc6ca40d8c2e6e840e4cacce4cae6d605b1b606082015260800190565b90815260200190565b60008f82528e60208301528d60408301528c60608301528b60808301528a60a083015289151560c0830152612ac860e083018a612780565b612ad6610100830189612773565b612ae4610120830188612773565b6101c0610140830152612afb6101c0830187612786565b828103610160840152612b0e8187612786565b61018084019590955250506101a001529c9b505050505050505050505050565b60005b83811015612b49578181015183820152602001612b31565b83811115610a955750506000910152565b6001600160a01b0381168114610d9857600080fdfe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c6f70657261746f723a207a65726f206164647265737320676976656e20666f72206e6577206f70657261746f72536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f776f70657261746f723a2063616c6c6572206973206e6f7420746865206f70657261746f725361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a2646970667358221220739200a7f630ec95848cc95aebcf5a95eb673fe969dccd27b848dadac628d60b64736f6c634300070600330000000000000000000000003e3434f57adf4e07dc2d75c6f109c20ac96a155700000000000000000000000034ea3f7162e6f6ed16bd171267ec180fd5c848da0000000000000000000000007083609fce4d1d8dc0c979aab8c869ea2c87340200000000000000000000000000000000000000000000021e19e0c9bab240000000000000000000000000000070abdb857e191b1033b6c67274681c816f3343bf

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

0000000000000000000000003e3434f57adf4e07dc2d75c6f109c20ac96a155700000000000000000000000034ea3f7162e6f6ed16bd171267ec180fd5c848da0000000000000000000000007083609fce4d1d8dc0c979aab8c869ea2c87340200000000000000000000000000000000000000000000021e19e0c9bab240000000000000000000000000000070abdb857e191b1033b6c67274681c816f3343bf

-----Decoded View---------------
Arg [0] : _dToken (address): 0x3e3434f57adf4e07dc2d75c6f109c20ac96a1557
Arg [1] : _diamond (address): 0x34ea3f7162e6f6ed16bd171267ec180fd5c848da
Arg [2] : _collateral (address): 0x7083609fce4d1d8dc0c979aab8c869ea2c873402
Arg [3] : _pool_ceiling (uint256): 10000000000000000000000
Arg [4] : _treasury (address): 0x70abdb857e191b1033b6c67274681c816f3343bf

-----Encoded View---------------
5 Constructor Arguments found :
Arg [0] : 0000000000000000000000003e3434f57adf4e07dc2d75c6f109c20ac96a1557
Arg [1] : 00000000000000000000000034ea3f7162e6f6ed16bd171267ec180fd5c848da
Arg [2] : 0000000000000000000000007083609fce4d1d8dc0c979aab8c869ea2c873402
Arg [3] : 00000000000000000000000000000000000000000000021e19e0c9bab2400000
Arg [4] : 00000000000000000000000070abdb857e191b1033b6c67274681c816f3343bf


Block Transaction Gas Used Reward
Age Block Fee Address BC Fee Address Voting Power Jailed Incoming
Block Uncle Number Difficulty Gas Used Reward
Loading
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.