ETH Price: $3,296.01 (-3.79%)
Gas: 10 Gwei

Contract

0x4082D11E506e3250009A991061ACd2176077C88f
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Token Holdings

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Value
Unbond140961402022-01-28 19:46:57886 days ago1643399217IN
0x4082D11E...76077C88f
0 ETH0.005551111.0200612
Unbond130362852021-08-16 12:27:261052 days ago1629116846IN
0x4082D11E...76077C88f
0 ETH0.0019616836.91818323
Unbond129834942021-08-08 9:06:251060 days ago1628413585IN
0x4082D11E...76077C88f
0 ETH0.0015944430
Unbond129834782021-08-08 9:03:181060 days ago1628413398IN
0x4082D11E...76077C88f
0 ETH0.0015940830
Claim129834692021-08-08 9:01:141060 days ago1628413274IN
0x4082D11E...76077C88f
0 ETH0.001292631
Withdraw129329802021-07-31 11:10:541068 days ago1627729854IN
0x4082D11E...76077C88f
0 ETH0.0013067619.00000145
Unbond128869102021-07-24 4:35:081075 days ago1627101308IN
0x4082D11E...76077C88f
0 ETH0.0010276410
Withdraw128806872021-07-23 5:10:061076 days ago1627017006IN
0x4082D11E...76077C88f
0 ETH0.0010313215
Unbond128657532021-07-20 21:09:211078 days ago1626815361IN
0x4082D11E...76077C88f
0 ETH0.0011414814.3
Unbond128586612021-07-19 18:40:071079 days ago1626720007IN
0x4082D11E...76077C88f
0 ETH0.0025543632
Withdraw128406302021-07-16 22:43:111082 days ago1626475391IN
0x4082D11E...76077C88f
0 ETH0.0018563827
Claim128405302021-07-16 22:23:331082 days ago1626474213IN
0x4082D11E...76077C88f
0 ETH0.0098956130
Claim128375062021-07-16 10:58:091083 days ago1626433089IN
0x4082D11E...76077C88f
0 ETH0.001180420
Unbond128340652021-07-15 21:52:351083 days ago1626385955IN
0x4082D11E...76077C88f
0 ETH0.0034939734
Withdraw128044432021-07-11 6:34:381088 days ago1625985278IN
0x4082D11E...76077C88f
0 ETH0.0006875510
Deposit128036752021-07-11 3:36:121088 days ago1625974572IN
0x4082D11E...76077C88f
0 ETH0.0007325210
Claim127611602021-07-04 12:58:441095 days ago1625403524IN
0x4082D11E...76077C88f
0 ETH0.000590210
Withdraw127611362021-07-04 12:53:521095 days ago1625403232IN
0x4082D11E...76077C88f
0 ETH0.0006875510
Withdraw127526282021-07-03 4:56:091096 days ago1625288169IN
0x4082D11E...76077C88f
0 ETH0.000568211
Claim127526282021-07-03 4:56:091096 days ago1625288169IN
0x4082D11E...76077C88f
0 ETH0.0008374511
Unbond127408372021-07-01 9:07:491098 days ago1625130469IN
0x4082D11E...76077C88f
0 ETH0.0017469817
Withdraw127362492021-06-30 15:47:421099 days ago1625068062IN
0x4082D11E...76077C88f
0 ETH0.0017188725
Withdraw127118672021-06-26 20:51:321102 days ago1624740692IN
0x4082D11E...76077C88f
0 ETH0.000756311
Withdraw127015672021-06-25 5:57:421104 days ago1624600662IN
0x4082D11E...76077C88f
0 ETH0.0006875510
Unbond126913572021-06-23 16:05:341106 days ago1624464334IN
0x4082D11E...76077C88f
0 ETH0.0015928415.5
View all transactions

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Pool

Compiler Version
v0.5.17+commit.d19bba13

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity)

/**
 *Submitted for verification at Etherscan.io on 2020-11-09
*/

pragma solidity ^0.5.17;
pragma experimental ABIEncoderV2;


/**
 * @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, 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) {
        return sub(a, b, "SafeMath: subtraction overflow");
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on
     * overflow (when the result is negative).
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     * - Subtraction cannot overflow.
     *
     * _Available since v2.4.0._
     */
    function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b <= a, errorMessage);
        uint256 c = a - b;

        return c;
    }

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

        uint256 c = a * b;
        require(c / a == b, "SafeMath: multiplication overflow");

        return c;
    }

    /**
     * @dev Returns the integer division of two unsigned integers. Reverts 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) {
        return div(a, b, "SafeMath: division by zero");
    }

    /**
     * @dev Returns the integer division of two unsigned integers. Reverts with custom message on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     * - The divisor cannot be zero.
     *
     * _Available since v2.4.0._
     */
    function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        // Solidity only automatically asserts when dividing by 0
        require(b > 0, errorMessage);
        uint256 c = a / b;
        // assert(a == b * c + a % b); // There is no case in which this doesn't hold

        return c;
    }

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

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * Reverts with custom message 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.
     *
     * _Available since v2.4.0._
     */
    function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b != 0, errorMessage);
        return a % b;
    }
}

/**
 * @dev Interface of the ERC20 standard as defined in the EIP. Does not include
 * the optional functions; to access them see {ERC20Detailed}.
 */
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);
}

/*
    Copyright 2019 dYdX Trading Inc.

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
*/
/**
 * @title Require
 * @author dYdX
 *
 * Stringifies parameters to pretty-print revert messages. Costs more gas than regular require()
 */
library Require {

    // ============ Constants ============

    uint256 constant ASCII_ZERO = 48; // '0'
    uint256 constant ASCII_RELATIVE_ZERO = 87; // 'a' - 10
    uint256 constant ASCII_LOWER_EX = 120; // 'x'
    bytes2 constant COLON = 0x3a20; // ': '
    bytes2 constant COMMA = 0x2c20; // ', '
    bytes2 constant LPAREN = 0x203c; // ' <'
    byte constant RPAREN = 0x3e; // '>'
    uint256 constant FOUR_BIT_MASK = 0xf;

    // ============ Library Functions ============

    function that(
        bool must,
        bytes32 file,
        bytes32 reason
    )
    internal
    pure
    {
        if (!must) {
            revert(
                string(
                    abi.encodePacked(
                        stringifyTruncated(file),
                        COLON,
                        stringifyTruncated(reason)
                    )
                )
            );
        }
    }

    function that(
        bool must,
        bytes32 file,
        bytes32 reason,
        uint256 payloadA
    )
    internal
    pure
    {
        if (!must) {
            revert(
                string(
                    abi.encodePacked(
                        stringifyTruncated(file),
                        COLON,
                        stringifyTruncated(reason),
                        LPAREN,
                        stringify(payloadA),
                        RPAREN
                    )
                )
            );
        }
    }

    function that(
        bool must,
        bytes32 file,
        bytes32 reason,
        uint256 payloadA,
        uint256 payloadB
    )
    internal
    pure
    {
        if (!must) {
            revert(
                string(
                    abi.encodePacked(
                        stringifyTruncated(file),
                        COLON,
                        stringifyTruncated(reason),
                        LPAREN,
                        stringify(payloadA),
                        COMMA,
                        stringify(payloadB),
                        RPAREN
                    )
                )
            );
        }
    }

    function that(
        bool must,
        bytes32 file,
        bytes32 reason,
        address payloadA
    )
    internal
    pure
    {
        if (!must) {
            revert(
                string(
                    abi.encodePacked(
                        stringifyTruncated(file),
                        COLON,
                        stringifyTruncated(reason),
                        LPAREN,
                        stringify(payloadA),
                        RPAREN
                    )
                )
            );
        }
    }

    function that(
        bool must,
        bytes32 file,
        bytes32 reason,
        address payloadA,
        uint256 payloadB
    )
    internal
    pure
    {
        if (!must) {
            revert(
                string(
                    abi.encodePacked(
                        stringifyTruncated(file),
                        COLON,
                        stringifyTruncated(reason),
                        LPAREN,
                        stringify(payloadA),
                        COMMA,
                        stringify(payloadB),
                        RPAREN
                    )
                )
            );
        }
    }

    function that(
        bool must,
        bytes32 file,
        bytes32 reason,
        address payloadA,
        uint256 payloadB,
        uint256 payloadC
    )
    internal
    pure
    {
        if (!must) {
            revert(
                string(
                    abi.encodePacked(
                        stringifyTruncated(file),
                        COLON,
                        stringifyTruncated(reason),
                        LPAREN,
                        stringify(payloadA),
                        COMMA,
                        stringify(payloadB),
                        COMMA,
                        stringify(payloadC),
                        RPAREN
                    )
                )
            );
        }
    }

    function that(
        bool must,
        bytes32 file,
        bytes32 reason,
        bytes32 payloadA
    )
    internal
    pure
    {
        if (!must) {
            revert(
                string(
                    abi.encodePacked(
                        stringifyTruncated(file),
                        COLON,
                        stringifyTruncated(reason),
                        LPAREN,
                        stringify(payloadA),
                        RPAREN
                    )
                )
            );
        }
    }

    function that(
        bool must,
        bytes32 file,
        bytes32 reason,
        bytes32 payloadA,
        uint256 payloadB,
        uint256 payloadC
    )
    internal
    pure
    {
        if (!must) {
            revert(
                string(
                    abi.encodePacked(
                        stringifyTruncated(file),
                        COLON,
                        stringifyTruncated(reason),
                        LPAREN,
                        stringify(payloadA),
                        COMMA,
                        stringify(payloadB),
                        COMMA,
                        stringify(payloadC),
                        RPAREN
                    )
                )
            );
        }
    }

    // ============ Private Functions ============

    function stringifyTruncated(
        bytes32 input
    )
    private
    pure
    returns (bytes memory)
    {
        // put the input bytes into the result
        bytes memory result = abi.encodePacked(input);

        // determine the length of the input by finding the location of the last non-zero byte
        for (uint256 i = 32; i > 0; ) {
            // reverse-for-loops with unsigned integer
            /* solium-disable-next-line security/no-modify-for-iter-var */
            i--;

            // find the last non-zero byte in order to determine the length
            if (result[i] != 0) {
                uint256 length = i + 1;

                /* solium-disable-next-line security/no-inline-assembly */
                assembly {
                    mstore(result, length) // r.length = length;
                }

                return result;
            }
        }

        // all bytes are zero
        return new bytes(0);
    }

    function stringify(
        uint256 input
    )
    private
    pure
    returns (bytes memory)
    {
        if (input == 0) {
            return "0";
        }

        // get the final string length
        uint256 j = input;
        uint256 length;
        while (j != 0) {
            length++;
            j /= 10;
        }

        // allocate the string
        bytes memory bstr = new bytes(length);

        // populate the string starting with the least-significant character
        j = input;
        for (uint256 i = length; i > 0; ) {
            // reverse-for-loops with unsigned integer
            /* solium-disable-next-line security/no-modify-for-iter-var */
            i--;

            // take last decimal digit
            bstr[i] = byte(uint8(ASCII_ZERO + (j % 10)));

            // remove the last decimal digit
            j /= 10;
        }

        return bstr;
    }

    function stringify(
        address input
    )
    private
    pure
    returns (bytes memory)
    {
        uint256 z = uint256(input);

        // addresses are "0x" followed by 20 bytes of data which take up 2 characters each
        bytes memory result = new bytes(42);

        // populate the result with "0x"
        result[0] = byte(uint8(ASCII_ZERO));
        result[1] = byte(uint8(ASCII_LOWER_EX));

        // for each byte (starting from the lowest byte), populate the result with two characters
        for (uint256 i = 0; i < 20; i++) {
            // each byte takes two characters
            uint256 shift = i * 2;

            // populate the least-significant character
            result[41 - shift] = char(z & FOUR_BIT_MASK);
            z = z >> 4;

            // populate the most-significant character
            result[40 - shift] = char(z & FOUR_BIT_MASK);
            z = z >> 4;
        }

        return result;
    }

    function stringify(
        bytes32 input
    )
    private
    pure
    returns (bytes memory)
    {
        uint256 z = uint256(input);

        // bytes32 are "0x" followed by 32 bytes of data which take up 2 characters each
        bytes memory result = new bytes(66);

        // populate the result with "0x"
        result[0] = byte(uint8(ASCII_ZERO));
        result[1] = byte(uint8(ASCII_LOWER_EX));

        // for each byte (starting from the lowest byte), populate the result with two characters
        for (uint256 i = 0; i < 32; i++) {
            // each byte takes two characters
            uint256 shift = i * 2;

            // populate the least-significant character
            result[65 - shift] = char(z & FOUR_BIT_MASK);
            z = z >> 4;

            // populate the most-significant character
            result[64 - shift] = char(z & FOUR_BIT_MASK);
            z = z >> 4;
        }

        return result;
    }

    function char(
        uint256 input
    )
    private
    pure
    returns (byte)
    {
        // return ASCII digit (0-9)
        if (input < 10) {
            return byte(uint8(input + ASCII_ZERO));
        }

        // return ASCII letter (a-f)
        return byte(uint8(input + ASCII_RELATIVE_ZERO));
    }
}

/*
    Copyright 2019 dYdX Trading Inc.
    Copyright 2020 Empty Set Squad <[email protected]>

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
*/
/**
 * @title Decimal
 * @author dYdX
 *
 * Library that defines a fixed-point number with 18 decimal places.
 */
library Decimal {
    using SafeMath for uint256;

    // ============ Constants ============

    uint256 constant BASE = 10**18;

    // ============ Structs ============


    struct D256 {
        uint256 value;
    }

    // ============ Static Functions ============

    function zero()
    internal
    pure
    returns (D256 memory)
    {
        return D256({ value: 0 });
    }

    function one()
    internal
    pure
    returns (D256 memory)
    {
        return D256({ value: BASE });
    }

    function from(
        uint256 a
    )
    internal
    pure
    returns (D256 memory)
    {
        return D256({ value: a.mul(BASE) });
    }

    function ratio(
        uint256 a,
        uint256 b
    )
    internal
    pure
    returns (D256 memory)
    {
        return D256({ value: getPartial(a, BASE, b) });
    }

    // ============ Self Functions ============

    function add(
        D256 memory self,
        uint256 b
    )
    internal
    pure
    returns (D256 memory)
    {
        return D256({ value: self.value.add(b.mul(BASE)) });
    }

    function sub(
        D256 memory self,
        uint256 b
    )
    internal
    pure
    returns (D256 memory)
    {
        return D256({ value: self.value.sub(b.mul(BASE)) });
    }

    function sub(
        D256 memory self,
        uint256 b,
        string memory reason
    )
    internal
    pure
    returns (D256 memory)
    {
        return D256({ value: self.value.sub(b.mul(BASE), reason) });
    }

    function mul(
        D256 memory self,
        uint256 b
    )
    internal
    pure
    returns (D256 memory)
    {
        return D256({ value: self.value.mul(b) });
    }

    function div(
        D256 memory self,
        uint256 b
    )
    internal
    pure
    returns (D256 memory)
    {
        return D256({ value: self.value.div(b) });
    }

    function pow(
        D256 memory self,
        uint256 b
    )
    internal
    pure
    returns (D256 memory)
    {
        if (b == 0) {
            return from(1);
        }

        D256 memory temp = D256({ value: self.value });
        for (uint256 i = 1; i < b; i++) {
            temp = mul(temp, self);
        }

        return temp;
    }

    function add(
        D256 memory self,
        D256 memory b
    )
    internal
    pure
    returns (D256 memory)
    {
        return D256({ value: self.value.add(b.value) });
    }

    function sub(
        D256 memory self,
        D256 memory b
    )
    internal
    pure
    returns (D256 memory)
    {
        return D256({ value: self.value.sub(b.value) });
    }

    function sub(
        D256 memory self,
        D256 memory b,
        string memory reason
    )
    internal
    pure
    returns (D256 memory)
    {
        return D256({ value: self.value.sub(b.value, reason) });
    }

    function mul(
        D256 memory self,
        D256 memory b
    )
    internal
    pure
    returns (D256 memory)
    {
        return D256({ value: getPartial(self.value, b.value, BASE) });
    }

    function div(
        D256 memory self,
        D256 memory b
    )
    internal
    pure
    returns (D256 memory)
    {
        return D256({ value: getPartial(self.value, BASE, b.value) });
    }

    function equals(D256 memory self, D256 memory b) internal pure returns (bool) {
        return self.value == b.value;
    }

    function greaterThan(D256 memory self, D256 memory b) internal pure returns (bool) {
        return compareTo(self, b) == 2;
    }

    function lessThan(D256 memory self, D256 memory b) internal pure returns (bool) {
        return compareTo(self, b) == 0;
    }

    function greaterThanOrEqualTo(D256 memory self, D256 memory b) internal pure returns (bool) {
        return compareTo(self, b) > 0;
    }

    function lessThanOrEqualTo(D256 memory self, D256 memory b) internal pure returns (bool) {
        return compareTo(self, b) < 2;
    }

    function isZero(D256 memory self) internal pure returns (bool) {
        return self.value == 0;
    }

    function asUint256(D256 memory self) internal pure returns (uint256) {
        return self.value.div(BASE);
    }

    // ============ Core Methods ============

    function getPartial(
        uint256 target,
        uint256 numerator,
        uint256 denominator
    )
    private
    pure
    returns (uint256)
    {
        return target.mul(numerator).div(denominator);
    }

    function compareTo(
        D256 memory a,
        D256 memory b
    )
    private
    pure
    returns (uint256)
    {
        if (a.value == b.value) {
            return 1;
        }
        return a.value > b.value ? 2 : 0;
    }
}

/*
    Copyright 2020 Empty Set Squad <[email protected]>

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
*/
library Constants {
    /* Chain */
    uint256 private constant CHAIN_ID = 1; // Mainnet

    /* Bootstrapping */
    uint256 private constant BOOTSTRAPPING_PERIOD = 90;
    uint256 private constant BOOTSTRAPPING_PRICE = 11e17; // 1.10 USDC
    uint256 private constant BOOTSTRAPPING_SPEEDUP_FACTOR = 3; // 30 days @ 8 hours

    /* Oracle */
    address private constant USDC = address(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48);
    uint256 private constant ORACLE_RESERVE_MINIMUM = 1e10; // 10,000 USDC

    /* Bonding */
    uint256 private constant INITIAL_STAKE_MULTIPLE = 1e6; // 100 ESD -> 100M ESDS

    /* Epoch */
    struct EpochStrategy {
        uint256 offset;
        uint256 start;
        uint256 period;
    }

    uint256 private constant PREVIOUS_EPOCH_OFFSET = 91;
    uint256 private constant PREVIOUS_EPOCH_START = 1600905600;
    uint256 private constant PREVIOUS_EPOCH_PERIOD = 86400;

    uint256 private constant CURRENT_EPOCH_OFFSET = 106;
    uint256 private constant CURRENT_EPOCH_START = 1602201600;
    uint256 private constant CURRENT_EPOCH_PERIOD = 28800;

    /* Governance */
    uint256 private constant GOVERNANCE_PERIOD = 9;
    uint256 private constant GOVERNANCE_QUORUM = 33e16; // 33%
    uint256 private constant GOVERNANCE_SUPER_MAJORITY = 66e16; // 66%
    uint256 private constant GOVERNANCE_EMERGENCY_DELAY = 6; // 6 epochs

    /* DAO */
    uint256 private constant ADVANCE_INCENTIVE = 1e20; // 100 ESD
    uint256 private constant DAO_EXIT_LOCKUP_EPOCHS = 15; // 15 epochs fluid

    /* Pool */
    uint256 private constant POOL_EXIT_LOCKUP_EPOCHS = 5; // 5 epochs fluid

    /* Market */
    uint256 private constant COUPON_EXPIRATION = 90;
    uint256 private constant DEBT_RATIO_CAP = 35e16; // 35%

    /* Regulator */
    uint256 private constant SUPPLY_CHANGE_LIMIT = 3e16; // 3%
    uint256 private constant COUPON_SUPPLY_CHANGE_LIMIT = 6e16; // 6%
    uint256 private constant ORACLE_POOL_RATIO = 20; // 20%

    /* Deployed */
    address private constant DAO_ADDRESS = address(0x443D2f2755DB5942601fa062Cc248aAA153313D3);
    address private constant DOLLAR_ADDRESS = address(0x36F3FD68E7325a35EB768F1AedaAe9EA0689d723);
    address private constant PAIR_ADDRESS = address(0x88ff79eB2Bc5850F27315415da8685282C7610F9);

    /* Pool Migration */
    address private constant LEGACY_POOL_ADDRESS = address(0xdF0Ae5504A48ab9f913F8490fBef1b9333A68e68);
    uint256 private constant LEGACY_POOL_REWARD = 1e18; // 1 ESD

    /**
     * Getters
     */

    function getUsdcAddress() internal pure returns (address) {
        return USDC;
    }

    function getOracleReserveMinimum() internal pure returns (uint256) {
        return ORACLE_RESERVE_MINIMUM;
    }

    function getPreviousEpochStrategy() internal pure returns (EpochStrategy memory) {
        return EpochStrategy({
            offset: PREVIOUS_EPOCH_OFFSET,
            start: PREVIOUS_EPOCH_START,
            period: PREVIOUS_EPOCH_PERIOD
        });
    }

    function getCurrentEpochStrategy() internal pure returns (EpochStrategy memory) {
        return EpochStrategy({
            offset: CURRENT_EPOCH_OFFSET,
            start: CURRENT_EPOCH_START,
            period: CURRENT_EPOCH_PERIOD
        });
    }

    function getInitialStakeMultiple() internal pure returns (uint256) {
        return INITIAL_STAKE_MULTIPLE;
    }

    function getBootstrappingPeriod() internal pure returns (uint256) {
        return BOOTSTRAPPING_PERIOD;
    }

    function getBootstrappingPrice() internal pure returns (Decimal.D256 memory) {
        return Decimal.D256({value: BOOTSTRAPPING_PRICE});
    }

    function getBootstrappingSpeedupFactor() internal pure returns (uint256) {
        return BOOTSTRAPPING_SPEEDUP_FACTOR;
    }

    function getGovernancePeriod() internal pure returns (uint256) {
        return GOVERNANCE_PERIOD;
    }

    function getGovernanceQuorum() internal pure returns (Decimal.D256 memory) {
        return Decimal.D256({value: GOVERNANCE_QUORUM});
    }

    function getGovernanceSuperMajority() internal pure returns (Decimal.D256 memory) {
        return Decimal.D256({value: GOVERNANCE_SUPER_MAJORITY});
    }

    function getGovernanceEmergencyDelay() internal pure returns (uint256) {
        return GOVERNANCE_EMERGENCY_DELAY;
    }

    function getAdvanceIncentive() internal pure returns (uint256) {
        return ADVANCE_INCENTIVE;
    }

    function getDAOExitLockupEpochs() internal pure returns (uint256) {
        return DAO_EXIT_LOCKUP_EPOCHS;
    }

    function getPoolExitLockupEpochs() internal pure returns (uint256) {
        return POOL_EXIT_LOCKUP_EPOCHS;
    }

    function getCouponExpiration() internal pure returns (uint256) {
        return COUPON_EXPIRATION;
    }

    function getDebtRatioCap() internal pure returns (Decimal.D256 memory) {
        return Decimal.D256({value: DEBT_RATIO_CAP});
    }

    function getSupplyChangeLimit() internal pure returns (Decimal.D256 memory) {
        return Decimal.D256({value: SUPPLY_CHANGE_LIMIT});
    }

    function getCouponSupplyChangeLimit() internal pure returns (Decimal.D256 memory) {
        return Decimal.D256({value: COUPON_SUPPLY_CHANGE_LIMIT});
    }

    function getOraclePoolRatio() internal pure returns (uint256) {
        return ORACLE_POOL_RATIO;
    }

    function getChainId() internal pure returns (uint256) {
        return CHAIN_ID;
    }

    function getDaoAddress() internal pure returns (address) {
        return DAO_ADDRESS;
    }

    function getDollarAddress() internal pure returns (address) {
        return DOLLAR_ADDRESS;
    }

    function getPairAddress() internal pure returns (address) {
        return PAIR_ADDRESS;
    }

    function getLegacyPoolAddress() internal pure returns (address) {
        return LEGACY_POOL_ADDRESS;
    }

    function getLegacyPoolReward() internal pure returns (uint256) {
        return LEGACY_POOL_REWARD;
    }
}

/*
    Copyright 2020 Empty Set Squad <[email protected]>

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
*/
contract IDollar is IERC20 {
    function burn(uint256 amount) public;
    function burnFrom(address account, uint256 amount) public;
    function mint(address account, uint256 amount) public returns (bool);
}

/*
    Copyright 2020 Empty Set Squad <[email protected]>

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
*/
contract IDAO {
    function epoch() external view returns (uint256);
}

/*
    Copyright 2020 Empty Set Squad <[email protected]>

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
*/
contract IUSDC {
    function isBlacklisted(address _account) external view returns (bool);
}

/*
    Copyright 2020 Empty Set Squad <[email protected]>

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
*/
contract PoolAccount {
    enum Status {
        Frozen,
        Fluid,
        Locked
    }

    struct State {
        uint256 staged;
        uint256 claimable;
        uint256 bonded;
        uint256 phantom;
        uint256 fluidUntil;
    }
}

contract PoolStorage {
    struct Balance {
        uint256 staged;
        uint256 claimable;
        uint256 bonded;
        uint256 phantom;
    }

    struct State {
        Balance balance;
        bool paused;

        mapping(address => PoolAccount.State) accounts;
    }
}

contract PoolState {
    PoolStorage.State _state;
}

/*
    Copyright 2020 Empty Set Squad <[email protected]>

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
*/
contract PoolGetters is PoolState {
    using SafeMath for uint256;

    /**
     * Global
     */

    function usdc() public view returns (address) {
        return Constants.getUsdcAddress();
    }

    function dao() public view returns (IDAO) {
        return IDAO(Constants.getDaoAddress());
    }

    function dollar() public view returns (IDollar) {
        return IDollar(Constants.getDollarAddress());
    }

    function univ2() public view returns (IERC20) {
        return IERC20(Constants.getPairAddress());
    }

    function totalBonded() public view returns (uint256) {
        return _state.balance.bonded;
    }

    function totalStaged() public view returns (uint256) {
        return _state.balance.staged;
    }

    function totalClaimable() public view returns (uint256) {
        return _state.balance.claimable;
    }

    function totalPhantom() public view returns (uint256) {
        return _state.balance.phantom;
    }

    function totalRewarded() public view returns (uint256) {
        return dollar().balanceOf(address(this)).sub(totalClaimable());
    }

    function paused() public view returns (bool) {
        return _state.paused;
    }

    /**
     * Account
     */

    function balanceOfStaged(address account) public view returns (uint256) {
        return _state.accounts[account].staged;
    }

    function balanceOfClaimable(address account) public view returns (uint256) {
        return _state.accounts[account].claimable;
    }

    function balanceOfBonded(address account) public view returns (uint256) {
        return _state.accounts[account].bonded;
    }

    function balanceOfPhantom(address account) public view returns (uint256) {
        return _state.accounts[account].phantom;
    }

    function balanceOfRewarded(address account) public view returns (uint256) {
        uint256 totalBonded = totalBonded();
        if (totalBonded == 0) {
            return 0;
        }

        uint256 totalRewardedWithPhantom = totalRewarded().add(totalPhantom());
        uint256 balanceOfRewardedWithPhantom = totalRewardedWithPhantom
            .mul(balanceOfBonded(account))
            .div(totalBonded);

        uint256 balanceOfPhantom = balanceOfPhantom(account);
        if (balanceOfRewardedWithPhantom > balanceOfPhantom) {
            return balanceOfRewardedWithPhantom.sub(balanceOfPhantom);
        }
        return 0;
    }

    function statusOf(address account) public view returns (PoolAccount.Status) {
        return epoch() >= _state.accounts[account].fluidUntil ?
            PoolAccount.Status.Frozen :
            PoolAccount.Status.Fluid;
    }

    /**
     * Epoch
     */

    function epoch() internal view returns (uint256) {
        return dao().epoch();
    }
}

/*
    Copyright 2020 Empty Set Squad <[email protected]>

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
*/
contract PoolSetters is PoolState, PoolGetters {
    using SafeMath for uint256;

    /**
     * Global
     */

    function pause() internal {
        _state.paused = true;
    }

    /**
     * Account
     */

    function incrementBalanceOfBonded(address account, uint256 amount) internal {
        _state.accounts[account].bonded = _state.accounts[account].bonded.add(amount);
        _state.balance.bonded = _state.balance.bonded.add(amount);
    }

    function decrementBalanceOfBonded(address account, uint256 amount, string memory reason) internal {
        _state.accounts[account].bonded = _state.accounts[account].bonded.sub(amount, reason);
        _state.balance.bonded = _state.balance.bonded.sub(amount, reason);
    }

    function incrementBalanceOfStaged(address account, uint256 amount) internal {
        _state.accounts[account].staged = _state.accounts[account].staged.add(amount);
        _state.balance.staged = _state.balance.staged.add(amount);
    }

    function decrementBalanceOfStaged(address account, uint256 amount, string memory reason) internal {
        _state.accounts[account].staged = _state.accounts[account].staged.sub(amount, reason);
        _state.balance.staged = _state.balance.staged.sub(amount, reason);
    }

    function incrementBalanceOfClaimable(address account, uint256 amount) internal {
        _state.accounts[account].claimable = _state.accounts[account].claimable.add(amount);
        _state.balance.claimable = _state.balance.claimable.add(amount);
    }

    function decrementBalanceOfClaimable(address account, uint256 amount, string memory reason) internal {
        _state.accounts[account].claimable = _state.accounts[account].claimable.sub(amount, reason);
        _state.balance.claimable = _state.balance.claimable.sub(amount, reason);
    }

    function incrementBalanceOfPhantom(address account, uint256 amount) internal {
        _state.accounts[account].phantom = _state.accounts[account].phantom.add(amount);
        _state.balance.phantom = _state.balance.phantom.add(amount);
    }

    function decrementBalanceOfPhantom(address account, uint256 amount, string memory reason) internal {
        _state.accounts[account].phantom = _state.accounts[account].phantom.sub(amount, reason);
        _state.balance.phantom = _state.balance.phantom.sub(amount, reason);
    }

    function unfreeze(address account) internal {
        _state.accounts[account].fluidUntil = epoch().add(Constants.getPoolExitLockupEpochs());
    }
}

interface IUniswapV2Pair {
    event Approval(address indexed owner, address indexed spender, uint value);
    event Transfer(address indexed from, address indexed to, uint value);

    function name() external pure returns (string memory);
    function symbol() external pure returns (string memory);
    function decimals() external pure returns (uint8);
    function totalSupply() external view returns (uint);
    function balanceOf(address owner) external view returns (uint);
    function allowance(address owner, address spender) external view returns (uint);

    function approve(address spender, uint value) external returns (bool);
    function transfer(address to, uint value) external returns (bool);
    function transferFrom(address from, address to, uint value) external returns (bool);

    function DOMAIN_SEPARATOR() external view returns (bytes32);
    function PERMIT_TYPEHASH() external pure returns (bytes32);
    function nonces(address owner) external view returns (uint);

    function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;

    event Mint(address indexed sender, uint amount0, uint amount1);
    event Burn(address indexed sender, uint amount0, uint amount1, address indexed to);
    event Swap(
        address indexed sender,
        uint amount0In,
        uint amount1In,
        uint amount0Out,
        uint amount1Out,
        address indexed to
    );
    event Sync(uint112 reserve0, uint112 reserve1);

    function MINIMUM_LIQUIDITY() external pure returns (uint);
    function factory() external view returns (address);
    function token0() external view returns (address);
    function token1() external view returns (address);
    function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
    function price0CumulativeLast() external view returns (uint);
    function price1CumulativeLast() external view returns (uint);
    function kLast() external view returns (uint);

    function mint(address to) external returns (uint liquidity);
    function burn(address to) external returns (uint amount0, uint amount1);
    function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external;
    function skim(address to) external;
    function sync() external;

    function initialize(address, address) external;
}

library UniswapV2Library {
    using SafeMath for uint;

    // returns sorted token addresses, used to handle return values from pairs sorted in this order
    function sortTokens(address tokenA, address tokenB) internal pure returns (address token0, address token1) {
        require(tokenA != tokenB, 'UniswapV2Library: IDENTICAL_ADDRESSES');
        (token0, token1) = tokenA < tokenB ? (tokenA, tokenB) : (tokenB, tokenA);
        require(token0 != address(0), 'UniswapV2Library: ZERO_ADDRESS');
    }

    // calculates the CREATE2 address for a pair without making any external calls
    function pairFor(address factory, address tokenA, address tokenB) internal pure returns (address pair) {
        (address token0, address token1) = sortTokens(tokenA, tokenB);
        pair = address(uint(keccak256(abi.encodePacked(
                hex'ff',
                factory,
                keccak256(abi.encodePacked(token0, token1)),
                hex'96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f' // init code hash
            ))));
    }

    // fetches and sorts the reserves for a pair
    function getReserves(address factory, address tokenA, address tokenB) internal view returns (uint reserveA, uint reserveB) {
        (address token0,) = sortTokens(tokenA, tokenB);
        (uint reserve0, uint reserve1,) = IUniswapV2Pair(pairFor(factory, tokenA, tokenB)).getReserves();
        (reserveA, reserveB) = tokenA == token0 ? (reserve0, reserve1) : (reserve1, reserve0);
    }

    // given some amount of an asset and pair reserves, returns an equivalent amount of the other asset
    function quote(uint amountA, uint reserveA, uint reserveB) internal pure returns (uint amountB) {
        require(amountA > 0, 'UniswapV2Library: INSUFFICIENT_AMOUNT');
        require(reserveA > 0 && reserveB > 0, 'UniswapV2Library: INSUFFICIENT_LIQUIDITY');
        amountB = amountA.mul(reserveB) / reserveA;
    }
}

/*
    Copyright 2020 Empty Set Squad <[email protected]>

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
*/
contract Liquidity is PoolGetters {
    address private constant UNISWAP_FACTORY = address(0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f);

    function addLiquidity(uint256 dollarAmount) internal returns (uint256, uint256) {
        (address dollar, address usdc) = (address(dollar()), usdc());
        (uint reserveA, uint reserveB) = getReserves(dollar, usdc);

        uint256 usdcAmount = (reserveA == 0 && reserveB == 0) ?
             dollarAmount :
             UniswapV2Library.quote(dollarAmount, reserveA, reserveB);

        address pair = address(univ2());
        IERC20(dollar).transfer(pair, dollarAmount);
        IERC20(usdc).transferFrom(msg.sender, pair, usdcAmount);
        return (usdcAmount, IUniswapV2Pair(pair).mint(address(this)));
    }

    // overridable for testing
    function getReserves(address tokenA, address tokenB) internal view returns (uint reserveA, uint reserveB) {
        (address token0,) = UniswapV2Library.sortTokens(tokenA, tokenB);
        (uint reserve0, uint reserve1,) = IUniswapV2Pair(UniswapV2Library.pairFor(UNISWAP_FACTORY, tokenA, tokenB)).getReserves();
        (reserveA, reserveB) = tokenA == token0 ? (reserve0, reserve1) : (reserve1, reserve0);
    }
}

/*
    Copyright 2020 Empty Set Squad <[email protected]>

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
*/
contract Pool is PoolSetters, Liquidity {
    using SafeMath for uint256;

    constructor() public { }

    bytes32 private constant FILE = "Pool";

    event Deposit(address indexed account, uint256 value);
    event Withdraw(address indexed account, uint256 value);
    event Claim(address indexed account, uint256 value);
    event Bond(address indexed account, uint256 start, uint256 value);
    event Unbond(address indexed account, uint256 start, uint256 value, uint256 newClaimable);
    event Provide(address indexed account, uint256 value, uint256 lessUsdc, uint256 newUniv2);

    function deposit(uint256 value) external onlyFrozen(msg.sender) notPaused {
        univ2().transferFrom(msg.sender, address(this), value);
        incrementBalanceOfStaged(msg.sender, value);

        balanceCheck();

        emit Deposit(msg.sender, value);
    }

    function withdraw(uint256 value) external onlyFrozen(msg.sender) {
        univ2().transfer(msg.sender, value);
        decrementBalanceOfStaged(msg.sender, value, "Pool: insufficient staged balance");

        balanceCheck();

        emit Withdraw(msg.sender, value);
    }

    function claim(uint256 value) external onlyFrozen(msg.sender) {
        dollar().transfer(msg.sender, value);
        decrementBalanceOfClaimable(msg.sender, value, "Pool: insufficient claimable balance");

        balanceCheck();

        emit Claim(msg.sender, value);
    }

    function bond(uint256 value) external notPaused {
        unfreeze(msg.sender);

        uint256 totalRewardedWithPhantom = totalRewarded().add(totalPhantom());
        uint256 newPhantom = totalBonded() == 0 ?
            totalRewarded() == 0 ? Constants.getInitialStakeMultiple().mul(value) : 0 :
            totalRewardedWithPhantom.mul(value).div(totalBonded());

        incrementBalanceOfBonded(msg.sender, value);
        incrementBalanceOfPhantom(msg.sender, newPhantom);
        decrementBalanceOfStaged(msg.sender, value, "Pool: insufficient staged balance");

        balanceCheck();

        emit Bond(msg.sender, epoch().add(1), value);
    }

    function unbond(uint256 value) external {
        unfreeze(msg.sender);

        uint256 balanceOfBonded = balanceOfBonded(msg.sender);
        Require.that(
            balanceOfBonded > 0,
            FILE,
            "insufficient bonded balance"
        );

        uint256 newClaimable = balanceOfRewarded(msg.sender).mul(value).div(balanceOfBonded);
        uint256 lessPhantom = balanceOfPhantom(msg.sender).mul(value).div(balanceOfBonded);

        incrementBalanceOfStaged(msg.sender, value);
        incrementBalanceOfClaimable(msg.sender, newClaimable);
        decrementBalanceOfBonded(msg.sender, value, "Pool: insufficient bonded balance");
        decrementBalanceOfPhantom(msg.sender, lessPhantom, "Pool: insufficient phantom balance");

        balanceCheck();

        emit Unbond(msg.sender, epoch().add(1), value, newClaimable);
    }

    function provide(uint256 value) external onlyFrozen(msg.sender) notPaused {
        Require.that(
            totalBonded() > 0,
            FILE,
            "insufficient total bonded"
        );

        Require.that(
            totalRewarded() > 0,
            FILE,
            "insufficient total rewarded"
        );

        Require.that(
            balanceOfRewarded(msg.sender) >= value,
            FILE,
            "insufficient rewarded balance"
        );

        (uint256 lessUsdc, uint256 newUniv2) = addLiquidity(value);

        uint256 totalRewardedWithPhantom = totalRewarded().add(totalPhantom()).add(value);
        uint256 newPhantomFromBonded = totalRewardedWithPhantom.mul(newUniv2).div(totalBonded());

        incrementBalanceOfBonded(msg.sender, newUniv2);
        incrementBalanceOfPhantom(msg.sender, value.add(newPhantomFromBonded));


        balanceCheck();

        emit Provide(msg.sender, value, lessUsdc, newUniv2);
    }

    function emergencyWithdraw(address token, uint256 value) external onlyDao {
        IERC20(token).transfer(address(dao()), value);
    }

    function emergencyPause() external onlyDao {
        pause();
    }

    function balanceCheck() private {
        Require.that(
            univ2().balanceOf(address(this)) >= totalStaged().add(totalBonded()),
            FILE,
            "Inconsistent UNI-V2 balances"
        );
    }

    modifier onlyFrozen(address account) {
        Require.that(
            statusOf(account) == PoolAccount.Status.Frozen,
            FILE,
            "Not frozen"
        );

        _;
    }

    modifier onlyDao() {
        Require.that(
            msg.sender == address(dao()),
            FILE,
            "Not dao"
        );

        _;
    }

    modifier notPaused() {
        Require.that(
            !paused(),
            FILE,
            "Paused"
        );

        _;
    }
}

Contract Security Audit

Contract ABI

[{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"start","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Bond","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Claim","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"lessUsdc","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newUniv2","type":"uint256"}],"name":"Provide","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"start","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newClaimable","type":"uint256"}],"name":"Unbond","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Withdraw","type":"event"},{"constant":true,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOfBonded","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOfClaimable","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOfPhantom","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOfRewarded","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOfStaged","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"value","type":"uint256"}],"name":"bond","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"value","type":"uint256"}],"name":"claim","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"dao","outputs":[{"internalType":"contract IDAO","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"value","type":"uint256"}],"name":"deposit","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"dollar","outputs":[{"internalType":"contract IDollar","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"emergencyPause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"emergencyWithdraw","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"value","type":"uint256"}],"name":"provide","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"statusOf","outputs":[{"internalType":"enum PoolAccount.Status","name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"totalBonded","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"totalClaimable","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"totalPhantom","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"totalRewarded","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"totalStaged","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"value","type":"uint256"}],"name":"unbond","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"univ2","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"usdc","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"value","type":"uint256"}],"name":"withdraw","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"}]

608060405234801561001057600080fd5b50612012806100206000396000f3fe608060405234801561001057600080fd5b50600436106101585760003560e01c80635c975abb116100c35780639940686e1161007c5780639940686e146102a7578063aed29d07146102ba578063b6b55f25146102c2578063c0d7a94f146102d5578063cf023779146102e8578063e0cf7285146102f057610158565b80635c975abb146102315780637298d36e14610246578063825ad6071461024e57806386cf9f141461026157806395ccea671461027457806397a5d5b51461028757610158565b80633e413bee116101155780633e413bee146101e75780634162169f146101fc57806344d96e95146102115780634838ed191461021957806351858e271461022157806351adeb571461022957610158565b80631667eb171461015d57806327de9e321461018657806329f32ed41461019b5780632e1a7d4d146101ae5780632e2ebe06146101c1578063379607f5146101d4575b600080fd5b61017061016b3660046118aa565b6102f8565b60405161017d9190611e05565b60405180910390f35b610199610194366004611975565b61031a565b005b6101706101a93660046118aa565b610463565b6101996101bc366004611975565b610481565b6101996101cf366004611975565b6105b0565b6101996101e2366004611975565b610755565b6101ef61084c565b60405161017d9190611d0b565b61020461085b565b60405161017d9190611d78565b610170610865565b61017061086b565b610199610871565b6102046108b2565b6102396108bc565b60405161017d9190611d6a565b6102046108c5565b61017061025c3660046118aa565b6108cf565b61017061026f3660046118aa565b6108ed565b6101996102823660046118d0565b610908565b61029a6102953660046118aa565b61099f565b60405161017d9190611d86565b6101996102b5366004611975565b6109d9565b610170610ac7565b6101996102d0366004611975565b610b63565b6101706102e33660046118aa565b610c4e565b610170610cd6565b610170610cdc565b6001600160a01b0381166000908152600560205260409020600101545b919050565b61032333610ce2565b600061032e336108cf565b90506103656000821163141bdbdb60e21b7f696e73756666696369656e7420626f6e6465642062616c616e63650000000000610d14565b6000610390826103848561037833610c4e565b9063ffffffff610d7216565b9063ffffffff610db316565b905060006103a5836103848661037833610463565b90506103b13385610df5565b6103bb3383610e52565b6103de3385604051806060016040528060218152602001611faf60219139610eb7565b6104013382604051806060016040528060228152602001611f6c60229139610f1f565b610409610f87565b337f93530ac0ee8c50e696e13c5ac62355d0c0ba4bd943620d5bda1eb08b64ae75126104446001610438611050565b9063ffffffff6110ca16565b868560405161045593929190611e21565b60405180910390a250505050565b6001600160a01b031660009081526005602052604090206003015490565b336104b860005b6104918361099f565b600281111561049c57fe5b1463141bdbdb60e21b692737ba10333937bd32b760b11b610d14565b6104c06108c5565b6001600160a01b031663a9059cbb33846040518363ffffffff1660e01b81526004016104ed929190611d41565b602060405180830381600087803b15801561050757600080fd5b505af115801561051b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061053f919081019061190a565b506105633383604051806060016040528060218152602001611f8e602191396110ef565b61056b610f87565b336001600160a01b03167f884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a9424364836040516105a49190611e05565b60405180910390a25050565b336105bb6000610488565b6105de6105c66108bc565b1563141bdbdb60e21b6514185d5cd95960d21b610d14565b61061a60006105eb610865565b1163141bdbdb60e21b7f696e73756666696369656e7420746f74616c20626f6e64656400000000000000610d14565b6106566000610627610ac7565b1163141bdbdb60e21b7f696e73756666696369656e7420746f74616c2072657761726465640000000000610d14565b6106938261066333610c4e565b101563141bdbdb60e21b7f696e73756666696369656e742072657761726465642062616c616e6365000000610d14565b60008061069f8461114f565b9150915060006106bc856104386106b4610cdc565b610438610ac7565b905060006106db6106cb610865565b610384848663ffffffff610d7216565b90506106e73384611342565b610700336106fb888463ffffffff6110ca16565b6113a7565b610708610f87565b336001600160a01b03167fbe9d8078818a53534ce225882a00e0c6f709b5296c8a08c3a1f23f9ffd44838087868660405161074593929190611e21565b60405180910390a2505050505050565b336107606000610488565b6107686108b2565b6001600160a01b031663a9059cbb33846040518363ffffffff1660e01b8152600401610795929190611d41565b602060405180830381600087803b1580156107af57600080fd5b505af11580156107c3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506107e7919081019061190a565b5061080b3383604051806060016040528060248152602001611f486024913961140c565b610813610f87565b336001600160a01b03167f47cee97cb7acd717b3c0aa1435d004cd5b3c8c57d70dbceb4e4458bbd60e39d4836040516105a49190611e05565b6000610856611474565b905090565b600061085661148c565b60025490565b60015490565b6108a861087c61085b565b6001600160a01b0316336001600160a01b03161463141bdbdb60e21b664e6f742064616f60c81b610d14565b6108b06114a4565b565b60006108566114b3565b60045460ff1690565b60006108566114cb565b6001600160a01b031660009081526005602052604090206002015490565b6001600160a01b031660009081526005602052604090205490565b61091361087c61085b565b816001600160a01b031663a9059cbb61092a61085b565b836040518363ffffffff1660e01b8152600401610948929190611d5c565b602060405180830381600087803b15801561096257600080fd5b505af1158015610976573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061099a919081019061190a565b505050565b6001600160a01b0381166000908152600560205260408120600401546109c3611050565b10156109d05760016109d3565b60005b92915050565b6109e46105c66108bc565b6109ed33610ce2565b60006109fa6106b4610cdc565b90506000610a06610865565b15610a1b57610a166106cb610865565b610a3b565b610a23610ac7565b15610a2f576000610a3b565b610a3b836103786114e3565b9050610a473384611342565b610a5133826113a7565b610a743384604051806060016040528060218152602001611f8e602191396110ef565b610a7c610f87565b337f3ae9ad26d7d47616d306d7757b947fe7b0f9a7c61a5f0dc784b0ddb6c7c40b5a610aab6001610438611050565b85604051610aba929190611e13565b60405180910390a2505050565b6000610856610ad461086b565b610adc6108b2565b6001600160a01b03166370a08231306040518263ffffffff1660e01b8152600401610b079190611d0b565b60206040518083038186803b158015610b1f57600080fd5b505afa158015610b33573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610b579190810190611993565b9063ffffffff6114ea16565b33610b6e6000610488565b610b796105c66108bc565b610b816108c5565b6001600160a01b03166323b872dd3330856040518463ffffffff1660e01b8152600401610bb093929190611d19565b602060405180830381600087803b158015610bca57600080fd5b505af1158015610bde573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610c02919081019061190a565b50610c0d3383610df5565b610c15610f87565b336001600160a01b03167fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c836040516105a49190611e05565b600080610c59610865565b905080610c6a576000915050610315565b6000610c776106b4610cdc565b90506000610c9883610384610c8b886108cf565b859063ffffffff610d7216565b90506000610ca586610463565b905080821115610cca57610cbf828263ffffffff6114ea16565b945050505050610315565b50600095945050505050565b60005490565b60035490565b610cf5610ced61152c565b610438611050565b6001600160a01b03909116600090815260056020526040902060040155565b8261099a57610d2282611531565b6101d160f51b610d3183611531565b604051602001610d4393929190611ca4565b60408051601f198184030181529082905262461bcd60e51b8252610d6991600401611d94565b60405180910390fd5b600082610d81575060006109d3565b82820282848281610d8e57fe5b0414610dac5760405162461bcd60e51b8152600401610d6990611dd5565b9392505050565b6000610dac83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506115b1565b6001600160a01b038216600090815260056020526040902054610e1e908263ffffffff6110ca16565b6001600160a01b03831660009081526005602052604081209190915554610e4b908263ffffffff6110ca16565b6000555050565b6001600160a01b038216600090815260056020526040902060010154610e7e908263ffffffff6110ca16565b6001600160a01b038316600090815260056020526040902060019081019190915554610eb0908263ffffffff6110ca16565b6001555050565b6001600160a01b038316600090815260056020526040902060020154610ee490838363ffffffff6115e816565b6001600160a01b038416600090815260056020526040902060029081019190915554610f1790838363ffffffff6115e816565b600255505050565b6001600160a01b038316600090815260056020526040902060030154610f4c90838363ffffffff6115e816565b6001600160a01b038416600090815260056020526040902060039081019190915554610f7f90838363ffffffff6115e816565b600355505050565b6108b0610f9d610f95610865565b610438610cd6565b610fa56108c5565b6001600160a01b03166370a08231306040518263ffffffff1660e01b8152600401610fd09190611d0b565b60206040518083038186803b158015610fe857600080fd5b505afa158015610ffc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506110209190810190611993565b101563141bdbdb60e21b7f496e636f6e73697374656e7420554e492d56322062616c616e63657300000000610d14565b600061105a61085b565b6001600160a01b031663900cf0cf6040518163ffffffff1660e01b815260040160206040518083038186803b15801561109257600080fd5b505afa1580156110a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506108569190810190611993565b600082820183811015610dac5760405162461bcd60e51b8152600401610d6990611da5565b6001600160a01b03831660009081526005602052604090205461111990838363ffffffff6115e816565b6001600160a01b0384166000908152600560205260408120919091555461114790838363ffffffff6115e816565b600055505050565b60008060008061115d6108b2565b61116561084c565b915091506000806111768484611614565b91509150600082600014801561118a575081155b61119e57611199888484611700565b6111a0565b875b905060006111ac6108c5565b60405163a9059cbb60e01b81529091506001600160a01b0387169063a9059cbb906111dd9084908d90600401611d5c565b602060405180830381600087803b1580156111f757600080fd5b505af115801561120b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061122f919081019061190a565b506040516323b872dd60e01b81526001600160a01b038616906323b872dd9061126090339085908790600401611d19565b602060405180830381600087803b15801561127a57600080fd5b505af115801561128e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506112b2919081019061190a565b506040516335313c2160e11b815282906001600160a01b03831690636a627842906112e1903090600401611d0b565b602060405180830381600087803b1580156112fb57600080fd5b505af115801561130f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506113339190810190611993565b97509750505050505050915091565b6001600160a01b03821660009081526005602052604090206002015461136e908263ffffffff6110ca16565b6001600160a01b0383166000908152600560205260409020600290810191909155546113a0908263ffffffff6110ca16565b6002555050565b6001600160a01b0382166000908152600560205260409020600301546113d3908263ffffffff6110ca16565b6001600160a01b038316600090815260056020526040902060039081019190915554611405908263ffffffff6110ca16565b6003555050565b6001600160a01b03831660009081526005602052604090206001015461143990838363ffffffff6115e816565b6001600160a01b03841660009081526005602052604090206001908101919091555461146c90838363ffffffff6115e816565b600155505050565b73a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4890565b73443d2f2755db5942601fa062cc248aaa153313d390565b6004805460ff19166001179055565b7336f3fd68e7325a35eb768f1aedaae9ea0689d72390565b7388ff79eb2bc5850f27315415da8685282c7610f990565b620f424090565b6000610dac83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506115e8565b600590565b606080826040516020016115459190611c8f565b60408051601f19818403018152919052905060205b801561159a5781516000199091019082908290811061157557fe5b01602001516001600160f81b031916156115955760010181529050610315565b61155a565b505060408051600081526020810190915292915050565b600081836115d25760405162461bcd60e51b8152600401610d699190611d94565b5060008385816115de57fe5b0495945050505050565b6000818484111561160c5760405162461bcd60e51b8152600401610d699190611d94565b505050900390565b6000806000611623858561176e565b509050600080611648735c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f88886117f8565b6001600160a01b0316630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b15801561168057600080fd5b505afa158015611694573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506116b89190810190611928565b506001600160701b031691506001600160701b03169150826001600160a01b0316876001600160a01b0316146116ef5780826116f2565b81815b909890975095505050505050565b60008084116117215760405162461bcd60e51b8152600401610d6990611de5565b6000831180156117315750600082115b61174d5760405162461bcd60e51b8152600401610d6990611dc5565b8261175e858463ffffffff610d7216565b8161176557fe5b04949350505050565b600080826001600160a01b0316846001600160a01b031614156117a35760405162461bcd60e51b8152600401610d6990611db5565b826001600160a01b0316846001600160a01b0316106117c35782846117c6565b83835b90925090506001600160a01b0382166117f15760405162461bcd60e51b8152600401610d6990611df5565b9250929050565b6000806000611807858561176e565b9150915085828260405160200161181f929190611c69565b60405160208183030381529060405280519060200120604051602001611846929190611cd5565b60408051601f1981840301815291905280516020909101209695505050505050565b80356109d381611f0f565b80516109d381611f23565b80516109d381611f2c565b80356109d381611f35565b80516109d381611f35565b80516109d381611f3e565b6000602082840312156118bc57600080fd5b60006118c88484611868565b949350505050565b600080604083850312156118e357600080fd5b60006118ef8585611868565b925050602061190085828601611889565b9150509250929050565b60006020828403121561191c57600080fd5b60006118c88484611873565b60008060006060848603121561193d57600080fd5b6000611949868661187e565b935050602061195a8682870161187e565b925050604061196b8682870161189f565b9150509250925092565b60006020828403121561198757600080fd5b60006118c88484611889565b6000602082840312156119a557600080fd5b60006118c88484611894565b6119ba81611e94565b82525050565b6119ba81611e49565b6119ba6119d582611e49565b611ee1565b6119ba81611e54565b6119ba6119ef82611e59565b611e66565b6119ba6119ef82611e66565b6000611a0b82611e3c565b611a158185610315565b9350611a25818560208601611eb1565b9290920192915050565b6119ba81611e9b565b6119ba81611ea6565b6000611a4c82611e3c565b611a568185611e40565b9350611a66818560208601611eb1565b611a6f81611ef2565b9093019392505050565b6000611a86601b83611e40565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000815260200192915050565b6000611abf602583611e40565b7f556e697377617056324c6962726172793a204944454e544943414c5f41444452815264455353455360d81b602082015260400192915050565b6000611b06602083610315565b7f96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f815260200192915050565b6000611b3f602883611e40565b7f556e697377617056324c6962726172793a20494e53554646494349454e545f4c815267495155494449545960c01b602082015260400192915050565b6000611b89600183610315565b6001600160f81b0319815260010192915050565b6000611baa602183611e40565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f8152607760f81b602082015260400192915050565b6000611bed602583611e40565b7f556e697377617056324c6962726172793a20494e53554646494349454e545f418152641353d5539560da1b602082015260400192915050565b6000611c34601e83611e40565b7f556e697377617056324c6962726172793a205a45524f5f414444524553530000815260200192915050565b6119ba81611e66565b6000611c7582856119c9565b601482019150611c8582846119c9565b5060140192915050565b6000611c9b82846119f4565b50602001919050565b6000611cb08286611a00565b9150611cbc82856119e3565b600282019150611ccc8284611a00565b95945050505050565b6000611ce082611b7c565b9150611cec82856119c9565b601482019150611cfc82846119f4565b6020820191506118c882611af9565b602081016109d382846119c0565b60608101611d2782866119b1565b611d3460208301856119c0565b6118c86040830184611c60565b60408101611d4f82856119b1565b610dac6020830184611c60565b60408101611d4f82856119c0565b602081016109d382846119da565b602081016109d38284611a2f565b602081016109d38284611a38565b60208082528101610dac8184611a41565b602080825281016109d381611a79565b602080825281016109d381611ab2565b602080825281016109d381611b32565b602080825281016109d381611b9d565b602080825281016109d381611be0565b602080825281016109d381611c27565b602081016109d38284611c60565b60408101611d4f8285611c60565b60608101611e2f8286611c60565b611d346020830185611c60565b5190565b90815260200190565b60006109d382611e7f565b151590565b6001600160f01b03191690565b90565b8061031581611f02565b6001600160701b031690565b6001600160a01b031690565b63ffffffff1690565b60006109d3825b60006109d382611e49565b60006109d382611e69565b60005b83811015611ecc578181015183820152602001611eb4565b83811115611edb576000848401525b50505050565b60006109d38260006109d382611efc565b601f01601f191690565b60601b90565b60038110611f0c57fe5b50565b611f1881611e49565b8114611f0c57600080fd5b611f1881611e54565b611f1881611e73565b611f1881611e66565b611f1881611e8b56fe506f6f6c3a20696e73756666696369656e7420636c61696d61626c652062616c616e6365506f6f6c3a20696e73756666696369656e74207068616e746f6d2062616c616e6365506f6f6c3a20696e73756666696369656e74207374616765642062616c616e6365506f6f6c3a20696e73756666696369656e7420626f6e6465642062616c616e6365a365627a7a72315820df6ff4dda10f1231628a2a3e61b7f36cf21bf5c8eba5e891f802c06c0aa9e5cd6c6578706572696d656e74616cf564736f6c63430005110040

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106101585760003560e01c80635c975abb116100c35780639940686e1161007c5780639940686e146102a7578063aed29d07146102ba578063b6b55f25146102c2578063c0d7a94f146102d5578063cf023779146102e8578063e0cf7285146102f057610158565b80635c975abb146102315780637298d36e14610246578063825ad6071461024e57806386cf9f141461026157806395ccea671461027457806397a5d5b51461028757610158565b80633e413bee116101155780633e413bee146101e75780634162169f146101fc57806344d96e95146102115780634838ed191461021957806351858e271461022157806351adeb571461022957610158565b80631667eb171461015d57806327de9e321461018657806329f32ed41461019b5780632e1a7d4d146101ae5780632e2ebe06146101c1578063379607f5146101d4575b600080fd5b61017061016b3660046118aa565b6102f8565b60405161017d9190611e05565b60405180910390f35b610199610194366004611975565b61031a565b005b6101706101a93660046118aa565b610463565b6101996101bc366004611975565b610481565b6101996101cf366004611975565b6105b0565b6101996101e2366004611975565b610755565b6101ef61084c565b60405161017d9190611d0b565b61020461085b565b60405161017d9190611d78565b610170610865565b61017061086b565b610199610871565b6102046108b2565b6102396108bc565b60405161017d9190611d6a565b6102046108c5565b61017061025c3660046118aa565b6108cf565b61017061026f3660046118aa565b6108ed565b6101996102823660046118d0565b610908565b61029a6102953660046118aa565b61099f565b60405161017d9190611d86565b6101996102b5366004611975565b6109d9565b610170610ac7565b6101996102d0366004611975565b610b63565b6101706102e33660046118aa565b610c4e565b610170610cd6565b610170610cdc565b6001600160a01b0381166000908152600560205260409020600101545b919050565b61032333610ce2565b600061032e336108cf565b90506103656000821163141bdbdb60e21b7f696e73756666696369656e7420626f6e6465642062616c616e63650000000000610d14565b6000610390826103848561037833610c4e565b9063ffffffff610d7216565b9063ffffffff610db316565b905060006103a5836103848661037833610463565b90506103b13385610df5565b6103bb3383610e52565b6103de3385604051806060016040528060218152602001611faf60219139610eb7565b6104013382604051806060016040528060228152602001611f6c60229139610f1f565b610409610f87565b337f93530ac0ee8c50e696e13c5ac62355d0c0ba4bd943620d5bda1eb08b64ae75126104446001610438611050565b9063ffffffff6110ca16565b868560405161045593929190611e21565b60405180910390a250505050565b6001600160a01b031660009081526005602052604090206003015490565b336104b860005b6104918361099f565b600281111561049c57fe5b1463141bdbdb60e21b692737ba10333937bd32b760b11b610d14565b6104c06108c5565b6001600160a01b031663a9059cbb33846040518363ffffffff1660e01b81526004016104ed929190611d41565b602060405180830381600087803b15801561050757600080fd5b505af115801561051b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061053f919081019061190a565b506105633383604051806060016040528060218152602001611f8e602191396110ef565b61056b610f87565b336001600160a01b03167f884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a9424364836040516105a49190611e05565b60405180910390a25050565b336105bb6000610488565b6105de6105c66108bc565b1563141bdbdb60e21b6514185d5cd95960d21b610d14565b61061a60006105eb610865565b1163141bdbdb60e21b7f696e73756666696369656e7420746f74616c20626f6e64656400000000000000610d14565b6106566000610627610ac7565b1163141bdbdb60e21b7f696e73756666696369656e7420746f74616c2072657761726465640000000000610d14565b6106938261066333610c4e565b101563141bdbdb60e21b7f696e73756666696369656e742072657761726465642062616c616e6365000000610d14565b60008061069f8461114f565b9150915060006106bc856104386106b4610cdc565b610438610ac7565b905060006106db6106cb610865565b610384848663ffffffff610d7216565b90506106e73384611342565b610700336106fb888463ffffffff6110ca16565b6113a7565b610708610f87565b336001600160a01b03167fbe9d8078818a53534ce225882a00e0c6f709b5296c8a08c3a1f23f9ffd44838087868660405161074593929190611e21565b60405180910390a2505050505050565b336107606000610488565b6107686108b2565b6001600160a01b031663a9059cbb33846040518363ffffffff1660e01b8152600401610795929190611d41565b602060405180830381600087803b1580156107af57600080fd5b505af11580156107c3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506107e7919081019061190a565b5061080b3383604051806060016040528060248152602001611f486024913961140c565b610813610f87565b336001600160a01b03167f47cee97cb7acd717b3c0aa1435d004cd5b3c8c57d70dbceb4e4458bbd60e39d4836040516105a49190611e05565b6000610856611474565b905090565b600061085661148c565b60025490565b60015490565b6108a861087c61085b565b6001600160a01b0316336001600160a01b03161463141bdbdb60e21b664e6f742064616f60c81b610d14565b6108b06114a4565b565b60006108566114b3565b60045460ff1690565b60006108566114cb565b6001600160a01b031660009081526005602052604090206002015490565b6001600160a01b031660009081526005602052604090205490565b61091361087c61085b565b816001600160a01b031663a9059cbb61092a61085b565b836040518363ffffffff1660e01b8152600401610948929190611d5c565b602060405180830381600087803b15801561096257600080fd5b505af1158015610976573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061099a919081019061190a565b505050565b6001600160a01b0381166000908152600560205260408120600401546109c3611050565b10156109d05760016109d3565b60005b92915050565b6109e46105c66108bc565b6109ed33610ce2565b60006109fa6106b4610cdc565b90506000610a06610865565b15610a1b57610a166106cb610865565b610a3b565b610a23610ac7565b15610a2f576000610a3b565b610a3b836103786114e3565b9050610a473384611342565b610a5133826113a7565b610a743384604051806060016040528060218152602001611f8e602191396110ef565b610a7c610f87565b337f3ae9ad26d7d47616d306d7757b947fe7b0f9a7c61a5f0dc784b0ddb6c7c40b5a610aab6001610438611050565b85604051610aba929190611e13565b60405180910390a2505050565b6000610856610ad461086b565b610adc6108b2565b6001600160a01b03166370a08231306040518263ffffffff1660e01b8152600401610b079190611d0b565b60206040518083038186803b158015610b1f57600080fd5b505afa158015610b33573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610b579190810190611993565b9063ffffffff6114ea16565b33610b6e6000610488565b610b796105c66108bc565b610b816108c5565b6001600160a01b03166323b872dd3330856040518463ffffffff1660e01b8152600401610bb093929190611d19565b602060405180830381600087803b158015610bca57600080fd5b505af1158015610bde573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610c02919081019061190a565b50610c0d3383610df5565b610c15610f87565b336001600160a01b03167fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c836040516105a49190611e05565b600080610c59610865565b905080610c6a576000915050610315565b6000610c776106b4610cdc565b90506000610c9883610384610c8b886108cf565b859063ffffffff610d7216565b90506000610ca586610463565b905080821115610cca57610cbf828263ffffffff6114ea16565b945050505050610315565b50600095945050505050565b60005490565b60035490565b610cf5610ced61152c565b610438611050565b6001600160a01b03909116600090815260056020526040902060040155565b8261099a57610d2282611531565b6101d160f51b610d3183611531565b604051602001610d4393929190611ca4565b60408051601f198184030181529082905262461bcd60e51b8252610d6991600401611d94565b60405180910390fd5b600082610d81575060006109d3565b82820282848281610d8e57fe5b0414610dac5760405162461bcd60e51b8152600401610d6990611dd5565b9392505050565b6000610dac83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506115b1565b6001600160a01b038216600090815260056020526040902054610e1e908263ffffffff6110ca16565b6001600160a01b03831660009081526005602052604081209190915554610e4b908263ffffffff6110ca16565b6000555050565b6001600160a01b038216600090815260056020526040902060010154610e7e908263ffffffff6110ca16565b6001600160a01b038316600090815260056020526040902060019081019190915554610eb0908263ffffffff6110ca16565b6001555050565b6001600160a01b038316600090815260056020526040902060020154610ee490838363ffffffff6115e816565b6001600160a01b038416600090815260056020526040902060029081019190915554610f1790838363ffffffff6115e816565b600255505050565b6001600160a01b038316600090815260056020526040902060030154610f4c90838363ffffffff6115e816565b6001600160a01b038416600090815260056020526040902060039081019190915554610f7f90838363ffffffff6115e816565b600355505050565b6108b0610f9d610f95610865565b610438610cd6565b610fa56108c5565b6001600160a01b03166370a08231306040518263ffffffff1660e01b8152600401610fd09190611d0b565b60206040518083038186803b158015610fe857600080fd5b505afa158015610ffc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506110209190810190611993565b101563141bdbdb60e21b7f496e636f6e73697374656e7420554e492d56322062616c616e63657300000000610d14565b600061105a61085b565b6001600160a01b031663900cf0cf6040518163ffffffff1660e01b815260040160206040518083038186803b15801561109257600080fd5b505afa1580156110a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506108569190810190611993565b600082820183811015610dac5760405162461bcd60e51b8152600401610d6990611da5565b6001600160a01b03831660009081526005602052604090205461111990838363ffffffff6115e816565b6001600160a01b0384166000908152600560205260408120919091555461114790838363ffffffff6115e816565b600055505050565b60008060008061115d6108b2565b61116561084c565b915091506000806111768484611614565b91509150600082600014801561118a575081155b61119e57611199888484611700565b6111a0565b875b905060006111ac6108c5565b60405163a9059cbb60e01b81529091506001600160a01b0387169063a9059cbb906111dd9084908d90600401611d5c565b602060405180830381600087803b1580156111f757600080fd5b505af115801561120b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061122f919081019061190a565b506040516323b872dd60e01b81526001600160a01b038616906323b872dd9061126090339085908790600401611d19565b602060405180830381600087803b15801561127a57600080fd5b505af115801561128e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506112b2919081019061190a565b506040516335313c2160e11b815282906001600160a01b03831690636a627842906112e1903090600401611d0b565b602060405180830381600087803b1580156112fb57600080fd5b505af115801561130f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506113339190810190611993565b97509750505050505050915091565b6001600160a01b03821660009081526005602052604090206002015461136e908263ffffffff6110ca16565b6001600160a01b0383166000908152600560205260409020600290810191909155546113a0908263ffffffff6110ca16565b6002555050565b6001600160a01b0382166000908152600560205260409020600301546113d3908263ffffffff6110ca16565b6001600160a01b038316600090815260056020526040902060039081019190915554611405908263ffffffff6110ca16565b6003555050565b6001600160a01b03831660009081526005602052604090206001015461143990838363ffffffff6115e816565b6001600160a01b03841660009081526005602052604090206001908101919091555461146c90838363ffffffff6115e816565b600155505050565b73a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4890565b73443d2f2755db5942601fa062cc248aaa153313d390565b6004805460ff19166001179055565b7336f3fd68e7325a35eb768f1aedaae9ea0689d72390565b7388ff79eb2bc5850f27315415da8685282c7610f990565b620f424090565b6000610dac83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506115e8565b600590565b606080826040516020016115459190611c8f565b60408051601f19818403018152919052905060205b801561159a5781516000199091019082908290811061157557fe5b01602001516001600160f81b031916156115955760010181529050610315565b61155a565b505060408051600081526020810190915292915050565b600081836115d25760405162461bcd60e51b8152600401610d699190611d94565b5060008385816115de57fe5b0495945050505050565b6000818484111561160c5760405162461bcd60e51b8152600401610d699190611d94565b505050900390565b6000806000611623858561176e565b509050600080611648735c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f88886117f8565b6001600160a01b0316630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b15801561168057600080fd5b505afa158015611694573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506116b89190810190611928565b506001600160701b031691506001600160701b03169150826001600160a01b0316876001600160a01b0316146116ef5780826116f2565b81815b909890975095505050505050565b60008084116117215760405162461bcd60e51b8152600401610d6990611de5565b6000831180156117315750600082115b61174d5760405162461bcd60e51b8152600401610d6990611dc5565b8261175e858463ffffffff610d7216565b8161176557fe5b04949350505050565b600080826001600160a01b0316846001600160a01b031614156117a35760405162461bcd60e51b8152600401610d6990611db5565b826001600160a01b0316846001600160a01b0316106117c35782846117c6565b83835b90925090506001600160a01b0382166117f15760405162461bcd60e51b8152600401610d6990611df5565b9250929050565b6000806000611807858561176e565b9150915085828260405160200161181f929190611c69565b60405160208183030381529060405280519060200120604051602001611846929190611cd5565b60408051601f1981840301815291905280516020909101209695505050505050565b80356109d381611f0f565b80516109d381611f23565b80516109d381611f2c565b80356109d381611f35565b80516109d381611f35565b80516109d381611f3e565b6000602082840312156118bc57600080fd5b60006118c88484611868565b949350505050565b600080604083850312156118e357600080fd5b60006118ef8585611868565b925050602061190085828601611889565b9150509250929050565b60006020828403121561191c57600080fd5b60006118c88484611873565b60008060006060848603121561193d57600080fd5b6000611949868661187e565b935050602061195a8682870161187e565b925050604061196b8682870161189f565b9150509250925092565b60006020828403121561198757600080fd5b60006118c88484611889565b6000602082840312156119a557600080fd5b60006118c88484611894565b6119ba81611e94565b82525050565b6119ba81611e49565b6119ba6119d582611e49565b611ee1565b6119ba81611e54565b6119ba6119ef82611e59565b611e66565b6119ba6119ef82611e66565b6000611a0b82611e3c565b611a158185610315565b9350611a25818560208601611eb1565b9290920192915050565b6119ba81611e9b565b6119ba81611ea6565b6000611a4c82611e3c565b611a568185611e40565b9350611a66818560208601611eb1565b611a6f81611ef2565b9093019392505050565b6000611a86601b83611e40565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000815260200192915050565b6000611abf602583611e40565b7f556e697377617056324c6962726172793a204944454e544943414c5f41444452815264455353455360d81b602082015260400192915050565b6000611b06602083610315565b7f96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f815260200192915050565b6000611b3f602883611e40565b7f556e697377617056324c6962726172793a20494e53554646494349454e545f4c815267495155494449545960c01b602082015260400192915050565b6000611b89600183610315565b6001600160f81b0319815260010192915050565b6000611baa602183611e40565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f8152607760f81b602082015260400192915050565b6000611bed602583611e40565b7f556e697377617056324c6962726172793a20494e53554646494349454e545f418152641353d5539560da1b602082015260400192915050565b6000611c34601e83611e40565b7f556e697377617056324c6962726172793a205a45524f5f414444524553530000815260200192915050565b6119ba81611e66565b6000611c7582856119c9565b601482019150611c8582846119c9565b5060140192915050565b6000611c9b82846119f4565b50602001919050565b6000611cb08286611a00565b9150611cbc82856119e3565b600282019150611ccc8284611a00565b95945050505050565b6000611ce082611b7c565b9150611cec82856119c9565b601482019150611cfc82846119f4565b6020820191506118c882611af9565b602081016109d382846119c0565b60608101611d2782866119b1565b611d3460208301856119c0565b6118c86040830184611c60565b60408101611d4f82856119b1565b610dac6020830184611c60565b60408101611d4f82856119c0565b602081016109d382846119da565b602081016109d38284611a2f565b602081016109d38284611a38565b60208082528101610dac8184611a41565b602080825281016109d381611a79565b602080825281016109d381611ab2565b602080825281016109d381611b32565b602080825281016109d381611b9d565b602080825281016109d381611be0565b602080825281016109d381611c27565b602081016109d38284611c60565b60408101611d4f8285611c60565b60608101611e2f8286611c60565b611d346020830185611c60565b5190565b90815260200190565b60006109d382611e7f565b151590565b6001600160f01b03191690565b90565b8061031581611f02565b6001600160701b031690565b6001600160a01b031690565b63ffffffff1690565b60006109d3825b60006109d382611e49565b60006109d382611e69565b60005b83811015611ecc578181015183820152602001611eb4565b83811115611edb576000848401525b50505050565b60006109d38260006109d382611efc565b601f01601f191690565b60601b90565b60038110611f0c57fe5b50565b611f1881611e49565b8114611f0c57600080fd5b611f1881611e54565b611f1881611e73565b611f1881611e66565b611f1881611e8b56fe506f6f6c3a20696e73756666696369656e7420636c61696d61626c652062616c616e6365506f6f6c3a20696e73756666696369656e74207068616e746f6d2062616c616e6365506f6f6c3a20696e73756666696369656e74207374616765642062616c616e6365506f6f6c3a20696e73756666696369656e7420626f6e6465642062616c616e6365a365627a7a72315820df6ff4dda10f1231628a2a3e61b7f36cf21bf5c8eba5e891f802c06c0aa9e5cd6c6578706572696d656e74616cf564736f6c63430005110040

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading
[ Download: CSV Export  ]

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.