ETH Price: $1,980.36 (-0.94%)
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

More Info

Private Name Tags

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Rebase228960862025-07-11 12:58:47235 days ago1752238727IN
0x97ED2E1A...5ff87f2Dc
0 ETH0.001544557.18365673
Set Rebase Timin...228960842025-07-11 12:58:23235 days ago1752238703IN
0x97ED2E1A...5ff87f2Dc
0 ETH0.000149214.0383035
Add Transaction228959892025-07-11 12:38:59235 days ago1752237539IN
0x97ED2E1A...5ff87f2Dc
0 ETH0.000504463.55568288
Set Rebase Mint ...228959662025-07-11 12:34:11235 days ago1752237251IN
0x97ED2E1A...5ff87f2Dc
0 ETH0.000104954.11790077
Set Deviation Th...228959382025-07-11 12:28:35235 days ago1752236915IN
0x97ED2E1A...5ff87f2Dc
0 ETH0.000093263.64531005
_accept Gov228955112025-07-11 11:02:47235 days ago1752231767IN
0x97ED2E1A...5ff87f2Dc
0 ETH0.000102723.62881913
Rebase109413452020-09-27 0:08:091984 days ago1601165289IN
0x97ED2E1A...5ff87f2Dc
0 ETH0.0047325955.5
Rebase108698632020-09-16 0:16:321995 days ago1600215392IN
0x97ED2E1A...5ff87f2Dc
0 ETH0.01849108101
Rebase108633592020-09-15 0:25:201996 days ago1600129520IN
0x97ED2E1A...5ff87f2Dc
0 ETH0.0181249299
Rebase108568232020-09-14 0:09:111997 days ago1600042151IN
0x97ED2E1A...5ff87f2Dc
0 ETH0.017392695
Rebase108502482020-09-13 0:03:241998 days ago1599955404IN
0x97ED2E1A...5ff87f2Dc
0 ETH0.0177587697
Rebase108437852020-09-12 0:10:131999 days ago1599869413IN
0x97ED2E1A...5ff87f2Dc
0 ETH0.0153054883.60000145
Rebase108374342020-09-11 0:55:232000 days ago1599785723IN
0x97ED2E1A...5ff87f2Dc
0 ETH0.02306808126
Rebase108243312020-09-09 0:40:182002 days ago1599612018IN
0x97ED2E1A...5ff87f2Dc
0 ETH0.0161110488
Rebase108112142020-09-07 0:10:322004 days ago1599437432IN
0x97ED2E1A...5ff87f2Dc
0 ETH0.0161110488
Rebase107980732020-09-05 0:13:102006 days ago1599264790IN
0x97ED2E1A...5ff87f2Dc
0 ETH0.01958956107
Rebase107915132020-09-04 0:21:372007 days ago1599178897IN
0x97ED2E1A...5ff87f2Dc
0 ETH0.06772321439
Rebase107849652020-09-03 0:04:462008 days ago1599091486IN
0x97ED2E1A...5ff87f2Dc
0 ETH0.03733261242
Rebase107784882020-09-02 0:06:532009 days ago1599005213IN
0x97ED2E1A...5ff87f2Dc
0 ETH0.07404816480
Rebase107720352020-09-01 0:24:362010 days ago1598919876IN
0x97ED2E1A...5ff87f2Dc
0 ETH0.03208753208
Rebase107523642020-08-29 0:12:272013 days ago1598659947IN
0x97ED2E1A...5ff87f2Dc
0 ETH0.0080218852
Rebase107393612020-08-27 0:24:532015 days ago1598487893IN
0x97ED2E1A...5ff87f2Dc
0 ETH0.0097188263
Rebase107327182020-08-26 0:04:572016 days ago1598400297IN
0x97ED2E1A...5ff87f2Dc
0 ETH0.0094102861.00000145
Rebase107199532020-08-24 0:49:382018 days ago1598230178IN
0x97ED2E1A...5ff87f2Dc
0 ETH0.0100273565.00000156
Rebase107132082020-08-23 0:06:472019 days ago1598141207IN
0x97ED2E1A...5ff87f2Dc
0 ETH0.0115700275
View all transactions

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading
Loading...
Loading
Cross-Chain Transactions

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
GRAPRebaser

Compiler Version
v0.5.17+commit.d19bba13

Optimization Enabled:
Yes with 50000 runs

Other Settings:
default evmVersion
/**
 *Submitted for verification at Etherscan.io on 2020-08-19
*/

pragma solidity 0.5.17;
pragma experimental ABIEncoderV2;


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

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

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

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

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

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

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

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

// SPDX-License-Identifier: MIT
/**
 * @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.
     */
    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.
     */
    function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        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.
     */
    function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b != 0, errorMessage);
        return a % b;
    }
}

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

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

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

        // solhint-disable-next-line avoid-low-level-calls, avoid-call-value
        (bool success, ) = recipient.call.value(amount)("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

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

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

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

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

    function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
        require(isContract(target), "Address: call to non-contract");

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.call.value(weiValue)(data);
        if (success) {
            return returndata;
        } else {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly

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

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

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

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

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

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

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

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

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

interface UniswapPair {
    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;
}

// SPDX-License-Identifier: GPL-3.0-or-later
// computes square roots using the babylonian method
// https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method
library Babylonian {
    function sqrt(uint y) internal pure returns (uint z) {
        if (y > 3) {
            z = y;
            uint x = y / 2 + 1;
            while (x < z) {
                z = x;
                x = (y / x + x) / 2;
            }
        } else if (y != 0) {
            z = 1;
        }
        // else z = 0
    }
}

// SPDX-License-Identifier: GPL-3.0-or-later
// a library for handling binary fixed point numbers (https://en.wikipedia.org/wiki/Q_(number_format))
library FixedPoint {
    // range: [0, 2**112 - 1]
    // resolution: 1 / 2**112
    struct uq112x112 {
        uint224 _x;
    }

    // range: [0, 2**144 - 1]
    // resolution: 1 / 2**112
    struct uq144x112 {
        uint _x;
    }

    uint8 private constant RESOLUTION = 112;
    uint private constant Q112 = uint(1) << RESOLUTION;
    uint private constant Q224 = Q112 << RESOLUTION;

    // encode a uint112 as a UQ112x112
    function encode(uint112 x) internal pure returns (uq112x112 memory) {
        return uq112x112(uint224(x) << RESOLUTION);
    }

    // encodes a uint144 as a UQ144x112
    function encode144(uint144 x) internal pure returns (uq144x112 memory) {
        return uq144x112(uint256(x) << RESOLUTION);
    }

    // divide a UQ112x112 by a uint112, returning a UQ112x112
    function div(uq112x112 memory self, uint112 x) internal pure returns (uq112x112 memory) {
        require(x != 0, 'FixedPoint: DIV_BY_ZERO');
        return uq112x112(self._x / uint224(x));
    }

    // multiply a UQ112x112 by a uint, returning a UQ144x112
    // reverts on overflow
    function mul(uq112x112 memory self, uint y) internal pure returns (uq144x112 memory) {
        uint z;
        require(y == 0 || (z = uint(self._x) * y) / y == uint(self._x), "FixedPoint: MULTIPLICATION_OVERFLOW");
        return uq144x112(z);
    }

    // returns a UQ112x112 which represents the ratio of the numerator to the denominator
    // equivalent to encode(numerator).div(denominator)
    function fraction(uint112 numerator, uint112 denominator) internal pure returns (uq112x112 memory) {
        require(denominator > 0, "FixedPoint: DIV_BY_ZERO");
        return uq112x112((uint224(numerator) << RESOLUTION) / denominator);
    }

    // decode a UQ112x112 into a uint112 by truncating after the radix point
    function decode(uq112x112 memory self) internal pure returns (uint112) {
        return uint112(self._x >> RESOLUTION);
    }

    // decode a UQ144x112 into a uint144 by truncating after the radix point
    function decode144(uq144x112 memory self) internal pure returns (uint144) {
        return uint144(self._x >> RESOLUTION);
    }

    // take the reciprocal of a UQ112x112
    function reciprocal(uq112x112 memory self) internal pure returns (uq112x112 memory) {
        require(self._x != 0, 'FixedPoint: ZERO_RECIPROCAL');
        return uq112x112(uint224(Q224 / self._x));
    }

    // square root of a UQ112x112
    function sqrt(uq112x112 memory self) internal pure returns (uq112x112 memory) {
        return uq112x112(uint224(Babylonian.sqrt(uint256(self._x)) << 56));
    }
}

// library with helper methods for oracles that are concerned with computing average prices
library UniswapV2OracleLibrary {
    using FixedPoint for *;

    // helper function that returns the current block timestamp within the range of uint32, i.e. [0, 2**32 - 1]
    function currentBlockTimestamp() internal view returns (uint32) {
        return uint32(block.timestamp % 2 ** 32);
    }

    // produces the cumulative price using counterfactuals to save gas and avoid a call to sync.
    function currentCumulativePrices(
        address pair,
        bool isToken0
    ) internal view returns (uint priceCumulative, uint32 blockTimestamp) {
        blockTimestamp = currentBlockTimestamp();
        (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast) = UniswapPair(pair).getReserves();
        if (isToken0) {
          priceCumulative = UniswapPair(pair).price0CumulativeLast();

          // if time has elapsed since the last update on the pair, mock the accumulated price values
          if (blockTimestampLast != blockTimestamp) {
              // subtraction overflow is desired
              uint32 timeElapsed = blockTimestamp - blockTimestampLast;
              // addition overflow is desired
              // counterfactual
              priceCumulative += uint(FixedPoint.fraction(reserve1, reserve0)._x) * timeElapsed;
          }
        } else {
          priceCumulative = UniswapPair(pair).price1CumulativeLast();
          // if time has elapsed since the last update on the pair, mock the accumulated price values
          if (blockTimestampLast != blockTimestamp) {
              // subtraction overflow is desired
              uint32 timeElapsed = blockTimestamp - blockTimestampLast;
              // addition overflow is desired
              // counterfactual
              priceCumulative += uint(FixedPoint.fraction(reserve1, reserve0)._x) * timeElapsed;
          }
        }

    }
}

// Storage for a GRAP token
contract GRAPTokenStorage {

    using SafeMath for uint256;

    /**
     * @dev Guard variable for re-entrancy checks. Not currently used
     */
    bool internal _notEntered;

    /**
     * @notice EIP-20 token name for this token
     */
    string public name;

    /**
     * @notice EIP-20 token symbol for this token
     */
    string public symbol;

    /**
     * @notice EIP-20 token decimals for this token
     */
    uint8 public decimals;

    /**
     * @notice Governor for this contract
     */
    address public gov;

    /**
     * @notice Pending governance for this contract
     */
    address public pendingGov;

    /**
     * @notice Approved rebaser for this contract
     */
    address public rebaser;

    /**
     * @notice Reserve address of GRAP protocol
     */
    address public incentivizer;

    /**
     * @notice Total supply of GRAPs
     */
    uint256 internal _totalSupply;

    /**
     * @notice Internal decimals used to handle scaling factor
     */
    uint256 public constant internalDecimals = 10**24;

    /**
     * @notice Used for percentage maths
     */
    uint256 public constant BASE = 10**18;

    /**
     * @notice Scaling factor that adjusts everyone's balances
     */
    uint256 public grapsScalingFactor;

    mapping (address => uint256) internal _grapBalances;

    mapping (address => mapping (address => uint256)) internal _allowedFragments;

    uint256 public initSupply;

}

contract GRAPGovernanceStorage {
    /// @notice A record of each accounts delegate
    mapping (address => address) internal _delegates;

    /// @notice A checkpoint for marking number of votes from a given block
    struct Checkpoint {
        uint32 fromBlock;
        uint256 votes;
    }

    /// @notice A record of votes checkpoints for each account, by index
    mapping (address => mapping (uint32 => Checkpoint)) public checkpoints;

    /// @notice The number of checkpoints for each account
    mapping (address => uint32) public numCheckpoints;

    /// @notice The EIP-712 typehash for the contract's domain
    bytes32 public constant DOMAIN_TYPEHASH = keccak256("EIP712Domain(string name,uint256 chainId,address verifyingContract)");

    /// @notice The EIP-712 typehash for the delegation struct used by the contract
    bytes32 public constant DELEGATION_TYPEHASH = keccak256("Delegation(address delegatee,uint256 nonce,uint256 expiry)");

    /// @notice A record of states for signing / validating signatures
    mapping (address => uint) public nonces;
}

contract GRAPTokenInterface is GRAPTokenStorage, GRAPGovernanceStorage {

    /// @notice An event thats emitted when an account changes its delegate
    event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate);

    /// @notice An event thats emitted when a delegate account's vote balance changes
    event DelegateVotesChanged(address indexed delegate, uint previousBalance, uint newBalance);

    /**
     * @notice Event emitted when tokens are rebased
     */
    event Rebase(uint256 epoch, uint256 prevGrapsScalingFactor, uint256 newGrapsScalingFactor);

    /*** Gov Events ***/

    /**
     * @notice Event emitted when pendingGov is changed
     */
    event NewPendingGov(address oldPendingGov, address newPendingGov);

    /**
     * @notice Event emitted when gov is changed
     */
    event NewGov(address oldGov, address newGov);

    /**
     * @notice Sets the rebaser contract
     */
    event NewRebaser(address oldRebaser, address newRebaser);

    /**
     * @notice Sets the incentivizer contract
     */
    event NewIncentivizer(address oldIncentivizer, address newIncentivizer);

    /* - ERC20 Events - */

    /**
     * @notice EIP20 Transfer event
     */
    event Transfer(address indexed from, address indexed to, uint amount);

    /**
     * @notice EIP20 Approval event
     */
    event Approval(address indexed owner, address indexed spender, uint amount);

    /* - Extra Events - */
    /**
     * @notice Tokens minted event
     */
    event Mint(address to, uint256 amount);

    // Public functions
    function totalSupply() external view returns (uint256);
    function transfer(address to, uint256 value) external returns(bool);
    function transferFrom(address from, address to, uint256 value) external returns(bool);
    function balanceOf(address who) external view returns(uint256);
    function balanceOfUnderlying(address who) external view returns(uint256);
    function allowance(address owner_, address spender) external view returns(uint256);
    function approve(address spender, uint256 value) external returns (bool);
    function increaseAllowance(address spender, uint256 addedValue) external returns (bool);
    function decreaseAllowance(address spender, uint256 subtractedValue) external returns (bool);
    function maxScalingFactor() external view returns (uint256);

    /* - Governance Functions - */
    function getPriorVotes(address account, uint blockNumber) external view returns (uint256);
    function delegateBySig(address delegatee, uint nonce, uint expiry, uint8 v, bytes32 r, bytes32 s) external;
    function delegate(address delegatee) external;
    function delegates(address delegator) external view returns (address);
    function getCurrentVotes(address account) external view returns (uint256);

    /* - Permissioned/Governance functions - */
    function mint(address to, uint256 amount) external returns (bool);
    function rebase(uint256 epoch, uint256 indexDelta, bool positive) external returns (uint256);
    function _setRebaser(address rebaser_) external;
    function _setIncentivizer(address incentivizer_) external;
    function _setPendingGov(address pendingGov_) external;
    function _acceptGov() external;
}

contract GRAPRebaser {

    using SafeMath for uint256;

    modifier onlyGov() {
        require(msg.sender == gov);
        _;
    }

    struct Transaction {
        bool enabled;
        address destination;
        bytes data;
    }

    struct UniVars {
      uint256 grapsToUni;
      uint256 amountFromReserves;
      uint256 mintToReserves;
    }

    /// @notice an event emitted when a transaction fails
    event TransactionFailed(address indexed destination, uint index, bytes data);

    /// @notice an event emitted when maxSlippageFactor is changed
    event NewMaxSlippageFactor(uint256 oldSlippageFactor, uint256 newSlippageFactor);

    /// @notice an event emitted when deviationThreshold is changed
    event NewDeviationThreshold(uint256 oldDeviationThreshold, uint256 newDeviationThreshold);

    /**
     * @notice Sets the treasury mint percentage of rebase
     */
    event NewRebaseMintPercent(uint256 oldRebaseMintPerc, uint256 newRebaseMintPerc);


    /**
     * @notice Sets the reserve contract
     */
    event NewReserveContract(address oldReserveContract, address newReserveContract);

    /**
     * @notice Sets the reserve contract
     */
    event TreasuryIncreased(uint256 reservesAdded, uint256 grapsSold, uint256 grapsFromReserves, uint256 grapsToReserves);


    /**
     * @notice Event emitted when pendingGov is changed
     */
    event NewPendingGov(address oldPendingGov, address newPendingGov);

    /**
     * @notice Event emitted when gov is changed
     */
    event NewGov(address oldGov, address newGov);

    // Stable ordering is not guaranteed.
    Transaction[] public transactions;


    /// @notice Governance address
    address public gov;

    /// @notice Pending Governance address
    address public pendingGov;

    /// @notice Spreads out getting to the target price
    uint256 public rebaseLag;

    /// @notice Peg target
    uint256 public targetRate;

    /// @notice Percent of rebase that goes to minting for treasury building
    uint256 public rebaseMintPerc;

    // If the current exchange rate is within this fractional distance from the target, no supply
    // update is performed. Fixed point number--same format as the rate.
    // (ie) abs(rate - targetRate) / targetRate < deviationThreshold, then no supply change.
    uint256 public deviationThreshold;

    /// @notice More than this much time must pass between rebase operations.
    uint256 public minRebaseTimeIntervalSec;

    /// @notice Block timestamp of last rebase operation
    uint256 public lastRebaseTimestampSec;

    /// @notice The rebase window begins this many seconds into the minRebaseTimeInterval period.
    // For example if minRebaseTimeInterval is 24hrs, it represents the time of day in seconds.
    uint256 public rebaseWindowOffsetSec;

    /// @notice The length of the time window where a rebase operation is allowed to execute, in seconds.
    uint256 public rebaseWindowLengthSec;

    /// @notice The number of rebase cycles since inception
    uint256 public epoch;

    // rebasing is not active initially. It can be activated at T+12 hours from
    // deployment time
    ///@notice boolean showing rebase activation status
    bool public rebasingActive;

    /// @notice delays rebasing activation to facilitate liquidity
    uint256 public constant rebaseDelay = 12 hours;

    /// @notice Time of TWAP initialization
    uint256 public timeOfTWAPInit;

    /// @notice GRAP token address
    address public grapAddress;

    /// @notice reserve token
    address public reserveToken;

    /// @notice Reserves vault contract
    address public reservesContract;

    /// @notice pair for reserveToken <> GRAP
    address public uniswap_pair;

    /// @notice last TWAP update time
    uint32 public blockTimestampLast;

    /// @notice last TWAP cumulative price;
    uint256 public priceCumulativeLast;

    // Max slippage factor when buying reserve token. Magic number based on
    // the fact that uniswap is a constant product. Therefore,
    // targeting a % max slippage can be achieved by using a single precomputed
    // number. i.e. 2.5% slippage is always equal to some f(maxSlippageFactor, reserves)
    /// @notice the maximum slippage factor when buying reserve token
    uint256 public maxSlippageFactor;

    /// @notice Whether or not this token is first in uniswap GRAP<>Reserve pair
    bool public isToken0;

    constructor(
        address grapAddress_,
        address reserveToken_,
        address uniswap_factory,
        address reservesContract_
    )
        public
    {
          minRebaseTimeIntervalSec = 24 hours;
          rebaseWindowOffsetSec = 0; // 8AM UTC+0 rebases
          reservesContract = reservesContract_;
          (address token0, address token1) = sortTokens(grapAddress_, reserveToken_);

          // used for interacting with uniswap
          if (token0 == grapAddress_) {
              isToken0 = true;
          } else {
              isToken0 = false;
          }
          // uniswap GRAP<>Reserve pair
          uniswap_pair = pairFor(uniswap_factory, token0, token1);

          // Reserves contract is mutable
          reservesContract = reservesContract_;

          // Reserve token is not mutable. Must deploy a new rebaser to update it
          reserveToken = reserveToken_;

          grapAddress = grapAddress_;

          // target 10% slippage
          // 5.4%
          maxSlippageFactor = 5409258 * 10**10;

          // 1 YCRV
          targetRate = 10**18;

          // twice daily rebase, with targeting reaching peg in 5 days
          rebaseLag = 10;

          // 10%
          rebaseMintPerc = 10**17;

          // 5%
          deviationThreshold = 5 * 10**16;

          // 60 minutes
          rebaseWindowLengthSec = 60 * 60;

          // Changed in deployment scripts to facilitate protocol initiation
          gov = msg.sender;

    }

    /**
    @notice Updates slippage factor
    @param maxSlippageFactor_ the new slippage factor
    *
    */
    function setMaxSlippageFactor(uint256 maxSlippageFactor_)
        public
        onlyGov
    {
        uint256 oldSlippageFactor = maxSlippageFactor;
        maxSlippageFactor = maxSlippageFactor_;
        emit NewMaxSlippageFactor(oldSlippageFactor, maxSlippageFactor_);
    }

    /**
    @notice Updates rebase mint percentage
    @param rebaseMintPerc_ the new rebase mint percentage
    *
    */
    function setRebaseMintPerc(uint256 rebaseMintPerc_)
        public
        onlyGov
    {
        uint256 oldPerc = rebaseMintPerc;
        rebaseMintPerc = rebaseMintPerc_;
        emit NewRebaseMintPercent(oldPerc, rebaseMintPerc_);
    }


    /**
    @notice Updates reserve contract
    @param reservesContract_ the new reserve contract
    *
    */
    function setReserveContract(address reservesContract_)
        public
        onlyGov
    {
        address oldReservesContract = reservesContract;
        reservesContract = reservesContract_;
        emit NewReserveContract(oldReservesContract, reservesContract_);
    }


    /** @notice sets the pendingGov
     * @param pendingGov_ The address of the rebaser contract to use for authentication.
     */
    function _setPendingGov(address pendingGov_)
        external
        onlyGov
    {
        address oldPendingGov = pendingGov;
        pendingGov = pendingGov_;
        emit NewPendingGov(oldPendingGov, pendingGov_);
    }

    /** @notice lets msg.sender accept governance
     *
     */
    function _acceptGov()
        external
    {
        require(msg.sender == pendingGov, "!pending");
        address oldGov = gov;
        gov = pendingGov;
        pendingGov = address(0);
        emit NewGov(oldGov, gov);
    }

    /** @notice Initializes TWAP start point, starts countdown to first rebase
    *
    */
    function init_twap()
        public
    {
        require(timeOfTWAPInit == 0, "already activated");
        (uint priceCumulative, uint32 blockTimestamp) =
           UniswapV2OracleLibrary.currentCumulativePrices(uniswap_pair, isToken0);
        require(blockTimestamp > 0, "no trades");
        blockTimestampLast = blockTimestamp;
        priceCumulativeLast = priceCumulative;
        timeOfTWAPInit = blockTimestamp;
    }

    /** @notice Activates rebasing
    *   @dev One way function, cannot be undone, callable by anyone
    */
    function activate_rebasing()
        public
    {
        require(timeOfTWAPInit > 0, "twap wasnt intitiated, call init_twap()");
        // cannot enable prior to end of rebaseDelay
        require(now >= timeOfTWAPInit + rebaseDelay, "!end_delay");

        rebasingActive = true;
    }

    /**
     * @notice Initiates a new rebase operation, provided the minimum time period has elapsed.
     *
     * @dev The supply adjustment equals (_totalSupply * DeviationFromTargetRate) / rebaseLag
     *      Where DeviationFromTargetRate is (MarketOracleRate - targetRate) / targetRate
     *      and targetRate is 1e18
     */
    function rebase()
        public
    {
        // EOA only
        require(msg.sender == tx.origin);
        // ensure rebasing at correct time
        _inRebaseWindow();

        // This comparison also ensures there is no reentrancy.
        require(lastRebaseTimestampSec.add(minRebaseTimeIntervalSec) < now);

        // Snap the rebase time to the start of this window.
        lastRebaseTimestampSec = now.sub(
            now.mod(minRebaseTimeIntervalSec)).add(rebaseWindowOffsetSec);

        epoch = epoch.add(1);

        // get twap from uniswap v2;
        uint256 exchangeRate = getTWAP();

        // calculates % change to supply
        (uint256 offPegPerc, bool positive) = computeOffPegPerc(exchangeRate);

        uint256 indexDelta = offPegPerc;

        // Apply the Dampening factor.
        indexDelta = indexDelta.div(rebaseLag);

        GRAPTokenInterface grap = GRAPTokenInterface(grapAddress);

        if (positive) {
            require(grap.grapsScalingFactor().mul(uint256(10**18).add(indexDelta)).div(10**18) < grap.maxScalingFactor(), "new scaling factor will be too big");
        }


        uint256 currSupply = grap.totalSupply();

        uint256 mintAmount;
        // reduce indexDelta to account for minting
        if (positive) {
            uint256 mintPerc = indexDelta.mul(rebaseMintPerc).div(10**18);
            indexDelta = indexDelta.sub(mintPerc);
            mintAmount = currSupply.mul(mintPerc).div(10**18);
        }

        // rebase
        uint256 supplyAfterRebase = grap.rebase(epoch, indexDelta, positive);
        assert(grap.grapsScalingFactor() <= grap.maxScalingFactor());

        // perform actions after rebase
        afterRebase(mintAmount, offPegPerc);
    }


    function uniswapV2Call(
        address sender,
        uint256 amount0,
        uint256 amount1,
        bytes memory data
    )
        public
    {
        // enforce that it is coming from uniswap
        require(msg.sender == uniswap_pair, "bad msg.sender");
        // enforce that this contract called uniswap
        require(sender == address(this), "bad origin");
        (UniVars memory uniVars) = abi.decode(data, (UniVars));

        GRAPTokenInterface grap = GRAPTokenInterface(grapAddress);

        if (uniVars.amountFromReserves > 0) {
            // transfer from reserves and mint to uniswap
            grap.transferFrom(reservesContract, uniswap_pair, uniVars.amountFromReserves);
            if (uniVars.amountFromReserves < uniVars.grapsToUni) {
                // if the amount from reserves > grapsToUni, we have fully paid for the yCRV tokens
                // thus this number would be 0 so no need to mint
                grap.mint(uniswap_pair, uniVars.grapsToUni.sub(uniVars.amountFromReserves));
            }
        } else {
            // mint to uniswap
            grap.mint(uniswap_pair, uniVars.grapsToUni);
        }

        // mint unsold to mintAmount
        if (uniVars.mintToReserves > 0) {
            grap.mint(reservesContract, uniVars.mintToReserves);
        }

        // transfer reserve token to reserves
        if (isToken0) {
            SafeERC20.safeTransfer(IERC20(reserveToken), reservesContract, amount1);
            emit TreasuryIncreased(amount1, uniVars.grapsToUni, uniVars.amountFromReserves, uniVars.mintToReserves);
        } else {
            SafeERC20.safeTransfer(IERC20(reserveToken), reservesContract, amount0);
            emit TreasuryIncreased(amount0, uniVars.grapsToUni, uniVars.amountFromReserves, uniVars.mintToReserves);
        }
    }

    function buyReserveAndTransfer(
        uint256 mintAmount,
        uint256 offPegPerc
    )
        internal
    {
        UniswapPair pair = UniswapPair(uniswap_pair);

        GRAPTokenInterface grap = GRAPTokenInterface(grapAddress);

        // get reserves
        (uint256 token0Reserves, uint256 token1Reserves, ) = pair.getReserves();

        // check if protocol has excess grap in the reserve
        uint256 excess = grap.balanceOf(reservesContract);


        uint256 tokens_to_max_slippage = uniswapMaxSlippage(token0Reserves, token1Reserves, offPegPerc);

        UniVars memory uniVars = UniVars({
          grapsToUni: tokens_to_max_slippage, // how many graps uniswap needs
          amountFromReserves: excess, // how much of grapsToUni comes from reserves
          mintToReserves: 0 // how much graps protocol mints to reserves
        });

        // tries to sell all mint + excess
        // falls back to selling some of mint and all of excess
        // if all else fails, sells portion of excess
        // upon pair.swap, `uniswapV2Call` is called by the uniswap pair contract
        if (isToken0) {
            if (tokens_to_max_slippage > mintAmount.add(excess)) {
                // we already have performed a safemath check on mintAmount+excess
                // so we dont need to continue using it in this code path

                // can handle selling all of reserves and mint
                uint256 buyTokens = getAmountOut(mintAmount + excess, token0Reserves, token1Reserves);
                uniVars.grapsToUni = mintAmount + excess;
                uniVars.amountFromReserves = excess;
                // call swap using entire mint amount and excess; mint 0 to reserves
                pair.swap(0, buyTokens, address(this), abi.encode(uniVars));
            } else {
                if (tokens_to_max_slippage > excess) {
                    // uniswap can handle entire reserves
                    uint256 buyTokens = getAmountOut(tokens_to_max_slippage, token0Reserves, token1Reserves);

                    // swap up to slippage limit, taking entire grap reserves, and minting part of total
                    uniVars.mintToReserves = mintAmount.sub((tokens_to_max_slippage - excess));
                    pair.swap(0, buyTokens, address(this), abi.encode(uniVars));
                } else {
                    // uniswap cant handle all of excess
                    uint256 buyTokens = getAmountOut(tokens_to_max_slippage, token0Reserves, token1Reserves);
                    uniVars.amountFromReserves = tokens_to_max_slippage;
                    uniVars.mintToReserves = mintAmount;
                    // swap up to slippage limit, taking excess - remainingExcess from reserves, and minting full amount
                    // to reserves
                    pair.swap(0, buyTokens, address(this), abi.encode(uniVars));
                }
            }
        } else {
            if (tokens_to_max_slippage > mintAmount.add(excess)) {
                // can handle all of reserves and mint
                uint256 buyTokens = getAmountOut(mintAmount + excess, token1Reserves, token0Reserves);
                uniVars.grapsToUni = mintAmount + excess;
                uniVars.amountFromReserves = excess;
                // call swap using entire mint amount and excess; mint 0 to reserves
                pair.swap(buyTokens, 0, address(this), abi.encode(uniVars));
            } else {
                if (tokens_to_max_slippage > excess) {
                    // uniswap can handle entire reserves
                    uint256 buyTokens = getAmountOut(tokens_to_max_slippage, token1Reserves, token0Reserves);

                    // swap up to slippage limit, taking entire grap reserves, and minting part of total
                    uniVars.mintToReserves = mintAmount.sub( (tokens_to_max_slippage - excess));
                    // swap up to slippage limit, taking entire grap reserves, and minting part of total
                    pair.swap(buyTokens, 0, address(this), abi.encode(uniVars));
                } else {
                    // uniswap cant handle all of excess
                    uint256 buyTokens = getAmountOut(tokens_to_max_slippage, token1Reserves, token0Reserves);
                    uniVars.amountFromReserves = tokens_to_max_slippage;
                    uniVars.mintToReserves = mintAmount;
                    // swap up to slippage limit, taking excess - remainingExcess from reserves, and minting full amount
                    // to reserves
                    pair.swap(buyTokens, 0, address(this), abi.encode(uniVars));
                }
            }
        }
    }

    function uniswapMaxSlippage(
        uint256 token0,
        uint256 token1,
        uint256 offPegPerc
    )
      internal
      view
      returns (uint256)
    {
        if (isToken0) {
          if (offPegPerc >= 10**17) {
              // cap slippage
              return token0.mul(maxSlippageFactor).div(10**18);
          } else {
              // in the 5-10% off peg range, slippage is essentially 2*x (where x is percentage of pool to buy).
              // all we care about is not pushing below the peg, so underestimate
              // the amount we can sell by dividing by 3. resulting price impact
              // should be ~= offPegPerc * 2 / 3, which will keep us above the peg
              //
              // this is a conservative heuristic
              return token0.mul(offPegPerc / 3).div(10**18);
          }
        } else {
            if (offPegPerc >= 10**17) {
                return token1.mul(maxSlippageFactor).div(10**18);
            } else {
                return token1.mul(offPegPerc / 3).div(10**18);
            }
        }
    }

    /**
     * @notice given an input amount of an asset and pair reserves, returns the maximum output amount of the other asset
     *
     * @param amountIn input amount of the asset
     * @param reserveIn reserves of the asset being sold
     * @param reserveOut reserves if the asset being purchased
     */

   function getAmountOut(
        uint amountIn,
        uint reserveIn,
        uint reserveOut
    )
        internal
        pure
        returns (uint amountOut)
    {
       require(amountIn > 0, 'UniswapV2Library: INSUFFICIENT_INPUT_AMOUNT');
       require(reserveIn > 0 && reserveOut > 0, 'UniswapV2Library: INSUFFICIENT_LIQUIDITY');
       uint amountInWithFee = amountIn.mul(997);
       uint numerator = amountInWithFee.mul(reserveOut);
       uint denominator = reserveIn.mul(1000).add(amountInWithFee);
       amountOut = numerator / denominator;
   }


    function afterRebase(
        uint256 mintAmount,
        uint256 offPegPerc
    )
        internal
    {
        // update uniswap
        UniswapPair(uniswap_pair).sync();

        if (mintAmount > 0) {
            buyReserveAndTransfer(
                mintAmount,
                offPegPerc
            );
        }

        // call any extra functions
        for (uint i = 0; i < transactions.length; i++) {
            Transaction storage t = transactions[i];
            if (t.enabled) {
                bool result =
                    externalCall(t.destination, t.data);
                if (!result) {
                    emit TransactionFailed(t.destination, i, t.data);
                    revert("Transaction Failed");
                }
            }
        }
    }


    /**
     * @notice Calculates TWAP from uniswap
     *
     * @dev When liquidity is low, this can be manipulated by an end of block -> next block
     *      attack. We delay the activation of rebases 12 hours after liquidity incentives
     *      to reduce this attack vector. Additional there is very little supply
     *      to be able to manipulate this during that time period of highest vuln.
     */
    function getTWAP()
        internal
        returns (uint256)
    {
      (uint priceCumulative, uint32 blockTimestamp) =
         UniswapV2OracleLibrary.currentCumulativePrices(uniswap_pair, isToken0);
       uint32 timeElapsed = blockTimestamp - blockTimestampLast; // overflow is desired

       // no period check as is done in isRebaseWindow

       // overflow is desired, casting never truncates
        // cumulative price is in (uq112x112 price * seconds) units so we simply wrap it after division by time elapsed
        FixedPoint.uq112x112 memory priceAverage = FixedPoint.uq112x112(uint224((priceCumulative - priceCumulativeLast) / timeElapsed));

        priceCumulativeLast = priceCumulative;
        blockTimestampLast = blockTimestamp;

        return FixedPoint.decode144(FixedPoint.mul(priceAverage, 10**18));
    }

    /**
     * @notice Calculates current TWAP from uniswap
     *
     */
    function getCurrentTWAP()
        public
        view
        returns (uint256)
    {
      (uint priceCumulative, uint32 blockTimestamp) =
         UniswapV2OracleLibrary.currentCumulativePrices(uniswap_pair, isToken0);
       uint32 timeElapsed = blockTimestamp - blockTimestampLast; // overflow is desired

       // no period check as is done in isRebaseWindow

       // overflow is desired, casting never truncates
        // cumulative price is in (uq112x112 price * seconds) units so we simply wrap it after division by time elapsed
        FixedPoint.uq112x112 memory priceAverage = FixedPoint.uq112x112(uint224((priceCumulative - priceCumulativeLast) / timeElapsed));

        return FixedPoint.decode144(FixedPoint.mul(priceAverage, 10**18));
    }

    /**
     * @notice Sets the deviation threshold fraction. If the exchange rate given by the market
     *         oracle is within this fractional distance from the targetRate, then no supply
     *         modifications are made.
     * @param deviationThreshold_ The new exchange rate threshold fraction.
     */
    function setDeviationThreshold(uint256 deviationThreshold_)
        external
        onlyGov
    {
        require(deviationThreshold > 0);
        uint256 oldDeviationThreshold = deviationThreshold;
        deviationThreshold = deviationThreshold_;
        emit NewDeviationThreshold(oldDeviationThreshold, deviationThreshold_);
    }

    /**
     * @notice Sets the rebase lag parameter.
               It is used to dampen the applied supply adjustment by 1 / rebaseLag
               If the rebase lag R, equals 1, the smallest value for R, then the full supply
               correction is applied on each rebase cycle.
               If it is greater than 1, then a correction of 1/R of is applied on each rebase.
     * @param rebaseLag_ The new rebase lag parameter.
     */
    function setRebaseLag(uint256 rebaseLag_)
        external
        onlyGov
    {
        require(rebaseLag_ > 0);
        rebaseLag = rebaseLag_;
    }

    /**
     * @notice Sets the targetRate parameter.
     * @param targetRate_ The new target rate parameter.
     */
    function setTargetRate(uint256 targetRate_)
        external
        onlyGov
    {
        require(targetRate_ > 0);
        targetRate = targetRate_;
    }

    /**
     * @notice Sets the parameters which control the timing and frequency of
     *         rebase operations.
     *         a) the minimum time period that must elapse between rebase cycles.
     *         b) the rebase window offset parameter.
     *         c) the rebase window length parameter.
     * @param minRebaseTimeIntervalSec_ More than this much time must pass between rebase
     *        operations, in seconds.
     * @param rebaseWindowOffsetSec_ The number of seconds from the beginning of
              the rebase interval, where the rebase window begins.
     * @param rebaseWindowLengthSec_ The length of the rebase window in seconds.
     */
    function setRebaseTimingParameters(
        uint256 minRebaseTimeIntervalSec_,
        uint256 rebaseWindowOffsetSec_,
        uint256 rebaseWindowLengthSec_)
        external
        onlyGov
    {
        require(minRebaseTimeIntervalSec_ > 0);
        require(rebaseWindowOffsetSec_ < minRebaseTimeIntervalSec_);

        minRebaseTimeIntervalSec = minRebaseTimeIntervalSec_;
        rebaseWindowOffsetSec = rebaseWindowOffsetSec_;
        rebaseWindowLengthSec = rebaseWindowLengthSec_;
    }

    /**
     * @return If the latest block timestamp is within the rebase time window it, returns true.
     *         Otherwise, returns false.
     */
    function inRebaseWindow() public view returns (bool) {

        // rebasing is delayed until there is a liquid market
        _inRebaseWindow();
        return true;
    }

    function _inRebaseWindow() internal view {

        // rebasing is delayed until there is a liquid market
        require(rebasingActive, "rebasing not active");

        require(now.mod(minRebaseTimeIntervalSec) >= rebaseWindowOffsetSec, "too early");
        require(now.mod(minRebaseTimeIntervalSec) < (rebaseWindowOffsetSec.add(rebaseWindowLengthSec)), "too late");
    }

    /**
     * @return Computes in % how far off market is from peg
     */
    function computeOffPegPerc(uint256 rate)
        private
        view
        returns (uint256, bool)
    {
        if (withinDeviationThreshold(rate)) {
            return (0, false);
        }

        // indexDelta =  (rate - targetRate) / targetRate
        if (rate > targetRate) {
            return (rate.sub(targetRate).mul(10**18).div(targetRate), true);
        } else {
            return (targetRate.sub(rate).mul(10**18).div(targetRate), false);
        }
    }

    /**
     * @param rate The current exchange rate, an 18 decimal fixed point number.
     * @return If the rate is within the deviation threshold from the target rate, returns true.
     *         Otherwise, returns false.
     */
    function withinDeviationThreshold(uint256 rate)
        private
        view
        returns (bool)
    {
        uint256 absoluteDeviationThreshold = targetRate.mul(deviationThreshold)
            .div(10 ** 18);

        return (rate >= targetRate && rate.sub(targetRate) < absoluteDeviationThreshold)
            || (rate < targetRate && targetRate.sub(rate) < absoluteDeviationThreshold);
    }

    /* - Constructor Helpers - */

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

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

    /* -- Rebase helpers -- */

    /**
     * @notice Adds a transaction that gets called for a downstream receiver of rebases
     * @param destination Address of contract destination
     * @param data Transaction data payload
     */
    function addTransaction(address destination, bytes calldata data)
        external
        onlyGov
    {
        transactions.push(Transaction({
            enabled: true,
            destination: destination,
            data: data
        }));
    }


    /**
     * @param index Index of transaction to remove.
     *              Transaction ordering may have changed since adding.
     */
    function removeTransaction(uint index)
        external
        onlyGov
    {
        require(index < transactions.length, "index out of bounds");

        if (index < transactions.length - 1) {
            transactions[index] = transactions[transactions.length - 1];
        }

        transactions.length--;
    }

    /**
     * @param index Index of transaction. Transaction ordering may have changed since adding.
     * @param enabled True for enabled, false for disabled.
     */
    function setTransactionEnabled(uint index, bool enabled)
        external
        onlyGov
    {
        require(index < transactions.length, "index must be in range of stored tx list");
        transactions[index].enabled = enabled;
    }

    /**
     * @dev wrapper to call the encoded transactions on downstream consumers.
     * @param destination Address of destination contract.
     * @param data The encoded data payload.
     * @return True on success
     */
    function externalCall(address destination, bytes memory data)
        internal
        returns (bool)
    {
        bool result;
        assembly {  // solhint-disable-line no-inline-assembly
            // "Allocate" memory for output
            // (0x40 is where "free memory" pointer is stored by convention)
            let outputAddress := mload(0x40)

            // First 32 bytes are the padded length of data, so exclude that
            let dataAddress := add(data, 32)

            result := call(
                // 34710 is the value that solidity is currently emitting
                // It includes callGas (700) + callVeryLow (3, to pay for SUB)
                // + callValueTransferGas (9000) + callNewAccountGas
                // (25000, in case the destination address does not exist and needs creating)
                sub(gas, 34710),


                destination,
                0, // transfer value in wei
                dataAddress,
                mload(data),  // Size of the input, in bytes. Stored in position 0 of the array.
                outputAddress,
                0  // Output is ignored, therefore the output size is zero
            )
        }
        return result;
    }
}

Contract Security Audit

Contract ABI

API
[{"inputs":[{"internalType":"address","name":"grapAddress_","type":"address"},{"internalType":"address","name":"reserveToken_","type":"address"},{"internalType":"address","name":"uniswap_factory","type":"address"},{"internalType":"address","name":"reservesContract_","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"oldDeviationThreshold","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newDeviationThreshold","type":"uint256"}],"name":"NewDeviationThreshold","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldGov","type":"address"},{"indexed":false,"internalType":"address","name":"newGov","type":"address"}],"name":"NewGov","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"oldSlippageFactor","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newSlippageFactor","type":"uint256"}],"name":"NewMaxSlippageFactor","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldPendingGov","type":"address"},{"indexed":false,"internalType":"address","name":"newPendingGov","type":"address"}],"name":"NewPendingGov","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"oldRebaseMintPerc","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newRebaseMintPerc","type":"uint256"}],"name":"NewRebaseMintPercent","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldReserveContract","type":"address"},{"indexed":false,"internalType":"address","name":"newReserveContract","type":"address"}],"name":"NewReserveContract","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"destination","type":"address"},{"indexed":false,"internalType":"uint256","name":"index","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"data","type":"bytes"}],"name":"TransactionFailed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"reservesAdded","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"grapsSold","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"grapsFromReserves","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"grapsToReserves","type":"uint256"}],"name":"TreasuryIncreased","type":"event"},{"constant":false,"inputs":[],"name":"_acceptGov","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"pendingGov_","type":"address"}],"name":"_setPendingGov","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"activate_rebasing","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"destination","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"addTransaction","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"blockTimestampLast","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"deviationThreshold","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"epoch","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getCurrentTWAP","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"gov","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"grapAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"inRebaseWindow","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"init_twap","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"isToken0","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"lastRebaseTimestampSec","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"maxSlippageFactor","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"minRebaseTimeIntervalSec","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"pendingGov","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"priceCumulativeLast","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"rebase","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"rebaseDelay","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"rebaseLag","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"rebaseMintPerc","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"rebaseWindowLengthSec","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"rebaseWindowOffsetSec","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"rebasingActive","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"removeTransaction","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"reserveToken","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"reservesContract","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"deviationThreshold_","type":"uint256"}],"name":"setDeviationThreshold","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"maxSlippageFactor_","type":"uint256"}],"name":"setMaxSlippageFactor","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"rebaseLag_","type":"uint256"}],"name":"setRebaseLag","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"rebaseMintPerc_","type":"uint256"}],"name":"setRebaseMintPerc","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"minRebaseTimeIntervalSec_","type":"uint256"},{"internalType":"uint256","name":"rebaseWindowOffsetSec_","type":"uint256"},{"internalType":"uint256","name":"rebaseWindowLengthSec_","type":"uint256"}],"name":"setRebaseTimingParameters","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"reservesContract_","type":"address"}],"name":"setReserveContract","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"targetRate_","type":"uint256"}],"name":"setTargetRate","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"index","type":"uint256"},{"internalType":"bool","name":"enabled","type":"bool"}],"name":"setTransactionEnabled","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"targetRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"timeOfTWAPInit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"transactions","outputs":[{"internalType":"bool","name":"enabled","type":"bool"},{"internalType":"address","name":"destination","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"uint256","name":"amount0","type":"uint256"},{"internalType":"uint256","name":"amount1","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"uniswapV2Call","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"uniswap_pair","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"}]

60806040523480156200001157600080fd5b50604051620047133803806200471383398101604081905262000034916200026c565b6201518060075560006009819055601080546001600160a01b0319166001600160a01b038416179055806200006a86866200015d565b91509150856001600160a01b0316826001600160a01b031614156200009c576014805460ff19166001179055620000a7565b6014805460ff191690555b620000bd8483836001600160e01b03620001f816565b601180546001600160a01b03199081166001600160a01b039384161790915560108054821695831695909517909455600f80548516968216969096179095555050600e8054821694909316939093179091555066c02cea37e26800601355670de0b6b3a7640000600455600a600381905567016345785d8a000060055566b1a2bc2ec50000600655610e10905560018054339216919091179055620004ec565b600080826001600160a01b0316846001600160a01b031614156200019e5760405162461bcd60e51b8152600401620001959062000470565b60405180910390fd5b826001600160a01b0316846001600160a01b031610620001c0578284620001c3565b83835b90925090506001600160a01b038216620001f15760405162461bcd60e51b8152600401620001959062000482565b9250929050565b60008383836040516020016200021092919062000400565b60405160208183030381529060405280519060200120604051602001620002399291906200042a565b60408051601f198184030181529190528051602090910120949350505050565b80516200026681620004d2565b92915050565b600080600080608085870312156200028357600080fd5b600062000291878762000259565b9450506020620002a48782880162000259565b9350506040620002b78782880162000259565b9250506060620002ca8782880162000259565b91505092959194509250565b620002eb620002e582620004a2565b620004be565b82525050565b620002eb6200030082620004af565b620004af565b60006200031560258362000494565b7f556e697377617056324c6962726172793a204944454e544943414c5f41444452815264455353455360d81b602082015260400192915050565b60006200035e6020836200049d565b7f96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f815260200192915050565b6000620003996001836200049d565b7fff00000000000000000000000000000000000000000000000000000000000000815260010192915050565b6000620003d4601e8362000494565b7f556e697377617056324c6962726172793a205a45524f5f414444524553530000815260200192915050565b60006200040e8285620002d6565b601482019150620004208284620002d6565b5060140192915050565b600062000437826200038a565b9150620004458285620002d6565b601482019150620004578284620002f1565b60208201915062000468826200034f565b949350505050565b60208082528101620002668162000306565b602080825281016200026681620003c5565b90815260200190565b919050565b60006200026682620004b2565b90565b6001600160a01b031690565b600062000266826000620002668260601b90565b620004dd81620004a2565b8114620004e957600080fd5b50565b61421780620004fc6000396000f3fe608060405234801561001057600080fd5b50600436106102d35760003560e01c80636406ca5f11610186578063b60e1e3e116100e3578063cdabdaac11610097578063dcf93f3211610071578063dcf93f32146104e5578063eccda406146104ed578063f4325d67146104f5576102d3565b8063cdabdaac146104c2578063cf1b927e146104d5578063d94ad837146104dd576102d3565b8063c5700a02116100c8578063c5700a021461049d578063cc8fd393146104b2578063cd877826146104ba576102d3565b8063b60e1e3e14610482578063c4c6eaad14610495576102d3565b8063832a30351161013a5780639466120f1161011f5780639466120f146104505780639ace38c214610458578063af14052c1461047a576102d3565b8063832a303514610440578063900cf0cf14610448576102d3565b80636e9dde991161016b5780636e9dde99146104125780637052b9021461042557806373f03dff1461042d576102d3565b80636406ca5f146103f75780636bf9ace7146103ff576102d3565b80633a68eaf6116102345780634e66f8ae116101e857806353a15edc116101cd57806353a15edc146103d457806357466c8b146103e757806363f6d4c8146103ef576102d3565b80634e66f8ae146103b9578063527a52c8146103c1576102d3565b806346c3bd1f1161021957806346c3bd1f146103965780634bda2e20146103a95780634dc95de1146103b1576102d3565b80633a68eaf6146103865780633a93069b1461038e576102d3565b806316250fd41161028b57806320ce83891161027057806320ce83891461036357806325240810146103765780632f43c1bc1461037e576102d3565b806316250fd4146103485780631cab801c1461035b576102d3565b8063111d0498116102bc578063111d04981461030b578063126e19be1461032057806312d43a5114610333576102d3565b806302101899146102d857806310d1e85c146102f6575b600080fd5b6102e06104fd565b6040516102ed9190613f9f565b60405180910390f35b6103096103043660046133d0565b610503565b005b6103136109cd565b6040516102ed9190613d98565b61030961032e36600461337a565b6109de565b61033b610b20565b6040516102ed9190613d2c565b610309610356366004613548565b610b3c565b6102e0610b87565b6103096103713660046134d2565b610b8d565b61033b610bc3565b6102e0610bdf565b61033b610be5565b6102e0610c01565b6103096103a43660046134d2565b610c07565b610309610de8565b610313610ecb565b610309610ed4565b6103096103cf36600461335c565b610f7d565b6103096103e23660046134d2565b611025565b610309611092565b6102e0611194565b6102e061119a565b61030961040d3660046134d2565b6111a0565b61030961042036600461350e565b6111fe565b6102e06112ac565b61030961043b36600461335c565b6112b2565b6102e061134e565b6102e0611429565b6102e061142f565b61046b6104663660046134d2565b611435565b6040516102ed93929190613da6565b610309611525565b6103096104903660046134d2565b611a12565b61033b611a70565b6104a5611a8c565b6040516102ed9190614053565b6102e0611ab0565b6102e0611ab6565b6103096104d03660046134d2565b611abc565b6102e0611af2565b6102e0611af8565b610313611afe565b61033b611b07565b61033b611b23565b60075481565b60115473ffffffffffffffffffffffffffffffffffffffff16331461055d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161055490613f21565b60405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff841630146105ac576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161055490613f81565b6105b4613005565b818060200190516105c89190810190613467565b600e54602082015191925073ffffffffffffffffffffffffffffffffffffffff1690156107635760105460115460208401516040517f23b872dd00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff808616946323b872dd946106529491831693921691600401613d55565b602060405180830381600087803b15801561066c57600080fd5b505af1158015610680573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506106a49190810190613449565b5081516020830151101561075e576011546020830151835173ffffffffffffffffffffffffffffffffffffffff808516936340c10f19939116916106ed9163ffffffff611b3f16565b6040518363ffffffff1660e01b815260040161070a929190613d7d565b602060405180830381600087803b15801561072457600080fd5b505af1158015610738573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061075c9190810190613449565b505b610812565b60115482516040517f40c10f1900000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff848116936340c10f19936107be939290911691600401613d7d565b602060405180830381600087803b1580156107d857600080fd5b505af11580156107ec573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506108109190810190613449565b505b6040820151156108ce5760105460408381015190517f40c10f1900000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff848116936340c10f199361087a939290911691600401613d7d565b602060405180830381600087803b15801561089457600080fd5b505af11580156108a8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506108cc9190810190613449565b505b60145460ff161561095157600f546010546109039173ffffffffffffffffffffffffffffffffffffffff908116911686611b8a565b7fb335015c214ae37ed112cc5eb042235c0ea40a7617987e1bd84783914387235084836000015184602001518560400151604051610944949392919061401e565b60405180910390a16109c5565b600f5460105461097b9173ffffffffffffffffffffffffffffffffffffffff908116911687611b8a565b7fb335015c214ae37ed112cc5eb042235c0ea40a7617987e1bd847839143872350858360000151846020015185604001516040516109bc949392919061401e565b60405180910390a15b505050505050565b60006109d7611c4c565b5060015b90565b60015473ffffffffffffffffffffffffffffffffffffffff163314610a0257600080fd5b600060405180606001604052806001151581526020018573ffffffffffffffffffffffffffffffffffffffff16815260200184848080601f016020809104026020016040519081016040528093929190818152602001838380828437600092018290525093909452505083546001818101808755958352602092839020855160029093020180548487015173ffffffffffffffffffffffffffffffffffffffff16610100027fffffffffffffffffffffff0000000000000000000000000000000000000000ff9415157fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00909216919091179390931692909217825560408501518051929450610b179391850192910190613026565b50505050505050565b60015473ffffffffffffffffffffffffffffffffffffffff1681565b60015473ffffffffffffffffffffffffffffffffffffffff163314610b6057600080fd5b60008311610b6d57600080fd5b828210610b7957600080fd5b600792909255600955600a55565b60055481565b60015473ffffffffffffffffffffffffffffffffffffffff163314610bb157600080fd5b60008111610bbe57600080fd5b600355565b60025473ffffffffffffffffffffffffffffffffffffffff1681565b60125481565b60105473ffffffffffffffffffffffffffffffffffffffff1681565b60085481565b60015473ffffffffffffffffffffffffffffffffffffffff163314610c2b57600080fd5b6000548110610c66576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161055490613f51565b6000547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01811015610db357600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8101908110610cc257fe5b906000526020600020906002020160008281548110610cdd57fe5b600091825260209091208254600292830290910180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660ff90921615159190911780825583547fffffffffffffffffffffff0000000000000000000000000000000000000000ff9091166101009182900473ffffffffffffffffffffffffffffffffffffffff168202178255600180850180549394610daf948387019492938116159092027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01909116046130a4565b5050505b6000805490610de4907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8301613119565b5050565b60025473ffffffffffffffffffffffffffffffffffffffff163314610e39576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161055490613eb1565b60018054600280547fffffffffffffffffffffffff000000000000000000000000000000000000000080841673ffffffffffffffffffffffffffffffffffffffff83811691909117958690559116909155604051918116927f1f14cfc03e486d23acee577b07bc0b3b23f4888c91fcdba5e0fef5a2549d552392610ec09285921690613d3a565b60405180910390a150565b600c5460ff1681565b6000600d5411610f10576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161055490613e31565b61a8c0600d5401421015610f50576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161055490613e71565b600c80547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055565b60015473ffffffffffffffffffffffffffffffffffffffff163314610fa157600080fd5b6010805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff00000000000000000000000000000000000000008316179092556040519116907fce840d2205f08f33375689943da5da9fdfde146fcbb5553b17910a60c8284a20906110199083908590613d3a565b60405180910390a15050565b60015473ffffffffffffffffffffffffffffffffffffffff16331461104957600080fd5b60006006541161105857600080fd5b60068054908290556040517f2a5cda4d16fba415b52d90b59ee30d4cb16494da9fd1ee51c4d5bac4a1f75bbe906110199083908590613fe8565b600d54156110cc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161055490613f41565b60115460145460009182916110fa9173ffffffffffffffffffffffffffffffffffffffff169060ff16611d39565b9150915060008163ffffffff161161113e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161055490613e61565b601180547fffffffffffffffff00000000ffffffffffffffffffffffffffffffffffffffff167401000000000000000000000000000000000000000063ffffffff93909316928302179055601291909155600d55565b60035481565b61a8c081565b60015473ffffffffffffffffffffffffffffffffffffffff1633146111c457600080fd5b60058054908290556040517f59b3ffce759ec92c629beee27554d8fbc2ca1a05020fa0cf500c890c172094be906110199083908590613fe8565b60015473ffffffffffffffffffffffffffffffffffffffff16331461122257600080fd5b600054821061125d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161055490613e51565b806000838154811061126b57fe5b6000918252602090912060029091020180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169115159190911790555050565b60095481565b60015473ffffffffffffffffffffffffffffffffffffffff1633146112d657600080fd5b6002805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff00000000000000000000000000000000000000008316179092556040519116907f6163d5b9efd962645dd649e6e48a61bcb0f9df00997a2398b80d135a9ab0c61e906110199083908590613d3a565b601154601454600091829182916113809173ffffffffffffffffffffffffffffffffffffffff9091169060ff16611d39565b601154919350915074010000000000000000000000000000000000000000900463ffffffff1681036113b0613145565b60405180602001604052808363ffffffff166012548703816113ce57fe5b047bffffffffffffffffffffffffffffffffffffffffffffffffffffffff16815250905061140c61140782670de0b6b3a7640000611f80565b61200e565b71ffffffffffffffffffffffffffffffffffff1694505050505090565b600b5481565b600a5481565b6000818154811061144257fe5b6000918252602091829020600291820201805460018083018054604080516101009483161585027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190921696909604601f810188900488028201880190965285815260ff841697509190920473ffffffffffffffffffffffffffffffffffffffff16949293909283018282801561151b5780601f106114f05761010080835404028352916020019161151b565b820191906000526020600020905b8154815290600101906020018083116114fe57829003601f168201915b5050505050905083565b33321461153157600080fd5b611539611c4c565b4261155160075460085461201590919063ffffffff16565b1061155b57600080fd5b6115926009546115866115796007544261205490919063ffffffff16565b429063ffffffff611b3f16565b9063ffffffff61201516565b600855600b546115a990600163ffffffff61201516565b600b5560006115b6612096565b90506000806115c48361219a565b600354919350915082906115df90829063ffffffff61221d16565b600e5490915073ffffffffffffffffffffffffffffffffffffffff16821561176b578073ffffffffffffffffffffffffffffffffffffffff166311d3e6c46040518163ffffffff1660e01b815260040160206040518083038186803b15801561164757600080fd5b505afa15801561165b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061167f91908101906134f0565b611734670de0b6b3a764000061172861169e828763ffffffff61201516565b8573ffffffffffffffffffffffffffffffffffffffff16638e0d8b7b6040518163ffffffff1660e01b815260040160206040518083038186803b1580156116e457600080fd5b505afa1580156116f8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061171c91908101906134f0565b9063ffffffff61225f16565b9063ffffffff61221d16565b1061176b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161055490613e91565b60008173ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b1580156117b357600080fd5b505afa1580156117c7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506117eb91908101906134f0565b90506000841561184c576000611818670de0b6b3a76400006117286005548861225f90919063ffffffff16565b905061182a858263ffffffff611b3f16565b9450611848670de0b6b3a7640000611728858463ffffffff61225f16565b9150505b600b546040517f7af548c100000000000000000000000000000000000000000000000000000000815260009173ffffffffffffffffffffffffffffffffffffffff861691637af548c1916118a69189908b90600401613ff6565b602060405180830381600087803b1580156118c057600080fd5b505af11580156118d4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506118f891908101906134f0565b90508373ffffffffffffffffffffffffffffffffffffffff166311d3e6c46040518163ffffffff1660e01b815260040160206040518083038186803b15801561194057600080fd5b505afa158015611954573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061197891908101906134f0565b8473ffffffffffffffffffffffffffffffffffffffff16638e0d8b7b6040518163ffffffff1660e01b815260040160206040518083038186803b1580156119be57600080fd5b505afa1580156119d2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506119f691908101906134f0565b11156119fe57fe5b611a0882886122b3565b5050505050505050565b60015473ffffffffffffffffffffffffffffffffffffffff163314611a3657600080fd5b60138054908290556040517fe21b25c4eda0340cd924f3247795d0acde6c304b68ae77657bb2d4e840198bf8906110199083908590613fe8565b60115473ffffffffffffffffffffffffffffffffffffffff1681565b60115474010000000000000000000000000000000000000000900463ffffffff1681565b60045481565b600d5481565b60015473ffffffffffffffffffffffffffffffffffffffff163314611ae057600080fd5b60008111611aed57600080fd5b600455565b60135481565b60065481565b60145460ff1681565b600e5473ffffffffffffffffffffffffffffffffffffffff1681565b600f5473ffffffffffffffffffffffffffffffffffffffff1681565b6000611b8183836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506124f6565b90505b92915050565b604051611c479084907fa9059cbb0000000000000000000000000000000000000000000000000000000090611bc59086908690602401613d7d565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152612541565b505050565b600c5460ff16611c88576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161055490613ec1565b600954600754611c9f90429063ffffffff61205416565b1015611cd7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161055490613ef1565b600a54600954611cec9163ffffffff61201516565b600754611d0090429063ffffffff61205416565b10611d37576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161055490613f01565b565b600080611d446125f7565b905060008060008673ffffffffffffffffffffffffffffffffffffffff16630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b158015611d9157600080fd5b505afa158015611da5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250611dc99190810190613485565b9250925092508515611ea8578673ffffffffffffffffffffffffffffffffffffffff16635909c0d56040518163ffffffff1660e01b815260040160206040518083038186803b158015611e1b57600080fd5b505afa158015611e2f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250611e5391908101906134f0565b94508363ffffffff168163ffffffff1614611ea35780840363ffffffff8116611e7c8486612601565b517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff16029590950194505b611f76565b8673ffffffffffffffffffffffffffffffffffffffff16635a3d54936040518163ffffffff1660e01b815260040160206040518083038186803b158015611eee57600080fd5b505afa158015611f02573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250611f2691908101906134f0565b94508363ffffffff168163ffffffff1614611f765780840363ffffffff8116611f4f8486612601565b517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff16029590950194505b5050509250929050565b611f88613157565b6000821580611fc357505082517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1682810290838281611fc057fe5b04145b611ff9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161055490613ed1565b60408051602081019091529081529392505050565b5160701c90565b600082820183811015611b81576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161055490613e41565b6000611b8183836040518060400160405280601881526020017f536166654d6174683a206d6f64756c6f206279207a65726f00000000000000008152506126c4565b601154601454600091829182916120c89173ffffffffffffffffffffffffffffffffffffffff9091169060ff16611d39565b601154919350915074010000000000000000000000000000000000000000900463ffffffff1681036120f8613145565b60405180602001604052808363ffffffff1660125487038161211657fe5b047bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1690526012859055601180547fffffffffffffffff00000000ffffffffffffffffffffffffffffffffffffffff167401000000000000000000000000000000000000000063ffffffff871602179055905061140c61140782670de0b6b3a7640000611f80565b6000806121a683612712565b156121b657506000905080612218565b6004548311156121ee576004546121e390611728670de0b6b3a764000061171c878463ffffffff611b3f16565b600191509150612218565b60045461221190611728670de0b6b3a764000061171c838863ffffffff611b3f16565b6000915091505b915091565b6000611b8183836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061278e565b60008261226e57506000611b84565b8282028284828161227b57fe5b0414611b81576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161055490613ea1565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663fff6cae96040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561231d57600080fd5b505af1158015612331573d6000803e3d6000fd5b5050505060008211156123485761234882826127df565b60005b600054811015611c4757600080828154811061236357fe5b60009182526020909120600290910201805490915060ff16156124ed5780546001808301805460408051602060026101009685161587027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190941693909304601f810184900484028201840190925281815260009561245695900473ffffffffffffffffffffffffffffffffffffffff1693909290919083018282801561244c5780601f106124215761010080835404028352916020019161244c565b820191906000526020600020905b81548152906001019060200180831161242f57829003601f168201915b5050505050612d3f565b9050806124eb57815460405161010090910473ffffffffffffffffffffffffffffffffffffffff16907f8091ecaaa54ebb82e02d36c2c336528e0fcb9b3430fc1291ac88295032b9c263906124b19086906001870190613fad565b60405180910390a26040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161055490613f61565b505b5060010161234b565b60008184841115612534576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105549190613e20565b50508183035b9392505050565b60606125a3826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16612d629092919063ffffffff16565b805190915015611c4757808060200190516125c19190810190613449565b611c47576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161055490613f11565b63ffffffff421690565b612609613145565b6000826dffffffffffffffffffffffffffff1611612653576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161055490613f71565b6040805160208101909152806dffffffffffffffffffffffffffff84167bffffffffffffffffffffffffffff0000000000000000000000000000607087901b168161269a57fe5b047bffffffffffffffffffffffffffffffffffffffffffffffffffffffff16815250905092915050565b600081836126ff576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105549190613e20565b5082848161270957fe5b06949350505050565b600080612738670de0b6b3a764000061172860065460045461225f90919063ffffffff16565b9050600454831015801561275f57508061275d60045485611b3f90919063ffffffff16565b105b8061253a57506004548310801561253a57506004548190612786908563ffffffff611b3f16565b109392505050565b600081836127c9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105549190613e20565b5060008385816127d557fe5b0495945050505050565b601154600e54604080517f0902f1ac000000000000000000000000000000000000000000000000000000008152905173ffffffffffffffffffffffffffffffffffffffff938416939092169160009182918591630902f1ac916004808301926060929190829003018186803b15801561285757600080fd5b505afa15801561286b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061288f9190810190613485565b506010546040517f70a082310000000000000000000000000000000000000000000000000000000081526dffffffffffffffffffffffffffff938416955091909216925060009173ffffffffffffffffffffffffffffffffffffffff808716926370a0823192612903921690600401613d2c565b60206040518083038186803b15801561291b57600080fd5b505afa15801561292f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061295391908101906134f0565b90506000612962848489612d79565b905061296c613005565b50604080516060810182528281526020810184905260009181019190915260145460ff1615612b83576129a5898463ffffffff61201516565b821115612a655760006129bb848b018787612e20565b8a85018352602080840186905260405191925073ffffffffffffffffffffffffffffffffffffffff8a169163022c0d9f91600091859130916129ff91899101613f91565b6040516020818303038152906040526040518563ffffffff1660e01b8152600401612a2d9493929190613ddc565b600060405180830381600087803b158015612a4757600080fd5b505af1158015612a5b573d6000803e3d6000fd5b5050505050612b7e565b82821115612ac8576000612a7a838787612e20565b9050612a8e8a85850363ffffffff611b3f16565b8260400181815250508773ffffffffffffffffffffffffffffffffffffffff1663022c0d9f60008330866040516020016129ff9190613f91565b6000612ad5838787612e20565b905082826020018181525050898260400181815250508773ffffffffffffffffffffffffffffffffffffffff1663022c0d9f6000833086604051602001612b1c9190613f91565b6040516020818303038152906040526040518563ffffffff1660e01b8152600401612b4a9493929190613ddc565b600060405180830381600087803b158015612b6457600080fd5b505af1158015612b78573d6000803e3d6000fd5b50505050505b612d34565b612b93898463ffffffff61201516565b821115612c1b576000612ba9848b018688612e20565b8a85018352602080840186905260405191925073ffffffffffffffffffffffffffffffffffffffff8a169163022c0d9f9184916000913091612bed91899101613f91565b6040516020818303038152906040526040518563ffffffff1660e01b8152600401612b4a9493929190613fcd565b82821115612c7e576000612c30838688612e20565b9050612c448a85850363ffffffff611b3f16565b8260400181815250508773ffffffffffffffffffffffffffffffffffffffff1663022c0d9f8260003086604051602001612bed9190613f91565b6000612c8b838688612e20565b905082826020018181525050898260400181815250508773ffffffffffffffffffffffffffffffffffffffff1663022c0d9f8260003086604051602001612cd29190613f91565b6040516020818303038152906040526040518563ffffffff1660e01b8152600401612d009493929190613fcd565b600060405180830381600087803b158015612d1a57600080fd5b505af1158015612d2e573d6000803e3d6000fd5b50505050505b505050505050505050565b6000806040516020840160008286518360008a6187965a03f19695505050505050565b6060612d718484600085612efa565b949350505050565b60145460009060ff1615612dd75767016345785d8a00008210612dbe57612db7670de0b6b3a76400006117286013548761225f90919063ffffffff16565b905061253a565b612db7670de0b6b3a7640000611728866003860461225f565b67016345785d8a00008210612e0757612db7670de0b6b3a76400006117286013548661225f90919063ffffffff16565b612db7670de0b6b3a7640000611728856003860461225f565b6000808411612e5b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161055490613f31565b600083118015612e6b5750600082115b612ea1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161055490613e81565b6000612eb5856103e563ffffffff61225f16565b90506000612ec9828563ffffffff61225f16565b90506000612ee383611586886103e863ffffffff61225f16565b9050808281612eee57fe5b04979650505050505050565b6060612f0585612fff565b612f3b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161055490613ee1565b600060608673ffffffffffffffffffffffffffffffffffffffff168587604051612f659190613d20565b60006040518083038185875af1925050503d8060008114612fa2576040519150601f19603f3d011682016040523d82523d6000602084013e612fa7565b606091505b50915091508115612fbb579150612d719050565b805115612fcb5780518082602001fd5b836040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105549190613e20565b3b151590565b60405180606001604052806000815260200160008152602001600081525090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061306757805160ff1916838001178555613094565b82800160010185558215613094579182015b82811115613094578251825591602001919060010190613079565b506130a092915061316a565b5090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106130dd5780548555613094565b8280016001018555821561309457600052602060002091601f016020900482015b828111156130945782548255916001019190600101906130fe565b815481835581811115611c4757600202816002028360005260206000209182019101611c479190613184565b60408051602081019091526000815290565b6040518060200160405280600081525090565b6109db91905b808211156130a05760008155600101613170565b6109db91905b808211156130a05780547fffffffffffffffffffffff00000000000000000000000000000000000000000016815560006131c760018301826131d0565b5060020161318a565b50805460018160011615610100020316600290046000825580601f106131f65750613214565b601f016020900490600052602060002090810190613214919061316a565b50565b8035611b848161419c565b8035611b84816141b0565b8051611b84816141b0565b60008083601f84011261324a57600080fd5b50813567ffffffffffffffff81111561326257600080fd5b60208301915083600182028301111561327a57600080fd5b9250929050565b600082601f83011261329257600080fd5b81356132a56132a082614088565b614061565b915080825260208301602083018583830111156132c157600080fd5b6132cc83828461413c565b50505092915050565b6000606082840312156132e757600080fd5b6132f16060614061565b905060006132ff8484613346565b825250602061331084848301613346565b602083015250604061332484828501613346565b60408301525092915050565b8051611b84816141b9565b8035611b84816141c2565b8051611b84816141c2565b8051611b84816141cb565b60006020828403121561336e57600080fd5b6000612d718484613217565b60008060006040848603121561338f57600080fd5b600061339b8686613217565b935050602084013567ffffffffffffffff8111156133b857600080fd5b6133c486828701613238565b92509250509250925092565b600080600080608085870312156133e657600080fd5b60006133f28787613217565b94505060206134038782880161333b565b93505060406134148782880161333b565b925050606085013567ffffffffffffffff81111561343157600080fd5b61343d87828801613281565b91505092959194509250565b60006020828403121561345b57600080fd5b6000612d71848461322d565b60006060828403121561347957600080fd5b6000612d7184846132d5565b60008060006060848603121561349a57600080fd5b60006134a68686613330565b93505060206134b786828701613330565b92505060406134c886828701613351565b9150509250925092565b6000602082840312156134e457600080fd5b6000612d71848461333b565b60006020828403121561350257600080fd5b6000612d718484613346565b6000806040838503121561352157600080fd5b600061352d858561333b565b925050602061353e85828601613222565b9150509250929050565b60008060006060848603121561355d57600080fd5b6000613569868661333b565b935050602061357a8682870161333b565b92505060406134c88682870161333b565b613594816140ec565b82525050565b613594816140f7565b60006135ae826140da565b6135b881856140de565b93506135c8818560208601614148565b6135d181614174565b9093019392505050565b60006135e6826140da565b6135f081856140e7565b9350613600818560208601614148565b9290920192915050565b600081546001811660008114613627576001811461366b576136aa565b607f600283041661363881876140de565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00841681529550506020850192506136aa565b6002820461367981876140de565b9550613684856140ce565b60005b828110156136a357815488820152600190910190602001613687565b8701945050505b505092915050565b61359481614131565b60006136c86027836140de565b7f74776170207761736e7420696e74697469617465642c2063616c6c20696e697481527f5f74776170282900000000000000000000000000000000000000000000000000602082015260400192915050565b6000613727601b836140de565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000815260200192915050565b60006137606028836140de565b7f696e646578206d75737420626520696e2072616e6765206f662073746f72656481527f207478206c697374000000000000000000000000000000000000000000000000602082015260400192915050565b60006137bf6009836140de565b7f6e6f207472616465730000000000000000000000000000000000000000000000815260200192915050565b60006137f8600a836140de565b7f21656e645f64656c617900000000000000000000000000000000000000000000815260200192915050565b60006138316028836140de565b7f556e697377617056324c6962726172793a20494e53554646494349454e545f4c81527f4951554944495459000000000000000000000000000000000000000000000000602082015260400192915050565b60006138906022836140de565b7f6e6577207363616c696e6720666163746f722077696c6c20626520746f6f206281527f6967000000000000000000000000000000000000000000000000000000000000602082015260400192915050565b60006138ef6021836140de565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f81527f7700000000000000000000000000000000000000000000000000000000000000602082015260400192915050565b600061394e6008836140de565b7f2170656e64696e67000000000000000000000000000000000000000000000000815260200192915050565b60006139876013836140de565b7f7265626173696e67206e6f742061637469766500000000000000000000000000815260200192915050565b60006139c06023836140de565b7f4669786564506f696e743a204d554c5449504c49434154494f4e5f4f5645524681527f4c4f570000000000000000000000000000000000000000000000000000000000602082015260400192915050565b6000613a1f601d836140de565b7f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000815260200192915050565b6000613a586009836140de565b7f746f6f206561726c790000000000000000000000000000000000000000000000815260200192915050565b6000613a916008836140de565b7f746f6f206c617465000000000000000000000000000000000000000000000000815260200192915050565b6000613aca602a836140de565b7f5361666545524332303a204552433230206f7065726174696f6e20646964206e81527f6f74207375636365656400000000000000000000000000000000000000000000602082015260400192915050565b6000613b29600e836140de565b7f626164206d73672e73656e646572000000000000000000000000000000000000815260200192915050565b6000613b62602b836140de565b7f556e697377617056324c6962726172793a20494e53554646494349454e545f4981527f4e5055545f414d4f554e54000000000000000000000000000000000000000000602082015260400192915050565b6000613bc16011836140de565b7f616c726561647920616374697661746564000000000000000000000000000000815260200192915050565b6000613bfa6013836140de565b7f696e646578206f7574206f6620626f756e647300000000000000000000000000815260200192915050565b6000613c336012836140de565b7f5472616e73616374696f6e204661696c65640000000000000000000000000000815260200192915050565b6000613c6c6017836140de565b7f4669786564506f696e743a204449565f42595f5a45524f000000000000000000815260200192915050565b6000613ca5600a836140de565b7f626164206f726967696e00000000000000000000000000000000000000000000815260200192915050565b80516060830190613ce28482613d0e565b506020820151613cf56020850182613d0e565b506040820151613d086040850182613d0e565b50505050565b613594816109db565b61359481614128565b600061253a82846135db565b60208101611b84828461358b565b60408101613d48828561358b565b61253a602083018461358b565b60608101613d63828661358b565b613d70602083018561358b565b612d716040830184613d0e565b60408101613d8b828561358b565b61253a6020830184613d0e565b60208101611b84828461359a565b60608101613db4828661359a565b613dc1602083018561358b565b8181036040830152613dd381846135a3565b95945050505050565b60808101613dea82876136b2565b613df76020830186613d0e565b613e04604083018561358b565b8181036060830152613e1681846135a3565b9695505050505050565b60208082528101611b8181846135a3565b60208082528101611b84816136bb565b60208082528101611b848161371a565b60208082528101611b8481613753565b60208082528101611b84816137b2565b60208082528101611b84816137eb565b60208082528101611b8481613824565b60208082528101611b8481613883565b60208082528101611b84816138e2565b60208082528101611b8481613941565b60208082528101611b848161397a565b60208082528101611b84816139b3565b60208082528101611b8481613a12565b60208082528101611b8481613a4b565b60208082528101611b8481613a84565b60208082528101611b8481613abd565b60208082528101611b8481613b1c565b60208082528101611b8481613b55565b60208082528101611b8481613bb4565b60208082528101611b8481613bed565b60208082528101611b8481613c26565b60208082528101611b8481613c5f565b60208082528101611b8481613c98565b60608101611b848284613cd1565b60208101611b848284613d0e565b60408101613fbb8285613d0e565b8181036020830152612d71818461360a565b60808101613fdb8287613d0e565b613df760208301866136b2565b60408101613d8b8285613d0e565b606081016140048286613d0e565b6140116020830185613d0e565b612d71604083018461359a565b6080810161402c8287613d0e565b6140396020830186613d0e565b6140466040830185613d0e565b613dd36060830184613d0e565b60208101611b848284613d17565b60405181810167ffffffffffffffff8111828210171561408057600080fd5b604052919050565b600067ffffffffffffffff82111561409f57600080fd5b506020601f919091017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0160190565b60009081526020902090565b5190565b90815260200190565b919050565b6000611b848261410f565b151590565b6dffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff1690565b63ffffffff1690565b6000611b84826109db565b82818337506000910152565b60005b8381101561416357818101518382015260200161414b565b83811115613d085750506000910152565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01690565b6141a5816140ec565b811461321457600080fd5b6141a5816140f7565b6141a5816140fc565b6141a5816109db565b6141a58161412856fea365627a7a723158203fa203a06047d7f1f863d85624d656846cea22531d2f02d9865d01fd4e1217506c6578706572696d656e74616cf564736f6c63430005110040000000000000000000000000c8d2ab2a6fdebc25432e54941cb85b55b9f152db000000000000000000000000df5e0e81dff6faf3a7e52ba697820c5e32d806a80000000000000000000000005c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f00000000000000000000000017388ec228ce19dac0067a6ff73a7f850528746a

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106102d35760003560e01c80636406ca5f11610186578063b60e1e3e116100e3578063cdabdaac11610097578063dcf93f3211610071578063dcf93f32146104e5578063eccda406146104ed578063f4325d67146104f5576102d3565b8063cdabdaac146104c2578063cf1b927e146104d5578063d94ad837146104dd576102d3565b8063c5700a02116100c8578063c5700a021461049d578063cc8fd393146104b2578063cd877826146104ba576102d3565b8063b60e1e3e14610482578063c4c6eaad14610495576102d3565b8063832a30351161013a5780639466120f1161011f5780639466120f146104505780639ace38c214610458578063af14052c1461047a576102d3565b8063832a303514610440578063900cf0cf14610448576102d3565b80636e9dde991161016b5780636e9dde99146104125780637052b9021461042557806373f03dff1461042d576102d3565b80636406ca5f146103f75780636bf9ace7146103ff576102d3565b80633a68eaf6116102345780634e66f8ae116101e857806353a15edc116101cd57806353a15edc146103d457806357466c8b146103e757806363f6d4c8146103ef576102d3565b80634e66f8ae146103b9578063527a52c8146103c1576102d3565b806346c3bd1f1161021957806346c3bd1f146103965780634bda2e20146103a95780634dc95de1146103b1576102d3565b80633a68eaf6146103865780633a93069b1461038e576102d3565b806316250fd41161028b57806320ce83891161027057806320ce83891461036357806325240810146103765780632f43c1bc1461037e576102d3565b806316250fd4146103485780631cab801c1461035b576102d3565b8063111d0498116102bc578063111d04981461030b578063126e19be1461032057806312d43a5114610333576102d3565b806302101899146102d857806310d1e85c146102f6575b600080fd5b6102e06104fd565b6040516102ed9190613f9f565b60405180910390f35b6103096103043660046133d0565b610503565b005b6103136109cd565b6040516102ed9190613d98565b61030961032e36600461337a565b6109de565b61033b610b20565b6040516102ed9190613d2c565b610309610356366004613548565b610b3c565b6102e0610b87565b6103096103713660046134d2565b610b8d565b61033b610bc3565b6102e0610bdf565b61033b610be5565b6102e0610c01565b6103096103a43660046134d2565b610c07565b610309610de8565b610313610ecb565b610309610ed4565b6103096103cf36600461335c565b610f7d565b6103096103e23660046134d2565b611025565b610309611092565b6102e0611194565b6102e061119a565b61030961040d3660046134d2565b6111a0565b61030961042036600461350e565b6111fe565b6102e06112ac565b61030961043b36600461335c565b6112b2565b6102e061134e565b6102e0611429565b6102e061142f565b61046b6104663660046134d2565b611435565b6040516102ed93929190613da6565b610309611525565b6103096104903660046134d2565b611a12565b61033b611a70565b6104a5611a8c565b6040516102ed9190614053565b6102e0611ab0565b6102e0611ab6565b6103096104d03660046134d2565b611abc565b6102e0611af2565b6102e0611af8565b610313611afe565b61033b611b07565b61033b611b23565b60075481565b60115473ffffffffffffffffffffffffffffffffffffffff16331461055d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161055490613f21565b60405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff841630146105ac576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161055490613f81565b6105b4613005565b818060200190516105c89190810190613467565b600e54602082015191925073ffffffffffffffffffffffffffffffffffffffff1690156107635760105460115460208401516040517f23b872dd00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff808616946323b872dd946106529491831693921691600401613d55565b602060405180830381600087803b15801561066c57600080fd5b505af1158015610680573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506106a49190810190613449565b5081516020830151101561075e576011546020830151835173ffffffffffffffffffffffffffffffffffffffff808516936340c10f19939116916106ed9163ffffffff611b3f16565b6040518363ffffffff1660e01b815260040161070a929190613d7d565b602060405180830381600087803b15801561072457600080fd5b505af1158015610738573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061075c9190810190613449565b505b610812565b60115482516040517f40c10f1900000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff848116936340c10f19936107be939290911691600401613d7d565b602060405180830381600087803b1580156107d857600080fd5b505af11580156107ec573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506108109190810190613449565b505b6040820151156108ce5760105460408381015190517f40c10f1900000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff848116936340c10f199361087a939290911691600401613d7d565b602060405180830381600087803b15801561089457600080fd5b505af11580156108a8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506108cc9190810190613449565b505b60145460ff161561095157600f546010546109039173ffffffffffffffffffffffffffffffffffffffff908116911686611b8a565b7fb335015c214ae37ed112cc5eb042235c0ea40a7617987e1bd84783914387235084836000015184602001518560400151604051610944949392919061401e565b60405180910390a16109c5565b600f5460105461097b9173ffffffffffffffffffffffffffffffffffffffff908116911687611b8a565b7fb335015c214ae37ed112cc5eb042235c0ea40a7617987e1bd847839143872350858360000151846020015185604001516040516109bc949392919061401e565b60405180910390a15b505050505050565b60006109d7611c4c565b5060015b90565b60015473ffffffffffffffffffffffffffffffffffffffff163314610a0257600080fd5b600060405180606001604052806001151581526020018573ffffffffffffffffffffffffffffffffffffffff16815260200184848080601f016020809104026020016040519081016040528093929190818152602001838380828437600092018290525093909452505083546001818101808755958352602092839020855160029093020180548487015173ffffffffffffffffffffffffffffffffffffffff16610100027fffffffffffffffffffffff0000000000000000000000000000000000000000ff9415157fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00909216919091179390931692909217825560408501518051929450610b179391850192910190613026565b50505050505050565b60015473ffffffffffffffffffffffffffffffffffffffff1681565b60015473ffffffffffffffffffffffffffffffffffffffff163314610b6057600080fd5b60008311610b6d57600080fd5b828210610b7957600080fd5b600792909255600955600a55565b60055481565b60015473ffffffffffffffffffffffffffffffffffffffff163314610bb157600080fd5b60008111610bbe57600080fd5b600355565b60025473ffffffffffffffffffffffffffffffffffffffff1681565b60125481565b60105473ffffffffffffffffffffffffffffffffffffffff1681565b60085481565b60015473ffffffffffffffffffffffffffffffffffffffff163314610c2b57600080fd5b6000548110610c66576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161055490613f51565b6000547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01811015610db357600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8101908110610cc257fe5b906000526020600020906002020160008281548110610cdd57fe5b600091825260209091208254600292830290910180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660ff90921615159190911780825583547fffffffffffffffffffffff0000000000000000000000000000000000000000ff9091166101009182900473ffffffffffffffffffffffffffffffffffffffff168202178255600180850180549394610daf948387019492938116159092027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01909116046130a4565b5050505b6000805490610de4907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8301613119565b5050565b60025473ffffffffffffffffffffffffffffffffffffffff163314610e39576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161055490613eb1565b60018054600280547fffffffffffffffffffffffff000000000000000000000000000000000000000080841673ffffffffffffffffffffffffffffffffffffffff83811691909117958690559116909155604051918116927f1f14cfc03e486d23acee577b07bc0b3b23f4888c91fcdba5e0fef5a2549d552392610ec09285921690613d3a565b60405180910390a150565b600c5460ff1681565b6000600d5411610f10576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161055490613e31565b61a8c0600d5401421015610f50576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161055490613e71565b600c80547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055565b60015473ffffffffffffffffffffffffffffffffffffffff163314610fa157600080fd5b6010805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff00000000000000000000000000000000000000008316179092556040519116907fce840d2205f08f33375689943da5da9fdfde146fcbb5553b17910a60c8284a20906110199083908590613d3a565b60405180910390a15050565b60015473ffffffffffffffffffffffffffffffffffffffff16331461104957600080fd5b60006006541161105857600080fd5b60068054908290556040517f2a5cda4d16fba415b52d90b59ee30d4cb16494da9fd1ee51c4d5bac4a1f75bbe906110199083908590613fe8565b600d54156110cc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161055490613f41565b60115460145460009182916110fa9173ffffffffffffffffffffffffffffffffffffffff169060ff16611d39565b9150915060008163ffffffff161161113e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161055490613e61565b601180547fffffffffffffffff00000000ffffffffffffffffffffffffffffffffffffffff167401000000000000000000000000000000000000000063ffffffff93909316928302179055601291909155600d55565b60035481565b61a8c081565b60015473ffffffffffffffffffffffffffffffffffffffff1633146111c457600080fd5b60058054908290556040517f59b3ffce759ec92c629beee27554d8fbc2ca1a05020fa0cf500c890c172094be906110199083908590613fe8565b60015473ffffffffffffffffffffffffffffffffffffffff16331461122257600080fd5b600054821061125d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161055490613e51565b806000838154811061126b57fe5b6000918252602090912060029091020180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169115159190911790555050565b60095481565b60015473ffffffffffffffffffffffffffffffffffffffff1633146112d657600080fd5b6002805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff00000000000000000000000000000000000000008316179092556040519116907f6163d5b9efd962645dd649e6e48a61bcb0f9df00997a2398b80d135a9ab0c61e906110199083908590613d3a565b601154601454600091829182916113809173ffffffffffffffffffffffffffffffffffffffff9091169060ff16611d39565b601154919350915074010000000000000000000000000000000000000000900463ffffffff1681036113b0613145565b60405180602001604052808363ffffffff166012548703816113ce57fe5b047bffffffffffffffffffffffffffffffffffffffffffffffffffffffff16815250905061140c61140782670de0b6b3a7640000611f80565b61200e565b71ffffffffffffffffffffffffffffffffffff1694505050505090565b600b5481565b600a5481565b6000818154811061144257fe5b6000918252602091829020600291820201805460018083018054604080516101009483161585027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190921696909604601f810188900488028201880190965285815260ff841697509190920473ffffffffffffffffffffffffffffffffffffffff16949293909283018282801561151b5780601f106114f05761010080835404028352916020019161151b565b820191906000526020600020905b8154815290600101906020018083116114fe57829003601f168201915b5050505050905083565b33321461153157600080fd5b611539611c4c565b4261155160075460085461201590919063ffffffff16565b1061155b57600080fd5b6115926009546115866115796007544261205490919063ffffffff16565b429063ffffffff611b3f16565b9063ffffffff61201516565b600855600b546115a990600163ffffffff61201516565b600b5560006115b6612096565b90506000806115c48361219a565b600354919350915082906115df90829063ffffffff61221d16565b600e5490915073ffffffffffffffffffffffffffffffffffffffff16821561176b578073ffffffffffffffffffffffffffffffffffffffff166311d3e6c46040518163ffffffff1660e01b815260040160206040518083038186803b15801561164757600080fd5b505afa15801561165b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061167f91908101906134f0565b611734670de0b6b3a764000061172861169e828763ffffffff61201516565b8573ffffffffffffffffffffffffffffffffffffffff16638e0d8b7b6040518163ffffffff1660e01b815260040160206040518083038186803b1580156116e457600080fd5b505afa1580156116f8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061171c91908101906134f0565b9063ffffffff61225f16565b9063ffffffff61221d16565b1061176b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161055490613e91565b60008173ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b1580156117b357600080fd5b505afa1580156117c7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506117eb91908101906134f0565b90506000841561184c576000611818670de0b6b3a76400006117286005548861225f90919063ffffffff16565b905061182a858263ffffffff611b3f16565b9450611848670de0b6b3a7640000611728858463ffffffff61225f16565b9150505b600b546040517f7af548c100000000000000000000000000000000000000000000000000000000815260009173ffffffffffffffffffffffffffffffffffffffff861691637af548c1916118a69189908b90600401613ff6565b602060405180830381600087803b1580156118c057600080fd5b505af11580156118d4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506118f891908101906134f0565b90508373ffffffffffffffffffffffffffffffffffffffff166311d3e6c46040518163ffffffff1660e01b815260040160206040518083038186803b15801561194057600080fd5b505afa158015611954573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061197891908101906134f0565b8473ffffffffffffffffffffffffffffffffffffffff16638e0d8b7b6040518163ffffffff1660e01b815260040160206040518083038186803b1580156119be57600080fd5b505afa1580156119d2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506119f691908101906134f0565b11156119fe57fe5b611a0882886122b3565b5050505050505050565b60015473ffffffffffffffffffffffffffffffffffffffff163314611a3657600080fd5b60138054908290556040517fe21b25c4eda0340cd924f3247795d0acde6c304b68ae77657bb2d4e840198bf8906110199083908590613fe8565b60115473ffffffffffffffffffffffffffffffffffffffff1681565b60115474010000000000000000000000000000000000000000900463ffffffff1681565b60045481565b600d5481565b60015473ffffffffffffffffffffffffffffffffffffffff163314611ae057600080fd5b60008111611aed57600080fd5b600455565b60135481565b60065481565b60145460ff1681565b600e5473ffffffffffffffffffffffffffffffffffffffff1681565b600f5473ffffffffffffffffffffffffffffffffffffffff1681565b6000611b8183836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506124f6565b90505b92915050565b604051611c479084907fa9059cbb0000000000000000000000000000000000000000000000000000000090611bc59086908690602401613d7d565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152612541565b505050565b600c5460ff16611c88576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161055490613ec1565b600954600754611c9f90429063ffffffff61205416565b1015611cd7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161055490613ef1565b600a54600954611cec9163ffffffff61201516565b600754611d0090429063ffffffff61205416565b10611d37576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161055490613f01565b565b600080611d446125f7565b905060008060008673ffffffffffffffffffffffffffffffffffffffff16630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b158015611d9157600080fd5b505afa158015611da5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250611dc99190810190613485565b9250925092508515611ea8578673ffffffffffffffffffffffffffffffffffffffff16635909c0d56040518163ffffffff1660e01b815260040160206040518083038186803b158015611e1b57600080fd5b505afa158015611e2f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250611e5391908101906134f0565b94508363ffffffff168163ffffffff1614611ea35780840363ffffffff8116611e7c8486612601565b517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff16029590950194505b611f76565b8673ffffffffffffffffffffffffffffffffffffffff16635a3d54936040518163ffffffff1660e01b815260040160206040518083038186803b158015611eee57600080fd5b505afa158015611f02573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250611f2691908101906134f0565b94508363ffffffff168163ffffffff1614611f765780840363ffffffff8116611f4f8486612601565b517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff16029590950194505b5050509250929050565b611f88613157565b6000821580611fc357505082517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1682810290838281611fc057fe5b04145b611ff9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161055490613ed1565b60408051602081019091529081529392505050565b5160701c90565b600082820183811015611b81576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161055490613e41565b6000611b8183836040518060400160405280601881526020017f536166654d6174683a206d6f64756c6f206279207a65726f00000000000000008152506126c4565b601154601454600091829182916120c89173ffffffffffffffffffffffffffffffffffffffff9091169060ff16611d39565b601154919350915074010000000000000000000000000000000000000000900463ffffffff1681036120f8613145565b60405180602001604052808363ffffffff1660125487038161211657fe5b047bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1690526012859055601180547fffffffffffffffff00000000ffffffffffffffffffffffffffffffffffffffff167401000000000000000000000000000000000000000063ffffffff871602179055905061140c61140782670de0b6b3a7640000611f80565b6000806121a683612712565b156121b657506000905080612218565b6004548311156121ee576004546121e390611728670de0b6b3a764000061171c878463ffffffff611b3f16565b600191509150612218565b60045461221190611728670de0b6b3a764000061171c838863ffffffff611b3f16565b6000915091505b915091565b6000611b8183836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061278e565b60008261226e57506000611b84565b8282028284828161227b57fe5b0414611b81576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161055490613ea1565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663fff6cae96040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561231d57600080fd5b505af1158015612331573d6000803e3d6000fd5b5050505060008211156123485761234882826127df565b60005b600054811015611c4757600080828154811061236357fe5b60009182526020909120600290910201805490915060ff16156124ed5780546001808301805460408051602060026101009685161587027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190941693909304601f810184900484028201840190925281815260009561245695900473ffffffffffffffffffffffffffffffffffffffff1693909290919083018282801561244c5780601f106124215761010080835404028352916020019161244c565b820191906000526020600020905b81548152906001019060200180831161242f57829003601f168201915b5050505050612d3f565b9050806124eb57815460405161010090910473ffffffffffffffffffffffffffffffffffffffff16907f8091ecaaa54ebb82e02d36c2c336528e0fcb9b3430fc1291ac88295032b9c263906124b19086906001870190613fad565b60405180910390a26040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161055490613f61565b505b5060010161234b565b60008184841115612534576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105549190613e20565b50508183035b9392505050565b60606125a3826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16612d629092919063ffffffff16565b805190915015611c4757808060200190516125c19190810190613449565b611c47576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161055490613f11565b63ffffffff421690565b612609613145565b6000826dffffffffffffffffffffffffffff1611612653576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161055490613f71565b6040805160208101909152806dffffffffffffffffffffffffffff84167bffffffffffffffffffffffffffff0000000000000000000000000000607087901b168161269a57fe5b047bffffffffffffffffffffffffffffffffffffffffffffffffffffffff16815250905092915050565b600081836126ff576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105549190613e20565b5082848161270957fe5b06949350505050565b600080612738670de0b6b3a764000061172860065460045461225f90919063ffffffff16565b9050600454831015801561275f57508061275d60045485611b3f90919063ffffffff16565b105b8061253a57506004548310801561253a57506004548190612786908563ffffffff611b3f16565b109392505050565b600081836127c9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105549190613e20565b5060008385816127d557fe5b0495945050505050565b601154600e54604080517f0902f1ac000000000000000000000000000000000000000000000000000000008152905173ffffffffffffffffffffffffffffffffffffffff938416939092169160009182918591630902f1ac916004808301926060929190829003018186803b15801561285757600080fd5b505afa15801561286b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061288f9190810190613485565b506010546040517f70a082310000000000000000000000000000000000000000000000000000000081526dffffffffffffffffffffffffffff938416955091909216925060009173ffffffffffffffffffffffffffffffffffffffff808716926370a0823192612903921690600401613d2c565b60206040518083038186803b15801561291b57600080fd5b505afa15801561292f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061295391908101906134f0565b90506000612962848489612d79565b905061296c613005565b50604080516060810182528281526020810184905260009181019190915260145460ff1615612b83576129a5898463ffffffff61201516565b821115612a655760006129bb848b018787612e20565b8a85018352602080840186905260405191925073ffffffffffffffffffffffffffffffffffffffff8a169163022c0d9f91600091859130916129ff91899101613f91565b6040516020818303038152906040526040518563ffffffff1660e01b8152600401612a2d9493929190613ddc565b600060405180830381600087803b158015612a4757600080fd5b505af1158015612a5b573d6000803e3d6000fd5b5050505050612b7e565b82821115612ac8576000612a7a838787612e20565b9050612a8e8a85850363ffffffff611b3f16565b8260400181815250508773ffffffffffffffffffffffffffffffffffffffff1663022c0d9f60008330866040516020016129ff9190613f91565b6000612ad5838787612e20565b905082826020018181525050898260400181815250508773ffffffffffffffffffffffffffffffffffffffff1663022c0d9f6000833086604051602001612b1c9190613f91565b6040516020818303038152906040526040518563ffffffff1660e01b8152600401612b4a9493929190613ddc565b600060405180830381600087803b158015612b6457600080fd5b505af1158015612b78573d6000803e3d6000fd5b50505050505b612d34565b612b93898463ffffffff61201516565b821115612c1b576000612ba9848b018688612e20565b8a85018352602080840186905260405191925073ffffffffffffffffffffffffffffffffffffffff8a169163022c0d9f9184916000913091612bed91899101613f91565b6040516020818303038152906040526040518563ffffffff1660e01b8152600401612b4a9493929190613fcd565b82821115612c7e576000612c30838688612e20565b9050612c448a85850363ffffffff611b3f16565b8260400181815250508773ffffffffffffffffffffffffffffffffffffffff1663022c0d9f8260003086604051602001612bed9190613f91565b6000612c8b838688612e20565b905082826020018181525050898260400181815250508773ffffffffffffffffffffffffffffffffffffffff1663022c0d9f8260003086604051602001612cd29190613f91565b6040516020818303038152906040526040518563ffffffff1660e01b8152600401612d009493929190613fcd565b600060405180830381600087803b158015612d1a57600080fd5b505af1158015612d2e573d6000803e3d6000fd5b50505050505b505050505050505050565b6000806040516020840160008286518360008a6187965a03f19695505050505050565b6060612d718484600085612efa565b949350505050565b60145460009060ff1615612dd75767016345785d8a00008210612dbe57612db7670de0b6b3a76400006117286013548761225f90919063ffffffff16565b905061253a565b612db7670de0b6b3a7640000611728866003860461225f565b67016345785d8a00008210612e0757612db7670de0b6b3a76400006117286013548661225f90919063ffffffff16565b612db7670de0b6b3a7640000611728856003860461225f565b6000808411612e5b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161055490613f31565b600083118015612e6b5750600082115b612ea1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161055490613e81565b6000612eb5856103e563ffffffff61225f16565b90506000612ec9828563ffffffff61225f16565b90506000612ee383611586886103e863ffffffff61225f16565b9050808281612eee57fe5b04979650505050505050565b6060612f0585612fff565b612f3b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161055490613ee1565b600060608673ffffffffffffffffffffffffffffffffffffffff168587604051612f659190613d20565b60006040518083038185875af1925050503d8060008114612fa2576040519150601f19603f3d011682016040523d82523d6000602084013e612fa7565b606091505b50915091508115612fbb579150612d719050565b805115612fcb5780518082602001fd5b836040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105549190613e20565b3b151590565b60405180606001604052806000815260200160008152602001600081525090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061306757805160ff1916838001178555613094565b82800160010185558215613094579182015b82811115613094578251825591602001919060010190613079565b506130a092915061316a565b5090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106130dd5780548555613094565b8280016001018555821561309457600052602060002091601f016020900482015b828111156130945782548255916001019190600101906130fe565b815481835581811115611c4757600202816002028360005260206000209182019101611c479190613184565b60408051602081019091526000815290565b6040518060200160405280600081525090565b6109db91905b808211156130a05760008155600101613170565b6109db91905b808211156130a05780547fffffffffffffffffffffff00000000000000000000000000000000000000000016815560006131c760018301826131d0565b5060020161318a565b50805460018160011615610100020316600290046000825580601f106131f65750613214565b601f016020900490600052602060002090810190613214919061316a565b50565b8035611b848161419c565b8035611b84816141b0565b8051611b84816141b0565b60008083601f84011261324a57600080fd5b50813567ffffffffffffffff81111561326257600080fd5b60208301915083600182028301111561327a57600080fd5b9250929050565b600082601f83011261329257600080fd5b81356132a56132a082614088565b614061565b915080825260208301602083018583830111156132c157600080fd5b6132cc83828461413c565b50505092915050565b6000606082840312156132e757600080fd5b6132f16060614061565b905060006132ff8484613346565b825250602061331084848301613346565b602083015250604061332484828501613346565b60408301525092915050565b8051611b84816141b9565b8035611b84816141c2565b8051611b84816141c2565b8051611b84816141cb565b60006020828403121561336e57600080fd5b6000612d718484613217565b60008060006040848603121561338f57600080fd5b600061339b8686613217565b935050602084013567ffffffffffffffff8111156133b857600080fd5b6133c486828701613238565b92509250509250925092565b600080600080608085870312156133e657600080fd5b60006133f28787613217565b94505060206134038782880161333b565b93505060406134148782880161333b565b925050606085013567ffffffffffffffff81111561343157600080fd5b61343d87828801613281565b91505092959194509250565b60006020828403121561345b57600080fd5b6000612d71848461322d565b60006060828403121561347957600080fd5b6000612d7184846132d5565b60008060006060848603121561349a57600080fd5b60006134a68686613330565b93505060206134b786828701613330565b92505060406134c886828701613351565b9150509250925092565b6000602082840312156134e457600080fd5b6000612d71848461333b565b60006020828403121561350257600080fd5b6000612d718484613346565b6000806040838503121561352157600080fd5b600061352d858561333b565b925050602061353e85828601613222565b9150509250929050565b60008060006060848603121561355d57600080fd5b6000613569868661333b565b935050602061357a8682870161333b565b92505060406134c88682870161333b565b613594816140ec565b82525050565b613594816140f7565b60006135ae826140da565b6135b881856140de565b93506135c8818560208601614148565b6135d181614174565b9093019392505050565b60006135e6826140da565b6135f081856140e7565b9350613600818560208601614148565b9290920192915050565b600081546001811660008114613627576001811461366b576136aa565b607f600283041661363881876140de565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00841681529550506020850192506136aa565b6002820461367981876140de565b9550613684856140ce565b60005b828110156136a357815488820152600190910190602001613687565b8701945050505b505092915050565b61359481614131565b60006136c86027836140de565b7f74776170207761736e7420696e74697469617465642c2063616c6c20696e697481527f5f74776170282900000000000000000000000000000000000000000000000000602082015260400192915050565b6000613727601b836140de565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000815260200192915050565b60006137606028836140de565b7f696e646578206d75737420626520696e2072616e6765206f662073746f72656481527f207478206c697374000000000000000000000000000000000000000000000000602082015260400192915050565b60006137bf6009836140de565b7f6e6f207472616465730000000000000000000000000000000000000000000000815260200192915050565b60006137f8600a836140de565b7f21656e645f64656c617900000000000000000000000000000000000000000000815260200192915050565b60006138316028836140de565b7f556e697377617056324c6962726172793a20494e53554646494349454e545f4c81527f4951554944495459000000000000000000000000000000000000000000000000602082015260400192915050565b60006138906022836140de565b7f6e6577207363616c696e6720666163746f722077696c6c20626520746f6f206281527f6967000000000000000000000000000000000000000000000000000000000000602082015260400192915050565b60006138ef6021836140de565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f81527f7700000000000000000000000000000000000000000000000000000000000000602082015260400192915050565b600061394e6008836140de565b7f2170656e64696e67000000000000000000000000000000000000000000000000815260200192915050565b60006139876013836140de565b7f7265626173696e67206e6f742061637469766500000000000000000000000000815260200192915050565b60006139c06023836140de565b7f4669786564506f696e743a204d554c5449504c49434154494f4e5f4f5645524681527f4c4f570000000000000000000000000000000000000000000000000000000000602082015260400192915050565b6000613a1f601d836140de565b7f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000815260200192915050565b6000613a586009836140de565b7f746f6f206561726c790000000000000000000000000000000000000000000000815260200192915050565b6000613a916008836140de565b7f746f6f206c617465000000000000000000000000000000000000000000000000815260200192915050565b6000613aca602a836140de565b7f5361666545524332303a204552433230206f7065726174696f6e20646964206e81527f6f74207375636365656400000000000000000000000000000000000000000000602082015260400192915050565b6000613b29600e836140de565b7f626164206d73672e73656e646572000000000000000000000000000000000000815260200192915050565b6000613b62602b836140de565b7f556e697377617056324c6962726172793a20494e53554646494349454e545f4981527f4e5055545f414d4f554e54000000000000000000000000000000000000000000602082015260400192915050565b6000613bc16011836140de565b7f616c726561647920616374697661746564000000000000000000000000000000815260200192915050565b6000613bfa6013836140de565b7f696e646578206f7574206f6620626f756e647300000000000000000000000000815260200192915050565b6000613c336012836140de565b7f5472616e73616374696f6e204661696c65640000000000000000000000000000815260200192915050565b6000613c6c6017836140de565b7f4669786564506f696e743a204449565f42595f5a45524f000000000000000000815260200192915050565b6000613ca5600a836140de565b7f626164206f726967696e00000000000000000000000000000000000000000000815260200192915050565b80516060830190613ce28482613d0e565b506020820151613cf56020850182613d0e565b506040820151613d086040850182613d0e565b50505050565b613594816109db565b61359481614128565b600061253a82846135db565b60208101611b84828461358b565b60408101613d48828561358b565b61253a602083018461358b565b60608101613d63828661358b565b613d70602083018561358b565b612d716040830184613d0e565b60408101613d8b828561358b565b61253a6020830184613d0e565b60208101611b84828461359a565b60608101613db4828661359a565b613dc1602083018561358b565b8181036040830152613dd381846135a3565b95945050505050565b60808101613dea82876136b2565b613df76020830186613d0e565b613e04604083018561358b565b8181036060830152613e1681846135a3565b9695505050505050565b60208082528101611b8181846135a3565b60208082528101611b84816136bb565b60208082528101611b848161371a565b60208082528101611b8481613753565b60208082528101611b84816137b2565b60208082528101611b84816137eb565b60208082528101611b8481613824565b60208082528101611b8481613883565b60208082528101611b84816138e2565b60208082528101611b8481613941565b60208082528101611b848161397a565b60208082528101611b84816139b3565b60208082528101611b8481613a12565b60208082528101611b8481613a4b565b60208082528101611b8481613a84565b60208082528101611b8481613abd565b60208082528101611b8481613b1c565b60208082528101611b8481613b55565b60208082528101611b8481613bb4565b60208082528101611b8481613bed565b60208082528101611b8481613c26565b60208082528101611b8481613c5f565b60208082528101611b8481613c98565b60608101611b848284613cd1565b60208101611b848284613d0e565b60408101613fbb8285613d0e565b8181036020830152612d71818461360a565b60808101613fdb8287613d0e565b613df760208301866136b2565b60408101613d8b8285613d0e565b606081016140048286613d0e565b6140116020830185613d0e565b612d71604083018461359a565b6080810161402c8287613d0e565b6140396020830186613d0e565b6140466040830185613d0e565b613dd36060830184613d0e565b60208101611b848284613d17565b60405181810167ffffffffffffffff8111828210171561408057600080fd5b604052919050565b600067ffffffffffffffff82111561409f57600080fd5b506020601f919091017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0160190565b60009081526020902090565b5190565b90815260200190565b919050565b6000611b848261410f565b151590565b6dffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff1690565b63ffffffff1690565b6000611b84826109db565b82818337506000910152565b60005b8381101561416357818101518382015260200161414b565b83811115613d085750506000910152565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01690565b6141a5816140ec565b811461321457600080fd5b6141a5816140f7565b6141a5816140fc565b6141a5816109db565b6141a58161412856fea365627a7a723158203fa203a06047d7f1f863d85624d656846cea22531d2f02d9865d01fd4e1217506c6578706572696d656e74616cf564736f6c63430005110040

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

000000000000000000000000c8d2ab2a6fdebc25432e54941cb85b55b9f152db000000000000000000000000df5e0e81dff6faf3a7e52ba697820c5e32d806a80000000000000000000000005c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f00000000000000000000000017388ec228ce19dac0067a6ff73a7f850528746a

-----Decoded View---------------
Arg [0] : grapAddress_ (address): 0xC8D2AB2a6FdEbC25432E54941cb85b55b9f152dB
Arg [1] : reserveToken_ (address): 0xdF5e0e81Dff6FAF3A7e52BA697820c5e32D806A8
Arg [2] : uniswap_factory (address): 0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f
Arg [3] : reservesContract_ (address): 0x17388ec228Ce19dAc0067a6Ff73a7F850528746A

-----Encoded View---------------
4 Constructor Arguments found :
Arg [0] : 000000000000000000000000c8d2ab2a6fdebc25432e54941cb85b55b9f152db
Arg [1] : 000000000000000000000000df5e0e81dff6faf3a7e52ba697820c5e32d806a8
Arg [2] : 0000000000000000000000005c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f
Arg [3] : 00000000000000000000000017388ec228ce19dac0067a6ff73a7f850528746a


Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading
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.