ETH Price: $1,794.59 (+10.19%)
Gas: 0.04 GWei
 

Overview

ETH Balance

Scroll LogoScroll LogoScroll Logo0 ETH

ETH Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Redeem47919512024-04-12 6:51:41376 days ago1712904701IN
0x95333331...95B582Ef3
0 ETH0.000153890.8471
Merge47919372024-04-12 6:50:22376 days ago1712904622IN
0x95333331...95B582Ef3
0 ETH0.000166310.85
Split47227782024-04-08 16:47:52379 days ago1712594872IN
0x95333331...95B582Ef3
0 ETH0.000283110.4725
Redeem47157872024-04-08 7:27:22380 days ago1712561242IN
0x95333331...95B582Ef3
0 ETH0.000191411.05
Transfer Ownersh...47017122024-04-07 8:09:49381 days ago1712477389IN
0x95333331...95B582Ef3
0 ETH0.000098870.7

Parent Transaction Hash Block From To
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
MaturityPrimaryMarket

Compiler Version
v0.6.12+commit.27d51765

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 17 : MaturityPrimaryMarket.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity >=0.6.10 <0.8.0;
pragma experimental ABIEncoderV2;

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

import "../utils/SafeDecimalMath.sol";

import "../interfaces/IPrimaryMarketV5.sol";
import "../interfaces/IFundV5.sol";
import "../interfaces/IFundForPrimaryMarketV4.sol";
import "../interfaces/ITrancheIndexV2.sol";

contract MaturityPrimaryMarket is IPrimaryMarketV5, ReentrancyGuard, ITrancheIndexV2, Ownable {
    event Created(address indexed account, uint256 underlying, uint256 outQ);
    event Redeemed(address indexed account, uint256 inQ, uint256 underlying, uint256 feeQ);
    event RedeemedBR(
        address indexed account,
        uint256 inB,
        uint256 inR,
        uint256 underlying,
        uint256 feeQ
    );
    event Split(address indexed account, uint256 inQ, uint256 outB, uint256 outR);
    event Merged(address indexed account, uint256 outQ, uint256 inB, uint256 inR, uint256 feeQ);
    event RedemptionQueued(address indexed account, uint256 index, uint256 underlying);
    event RedemptionPopped(uint256 count, uint256 newHead, uint256 requiredUnderlying);
    event RedemptionClaimed(address indexed account, uint256 index, uint256 underlying);
    event FundCapUpdated(uint256 newCap);
    event RedemptionFeeRateUpdated(uint256 newRedemptionFeeRate);
    event MergeFeeRateUpdated(uint256 newMergeFeeRate);

    using SafeMath for uint256;
    using SafeDecimalMath for uint256;
    using SafeERC20 for IERC20;

    struct QueuedRedemption {
        address account;
        uint256 underlying;
        uint256 previousPrefixSum;
    }

    uint256 private constant MAX_REDEMPTION_FEE_RATE = 0.01e18;
    uint256 private constant MAX_MERGE_FEE_RATE = 0.01e18;

    address public immutable override fund;
    bool public immutable redemptionFlag;
    uint256 private immutable _weightB;
    IERC20 private immutable _tokenUnderlying;

    uint256 public redemptionFeeRate;
    uint256 public mergeFeeRate;

    /// @notice The upper limit of underlying that the fund can hold. This contract rejects
    ///         creations that may break this limit.
    /// @dev This limit can be bypassed if the fund has multiple primary markets.
    ///
    ///      Set it to uint(-1) to skip the check and save gas.
    uint256 public fundCap;

    constructor(
        address fund_,
        uint256 redemptionFeeRate_,
        uint256 mergeFeeRate_,
        uint256 fundCap_,
        bool redemptionFlag_
    ) public Ownable() {
        fund = fund_;
        _tokenUnderlying = IERC20(IFundV3(fund_).tokenUnderlying());
        _updateRedemptionFeeRate(redemptionFeeRate_);
        _updateMergeFeeRate(mergeFeeRate_);
        _updateFundCap(fundCap_);
        _weightB = IFundV5(fund_).weightB();
        redemptionFlag = redemptionFlag_;
    }

    /// @notice Calculate the result of a creation.
    /// @param underlying Underlying amount spent for the creation
    /// @return outQ Created QUEEN amount
    function getCreation(uint256 underlying) public view override returns (uint256 outQ) {
        uint256 fundUnderlying = IFundV3(fund).getTotalUnderlying();
        uint256 fundEquivalentTotalQ = IFundV3(fund).getEquivalentTotalQ();
        require(fundUnderlying.add(underlying) <= fundCap, "Exceed fund cap");
        if (fundEquivalentTotalQ == 0) {
            outQ = underlying.mul(IFundV3(fund).underlyingDecimalMultiplier());
            uint256 splitRatio = IFundV3(fund).splitRatio();
            require(splitRatio != 0, "Fund is not initialized");
            uint256 settledDay = IFundV5(fund).getSettledDay();
            uint256 underlyingPrice = IFundV3(fund).twapOracle().getTwap(settledDay);
            (uint256 navB, uint256 navR) = IFundV3(fund).historicalNavs(settledDay);
            outQ = outQ.mul(underlyingPrice).div(splitRatio).divideDecimal(
                navB.mul(_weightB).add(navR)
            );
        } else {
            require(
                fundUnderlying != 0,
                "Cannot create QUEEN for fund with shares but no underlying"
            );
            outQ = underlying.mul(fundEquivalentTotalQ).div(fundUnderlying);
        }
    }

    /// @notice Calculate the amount of underlying tokens to create at least the given QUEEN amount.
    ///         This only works with non-empty fund for simplicity.
    /// @param minOutQ Minimum received QUEEN amount
    /// @return underlying Underlying amount that should be used for creation
    function getCreationForQ(uint256 minOutQ) external view override returns (uint256 underlying) {
        // Assume:
        //   minOutQ * fundUnderlying = a * fundEquivalentTotalQ - b
        // where a and b are integers and 0 <= b < fundEquivalentTotalQ
        // Then
        //   underlying = a
        //   getCreation(underlying)
        //     = floor(a * fundEquivalentTotalQ / fundUnderlying)
        //    >= floor((a * fundEquivalentTotalQ - b) / fundUnderlying)
        //     = minOutQ
        //   getCreation(underlying - 1)
        //     = floor((a * fundEquivalentTotalQ - fundEquivalentTotalQ) / fundUnderlying)
        //     < (a * fundEquivalentTotalQ - b) / fundUnderlying
        //     = minOutQ
        uint256 fundUnderlying = IFundV3(fund).getTotalUnderlying();
        uint256 fundEquivalentTotalQ = IFundV3(fund).getEquivalentTotalQ();
        require(fundEquivalentTotalQ > 0, "Cannot calculate creation for empty fund");
        return minOutQ.mul(fundUnderlying).add(fundEquivalentTotalQ - 1).div(fundEquivalentTotalQ);
    }

    function _getRedemption(uint256 inQ) private view returns (uint256 underlying) {
        uint256 fundUnderlying = IFundV3(fund).getTotalUnderlying();
        uint256 fundEquivalentTotalQ = IFundV3(fund).getEquivalentTotalQ();
        underlying = inQ.mul(fundUnderlying).div(fundEquivalentTotalQ);
    }

    /// @notice Calculate the result of a redemption.
    /// @param inQ QUEEN amount spent for the redemption
    /// @return underlying Redeemed underlying amount
    /// @return feeQ QUEEN amount charged as redemption fee
    function getRedemption(
        uint256 inQ
    ) public view override returns (uint256 underlying, uint256 feeQ) {
        feeQ = inQ.multiplyDecimal(redemptionFeeRate);
        underlying = _getRedemption(inQ - feeQ);
    }

    /// @notice Calculate the result of a redemption using BISHOP and ROOK.
    ///         Q = B / splitRatio * navB / navSum
    ///         Q = R / splitRatio * navR / navSum
    /// @param inB Spent BISHOP amount
    /// @param inR Spent ROOK amount
    /// @return underlying Redeemed underlying amount
    function getRedemptionBR(uint256 inB, uint256 inR) public view returns (uint256 underlying) {
        uint256 settledDay = IFundV5(fund).getSettledDay();
        (uint256 navB, uint256 navR) = IFundV5(fund).historicalNavs(settledDay);
        uint256 navSum = navB.mul(_weightB).add(navR);
        uint256 splitRatio = IFundV3(fund).splitRatio();
        uint256 amountQFromB = inB.mul(navB).div(navSum).divideDecimal(splitRatio);
        uint256 amountQFromR = inR.mul(navR).div(navSum).divideDecimal(splitRatio);
        // Calculate the equivalent underlying amount.
        underlying = _getRedemption(amountQFromB.add(amountQFromR));
    }

    /// @notice Calculate the amount of QUEEN that can be redeemed for at least the given amount
    ///         of underlying tokens.
    /// @dev The return value may not be the minimum solution due to rounding errors.
    /// @param minUnderlying Minimum received underlying amount
    /// @return inQ QUEEN amount that should be redeemed
    function getRedemptionForUnderlying(
        uint256 minUnderlying
    ) external view override returns (uint256 inQ) {
        // Assume:
        //   minUnderlying * fundEquivalentTotalQ = a * fundUnderlying - b
        //   a * 1e18 = c * (1e18 - redemptionFeeRate) + d
        // where
        //   a, b, c, d are integers
        //   0 <= b < fundUnderlying
        //   0 <= d < 1e18 - redemeptionFeeRate
        // Then
        //   inQAfterFee = a
        //   inQ = c
        //   getRedemption(inQ).underlying
        //     = floor((c - floor(c * redemptionFeeRate / 1e18)) * fundUnderlying / fundEquivalentTotalQ)
        //     = floor(ceil(c * (1e18 - redemptionFeeRate) / 1e18) * fundUnderlying / fundEquivalentTotalQ)
        //     = floor(((c * (1e18 - redemptionFeeRate) + d) / 1e18) * fundUnderlying / fundEquivalentTotalQ)
        //     = floor(a * fundUnderlying / fundEquivalentTotalQ)
        //     => floor((a * fundUnderlying - b) / fundEquivalentTotalQ)
        //     = minUnderlying
        uint256 fundUnderlying = IFundV3(fund).getTotalUnderlying();
        uint256 fundEquivalentTotalQ = IFundV3(fund).getEquivalentTotalQ();
        uint256 inQAfterFee = minUnderlying.mul(fundEquivalentTotalQ).add(fundUnderlying - 1).div(
            fundUnderlying
        );
        return inQAfterFee.divideDecimal(1e18 - redemptionFeeRate);
    }

    /// @notice Calculate the result of a split.
    /// @param inQ QUEEN amount to be split
    /// @return outB Received BISHOP amount
    /// @return outR Received ROOK amount
    function getSplit(uint256 inQ) public view override returns (uint256 outB, uint256 outR) {
        outR = inQ.multiplyDecimal(IFundV5(fund).splitRatio());
        outB = outR.mul(_weightB);
    }

    /// @notice Calculate the amount of QUEEN that can be split into at least the given amount of
    ///         BISHOP and ROOK.
    /// @param minOutR Received ROOK amount
    /// @return inQ QUEEN amount that should be split
    /// @return outB Received BISHOP amount
    function getSplitForR(
        uint256 minOutR
    ) external view override returns (uint256 inQ, uint256 outB) {
        uint256 splitRatio = IFundV3(fund).splitRatio();
        outB = minOutR.mul(_weightB);
        inQ = minOutR.mul(1e18).add(splitRatio.sub(1)).div(splitRatio);
    }

    /// @notice Calculate the result of a merge.
    /// @param inB Spent BISHOP amount
    /// @return inR Spent ROOK amount
    /// @return outQ Received QUEEN amount
    /// @return feeQ QUEEN amount charged as merge fee
    function getMerge(
        uint256 inB
    ) public view override returns (uint256 inR, uint256 outQ, uint256 feeQ) {
        uint256 splitRatio = IFundV5(fund).splitRatio();
        uint256 outQBeforeFee = inB.divideDecimal(splitRatio.mul(_weightB));
        feeQ = outQBeforeFee.multiplyDecimal(mergeFeeRate);
        outQ = outQBeforeFee.sub(feeQ);
        inR = outQBeforeFee.multiplyDecimal(splitRatio);
    }

    /// @notice Calculate the result of a merge using ROOK.
    /// @param inR Spent ROOK amount
    /// @return inB Spent BISHOP amount
    /// @return outQ Received QUEEN amount
    /// @return feeQ QUEEN amount charged as merge fee
    function getMergeByR(
        uint256 inR
    ) public view override returns (uint256 inB, uint256 outQ, uint256 feeQ) {
        inB = inR.mul(_weightB);
        uint256 splitRatio = IFundV5(fund).splitRatio();
        uint256 outQBeforeFee = inR.divideDecimal(splitRatio);
        feeQ = outQBeforeFee.multiplyDecimal(mergeFeeRate);
        outQ = outQBeforeFee.sub(feeQ);
    }

    /// @notice Return whether the fund can change its primary market to another contract.
    function canBeRemovedFromFund() external view override returns (bool) {
        return true;
    }

    /// @notice Create QUEEN using underlying tokens. This function should be called by
    ///         a smart contract, which transfers underlying tokens to this contract
    ///         in the same transaction.
    /// @param recipient Address that will receive created QUEEN
    /// @param minOutQ Minimum QUEEN amount to be received
    /// @param version The latest rebalance version
    /// @return outQ Received QUEEN amount
    function create(
        address recipient,
        uint256 minOutQ,
        uint256 version
    ) external override nonReentrant whenFundActive returns (uint256 outQ) {
        uint256 underlying = _tokenUnderlying.balanceOf(address(this));
        outQ = getCreation(underlying);
        require(outQ >= minOutQ && outQ > 0, "Min QUEEN created");
        IFundForPrimaryMarketV4(fund).primaryMarketMint(TRANCHE_Q, recipient, outQ, version);
        _tokenUnderlying.safeTransfer(fund, underlying);
        emit Created(recipient, underlying, outQ);
    }

    /// @notice Redeem QUEEN to get underlying tokens back. Revert if there are still some
    ///         queued redemptions that cannot be claimed now.
    /// @param recipient Address that will receive redeemed underlying tokens
    /// @param inQ Spent QUEEN amount
    /// @param minUnderlying Minimum amount of underlying tokens to be received
    /// @param version The latest rebalance version
    /// @return underlying Received underlying amount
    function redeem(
        address recipient,
        uint256 inQ,
        uint256 minUnderlying,
        uint256 version
    ) external override nonReentrant allowRedemption returns (uint256 underlying) {
        uint256 feeQ;
        (underlying, feeQ) = getRedemption(inQ);
        IFundForPrimaryMarketV4(fund).primaryMarketBurn(TRANCHE_Q, msg.sender, inQ, version);
        require(underlying >= minUnderlying && underlying > 0, "Min underlying redeemed");
        // Redundant check for user-friendly revert message.
        require(underlying <= _tokenUnderlying.balanceOf(fund), "Not enough underlying in fund");
        IFundForPrimaryMarketV4(fund).primaryMarketTransferUnderlying(recipient, underlying, feeQ);
        emit Redeemed(recipient, inQ, underlying, feeQ);
    }

    function redeemBR(
        address recipient,
        uint256 inB,
        uint256 inR,
        uint256 minUnderlying,
        uint256 version
    ) external nonReentrant allowRedemption whenFundFrozen returns (uint256 underlying) {
        underlying = getRedemptionBR(inB, inR);
        IFundForPrimaryMarketV4(fund).primaryMarketBurn(TRANCHE_B, msg.sender, inB, version);
        IFundForPrimaryMarketV4(fund).primaryMarketBurn(TRANCHE_R, msg.sender, inR, version);
        require(underlying >= minUnderlying && underlying > 0, "Min underlying redeemed");
        // Redundant check for user-friendly revert message.
        require(underlying <= _tokenUnderlying.balanceOf(fund), "Not enough underlying in fund");
        IFundForPrimaryMarketV4(fund).primaryMarketTransferUnderlying(recipient, underlying, 0);
        emit RedeemedBR(recipient, inB, inR, underlying, 0);
    }

    function redeemAndUnwrap(
        address,
        uint256,
        uint256,
        uint256
    ) external override returns (uint256) {
        revert("Not Supported");
    }

    function split(
        address recipient,
        uint256 inQ,
        uint256 version
    ) external override whenFundActive returns (uint256 outB, uint256 outR) {
        (outB, outR) = getSplit(inQ);
        IFundForPrimaryMarketV4(fund).primaryMarketBurn(TRANCHE_Q, msg.sender, inQ, version);
        IFundForPrimaryMarketV4(fund).primaryMarketMint(TRANCHE_B, recipient, outB, version);
        IFundForPrimaryMarketV4(fund).primaryMarketMint(TRANCHE_R, recipient, outR, version);
        emit Split(recipient, inQ, outB, outR);
    }

    function merge(
        address recipient,
        uint256 inB,
        uint256 version
    ) external override whenFundActive returns (uint256 outQ) {
        uint256 inR;
        uint256 feeQ;
        (inR, outQ, feeQ) = getMerge(inB);
        IFundForPrimaryMarketV4(fund).primaryMarketBurn(TRANCHE_B, msg.sender, inB, version);
        IFundForPrimaryMarketV4(fund).primaryMarketBurn(TRANCHE_R, msg.sender, inR, version);
        IFundForPrimaryMarketV4(fund).primaryMarketMint(TRANCHE_Q, recipient, outQ, version);
        IFundForPrimaryMarketV4(fund).primaryMarketAddDebtAndFee(0, feeQ);
        emit Merged(recipient, outQ, inB, inR, feeQ);
    }

    /// @dev Nothing to do for daily fund settlement.
    function settle(uint256 day) external override onlyFund {}

    function _updateFundCap(uint256 newCap) private {
        fundCap = newCap;
        emit FundCapUpdated(newCap);
    }

    function updateFundCap(uint256 newCap) external onlyOwner {
        _updateFundCap(newCap);
    }

    function _updateRedemptionFeeRate(uint256 newRedemptionFeeRate) private {
        require(newRedemptionFeeRate <= MAX_REDEMPTION_FEE_RATE, "Exceed max redemption fee rate");
        redemptionFeeRate = newRedemptionFeeRate;
        emit RedemptionFeeRateUpdated(newRedemptionFeeRate);
    }

    function updateRedemptionFeeRate(uint256 newRedemptionFeeRate) external onlyOwner {
        _updateRedemptionFeeRate(newRedemptionFeeRate);
    }

    function _updateMergeFeeRate(uint256 newMergeFeeRate) private {
        require(newMergeFeeRate <= MAX_MERGE_FEE_RATE, "Exceed max merge fee rate");
        mergeFeeRate = newMergeFeeRate;
        emit MergeFeeRateUpdated(newMergeFeeRate);
    }

    function updateMergeFeeRate(uint256 newMergeFeeRate) external onlyOwner {
        _updateMergeFeeRate(newMergeFeeRate);
    }

    modifier onlyFund() {
        require(msg.sender == fund, "Only fund");
        _;
    }

    modifier allowRedemption() {
        require(redemptionFlag, "Redemption N/A");
        _;
    }

    modifier whenFundFrozen() {
        require(IFundV5(fund).frozen(), "Fund not frozen");
        _;
    }

    modifier whenFundActive() {
        require(!IFundV5(fund).frozen(), "Fund frozen");
        _;
    }

    function queueRedemption(
        address,
        uint256,
        uint256,
        uint256
    ) external override returns (uint256, uint256) {
        revert("Not Supported");
    }

    function claimRedemptions(address, uint256[] calldata) external override returns (uint256) {
        revert("Not Supported");
    }

    function claimRedemptionsAndUnwrap(
        address,
        uint256[] calldata
    ) external override returns (uint256) {
        revert("Not Supported");
    }

    function claimRedemptionsAndUnwrapWstETH(
        address,
        uint256[] calldata
    ) external override returns (uint256) {
        revert("Not Supported");
    }

    function redeemAndUnwrapWstETH(
        address,
        uint256,
        uint256,
        uint256
    ) external override returns (uint256) {
        revert("Not Supported");
    }
}

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

pragma solidity >=0.6.0 <0.8.0;

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

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

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

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

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

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

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

File 3 of 17 : Math.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

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

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

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

File 4 of 17 : SafeMath.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

/**
 * @dev Wrappers over Solidity's arithmetic operations with added overflow
 * checks.
 *
 * Arithmetic operations in Solidity wrap on overflow. This can easily result
 * in bugs, because programmers usually assume that an overflow raises an
 * error, which is the standard behavior in high level programming languages.
 * `SafeMath` restores this intuition by reverting the transaction when an
 * operation overflows.
 *
 * Using this library instead of the unchecked operations eliminates an entire
 * class of bugs, so it's recommended to use it always.
 */
library SafeMath {
    /**
     * @dev Returns the addition of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        uint256 c = a + b;
        if (c < a) return (false, 0);
        return (true, c);
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

pragma solidity >=0.6.0 <0.8.0;

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

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

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

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

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

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

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

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

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

pragma solidity >=0.6.0 <0.8.0;

import "./IERC20.sol";
import "../../math/SafeMath.sol";
import "../../utils/Address.sol";

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

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

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

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

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

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

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

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

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

pragma solidity >=0.6.2 <0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

pragma solidity >=0.6.0 <0.8.0;

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

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

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

pragma solidity >=0.6.0 <0.8.0;

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

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

    uint256 private _status;

    constructor () internal {
        _status = _NOT_ENTERED;
    }

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

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

        _;

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

File 10 of 17 : IFundForPrimaryMarketV4.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity >=0.6.10 <0.8.0;

interface IFundForPrimaryMarketV4 {
    function primaryMarketMint(
        uint256 tranche,
        address account,
        uint256 amount,
        uint256 version
    ) external;

    function primaryMarketBurn(
        uint256 tranche,
        address account,
        uint256 amount,
        uint256 version
    ) external;

    function primaryMarketTransferUnderlying(
        address recipient,
        uint256 amount,
        uint256 feeQ
    ) external;

    function primaryMarketAddDebtAndFee(uint256 amount, uint256 feeQ) external;

    function primaryMarketPayDebt(uint256 amount) external;
}

File 11 of 17 : IFundV3.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity >=0.6.10 <0.8.0;
pragma experimental ABIEncoderV2;

import "./ITwapOracleV2.sol";

interface IFundV3 {
    /// @notice A linear transformation matrix that represents a rebalance.
    ///
    ///         ```
    ///             [        1        0        0 ]
    ///         R = [ ratioB2Q  ratioBR        0 ]
    ///             [ ratioR2Q        0  ratioBR ]
    ///         ```
    ///
    ///         Amounts of the three tranches `q`, `b` and `r` can be rebalanced by multiplying the matrix:
    ///
    ///         ```
    ///         [ q', b', r' ] = [ q, b, r ] * R
    ///         ```
    struct Rebalance {
        uint256 ratioB2Q;
        uint256 ratioR2Q;
        uint256 ratioBR;
        uint256 timestamp;
    }

    function tokenUnderlying() external view returns (address);

    function tokenQ() external view returns (address);

    function tokenB() external view returns (address);

    function tokenR() external view returns (address);

    function tokenShare(uint256 tranche) external view returns (address);

    function primaryMarket() external view returns (address);

    function primaryMarketUpdateProposal() external view returns (address, uint256);

    function strategy() external view returns (address);

    function strategyUpdateProposal() external view returns (address, uint256);

    function underlyingDecimalMultiplier() external view returns (uint256);

    function twapOracle() external view returns (ITwapOracleV2);

    function feeCollector() external view returns (address);

    function endOfDay(uint256 timestamp) external pure returns (uint256);

    function trancheTotalSupply(uint256 tranche) external view returns (uint256);

    function trancheBalanceOf(uint256 tranche, address account) external view returns (uint256);

    function trancheAllBalanceOf(address account) external view returns (uint256, uint256, uint256);

    function trancheBalanceVersion(address account) external view returns (uint256);

    function trancheAllowance(
        uint256 tranche,
        address owner,
        address spender
    ) external view returns (uint256);

    function trancheAllowanceVersion(
        address owner,
        address spender
    ) external view returns (uint256);

    function trancheTransfer(
        uint256 tranche,
        address recipient,
        uint256 amount,
        uint256 version
    ) external;

    function trancheTransferFrom(
        uint256 tranche,
        address sender,
        address recipient,
        uint256 amount,
        uint256 version
    ) external;

    function trancheApprove(
        uint256 tranche,
        address spender,
        uint256 amount,
        uint256 version
    ) external;

    function getRebalanceSize() external view returns (uint256);

    function getRebalance(uint256 index) external view returns (Rebalance memory);

    function getRebalanceTimestamp(uint256 index) external view returns (uint256);

    function currentDay() external view returns (uint256);

    function splitRatio() external view returns (uint256);

    function historicalSplitRatio(uint256 version) external view returns (uint256);

    function fundActivityStartTime() external view returns (uint256);

    function isFundActive(uint256 timestamp) external view returns (bool);

    function getEquivalentTotalB() external view returns (uint256);

    function getEquivalentTotalQ() external view returns (uint256);

    function historicalEquivalentTotalB(uint256 timestamp) external view returns (uint256);

    function historicalNavs(uint256 timestamp) external view returns (uint256 navB, uint256 navR);

    function extrapolateNav(uint256 price) external view returns (uint256, uint256, uint256);

    function doRebalance(
        uint256 amountQ,
        uint256 amountB,
        uint256 amountR,
        uint256 index
    ) external view returns (uint256 newAmountQ, uint256 newAmountB, uint256 newAmountR);

    function batchRebalance(
        uint256 amountQ,
        uint256 amountB,
        uint256 amountR,
        uint256 fromIndex,
        uint256 toIndex
    ) external view returns (uint256 newAmountQ, uint256 newAmountB, uint256 newAmountR);

    function refreshBalance(address account, uint256 targetVersion) external;

    function refreshAllowance(address owner, address spender, uint256 targetVersion) external;

    function shareTransfer(address sender, address recipient, uint256 amount) external;

    function shareTransferFrom(
        address spender,
        address sender,
        address recipient,
        uint256 amount
    ) external returns (uint256 newAllowance);

    function shareIncreaseAllowance(
        address sender,
        address spender,
        uint256 addedValue
    ) external returns (uint256 newAllowance);

    function shareDecreaseAllowance(
        address sender,
        address spender,
        uint256 subtractedValue
    ) external returns (uint256 newAllowance);

    function shareApprove(address owner, address spender, uint256 amount) external;

    function historicalUnderlying(uint256 timestamp) external view returns (uint256);

    function getTotalUnderlying() external view returns (uint256);

    function getStrategyUnderlying() external view returns (uint256);

    function getTotalDebt() external view returns (uint256);

    event RebalanceTriggered(
        uint256 indexed index,
        uint256 indexed day,
        uint256 navSum,
        uint256 navB,
        uint256 navROrZero,
        uint256 ratioB2Q,
        uint256 ratioR2Q,
        uint256 ratioBR
    );
    event Settled(uint256 indexed day, uint256 navB, uint256 navR, uint256 interestRate);
    event InterestRateUpdated(uint256 baseInterestRate, uint256 floatingInterestRate);
    event BalancesRebalanced(
        address indexed account,
        uint256 version,
        uint256 balanceQ,
        uint256 balanceB,
        uint256 balanceR
    );
    event AllowancesRebalanced(
        address indexed owner,
        address indexed spender,
        uint256 version,
        uint256 allowanceQ,
        uint256 allowanceB,
        uint256 allowanceR
    );
}

File 12 of 17 : IFundV5.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity >=0.6.10 <0.8.0;

import "./IFundV3.sol";

interface IFundV5 is IFundV3 {
    function weightB() external view returns (uint256);

    function getSettledDay() external view returns (uint256);

    function getEquivalentTotalR() external view returns (uint256);

    function frozen() external view returns (bool);
}

File 13 of 17 : IPrimaryMarketV5.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity >=0.6.10 <0.8.0;

interface IPrimaryMarketV5 {
    function fund() external view returns (address);

    function getCreation(uint256 underlying) external view returns (uint256 outQ);

    function getCreationForQ(uint256 minOutQ) external view returns (uint256 underlying);

    function getRedemption(uint256 inQ) external view returns (uint256 underlying, uint256 fee);

    function getRedemptionForUnderlying(uint256 minUnderlying) external view returns (uint256 inQ);

    function getSplit(uint256 inQ) external view returns (uint256 outB, uint256 outR);

    function getSplitForR(uint256 minOutR) external view returns (uint256 inQ, uint256 outB);

    function getMerge(uint256 inB) external view returns (uint256 inR, uint256 outQ, uint256 feeQ);

    function getMergeByR(
        uint256 inR
    ) external view returns (uint256 inB, uint256 outQ, uint256 feeQ);

    function canBeRemovedFromFund() external view returns (bool);

    function create(
        address recipient,
        uint256 minOutQ,
        uint256 version
    ) external returns (uint256 outQ);

    function redeem(
        address recipient,
        uint256 inQ,
        uint256 minUnderlying,
        uint256 version
    ) external returns (uint256 underlying);

    function redeemAndUnwrap(
        address recipient,
        uint256 inQ,
        uint256 minUnderlying,
        uint256 version
    ) external returns (uint256 underlying);

    function redeemAndUnwrapWstETH(
        address recipient,
        uint256 inQ,
        uint256 minStETH,
        uint256 version
    ) external returns (uint256 stETHAmount);

    function queueRedemption(
        address recipient,
        uint256 inQ,
        uint256 minUnderlying,
        uint256 version
    ) external returns (uint256 underlying, uint256 index);

    function claimRedemptions(
        address account,
        uint256[] calldata indices
    ) external returns (uint256 underlying);

    function claimRedemptionsAndUnwrap(
        address account,
        uint256[] calldata indices
    ) external returns (uint256 underlying);

    function claimRedemptionsAndUnwrapWstETH(
        address account,
        uint256[] calldata indices
    ) external returns (uint256 stETHAmount);

    function split(
        address recipient,
        uint256 inQ,
        uint256 version
    ) external returns (uint256 outB, uint256 outR);

    function merge(address recipient, uint256 inB, uint256 version) external returns (uint256 outQ);

    function settle(uint256 day) external;
}

File 14 of 17 : ITrancheIndexV2.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity >=0.6.10 <0.8.0;

/// @notice Amounts of QUEEN, BISHOP and ROOK are sometimes stored in a `uint256[3]` array.
///         This contract defines index of each tranche in this array.
///
///         Solidity does not allow constants to be defined in interfaces. So this contract follows
///         the naming convention of interfaces but is implemented as an `abstract contract`.
abstract contract ITrancheIndexV2 {
    uint256 internal constant TRANCHE_Q = 0;
    uint256 internal constant TRANCHE_B = 1;
    uint256 internal constant TRANCHE_R = 2;

    uint256 internal constant TRANCHE_COUNT = 3;
}

File 15 of 17 : ITwapOracle.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity >=0.6.10 <0.8.0;

interface ITwapOracle {
    enum UpdateType {
        PRIMARY,
        SECONDARY,
        OWNER,
        CHAINLINK,
        UNISWAP_V2
    }

    function getTwap(uint256 timestamp) external view returns (uint256);
}

File 16 of 17 : ITwapOracleV2.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity >=0.6.10 <0.8.0;

import "./ITwapOracle.sol";

interface ITwapOracleV2 is ITwapOracle {
    function getLatest() external view returns (uint256);
}

File 17 of 17 : SafeDecimalMath.sol
// SPDX-License-Identifier: MIT
//
// Copyright (c) 2019 Synthetix
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
pragma solidity >=0.6.10 <0.8.0;

import "@openzeppelin/contracts/math/SafeMath.sol";

library SafeDecimalMath {
    using SafeMath for uint256;

    /* Number of decimal places in the representations. */
    uint256 private constant decimals = 18;
    uint256 private constant highPrecisionDecimals = 27;

    /* The number representing 1.0. */
    uint256 private constant UNIT = 10 ** uint256(decimals);

    /* The number representing 1.0 for higher fidelity numbers. */
    uint256 private constant PRECISE_UNIT = 10 ** uint256(highPrecisionDecimals);
    uint256 private constant UNIT_TO_HIGH_PRECISION_CONVERSION_FACTOR =
        10 ** uint256(highPrecisionDecimals - decimals);

    /**
     * @return The result of multiplying x and y, interpreting the operands as fixed-point
     * decimals.
     *
     * @dev A unit factor is divided out after the product of x and y is evaluated,
     * so that product must be less than 2**256. As this is an integer division,
     * the internal division always rounds down. This helps save on gas. Rounding
     * is more expensive on gas.
     */
    function multiplyDecimal(uint256 x, uint256 y) internal pure returns (uint256) {
        /* Divide by UNIT to remove the extra factor introduced by the product. */
        return x.mul(y).div(UNIT);
    }

    function multiplyDecimalPrecise(uint256 x, uint256 y) internal pure returns (uint256) {
        /* Divide by UNIT to remove the extra factor introduced by the product. */
        return x.mul(y).div(PRECISE_UNIT);
    }

    /**
     * @return The result of safely dividing x and y. The return value is a high
     * precision decimal.
     *
     * @dev y is divided after the product of x and the standard precision unit
     * is evaluated, so the product of x and UNIT must be less than 2**256. As
     * this is an integer division, the result is always rounded down.
     * This helps save on gas. Rounding is more expensive on gas.
     */
    function divideDecimal(uint256 x, uint256 y) internal pure returns (uint256) {
        /* Reintroduce the UNIT factor that will be divided out by y. */
        return x.mul(UNIT).div(y);
    }

    function divideDecimalPrecise(uint256 x, uint256 y) internal pure returns (uint256) {
        /* Reintroduce the UNIT factor that will be divided out by y. */
        return x.mul(PRECISE_UNIT).div(y);
    }

    /**
     * @dev Convert a standard decimal representation to a high precision one.
     */
    function decimalToPreciseDecimal(uint256 i) internal pure returns (uint256) {
        return i.mul(UNIT_TO_HIGH_PRECISION_CONVERSION_FACTOR);
    }

    /**
     * @dev Convert a high precision decimal to a standard decimal representation.
     */
    function preciseDecimalToDecimal(uint256 i) internal pure returns (uint256) {
        uint256 quotientTimesTen = i.mul(10).div(UNIT_TO_HIGH_PRECISION_CONVERSION_FACTOR);

        if (quotientTimesTen % 10 >= 5) {
            quotientTimesTen = quotientTimesTen.add(10);
        }

        return quotientTimesTen.div(10);
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, and the max value of
     * uint256 on overflow.
     */
    function saturatingMul(uint256 a, uint256 b) internal pure returns (uint256) {
        if (a == 0) {
            return 0;
        }
        uint256 c = a * b;
        return c / a != b ? type(uint256).max : c;
    }

    function saturatingMultiplyDecimal(uint256 x, uint256 y) internal pure returns (uint256) {
        /* Divide by UNIT to remove the extra factor introduced by the product. */
        return saturatingMul(x, y).div(UNIT);
    }
}

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

Contract Security Audit

Contract ABI

API
[{"inputs":[{"internalType":"address","name":"fund_","type":"address"},{"internalType":"uint256","name":"redemptionFeeRate_","type":"uint256"},{"internalType":"uint256","name":"mergeFeeRate_","type":"uint256"},{"internalType":"uint256","name":"fundCap_","type":"uint256"},{"internalType":"bool","name":"redemptionFlag_","type":"bool"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"underlying","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"outQ","type":"uint256"}],"name":"Created","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newCap","type":"uint256"}],"name":"FundCapUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newMergeFeeRate","type":"uint256"}],"name":"MergeFeeRateUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"outQ","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"inB","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"inR","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"feeQ","type":"uint256"}],"name":"Merged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"inQ","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"underlying","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"feeQ","type":"uint256"}],"name":"Redeemed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"inB","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"inR","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"underlying","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"feeQ","type":"uint256"}],"name":"RedeemedBR","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"index","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"underlying","type":"uint256"}],"name":"RedemptionClaimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newRedemptionFeeRate","type":"uint256"}],"name":"RedemptionFeeRateUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"count","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newHead","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"requiredUnderlying","type":"uint256"}],"name":"RedemptionPopped","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"index","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"underlying","type":"uint256"}],"name":"RedemptionQueued","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"inQ","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"outB","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"outR","type":"uint256"}],"name":"Split","type":"event"},{"inputs":[],"name":"canBeRemovedFromFund","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256[]","name":"","type":"uint256[]"}],"name":"claimRedemptions","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256[]","name":"","type":"uint256[]"}],"name":"claimRedemptionsAndUnwrap","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256[]","name":"","type":"uint256[]"}],"name":"claimRedemptionsAndUnwrapWstETH","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"minOutQ","type":"uint256"},{"internalType":"uint256","name":"version","type":"uint256"}],"name":"create","outputs":[{"internalType":"uint256","name":"outQ","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"fund","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"fundCap","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"underlying","type":"uint256"}],"name":"getCreation","outputs":[{"internalType":"uint256","name":"outQ","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"minOutQ","type":"uint256"}],"name":"getCreationForQ","outputs":[{"internalType":"uint256","name":"underlying","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"inB","type":"uint256"}],"name":"getMerge","outputs":[{"internalType":"uint256","name":"inR","type":"uint256"},{"internalType":"uint256","name":"outQ","type":"uint256"},{"internalType":"uint256","name":"feeQ","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"inR","type":"uint256"}],"name":"getMergeByR","outputs":[{"internalType":"uint256","name":"inB","type":"uint256"},{"internalType":"uint256","name":"outQ","type":"uint256"},{"internalType":"uint256","name":"feeQ","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"inQ","type":"uint256"}],"name":"getRedemption","outputs":[{"internalType":"uint256","name":"underlying","type":"uint256"},{"internalType":"uint256","name":"feeQ","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"inB","type":"uint256"},{"internalType":"uint256","name":"inR","type":"uint256"}],"name":"getRedemptionBR","outputs":[{"internalType":"uint256","name":"underlying","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"minUnderlying","type":"uint256"}],"name":"getRedemptionForUnderlying","outputs":[{"internalType":"uint256","name":"inQ","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"inQ","type":"uint256"}],"name":"getSplit","outputs":[{"internalType":"uint256","name":"outB","type":"uint256"},{"internalType":"uint256","name":"outR","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"minOutR","type":"uint256"}],"name":"getSplitForR","outputs":[{"internalType":"uint256","name":"inQ","type":"uint256"},{"internalType":"uint256","name":"outB","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"inB","type":"uint256"},{"internalType":"uint256","name":"version","type":"uint256"}],"name":"merge","outputs":[{"internalType":"uint256","name":"outQ","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"mergeFeeRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"queueRedemption","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"inQ","type":"uint256"},{"internalType":"uint256","name":"minUnderlying","type":"uint256"},{"internalType":"uint256","name":"version","type":"uint256"}],"name":"redeem","outputs":[{"internalType":"uint256","name":"underlying","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"redeemAndUnwrap","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"redeemAndUnwrapWstETH","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"inB","type":"uint256"},{"internalType":"uint256","name":"inR","type":"uint256"},{"internalType":"uint256","name":"minUnderlying","type":"uint256"},{"internalType":"uint256","name":"version","type":"uint256"}],"name":"redeemBR","outputs":[{"internalType":"uint256","name":"underlying","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"redemptionFeeRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"redemptionFlag","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"day","type":"uint256"}],"name":"settle","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"inQ","type":"uint256"},{"internalType":"uint256","name":"version","type":"uint256"}],"name":"split","outputs":[{"internalType":"uint256","name":"outB","type":"uint256"},{"internalType":"uint256","name":"outR","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newCap","type":"uint256"}],"name":"updateFundCap","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newMergeFeeRate","type":"uint256"}],"name":"updateMergeFeeRate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newRedemptionFeeRate","type":"uint256"}],"name":"updateRedemptionFeeRate","outputs":[],"stateMutability":"nonpayable","type":"function"}]

6101006040523480156200001257600080fd5b506040516200389a3803806200389a833981016040819052620000359162000336565b6001600090815562000046620001e2565b600180546001600160a01b0319166001600160a01b038316908117909155604051919250906000907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a350846001600160a01b03166080816001600160a01b031660601b81525050846001600160a01b031663db77e2b26040518163ffffffff1660e01b815260040160206040518083038186803b158015620000eb57600080fd5b505afa15801562000100573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000126919062000311565b60601b6001600160601b03191660e0526200014184620001e6565b6200014c836200025b565b6200015782620002bc565b846001600160a01b031663f42b68bb6040518163ffffffff1660e01b815260040160206040518083038186803b1580156200019157600080fd5b505afa158015620001a6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620001cc919062000392565b60c052151560f81b60a052506200042292505050565b3390565b662386f26fc10000811115620002195760405162461bcd60e51b81526004016200021090620003e2565b60405180910390fd5b60028190556040517f022ca5430126894b100ba72a73d93970f2795276b07a287e0ff2a7342131e180906200025090839062000419565b60405180910390a150565b662386f26fc10000811115620002855760405162461bcd60e51b81526004016200021090620003ab565b60038190556040517f68ee6a600c8d4c88d1b96f8ad76fbfdf767cc89ecf54d91da8e297fa1f53126e906200025090839062000419565b60048190556040517f2bf8fcc3a5c1c15d79911403f6216aee8166879c976a9cc7a3d1b84cf6131132906200025090839062000419565b80516001600160a01b03811681146200030b57600080fd5b92915050565b60006020828403121562000323578081fd5b6200032f8383620002f3565b9392505050565b600080600080600060a086880312156200034e578081fd5b6200035a8787620002f3565b94506020860151935060408601519250606086015191506080860151801515811462000384578182fd5b809150509295509295909350565b600060208284031215620003a4578081fd5b5051919050565b60208082526019908201527f457863656564206d6178206d6572676520666565207261746500000000000000604082015260600190565b6020808252601e908201527f457863656564206d617820726564656d7074696f6e2066656520726174650000604082015260600190565b90815260200190565b60805160601c60a05160f81c60c05160e05160601c61333a6200056060003980610ac05280610c1052806110a4528061206352508061057e52806109a75280610cb352806116255280611cf35280612408525080610e62528061153b5280611f505250806104e752806105e052806106b8528061073b52806107c05280610845528061090952806109fa5280610b955280610c345280610cdd5280610e9f5280610f6e5280610ff152806110d1528061117f528061124c528061131d52806113a0528061142552806114fc528061155f5280611589528061168f528061172452806117f8528061188d528061195452806119f05280611aa25280611b375280611c485280611dbc5280611e515280611fb25280612090528061213e52806122c8528061235e5280612432528061257d5280612612525061333a6000f3fe608060405234801561001057600080fd5b50600436106101fa5760003560e01c80638d8ee8de1161011a578063c6fdbc90116100ad578063ea2092f31161007c578063ea2092f3146103d7578063ed5614b6146103ea578063f2fde38b146103f2578063fd5e3cdd14610405578063fdf7c9b514610418576101fa565b8063c6fdbc9014610396578063d4149395146103a9578063d89c5caf146103bc578063e39c9c8c146103c4576101fa565b8063b18ac0dc116100e9578063b18ac0dc14610229578063b60d428814610368578063b65d3e2514610370578063bb1987b914610383576101fa565b80638d8ee8de146102295780638da5cb5b146103385780638df828001461034d578063acc14e7214610360576101fa565b8063514a681011610192578063715018a611610161578063715018a6146103025780637c8b2e0b1461030a57806389dc22cf1461031d5780638afbc1ed14610325576101fa565b8063514a6810146102a55780635165da30146102b85780635e1e8db3146102cb5780636c8fcfa2146102ed576101fa565b806321e1f4f3116101ce57806321e1f4f31461026a5780632d961f9214610249578063450018f31461027f578063463dcf0a14610292576101fa565b8062e2c321146101ff57806312274ee614610229578063151dad34146102495780631953cc2114610257575b600080fd5b61021261020d366004612b53565b61042b565b604051610220929190612cf5565b60405180910390f35b61023c610237366004612a9d565b61044f565b6040516102209190613261565b61023c610237366004612b53565b610212610265366004612c0c565b610469565b61027d610278366004612c0c565b610495565b005b61021261028d366004612c0c565b6104e0565b61023c6102a0366004612b1f565b6105dc565b6102126102b3366004612c0c565b610901565b61023c6102c6366004612b1f565b6109cb565b6102de6102d9366004612c0c565b610ca9565b6040516102209392919061328e565b6102f5610da8565b6040516102209190612cea565b61027d610dad565b61023c610318366004612b8d565b610e36565b61023c611241565b610212610333366004612b1f565b611247565b6103406114e2565b6040516102209190612c9c565b61027d61035b366004612c0c565b6114f1565b6102f5611539565b61034061155d565b6102de61037e366004612c0c565b611581565b61023c610391366004612c0c565b61168a565b61023c6103a4366004612c0c565b6117f3565b61027d6103b7366004612c0c565b611d69565b61023c611db1565b61023c6103d2366004612c0c565b611db7565b61023c6103e5366004612b53565b611f24565b61023c6121fc565b61027d610400366004612a81565b612202565b61023c610413366004612c3c565b6122c3565b61027d610426366004612c0c565b61250f565b60008060405162461bcd60e51b815260040161044690613103565b60405180910390fd5b600060405162461bcd60e51b815260040161044690613103565b6000806104816002548461255790919063ffffffff16565b905061048e818403612578565b9150915091565b61049d6126b1565b6001600160a01b03166104ae6114e2565b6001600160a01b0316146104d45760405162461bcd60e51b815260040161044690613074565b6104dd816126b5565b50565b60008060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316635c59f3bb6040518163ffffffff1660e01b815260040160206040518083038186803b15801561053e57600080fd5b505afa158015610552573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105769190612c24565b90506105a2847f00000000000000000000000000000000000000000000000000000000000000006126f5565b91506105d4816105ce6105b682600161272f565b6105c888670de0b6b3a76400006126f5565b90612757565b9061277c565b925050915091565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663054f7d9c6040518163ffffffff1660e01b815260040160206040518083038186803b15801561063757600080fd5b505afa15801561064b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061066f9190612bd0565b1561068c5760405162461bcd60e51b815260040161044690612efd565b60008061069885611581565b60405163053454e760e11b81529195509193509091506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690630a68a9ce906106f49060019033908a908a9060040161326a565b600060405180830381600087803b15801561070e57600080fd5b505af1158015610722573d6000803e3d6000fd5b505060405163053454e760e11b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169250630a68a9ce915061077990600290339087908a9060040161326a565b600060405180830381600087803b15801561079357600080fd5b505af11580156107a7573d6000803e3d6000fd5b505060405163575ec3c560e11b81526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016925063aebd878a91506107fe906000908a9088908a9060040161326a565b600060405180830381600087803b15801561081857600080fd5b505af115801561082c573d6000803e3d6000fd5b505060405163846f1f4960e01b81526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016925063846f1f49915061087f906000908590600401612cf5565b600060405180830381600087803b15801561089957600080fd5b505af11580156108ad573d6000803e3d6000fd5b50505050856001600160a01b03167f8f9b65c4201143c15e345350ae2fbcb591a753d71eb2a62b3f804db0d26c242c848785856040516108f094939291906132a4565b60405180910390a250509392505050565b60008061099f7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316635c59f3bb6040518163ffffffff1660e01b815260040160206040518083038186803b15801561096057600080fd5b505afa158015610974573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109989190612c24565b8490612557565b905061048e817f00000000000000000000000000000000000000000000000000000000000000006126f5565b6000600260005414156109f05760405162461bcd60e51b8152600401610446906131ab565b60026000819055507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663054f7d9c6040518163ffffffff1660e01b815260040160206040518083038186803b158015610a5157600080fd5b505afa158015610a65573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a899190612bd0565b15610aa65760405162461bcd60e51b815260040161044690612efd565b6040516370a0823160e01b81526000906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906370a0823190610af5903090600401612c9c565b60206040518083038186803b158015610b0d57600080fd5b505afa158015610b21573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b459190612c24565b9050610b50816117f3565b9150838210158015610b625750600082115b610b7e5760405162461bcd60e51b815260040161044690613049565b60405163575ec3c560e11b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063aebd878a90610bd19060009089908790899060040161326a565b600060405180830381600087803b158015610beb57600080fd5b505af1158015610bff573d6000803e3d6000fd5b50610c599250506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690507f0000000000000000000000000000000000000000000000000000000000000000836127ae565b846001600160a01b03167f95b18bbe5373dcbe675d3ab2ae6e3888392575c51b8b8c9c3cbbdb431af192998284604051610c94929190612cf5565b60405180910390a25060016000559392505050565b60008080610cd7847f00000000000000000000000000000000000000000000000000000000000000006126f5565b925060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316635c59f3bb6040518163ffffffff1660e01b815260040160206040518083038186803b158015610d3457600080fd5b505afa158015610d48573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d6c9190612c24565b90506000610d7a8683612809565b9050610d916003548261255790919063ffffffff16565b9250610d9d818461272f565b935050509193909250565b600190565b610db56126b1565b6001600160a01b0316610dc66114e2565b6001600160a01b031614610dec5760405162461bcd60e51b815260040161044690613074565b6001546040516000916001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600180546001600160a01b0319169055565b600060026000541415610e5b5760405162461bcd60e51b8152600401610446906131ab565b60026000557f0000000000000000000000000000000000000000000000000000000000000000610e9d5760405162461bcd60e51b815260040161044690612e21565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663054f7d9c6040518163ffffffff1660e01b815260040160206040518083038186803b158015610ef657600080fd5b505afa158015610f0a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f2e9190612bd0565b610f4a5760405162461bcd60e51b815260040161044690612fdf565b610f5485856122c3565b60405163053454e760e11b81529091506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690630a68a9ce90610faa9060019033908a90889060040161326a565b600060405180830381600087803b158015610fc457600080fd5b505af1158015610fd8573d6000803e3d6000fd5b505060405163053454e760e11b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169250630a68a9ce915061102f9060029033908990889060040161326a565b600060405180830381600087803b15801561104957600080fd5b505af115801561105d573d6000803e3d6000fd5b505050508281101580156110715750600081115b61108d5760405162461bcd60e51b8152600401610446906131e2565b6040516370a0823160e01b81526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906370a08231906110f9907f000000000000000000000000000000000000000000000000000000000000000090600401612c9c565b60206040518083038186803b15801561111157600080fd5b505afa158015611125573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111499190612c24565b8111156111685760405162461bcd60e51b815260040161044690612e49565b60405163539b4c2d60e11b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063a736985a906111b99089908590600090600401612cc9565b600060405180830381600087803b1580156111d357600080fd5b505af11580156111e7573d6000803e3d6000fd5b50505050856001600160a01b03167fcec6b7ea6185e3b54a41256f271619f1edd28ce6bcea7473af5d4a9d0a37b1b6868684600060405161122b94939291906132a4565b60405180910390a2600160005595945050505050565b60035481565b6000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663054f7d9c6040518163ffffffff1660e01b815260040160206040518083038186803b1580156112a357600080fd5b505afa1580156112b7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112db9190612bd0565b156112f85760405162461bcd60e51b815260040161044690612efd565b61130184610901565b60405163053454e760e11b815291935091506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690630a68a9ce906113599060009033908990899060040161326a565b600060405180830381600087803b15801561137357600080fd5b505af1158015611387573d6000803e3d6000fd5b505060405163575ec3c560e11b81526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016925063aebd878a91506113de9060019089908790899060040161326a565b600060405180830381600087803b1580156113f857600080fd5b505af115801561140c573d6000803e3d6000fd5b505060405163575ec3c560e11b81526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016925063aebd878a91506114639060029089908690899060040161326a565b600060405180830381600087803b15801561147d57600080fd5b505af1158015611491573d6000803e3d6000fd5b50505050846001600160a01b03167ff66885c33d648fcd0d97e0f2a18e30102169c22763473af0fb716f11b4a17dd68584846040516114d29392919061328e565b60405180910390a2935093915050565b6001546001600160a01b031690565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146104dd5760405162461bcd60e51b8152600401610446906130a9565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b6000806000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316635c59f3bb6040518163ffffffff1660e01b815260040160206040518083038186803b1580156115e057600080fd5b505afa1580156115f4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116189190612c24565b90506000611650611649837f00000000000000000000000000000000000000000000000000000000000000006126f5565b8790612809565b90506116676003548261255790919063ffffffff16565b9250611673818461272f565b935061167f8183612557565b945050509193909250565b6000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663b40494e56040518163ffffffff1660e01b815260040160206040518083038186803b1580156116e657600080fd5b505afa1580156116fa573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061171e9190612c24565b905060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166312e778b66040518163ffffffff1660e01b815260040160206040518083038186803b15801561177b57600080fd5b505afa15801561178f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117b39190612c24565b9050600081116117d55760405162461bcd60e51b815260040161044690613219565b6117eb816105ce60001982016105c888876126f5565b949350505050565b6000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663b40494e56040518163ffffffff1660e01b815260040160206040518083038186803b15801561184f57600080fd5b505afa158015611863573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118879190612c24565b905060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166312e778b66040518163ffffffff1660e01b815260040160206040518083038186803b1580156118e457600080fd5b505afa1580156118f8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061191c9190612c24565b60045490915061192c8386612757565b111561194a5760405162461bcd60e51b815260040161044690612f59565b80611d37576119ea7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663094fc9216040518163ffffffff1660e01b815260040160206040518083038186803b1580156119ab57600080fd5b505afa1580156119bf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119e39190612c24565b85906126f5565b925060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316635c59f3bb6040518163ffffffff1660e01b815260040160206040518083038186803b158015611a4757600080fd5b505afa158015611a5b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a7f9190612c24565b905080611a9e5760405162461bcd60e51b815260040161044690612d7c565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663dee1c6be6040518163ffffffff1660e01b815260040160206040518083038186803b158015611af957600080fd5b505afa158015611b0d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b319190612c24565b905060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316639043292a6040518163ffffffff1660e01b815260040160206040518083038186803b158015611b8e57600080fd5b505afa158015611ba2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bc69190612bf0565b6001600160a01b0316639f057151836040518263ffffffff1660e01b8152600401611bf19190613261565b60206040518083038186803b158015611c0957600080fd5b505afa158015611c1d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c419190612c24565b90506000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663eed9a179856040518263ffffffff1660e01b8152600401611c929190613261565b604080518083038186803b158015611ca957600080fd5b505afa158015611cbd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ce19190612c5d565b9092509050611d2b611d17826105c8857f00000000000000000000000000000000000000000000000000000000000000006126f5565b611d25876105ce8c886126f5565b90612809565b97505050505050611d62565b81611d545760405162461bcd60e51b815260040161044690612f82565b6117eb826105ce86846126f5565b5050919050565b611d716126b1565b6001600160a01b0316611d826114e2565b6001600160a01b031614611da85760405162461bcd60e51b815260040161044690613074565b6104dd81612821565b60045481565b6000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663b40494e56040518163ffffffff1660e01b815260040160206040518083038186803b158015611e1357600080fd5b505afa158015611e27573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e4b9190612c24565b905060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166312e778b66040518163ffffffff1660e01b815260040160206040518083038186803b158015611ea857600080fd5b505afa158015611ebc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ee09190612c24565b90506000611efa836105ce60001982016105c889876126f5565b9050611f1b600254670de0b6b3a7640000038261280990919063ffffffff16565b95945050505050565b600060026000541415611f495760405162461bcd60e51b8152600401610446906131ab565b60026000557f0000000000000000000000000000000000000000000000000000000000000000611f8b5760405162461bcd60e51b815260040161044690612e21565b6000611f9685610469565b60405163053454e760e11b815291935091506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690630a68a9ce90611fee9060009033908a90899060040161326a565b600060405180830381600087803b15801561200857600080fd5b505af115801561201c573d6000803e3d6000fd5b505050508382101580156120305750600082115b61204c5760405162461bcd60e51b8152600401610446906131e2565b6040516370a0823160e01b81526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906370a08231906120b8907f000000000000000000000000000000000000000000000000000000000000000090600401612c9c565b60206040518083038186803b1580156120d057600080fd5b505afa1580156120e4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121089190612c24565b8211156121275760405162461bcd60e51b815260040161044690612e49565b60405163539b4c2d60e11b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063a736985a9061217790899086908690600401612cc9565b600060405180830381600087803b15801561219157600080fd5b505af11580156121a5573d6000803e3d6000fd5b50505050856001600160a01b03167f484c40561359f3e3b8be9101897f8680aa82fbe1df9fd9038e0dbc62840326468684846040516121e69392919061328e565b60405180910390a2506001600055949350505050565b60025481565b61220a6126b1565b6001600160a01b031661221b6114e2565b6001600160a01b0316146122415760405162461bcd60e51b815260040161044690613074565b6001600160a01b0381166122675760405162461bcd60e51b815260040161044690612d36565b6001546040516001600160a01b038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3600180546001600160a01b0319166001600160a01b0392909216919091179055565b6000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663dee1c6be6040518163ffffffff1660e01b815260040160206040518083038186803b15801561231f57600080fd5b505afa158015612333573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123579190612c24565b90506000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663eed9a179846040518263ffffffff1660e01b81526004016123a89190613261565b604080518083038186803b1580156123bf57600080fd5b505afa1580156123d3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123f79190612c5d565b9092509050600061242c826105c8857f00000000000000000000000000000000000000000000000000000000000000006126f5565b905060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316635c59f3bb6040518163ffffffff1660e01b815260040160206040518083038186803b15801561248957600080fd5b505afa15801561249d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124c19190612c24565b905060006124d782611d25856105ce8d8a6126f5565b905060006124ed83611d25866105ce8d8a6126f5565b90506125016124fc8383612757565b612578565b9a9950505050505050505050565b6125176126b1565b6001600160a01b03166125286114e2565b6001600160a01b03161461254e5760405162461bcd60e51b815260040161044690613074565b6104dd8161287d565b600061256f670de0b6b3a76400006105ce85856126f5565b90505b92915050565b6000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663b40494e56040518163ffffffff1660e01b815260040160206040518083038186803b1580156125d457600080fd5b505afa1580156125e8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061260c9190612c24565b905060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166312e778b66040518163ffffffff1660e01b815260040160206040518083038186803b15801561266957600080fd5b505afa15801561267d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126a19190612c24565b90506117eb816105ce86856126f5565b3390565b60048190556040517f2bf8fcc3a5c1c15d79911403f6216aee8166879c976a9cc7a3d1b84cf6131132906126ea908390613261565b60405180910390a150565b60008261270457506000612572565b8282028284828161271157fe5b041461256f5760405162461bcd60e51b815260040161044690613008565b6000828211156127515760405162461bcd60e51b815260040161044690612e80565b50900390565b60008282018381101561256f5760405162461bcd60e51b815260040161044690612db3565b600080821161279d5760405162461bcd60e51b815260040161044690612f22565b8183816127a657fe5b049392505050565b6128048363a9059cbb60e01b84846040516024016127cd929190612cb0565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526128d9565b505050565b600061256f826105ce85670de0b6b3a76400006126f5565b662386f26fc100008111156128485760405162461bcd60e51b815260040161044690612dea565b60038190556040517f68ee6a600c8d4c88d1b96f8ad76fbfdf767cc89ecf54d91da8e297fa1f53126e906126ea908390613261565b662386f26fc100008111156128a45760405162461bcd60e51b81526004016104469061312a565b60028190556040517f022ca5430126894b100ba72a73d93970f2795276b07a287e0ff2a7342131e180906126ea908390613261565b606061292e826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166129689092919063ffffffff16565b805190915015612804578080602001905181019061294c9190612bd0565b6128045760405162461bcd60e51b815260040161044690613161565b60606129778484600085612981565b90505b9392505050565b6060824710156129a35760405162461bcd60e51b815260040161044690612eb7565b6129ac85612a42565b6129c85760405162461bcd60e51b8152600401610446906130cc565b60006060866001600160a01b031685876040516129e59190612c80565b60006040518083038185875af1925050503d8060008114612a22576040519150601f19603f3d011682016040523d82523d6000602084013e612a27565b606091505b5091509150612a37828286612a48565b979650505050505050565b3b151590565b60608315612a5757508161297a565b825115612a675782518084602001fd5b8160405162461bcd60e51b81526004016104469190612d03565b600060208284031215612a92578081fd5b813561256f816132ef565b600080600060408486031215612ab1578182fd5b8335612abc816132ef565b9250602084013567ffffffffffffffff80821115612ad8578384fd5b818601915086601f830112612aeb578384fd5b813581811115612af9578485fd5b8760208083028501011115612b0c578485fd5b6020830194508093505050509250925092565b600080600060608486031215612b33578283fd5b8335612b3e816132ef565b95602085013595506040909401359392505050565b60008060008060808587031215612b68578081fd5b8435612b73816132ef565b966020860135965060408601359560600135945092505050565b600080600080600060a08688031215612ba4578081fd5b8535612baf816132ef565b97602087013597506040870135966060810135965060800135945092505050565b600060208284031215612be1578081fd5b8151801515811461256f578182fd5b600060208284031215612c01578081fd5b815161256f816132ef565b600060208284031215612c1d578081fd5b5035919050565b600060208284031215612c35578081fd5b5051919050565b60008060408385031215612c4e578182fd5b50508035926020909101359150565b60008060408385031215612c6f578182fd5b505080516020909101519092909150565b60008251612c928184602087016132bf565b9190910192915050565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b039390931683526020830191909152604082015260600190565b901515815260200190565b918252602082015260400190565b6000602082528251806020840152612d228160408501602087016132bf565b601f01601f19169190910160400192915050565b60208082526026908201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160408201526564647265737360d01b606082015260800190565b60208082526017908201527f46756e64206973206e6f7420696e697469616c697a6564000000000000000000604082015260600190565b6020808252601b908201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604082015260600190565b60208082526019908201527f457863656564206d6178206d6572676520666565207261746500000000000000604082015260600190565b6020808252600e908201526d526564656d7074696f6e204e2f4160901b604082015260600190565b6020808252601d908201527f4e6f7420656e6f75676820756e6465726c79696e6720696e2066756e64000000604082015260600190565b6020808252601e908201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604082015260600190565b60208082526026908201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6040820152651c8818d85b1b60d21b606082015260800190565b6020808252600b908201526a233ab73210333937bd32b760a91b604082015260600190565b6020808252601a908201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604082015260600190565b6020808252600f908201526e04578636565642066756e642063617608c1b604082015260600190565b6020808252603a908201527f43616e6e6f742063726561746520515545454e20666f722066756e642077697460408201527f682073686172657320627574206e6f20756e6465726c79696e67000000000000606082015260800190565b6020808252600f908201526e233ab732103737ba10333937bd32b760891b604082015260600190565b60208082526021908201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6040820152607760f81b606082015260800190565b602080825260119082015270135a5b8814555151538818dc99585d1959607a1b604082015260600190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526009908201526813db9b1e48199d5b9960ba1b604082015260600190565b6020808252601d908201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604082015260600190565b6020808252600d908201526c139bdd0814dd5c1c1bdc9d1959609a1b604082015260600190565b6020808252601e908201527f457863656564206d617820726564656d7074696f6e2066656520726174650000604082015260600190565b6020808252602a908201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6040820152691bdd081cdd58d8d9595960b21b606082015260800190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b60208082526017908201527f4d696e20756e6465726c79696e672072656465656d6564000000000000000000604082015260600190565b60208082526028908201527f43616e6e6f742063616c63756c617465206372656174696f6e20666f7220656d6040820152671c1d1e48199d5b9960c21b606082015260800190565b90815260200190565b9384526001600160a01b039290921660208401526040830152606082015260800190565b9283526020830191909152604082015260600190565b93845260208401929092526040830152606082015260800190565b60005b838110156132da5781810151838201526020016132c2565b838111156132e9576000848401525b50505050565b6001600160a01b03811681146104dd57600080fdfea2646970667358221220528ccf2506093a938d08db0966c8485dd8deed3bfc037560b0f79518e6997f7a64736f6c634300060c00330000000000000000000000005956f0d618b8a4f8c5473f3804918e7fa7f4fa8d00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000000000000000000000000000000000000000000000000000000000000001

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106101fa5760003560e01c80638d8ee8de1161011a578063c6fdbc90116100ad578063ea2092f31161007c578063ea2092f3146103d7578063ed5614b6146103ea578063f2fde38b146103f2578063fd5e3cdd14610405578063fdf7c9b514610418576101fa565b8063c6fdbc9014610396578063d4149395146103a9578063d89c5caf146103bc578063e39c9c8c146103c4576101fa565b8063b18ac0dc116100e9578063b18ac0dc14610229578063b60d428814610368578063b65d3e2514610370578063bb1987b914610383576101fa565b80638d8ee8de146102295780638da5cb5b146103385780638df828001461034d578063acc14e7214610360576101fa565b8063514a681011610192578063715018a611610161578063715018a6146103025780637c8b2e0b1461030a57806389dc22cf1461031d5780638afbc1ed14610325576101fa565b8063514a6810146102a55780635165da30146102b85780635e1e8db3146102cb5780636c8fcfa2146102ed576101fa565b806321e1f4f3116101ce57806321e1f4f31461026a5780632d961f9214610249578063450018f31461027f578063463dcf0a14610292576101fa565b8062e2c321146101ff57806312274ee614610229578063151dad34146102495780631953cc2114610257575b600080fd5b61021261020d366004612b53565b61042b565b604051610220929190612cf5565b60405180910390f35b61023c610237366004612a9d565b61044f565b6040516102209190613261565b61023c610237366004612b53565b610212610265366004612c0c565b610469565b61027d610278366004612c0c565b610495565b005b61021261028d366004612c0c565b6104e0565b61023c6102a0366004612b1f565b6105dc565b6102126102b3366004612c0c565b610901565b61023c6102c6366004612b1f565b6109cb565b6102de6102d9366004612c0c565b610ca9565b6040516102209392919061328e565b6102f5610da8565b6040516102209190612cea565b61027d610dad565b61023c610318366004612b8d565b610e36565b61023c611241565b610212610333366004612b1f565b611247565b6103406114e2565b6040516102209190612c9c565b61027d61035b366004612c0c565b6114f1565b6102f5611539565b61034061155d565b6102de61037e366004612c0c565b611581565b61023c610391366004612c0c565b61168a565b61023c6103a4366004612c0c565b6117f3565b61027d6103b7366004612c0c565b611d69565b61023c611db1565b61023c6103d2366004612c0c565b611db7565b61023c6103e5366004612b53565b611f24565b61023c6121fc565b61027d610400366004612a81565b612202565b61023c610413366004612c3c565b6122c3565b61027d610426366004612c0c565b61250f565b60008060405162461bcd60e51b815260040161044690613103565b60405180910390fd5b600060405162461bcd60e51b815260040161044690613103565b6000806104816002548461255790919063ffffffff16565b905061048e818403612578565b9150915091565b61049d6126b1565b6001600160a01b03166104ae6114e2565b6001600160a01b0316146104d45760405162461bcd60e51b815260040161044690613074565b6104dd816126b5565b50565b60008060007f0000000000000000000000005956f0d618b8a4f8c5473f3804918e7fa7f4fa8d6001600160a01b0316635c59f3bb6040518163ffffffff1660e01b815260040160206040518083038186803b15801561053e57600080fd5b505afa158015610552573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105769190612c24565b90506105a2847f00000000000000000000000000000000000000000000000000000000000000096126f5565b91506105d4816105ce6105b682600161272f565b6105c888670de0b6b3a76400006126f5565b90612757565b9061277c565b925050915091565b60007f0000000000000000000000005956f0d618b8a4f8c5473f3804918e7fa7f4fa8d6001600160a01b031663054f7d9c6040518163ffffffff1660e01b815260040160206040518083038186803b15801561063757600080fd5b505afa15801561064b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061066f9190612bd0565b1561068c5760405162461bcd60e51b815260040161044690612efd565b60008061069885611581565b60405163053454e760e11b81529195509193509091506001600160a01b037f0000000000000000000000005956f0d618b8a4f8c5473f3804918e7fa7f4fa8d1690630a68a9ce906106f49060019033908a908a9060040161326a565b600060405180830381600087803b15801561070e57600080fd5b505af1158015610722573d6000803e3d6000fd5b505060405163053454e760e11b81526001600160a01b037f0000000000000000000000005956f0d618b8a4f8c5473f3804918e7fa7f4fa8d169250630a68a9ce915061077990600290339087908a9060040161326a565b600060405180830381600087803b15801561079357600080fd5b505af11580156107a7573d6000803e3d6000fd5b505060405163575ec3c560e11b81526001600160a01b037f0000000000000000000000005956f0d618b8a4f8c5473f3804918e7fa7f4fa8d16925063aebd878a91506107fe906000908a9088908a9060040161326a565b600060405180830381600087803b15801561081857600080fd5b505af115801561082c573d6000803e3d6000fd5b505060405163846f1f4960e01b81526001600160a01b037f0000000000000000000000005956f0d618b8a4f8c5473f3804918e7fa7f4fa8d16925063846f1f49915061087f906000908590600401612cf5565b600060405180830381600087803b15801561089957600080fd5b505af11580156108ad573d6000803e3d6000fd5b50505050856001600160a01b03167f8f9b65c4201143c15e345350ae2fbcb591a753d71eb2a62b3f804db0d26c242c848785856040516108f094939291906132a4565b60405180910390a250509392505050565b60008061099f7f0000000000000000000000005956f0d618b8a4f8c5473f3804918e7fa7f4fa8d6001600160a01b0316635c59f3bb6040518163ffffffff1660e01b815260040160206040518083038186803b15801561096057600080fd5b505afa158015610974573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109989190612c24565b8490612557565b905061048e817f00000000000000000000000000000000000000000000000000000000000000096126f5565b6000600260005414156109f05760405162461bcd60e51b8152600401610446906131ab565b60026000819055507f0000000000000000000000005956f0d618b8a4f8c5473f3804918e7fa7f4fa8d6001600160a01b031663054f7d9c6040518163ffffffff1660e01b815260040160206040518083038186803b158015610a5157600080fd5b505afa158015610a65573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a899190612bd0565b15610aa65760405162461bcd60e51b815260040161044690612efd565b6040516370a0823160e01b81526000906001600160a01b037f00000000000000000000000080137510979822322193fc997d400d5a6c747bf716906370a0823190610af5903090600401612c9c565b60206040518083038186803b158015610b0d57600080fd5b505afa158015610b21573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b459190612c24565b9050610b50816117f3565b9150838210158015610b625750600082115b610b7e5760405162461bcd60e51b815260040161044690613049565b60405163575ec3c560e11b81526001600160a01b037f0000000000000000000000005956f0d618b8a4f8c5473f3804918e7fa7f4fa8d169063aebd878a90610bd19060009089908790899060040161326a565b600060405180830381600087803b158015610beb57600080fd5b505af1158015610bff573d6000803e3d6000fd5b50610c599250506001600160a01b037f00000000000000000000000080137510979822322193fc997d400d5a6c747bf71690507f0000000000000000000000005956f0d618b8a4f8c5473f3804918e7fa7f4fa8d836127ae565b846001600160a01b03167f95b18bbe5373dcbe675d3ab2ae6e3888392575c51b8b8c9c3cbbdb431af192998284604051610c94929190612cf5565b60405180910390a25060016000559392505050565b60008080610cd7847f00000000000000000000000000000000000000000000000000000000000000096126f5565b925060007f0000000000000000000000005956f0d618b8a4f8c5473f3804918e7fa7f4fa8d6001600160a01b0316635c59f3bb6040518163ffffffff1660e01b815260040160206040518083038186803b158015610d3457600080fd5b505afa158015610d48573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d6c9190612c24565b90506000610d7a8683612809565b9050610d916003548261255790919063ffffffff16565b9250610d9d818461272f565b935050509193909250565b600190565b610db56126b1565b6001600160a01b0316610dc66114e2565b6001600160a01b031614610dec5760405162461bcd60e51b815260040161044690613074565b6001546040516000916001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600180546001600160a01b0319169055565b600060026000541415610e5b5760405162461bcd60e51b8152600401610446906131ab565b60026000557f0000000000000000000000000000000000000000000000000000000000000001610e9d5760405162461bcd60e51b815260040161044690612e21565b7f0000000000000000000000005956f0d618b8a4f8c5473f3804918e7fa7f4fa8d6001600160a01b031663054f7d9c6040518163ffffffff1660e01b815260040160206040518083038186803b158015610ef657600080fd5b505afa158015610f0a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f2e9190612bd0565b610f4a5760405162461bcd60e51b815260040161044690612fdf565b610f5485856122c3565b60405163053454e760e11b81529091506001600160a01b037f0000000000000000000000005956f0d618b8a4f8c5473f3804918e7fa7f4fa8d1690630a68a9ce90610faa9060019033908a90889060040161326a565b600060405180830381600087803b158015610fc457600080fd5b505af1158015610fd8573d6000803e3d6000fd5b505060405163053454e760e11b81526001600160a01b037f0000000000000000000000005956f0d618b8a4f8c5473f3804918e7fa7f4fa8d169250630a68a9ce915061102f9060029033908990889060040161326a565b600060405180830381600087803b15801561104957600080fd5b505af115801561105d573d6000803e3d6000fd5b505050508281101580156110715750600081115b61108d5760405162461bcd60e51b8152600401610446906131e2565b6040516370a0823160e01b81526001600160a01b037f00000000000000000000000080137510979822322193fc997d400d5a6c747bf716906370a08231906110f9907f0000000000000000000000005956f0d618b8a4f8c5473f3804918e7fa7f4fa8d90600401612c9c565b60206040518083038186803b15801561111157600080fd5b505afa158015611125573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111499190612c24565b8111156111685760405162461bcd60e51b815260040161044690612e49565b60405163539b4c2d60e11b81526001600160a01b037f0000000000000000000000005956f0d618b8a4f8c5473f3804918e7fa7f4fa8d169063a736985a906111b99089908590600090600401612cc9565b600060405180830381600087803b1580156111d357600080fd5b505af11580156111e7573d6000803e3d6000fd5b50505050856001600160a01b03167fcec6b7ea6185e3b54a41256f271619f1edd28ce6bcea7473af5d4a9d0a37b1b6868684600060405161122b94939291906132a4565b60405180910390a2600160005595945050505050565b60035481565b6000807f0000000000000000000000005956f0d618b8a4f8c5473f3804918e7fa7f4fa8d6001600160a01b031663054f7d9c6040518163ffffffff1660e01b815260040160206040518083038186803b1580156112a357600080fd5b505afa1580156112b7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112db9190612bd0565b156112f85760405162461bcd60e51b815260040161044690612efd565b61130184610901565b60405163053454e760e11b815291935091506001600160a01b037f0000000000000000000000005956f0d618b8a4f8c5473f3804918e7fa7f4fa8d1690630a68a9ce906113599060009033908990899060040161326a565b600060405180830381600087803b15801561137357600080fd5b505af1158015611387573d6000803e3d6000fd5b505060405163575ec3c560e11b81526001600160a01b037f0000000000000000000000005956f0d618b8a4f8c5473f3804918e7fa7f4fa8d16925063aebd878a91506113de9060019089908790899060040161326a565b600060405180830381600087803b1580156113f857600080fd5b505af115801561140c573d6000803e3d6000fd5b505060405163575ec3c560e11b81526001600160a01b037f0000000000000000000000005956f0d618b8a4f8c5473f3804918e7fa7f4fa8d16925063aebd878a91506114639060029089908690899060040161326a565b600060405180830381600087803b15801561147d57600080fd5b505af1158015611491573d6000803e3d6000fd5b50505050846001600160a01b03167ff66885c33d648fcd0d97e0f2a18e30102169c22763473af0fb716f11b4a17dd68584846040516114d29392919061328e565b60405180910390a2935093915050565b6001546001600160a01b031690565b336001600160a01b037f0000000000000000000000005956f0d618b8a4f8c5473f3804918e7fa7f4fa8d16146104dd5760405162461bcd60e51b8152600401610446906130a9565b7f000000000000000000000000000000000000000000000000000000000000000181565b7f0000000000000000000000005956f0d618b8a4f8c5473f3804918e7fa7f4fa8d81565b6000806000807f0000000000000000000000005956f0d618b8a4f8c5473f3804918e7fa7f4fa8d6001600160a01b0316635c59f3bb6040518163ffffffff1660e01b815260040160206040518083038186803b1580156115e057600080fd5b505afa1580156115f4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116189190612c24565b90506000611650611649837f00000000000000000000000000000000000000000000000000000000000000096126f5565b8790612809565b90506116676003548261255790919063ffffffff16565b9250611673818461272f565b935061167f8183612557565b945050509193909250565b6000807f0000000000000000000000005956f0d618b8a4f8c5473f3804918e7fa7f4fa8d6001600160a01b031663b40494e56040518163ffffffff1660e01b815260040160206040518083038186803b1580156116e657600080fd5b505afa1580156116fa573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061171e9190612c24565b905060007f0000000000000000000000005956f0d618b8a4f8c5473f3804918e7fa7f4fa8d6001600160a01b03166312e778b66040518163ffffffff1660e01b815260040160206040518083038186803b15801561177b57600080fd5b505afa15801561178f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117b39190612c24565b9050600081116117d55760405162461bcd60e51b815260040161044690613219565b6117eb816105ce60001982016105c888876126f5565b949350505050565b6000807f0000000000000000000000005956f0d618b8a4f8c5473f3804918e7fa7f4fa8d6001600160a01b031663b40494e56040518163ffffffff1660e01b815260040160206040518083038186803b15801561184f57600080fd5b505afa158015611863573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118879190612c24565b905060007f0000000000000000000000005956f0d618b8a4f8c5473f3804918e7fa7f4fa8d6001600160a01b03166312e778b66040518163ffffffff1660e01b815260040160206040518083038186803b1580156118e457600080fd5b505afa1580156118f8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061191c9190612c24565b60045490915061192c8386612757565b111561194a5760405162461bcd60e51b815260040161044690612f59565b80611d37576119ea7f0000000000000000000000005956f0d618b8a4f8c5473f3804918e7fa7f4fa8d6001600160a01b031663094fc9216040518163ffffffff1660e01b815260040160206040518083038186803b1580156119ab57600080fd5b505afa1580156119bf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119e39190612c24565b85906126f5565b925060007f0000000000000000000000005956f0d618b8a4f8c5473f3804918e7fa7f4fa8d6001600160a01b0316635c59f3bb6040518163ffffffff1660e01b815260040160206040518083038186803b158015611a4757600080fd5b505afa158015611a5b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a7f9190612c24565b905080611a9e5760405162461bcd60e51b815260040161044690612d7c565b60007f0000000000000000000000005956f0d618b8a4f8c5473f3804918e7fa7f4fa8d6001600160a01b031663dee1c6be6040518163ffffffff1660e01b815260040160206040518083038186803b158015611af957600080fd5b505afa158015611b0d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b319190612c24565b905060007f0000000000000000000000005956f0d618b8a4f8c5473f3804918e7fa7f4fa8d6001600160a01b0316639043292a6040518163ffffffff1660e01b815260040160206040518083038186803b158015611b8e57600080fd5b505afa158015611ba2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bc69190612bf0565b6001600160a01b0316639f057151836040518263ffffffff1660e01b8152600401611bf19190613261565b60206040518083038186803b158015611c0957600080fd5b505afa158015611c1d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c419190612c24565b90506000807f0000000000000000000000005956f0d618b8a4f8c5473f3804918e7fa7f4fa8d6001600160a01b031663eed9a179856040518263ffffffff1660e01b8152600401611c929190613261565b604080518083038186803b158015611ca957600080fd5b505afa158015611cbd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ce19190612c5d565b9092509050611d2b611d17826105c8857f00000000000000000000000000000000000000000000000000000000000000096126f5565b611d25876105ce8c886126f5565b90612809565b97505050505050611d62565b81611d545760405162461bcd60e51b815260040161044690612f82565b6117eb826105ce86846126f5565b5050919050565b611d716126b1565b6001600160a01b0316611d826114e2565b6001600160a01b031614611da85760405162461bcd60e51b815260040161044690613074565b6104dd81612821565b60045481565b6000807f0000000000000000000000005956f0d618b8a4f8c5473f3804918e7fa7f4fa8d6001600160a01b031663b40494e56040518163ffffffff1660e01b815260040160206040518083038186803b158015611e1357600080fd5b505afa158015611e27573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e4b9190612c24565b905060007f0000000000000000000000005956f0d618b8a4f8c5473f3804918e7fa7f4fa8d6001600160a01b03166312e778b66040518163ffffffff1660e01b815260040160206040518083038186803b158015611ea857600080fd5b505afa158015611ebc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ee09190612c24565b90506000611efa836105ce60001982016105c889876126f5565b9050611f1b600254670de0b6b3a7640000038261280990919063ffffffff16565b95945050505050565b600060026000541415611f495760405162461bcd60e51b8152600401610446906131ab565b60026000557f0000000000000000000000000000000000000000000000000000000000000001611f8b5760405162461bcd60e51b815260040161044690612e21565b6000611f9685610469565b60405163053454e760e11b815291935091506001600160a01b037f0000000000000000000000005956f0d618b8a4f8c5473f3804918e7fa7f4fa8d1690630a68a9ce90611fee9060009033908a90899060040161326a565b600060405180830381600087803b15801561200857600080fd5b505af115801561201c573d6000803e3d6000fd5b505050508382101580156120305750600082115b61204c5760405162461bcd60e51b8152600401610446906131e2565b6040516370a0823160e01b81526001600160a01b037f00000000000000000000000080137510979822322193fc997d400d5a6c747bf716906370a08231906120b8907f0000000000000000000000005956f0d618b8a4f8c5473f3804918e7fa7f4fa8d90600401612c9c565b60206040518083038186803b1580156120d057600080fd5b505afa1580156120e4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121089190612c24565b8211156121275760405162461bcd60e51b815260040161044690612e49565b60405163539b4c2d60e11b81526001600160a01b037f0000000000000000000000005956f0d618b8a4f8c5473f3804918e7fa7f4fa8d169063a736985a9061217790899086908690600401612cc9565b600060405180830381600087803b15801561219157600080fd5b505af11580156121a5573d6000803e3d6000fd5b50505050856001600160a01b03167f484c40561359f3e3b8be9101897f8680aa82fbe1df9fd9038e0dbc62840326468684846040516121e69392919061328e565b60405180910390a2506001600055949350505050565b60025481565b61220a6126b1565b6001600160a01b031661221b6114e2565b6001600160a01b0316146122415760405162461bcd60e51b815260040161044690613074565b6001600160a01b0381166122675760405162461bcd60e51b815260040161044690612d36565b6001546040516001600160a01b038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3600180546001600160a01b0319166001600160a01b0392909216919091179055565b6000807f0000000000000000000000005956f0d618b8a4f8c5473f3804918e7fa7f4fa8d6001600160a01b031663dee1c6be6040518163ffffffff1660e01b815260040160206040518083038186803b15801561231f57600080fd5b505afa158015612333573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123579190612c24565b90506000807f0000000000000000000000005956f0d618b8a4f8c5473f3804918e7fa7f4fa8d6001600160a01b031663eed9a179846040518263ffffffff1660e01b81526004016123a89190613261565b604080518083038186803b1580156123bf57600080fd5b505afa1580156123d3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123f79190612c5d565b9092509050600061242c826105c8857f00000000000000000000000000000000000000000000000000000000000000096126f5565b905060007f0000000000000000000000005956f0d618b8a4f8c5473f3804918e7fa7f4fa8d6001600160a01b0316635c59f3bb6040518163ffffffff1660e01b815260040160206040518083038186803b15801561248957600080fd5b505afa15801561249d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124c19190612c24565b905060006124d782611d25856105ce8d8a6126f5565b905060006124ed83611d25866105ce8d8a6126f5565b90506125016124fc8383612757565b612578565b9a9950505050505050505050565b6125176126b1565b6001600160a01b03166125286114e2565b6001600160a01b03161461254e5760405162461bcd60e51b815260040161044690613074565b6104dd8161287d565b600061256f670de0b6b3a76400006105ce85856126f5565b90505b92915050565b6000807f0000000000000000000000005956f0d618b8a4f8c5473f3804918e7fa7f4fa8d6001600160a01b031663b40494e56040518163ffffffff1660e01b815260040160206040518083038186803b1580156125d457600080fd5b505afa1580156125e8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061260c9190612c24565b905060007f0000000000000000000000005956f0d618b8a4f8c5473f3804918e7fa7f4fa8d6001600160a01b03166312e778b66040518163ffffffff1660e01b815260040160206040518083038186803b15801561266957600080fd5b505afa15801561267d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126a19190612c24565b90506117eb816105ce86856126f5565b3390565b60048190556040517f2bf8fcc3a5c1c15d79911403f6216aee8166879c976a9cc7a3d1b84cf6131132906126ea908390613261565b60405180910390a150565b60008261270457506000612572565b8282028284828161271157fe5b041461256f5760405162461bcd60e51b815260040161044690613008565b6000828211156127515760405162461bcd60e51b815260040161044690612e80565b50900390565b60008282018381101561256f5760405162461bcd60e51b815260040161044690612db3565b600080821161279d5760405162461bcd60e51b815260040161044690612f22565b8183816127a657fe5b049392505050565b6128048363a9059cbb60e01b84846040516024016127cd929190612cb0565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526128d9565b505050565b600061256f826105ce85670de0b6b3a76400006126f5565b662386f26fc100008111156128485760405162461bcd60e51b815260040161044690612dea565b60038190556040517f68ee6a600c8d4c88d1b96f8ad76fbfdf767cc89ecf54d91da8e297fa1f53126e906126ea908390613261565b662386f26fc100008111156128a45760405162461bcd60e51b81526004016104469061312a565b60028190556040517f022ca5430126894b100ba72a73d93970f2795276b07a287e0ff2a7342131e180906126ea908390613261565b606061292e826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166129689092919063ffffffff16565b805190915015612804578080602001905181019061294c9190612bd0565b6128045760405162461bcd60e51b815260040161044690613161565b60606129778484600085612981565b90505b9392505050565b6060824710156129a35760405162461bcd60e51b815260040161044690612eb7565b6129ac85612a42565b6129c85760405162461bcd60e51b8152600401610446906130cc565b60006060866001600160a01b031685876040516129e59190612c80565b60006040518083038185875af1925050503d8060008114612a22576040519150601f19603f3d011682016040523d82523d6000602084013e612a27565b606091505b5091509150612a37828286612a48565b979650505050505050565b3b151590565b60608315612a5757508161297a565b825115612a675782518084602001fd5b8160405162461bcd60e51b81526004016104469190612d03565b600060208284031215612a92578081fd5b813561256f816132ef565b600080600060408486031215612ab1578182fd5b8335612abc816132ef565b9250602084013567ffffffffffffffff80821115612ad8578384fd5b818601915086601f830112612aeb578384fd5b813581811115612af9578485fd5b8760208083028501011115612b0c578485fd5b6020830194508093505050509250925092565b600080600060608486031215612b33578283fd5b8335612b3e816132ef565b95602085013595506040909401359392505050565b60008060008060808587031215612b68578081fd5b8435612b73816132ef565b966020860135965060408601359560600135945092505050565b600080600080600060a08688031215612ba4578081fd5b8535612baf816132ef565b97602087013597506040870135966060810135965060800135945092505050565b600060208284031215612be1578081fd5b8151801515811461256f578182fd5b600060208284031215612c01578081fd5b815161256f816132ef565b600060208284031215612c1d578081fd5b5035919050565b600060208284031215612c35578081fd5b5051919050565b60008060408385031215612c4e578182fd5b50508035926020909101359150565b60008060408385031215612c6f578182fd5b505080516020909101519092909150565b60008251612c928184602087016132bf565b9190910192915050565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b039390931683526020830191909152604082015260600190565b901515815260200190565b918252602082015260400190565b6000602082528251806020840152612d228160408501602087016132bf565b601f01601f19169190910160400192915050565b60208082526026908201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160408201526564647265737360d01b606082015260800190565b60208082526017908201527f46756e64206973206e6f7420696e697469616c697a6564000000000000000000604082015260600190565b6020808252601b908201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604082015260600190565b60208082526019908201527f457863656564206d6178206d6572676520666565207261746500000000000000604082015260600190565b6020808252600e908201526d526564656d7074696f6e204e2f4160901b604082015260600190565b6020808252601d908201527f4e6f7420656e6f75676820756e6465726c79696e6720696e2066756e64000000604082015260600190565b6020808252601e908201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604082015260600190565b60208082526026908201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6040820152651c8818d85b1b60d21b606082015260800190565b6020808252600b908201526a233ab73210333937bd32b760a91b604082015260600190565b6020808252601a908201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604082015260600190565b6020808252600f908201526e04578636565642066756e642063617608c1b604082015260600190565b6020808252603a908201527f43616e6e6f742063726561746520515545454e20666f722066756e642077697460408201527f682073686172657320627574206e6f20756e6465726c79696e67000000000000606082015260800190565b6020808252600f908201526e233ab732103737ba10333937bd32b760891b604082015260600190565b60208082526021908201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6040820152607760f81b606082015260800190565b602080825260119082015270135a5b8814555151538818dc99585d1959607a1b604082015260600190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526009908201526813db9b1e48199d5b9960ba1b604082015260600190565b6020808252601d908201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604082015260600190565b6020808252600d908201526c139bdd0814dd5c1c1bdc9d1959609a1b604082015260600190565b6020808252601e908201527f457863656564206d617820726564656d7074696f6e2066656520726174650000604082015260600190565b6020808252602a908201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6040820152691bdd081cdd58d8d9595960b21b606082015260800190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b60208082526017908201527f4d696e20756e6465726c79696e672072656465656d6564000000000000000000604082015260600190565b60208082526028908201527f43616e6e6f742063616c63756c617465206372656174696f6e20666f7220656d6040820152671c1d1e48199d5b9960c21b606082015260800190565b90815260200190565b9384526001600160a01b039290921660208401526040830152606082015260800190565b9283526020830191909152604082015260600190565b93845260208401929092526040830152606082015260800190565b60005b838110156132da5781810151838201526020016132c2565b838111156132e9576000848401525b50505050565b6001600160a01b03811681146104dd57600080fdfea2646970667358221220528ccf2506093a938d08db0966c8485dd8deed3bfc037560b0f79518e6997f7a64736f6c634300060c0033

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

0000000000000000000000005956f0d618b8a4f8c5473f3804918e7fa7f4fa8d00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000000000000000000000000000000000000000000000000000000000000001

-----Decoded View---------------
Arg [0] : fund_ (address): 0x5956F0d618B8a4F8c5473f3804918E7Fa7f4fA8D
Arg [1] : redemptionFeeRate_ (uint256): 0
Arg [2] : mergeFeeRate_ (uint256): 0
Arg [3] : fundCap_ (uint256): 115792089237316195423570985008687907853269984665640564039457584007913129639935
Arg [4] : redemptionFlag_ (bool): True

-----Encoded View---------------
5 Constructor Arguments found :
Arg [0] : 0000000000000000000000005956f0d618b8a4f8c5473f3804918e7fa7f4fa8d
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [2] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [3] : ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
Arg [4] : 0000000000000000000000000000000000000000000000000000000000000001


Block Transaction Gas Used Reward
view all blocks sequenced

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

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
[ 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.