Contract 0xD365641c875eE9a1daC5eb8668Cc1e0F3dF093dc 2

 
Txn Hash Method
Block
From
To
Value [Txn Fee]
0xfb305bb2d620a5c3718b58b6c964bc0296690cc954b1e4c303affecf7940451b0x60806040199453542022-08-10 21:42:10595 days 19 hrs ago0x4b70031e70a64a3c9af242a0ba96e4b9bdb2fd6c IN  Create: Controller0 ETH0.015970834842 ETH0.324293197
[ Download CSV Export 
Latest 25 internal transaction
Parent Txn Hash Block From To Value
0x5e4c397bf05d1e6cf09ec5cfb0b67afee85ff41a3686ca41a0acd0d93b467ca3621675342023-02-18 17:26:26403 days 23 hrs ago 0x4ba30fa240047c17fc557b8628799068d4396790 0xd365641c875ee9a1dac5eb8668cc1e0f3df093dc0 ETH
0x5e4c397bf05d1e6cf09ec5cfb0b67afee85ff41a3686ca41a0acd0d93b467ca3621675342023-02-18 17:26:26403 days 23 hrs ago 0x4ba30fa240047c17fc557b8628799068d4396790 0xd365641c875ee9a1dac5eb8668cc1e0f3df093dc0 ETH
0x73fd56ccf844da63bc0fb21455a02ff461a30cbece2f2c1789322cbe85c7caef611035972023-02-15 9:47:18407 days 7 hrs ago 0x4ba30fa240047c17fc557b8628799068d4396790 0xd365641c875ee9a1dac5eb8668cc1e0f3df093dc0 ETH
0x73fd56ccf844da63bc0fb21455a02ff461a30cbece2f2c1789322cbe85c7caef611035972023-02-15 9:47:18407 days 7 hrs ago 0x4ba30fa240047c17fc557b8628799068d4396790 0xd365641c875ee9a1dac5eb8668cc1e0f3df093dc0 ETH
0x7c0ba960090477ff8b83a40007805f25324f47a120cc23c963edd3a6cafe531c609412472023-02-14 19:19:19407 days 21 hrs ago 0x4ba30fa240047c17fc557b8628799068d4396790 0xd365641c875ee9a1dac5eb8668cc1e0f3df093dc0 ETH
0x7c0ba960090477ff8b83a40007805f25324f47a120cc23c963edd3a6cafe531c609412472023-02-14 19:19:19407 days 21 hrs ago 0x4ba30fa240047c17fc557b8628799068d4396790 0xd365641c875ee9a1dac5eb8668cc1e0f3df093dc0 ETH
0x4269a46386418e29f396a29d4119fc23fe8258c9cd248e86b307946ce27a6f64609139562023-02-14 17:11:02408 days 7 mins ago 0x4ba30fa240047c17fc557b8628799068d4396790 0xd365641c875ee9a1dac5eb8668cc1e0f3df093dc0 ETH
0x4269a46386418e29f396a29d4119fc23fe8258c9cd248e86b307946ce27a6f64609139562023-02-14 17:11:02408 days 7 mins ago 0x4ba30fa240047c17fc557b8628799068d4396790 0xd365641c875ee9a1dac5eb8668cc1e0f3df093dc0 ETH
0x82665a292482ac6fca1c0a89140294df09eb609b149c0239cedfb168a19ed0af609132032023-02-14 17:07:43408 days 11 mins ago 0x4ba30fa240047c17fc557b8628799068d4396790 0xd365641c875ee9a1dac5eb8668cc1e0f3df093dc0 ETH
0x82665a292482ac6fca1c0a89140294df09eb609b149c0239cedfb168a19ed0af609132032023-02-14 17:07:43408 days 11 mins ago 0x4ba30fa240047c17fc557b8628799068d4396790 0xd365641c875ee9a1dac5eb8668cc1e0f3df093dc0 ETH
0xd4988ccc530422685990c8d0f9e7fecfe891f614a8d09dca94d862721553e7ec608060462023-02-14 9:17:58408 days 8 hrs ago 0x4ba30fa240047c17fc557b8628799068d4396790 0xd365641c875ee9a1dac5eb8668cc1e0f3df093dc0 ETH
0x6f900e3f4f605e854d6a384e47e2ae7a8641c334c71fc6a89bf82c163272a238571939042023-02-01 16:11:51421 days 1 hr ago 0x4ba30fa240047c17fc557b8628799068d4396790 0xd365641c875ee9a1dac5eb8668cc1e0f3df093dc0 ETH
0x9f23efaaf7cc9490f0e2b2869d3fa5cb7dddfa28ba179bd0d0c2b4344f9cbe0f523447362023-01-11 16:26:14442 days 52 mins ago 0x4ba30fa240047c17fc557b8628799068d4396790 0xd365641c875ee9a1dac5eb8668cc1e0f3df093dc0 ETH
0x9f23efaaf7cc9490f0e2b2869d3fa5cb7dddfa28ba179bd0d0c2b4344f9cbe0f523447362023-01-11 16:26:14442 days 52 mins ago 0x4ba30fa240047c17fc557b8628799068d4396790 0xd365641c875ee9a1dac5eb8668cc1e0f3df093dc0 ETH
0x3a7ac89d2a8fe7fe5f581e2c9f784f420691d24e32b5d910adeb84e7391b8f95523437882023-01-11 16:20:38442 days 58 mins ago 0x4ba30fa240047c17fc557b8628799068d4396790 0xd365641c875ee9a1dac5eb8668cc1e0f3df093dc0 ETH
0x3a7ac89d2a8fe7fe5f581e2c9f784f420691d24e32b5d910adeb84e7391b8f95523437882023-01-11 16:20:38442 days 58 mins ago 0x4ba30fa240047c17fc557b8628799068d4396790 0xd365641c875ee9a1dac5eb8668cc1e0f3df093dc0 ETH
0x59be11ca495238ee096e2f75a0709fb9c32de71ed2098b0535806edeea6830c4523433582023-01-11 16:18:18442 days 1 hr ago 0x4ba30fa240047c17fc557b8628799068d4396790 0xd365641c875ee9a1dac5eb8668cc1e0f3df093dc0 ETH
0x59be11ca495238ee096e2f75a0709fb9c32de71ed2098b0535806edeea6830c4523433582023-01-11 16:18:18442 days 1 hr ago 0x4ba30fa240047c17fc557b8628799068d4396790 0xd365641c875ee9a1dac5eb8668cc1e0f3df093dc0 ETH
0x34e355c98bb887229234835e99fb0900ee5b32d59e0703eb0b55167d033bb5fc475937852022-12-20 16:32:40464 days 46 mins ago 0x4ba30fa240047c17fc557b8628799068d4396790 0xd365641c875ee9a1dac5eb8668cc1e0f3df093dc0 ETH
0x34e355c98bb887229234835e99fb0900ee5b32d59e0703eb0b55167d033bb5fc475937852022-12-20 16:32:40464 days 46 mins ago 0x4ba30fa240047c17fc557b8628799068d4396790 0xd365641c875ee9a1dac5eb8668cc1e0f3df093dc0 ETH
0x34e355c98bb887229234835e99fb0900ee5b32d59e0703eb0b55167d033bb5fc475937852022-12-20 16:32:40464 days 46 mins ago 0x4ba30fa240047c17fc557b8628799068d4396790 0xd365641c875ee9a1dac5eb8668cc1e0f3df093dc0 ETH
0x34e355c98bb887229234835e99fb0900ee5b32d59e0703eb0b55167d033bb5fc475937852022-12-20 16:32:40464 days 46 mins ago 0x4ba30fa240047c17fc557b8628799068d4396790 0xd365641c875ee9a1dac5eb8668cc1e0f3df093dc0 ETH
0x34e355c98bb887229234835e99fb0900ee5b32d59e0703eb0b55167d033bb5fc475937852022-12-20 16:32:40464 days 46 mins ago 0x4ba30fa240047c17fc557b8628799068d4396790 0xd365641c875ee9a1dac5eb8668cc1e0f3df093dc0 ETH
0x34e355c98bb887229234835e99fb0900ee5b32d59e0703eb0b55167d033bb5fc475937852022-12-20 16:32:40464 days 46 mins ago 0x4ba30fa240047c17fc557b8628799068d4396790 0xd365641c875ee9a1dac5eb8668cc1e0f3df093dc0 ETH
0x34e355c98bb887229234835e99fb0900ee5b32d59e0703eb0b55167d033bb5fc475937852022-12-20 16:32:40464 days 46 mins ago 0x4ba30fa240047c17fc557b8628799068d4396790 0xd365641c875ee9a1dac5eb8668cc1e0f3df093dc0 ETH
[ Download CSV Export 
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Controller

Compiler Version
v0.7.6+commit.7338295f

Optimization Enabled:
Yes with 1000 runs

Other Settings:
default evmVersion
File 1 of 20 : Controller.sol
// SPDX-License-Identifier: BUSL-1.1

pragma solidity 0.7.6;

import "@openzeppelin/contracts-upgradeable/utils/EnumerableSetUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/SafeERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/math/SafeMathUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/ReentrancyGuardUpgradeable.sol";

import "contracts/Protocol/interfaces/IERC20.sol";
import "contracts/Protocol/interfaces/apwine/tokens/IFutureYieldToken.sol";
import "contracts/Protocol/interfaces/apwine/IFutureVault.sol";
import "contracts/Protocol/interfaces/apwine/IFutureWallet.sol";
import "contracts/Protocol/interfaces/apwine/IController.sol";

import "contracts/Protocol/utils/RegistryStorage.sol";

/**
 * @title Controller contract
 * @notice The controller dictates the futureVault mechanisms and serves as an interface for main user interaction with futures
 */
contract Controller is
    Initializable,
    RegistryStorage,
    ReentrancyGuardUpgradeable,
    IController
{
    using EnumerableSetUpgradeable for EnumerableSetUpgradeable.AddressSet;
    using EnumerableSetUpgradeable for EnumerableSetUpgradeable.UintSet;
    using SafeERC20Upgradeable for IERC20;
    using SafeMathUpgradeable for uint256;

    /* Attributes */

    mapping(uint256 => uint256) private nextPeriodSwitchByDuration;
    mapping(address => uint256) private nextPerformanceFeeFactor; // represented as x/(10**18)

    mapping(uint256 => mapping(uint256 => bool))
        private periodSwitchedByDurationDisabled;

    EnumerableSetUpgradeable.UintSet private durations;
    mapping(uint256 => EnumerableSetUpgradeable.AddressSet)
        private futureVaultsByDuration;
    mapping(uint256 => uint256) private periodIndexByDurations;

    mapping(address => bool) private toBeTerminatedByFutureVault;
    EnumerableSetUpgradeable.AddressSet private futureVaultsTerminated;
    mapping(address => bool) private withdrawalsPausedByFutureVault;
    mapping(address => bool) private depositsPausedByFutureVault;

    // /* Events */
    event DepositPauseChanged(IFutureVault _futureVault, bool _depositPaused);
    event WithdrawalPauseChanged(
        IFutureVault _futureVault,
        bool _withdrawalPaused
    );
    event PeriodSwitchedByDurationDisabled(
        uint256 indexed _periodDuration,
        uint256 _periodIndex
    );
    event DelegationPauseChanged(bool _delegationPaused);

    /* PlatformController Settings */
    uint256 public override STARTING_DELAY;
    bool public DELEGATION_ENABLED;

    /* Modifiers */

    modifier futureVaultIsValid(IFutureVault _futureVault) {
        require(
            registry.isRegisteredFutureVault(address(_futureVault)),
            "Controller: ERR_FUTURE_ADDRESS"
        );
        _;
    }

    modifier durationIsPresent(uint256 _duration) {
        require(
            durations.contains(_duration),
            "Controller: Period Duration not Found"
        );
        _;
    }

    modifier delegationIsEnabled() {
        require(DELEGATION_ENABLED, "Controller: Delegation not enabled");
        _;
    }

    /* Initializer */

    /**
     * @notice Initializer of the Controller contract
     * @param _registry the address of the registry
     * @param _admin the address of the admin
     */
    function initialize(IRegistry _registry, address _admin)
        external
        initializer
    {
        _setupRole(DEFAULT_ADMIN_ROLE, _admin);
        _setupRole(ADMIN_ROLE, _admin);
        registry = _registry;
        DELEGATION_ENABLED = true;
    }

    /* User Methods */

    /**
     * @notice Withdraw deposited funds from APWine
     * @param _futureVault the interface of the futureVault to withdraw the IBT from
     * @param _amount the amount to withdraw
     */
    function withdraw(IFutureVault _futureVault, uint256 _amount)
        external
        override
        futureVaultIsValid(_futureVault)
    {
        _futureVault.withdraw(msg.sender, _amount);
    }

    /**
     * @notice Deposit funds into ongoing period
     * @param _futureVault the interface of the futureVault to be deposit the funds in
     * @param _amount the amount to deposit on the ongoing period
     * @dev part of the amount depostied will be used to buy back the yield already generated proportionaly to the amount deposited
     */
    function deposit(IFutureVault _futureVault, uint256 _amount)
        external
        override
        nonReentrant
        futureVaultIsValid(_futureVault)
    {
        _futureVault.deposit(msg.sender, _amount);
        IERC20(_futureVault.getIBTAddress()).safeTransferFrom(
            msg.sender,
            address(_futureVault),
            _amount
        );
    }

    /**
     * @notice Deposit funds into ongoing period
     * @param _futureVault the interface of the futureVault to be deposit the funds in
     * @param _user the user whow will recieve the pt and fyt against the deposited amount
     * @param _amount the amount to deposit on the ongoing period
     * @dev part of the amount depostied will be used to buy back the yield already generated proportionaly to the amount deposited
     */
    function depositForUser(
        IFutureVault _futureVault,
        address _user,
        uint256 _amount
    ) external override nonReentrant futureVaultIsValid(_futureVault) {
        _futureVault.deposit(_user, _amount);
        IERC20(_futureVault.getIBTAddress()).safeTransferFrom(
            msg.sender,
            address(_futureVault),
            _amount
        );
    }

    /**
     * @notice Create a delegation from one address to another for a futureVault
     * @param _futureVault the corresponding futureVault interface
     * @param _receiver the address receiving the futureVault FYTs
     * @param _amount the of futureVault FYTs to delegate
     */
    function createFYTDelegationTo(
        IFutureVault _futureVault,
        address _receiver,
        uint256 _amount
    ) external override delegationIsEnabled futureVaultIsValid(_futureVault) {
        _futureVault.createFYTDelegationTo(msg.sender, _receiver, _amount);
    }

    /**
     * @notice Remove a delegation from one address to another for a futureVault
     * @param _futureVault the corresponding futureVault interface
     * @param _receiver the address receiving the futureVault FYTs
     * @param _amount the of futureVault FYTs to remove from the delegation
     */
    function withdrawFYTDelegationFrom(
        IFutureVault _futureVault,
        address _receiver,
        uint256 _amount
    ) external override futureVaultIsValid(_futureVault) {
        _futureVault.withdrawFYTDelegationFrom(msg.sender, _receiver, _amount);
    }

    /* Future admin methods */

    /**
     * @notice Register a newly created futureVault in the registry
     * @param _futureVault the interface of the new futureVault
     */
    function registerNewFutureVault(IFutureVault _futureVault)
        external
        override
        onlyAdmin
    {
        registry.addFutureVault(address(_futureVault));
        uint256 futureDuration = _futureVault.PERIOD_DURATION();
        durations.add(futureDuration);
        futureVaultsByDuration[futureDuration].add(address(_futureVault));
        emit FutureRegistered(_futureVault);
    }

    /**
     * @notice Unregister a futureVault from the registry
     * @param _futureVault the interface of the futureVault to unregister
     */
    function unregisterFutureVault(IFutureVault _futureVault)
        external
        override
        onlyAdmin
    {
        registry.removeFutureVault(address(_futureVault));

        uint256 futureDuration = _futureVault.PERIOD_DURATION();
        futureVaultsByDuration[futureDuration].remove(address(_futureVault));
        if (
            durations.contains(futureDuration) &&
            futureVaultsByDuration[futureDuration].length() == 0
        ) durations.remove(futureDuration);
        emit FutureUnregistered(_futureVault);
    }

    /**
     * @notice Change the delay for starting a new period
     * @param _startingDelay the new delay (+-) to start the next period
     */
    function setPeriodStartingDelay(uint256 _startingDelay)
        public
        override
        onlyAdmin
    {
        STARTING_DELAY = _startingDelay;
        emit StartingDelaySet(_startingDelay);
    }

    /**
     * @notice Set the next period switch timestamp for the futureVault with corresponding duration
     * @param _periodDuration the period duration
     * @param _nextPeriodTimestamp the next period switch timestamp
     */
    function setNextPeriodSwitchTimestamp(
        uint256 _periodDuration,
        uint256 _nextPeriodTimestamp
    ) external override onlyAdmin durationIsPresent(_periodDuration) {
        nextPeriodSwitchByDuration[_periodDuration] = _nextPeriodTimestamp;
        emit NextPeriodSwitchSet(_periodDuration, _nextPeriodTimestamp);
    }

    /**
     * @notice Set the next period duration index
     * @param _periodDuration the period duration
     * @param _newPeriodIndex the next period duration index
     * @dev should only be called if there is a need of arbitrarily chaging the indexes in the FYT/PT naming
     */
    function setPeriodDurationIndex(
        uint256 _periodDuration,
        uint256 _newPeriodIndex
    ) external override onlyAdmin durationIsPresent(_periodDuration) {
        periodIndexByDurations[_periodDuration] = _newPeriodIndex;
        emit NewPeriodDurationIndexSet(_newPeriodIndex);
    }

    /**
     * @notice Start all futures that have a defined period duration to synchronize them
     * @param _periodDuration the period duration of the futures to start
     */
    function startFuturesByPeriodDuration(uint256 _periodDuration)
        external
        override
        onlyStartFuture
        durationIsPresent(_periodDuration)
    {
        uint256 perodIndexByDuration = periodIndexByDurations[_periodDuration];
        require(
            !periodSwitchedByDurationDisabled[_periodDuration][
                perodIndexByDuration
            ],
            "Controller: period cannot be switched with duration"
        );
        uint256 numberOfVaults = futureVaultsByDuration[_periodDuration]
            .length();
        for (uint256 i = 0; i < numberOfVaults; i++) {
            address futureVault = futureVaultsByDuration[_periodDuration].at(i);
            _startFuture(IFutureVault(futureVault));
        }
        nextPeriodSwitchByDuration[
            _periodDuration
        ] = nextPeriodSwitchByDuration[_periodDuration].add(_periodDuration);
        periodIndexByDurations[_periodDuration] = perodIndexByDuration.add(1);
        emit NextPeriodSwitchSet(
            _periodDuration,
            nextPeriodSwitchByDuration[_periodDuration]
        );
    }

    /**
     * @notice Start a specific future
     * @param _futureVault the interface of the futureVault to start
     * @dev should not be called if planning to use startFuturesByPeriodDuration in the same period
     */
    function startFuture(IFutureVault _futureVault)
        external
        override
        onlyStartFuture
        futureVaultIsValid(_futureVault)
    {
        uint256 periodDuration = _futureVault.PERIOD_DURATION();
        uint256 periodIndex = periodIndexByDurations[periodDuration];
        periodSwitchedByDurationDisabled[periodDuration][periodIndex] = true;
        _startFuture(_futureVault);
        emit PeriodSwitchedByDurationDisabled(periodDuration, periodIndex);
    }

    function _startFuture(IFutureVault _futureVault) internal {
        _futureVault.startNewPeriod();
        if (toBeTerminatedByFutureVault[address(_futureVault)]) {
            futureVaultsTerminated.add(address(_futureVault));
            futureVaultsByDuration[_futureVault.PERIOD_DURATION()].remove(
                address(_futureVault)
            );
            emit FutureTerminated(_futureVault);
        }
    }

    /**
     * @notice Exit a terminated pool
     * @param _futureVault the interface of the futureVault to terminate
     * @dev the user to exit from the pool is the message sender
     */
    function exitTerminatedFuture(IFutureVault _futureVault)
        external
        override
        futureVaultIsValid(_futureVault)
    {
        _futureVault.exitTerminatedFuture(msg.sender);
    }

    /* Future Vault rewards mechanism */

    function harvestVaultRewards(IFutureVault _futureVault)
        external
        override
        onlyHarvestReward
        futureVaultIsValid(_futureVault)
    {
        _futureVault.harvestRewards();
    }

    function redeemAllVaultRewards(IFutureVault _futureVault)
        external
        override
        onlyHarvestReward
        futureVaultIsValid(_futureVault)
    {
        _futureVault.redeemAllVaultRewards();
    }

    function redeemVaultRewards(IFutureVault _futureVault, address _rewardToken)
        external
        override
        onlyHarvestReward
        futureVaultIsValid(_futureVault)
    {
        _futureVault.redeemVaultRewards(_rewardToken);
    }

    function harvestWalletRewards(IFutureVault _futureVault)
        external
        override
        onlyHarvestReward
        futureVaultIsValid(_futureVault)
    {
        IFutureWallet(_futureVault.getFutureWalletAddress()).harvestRewards();
    }

    function redeemAllWalletRewards(IFutureVault _futureVault)
        external
        override
        onlyHarvestReward
        futureVaultIsValid(_futureVault)
    {
        IFutureWallet(_futureVault.getFutureWalletAddress())
            .redeemAllWalletRewards();
    }

    function redeemWalletRewards(
        IFutureVault _futureVault,
        address _rewardToken
    ) external override onlyHarvestReward futureVaultIsValid(_futureVault) {
        IFutureWallet(_futureVault.getFutureWalletAddress())
            .redeemWalletRewards(_rewardToken);
    }

    /* Getters */

    /**
     * @notice Getter for the registry address of the protocol
     * @return the address of the protocol registry
     */
    function getRegistryAddress() external view override returns (address) {
        return address(registry);
    }

    /**
     * @notice Getter for the period index depending on the period duration of the futureVault
     * @param _periodDuration the duration of the periods
     * @return the period index
     */
    function getPeriodIndex(uint256 _periodDuration)
        public
        view
        override
        returns (uint256)
    {
        return periodIndexByDurations[_periodDuration];
    }

    /**
     * @notice Getter for the beginning timestamp of the next period for the futures with a defined period duration
     * @param _periodDuration the duration of the periods
     * @return the timestamp of the beginning of the next period
     */
    function getNextPeriodStart(uint256 _periodDuration)
        public
        view
        override
        returns (uint256)
    {
        return nextPeriodSwitchByDuration[_periodDuration];
    }

    /**
     * @notice Getter for the list of futureVault durations registered in the contract
     * @return durationsList which consists of futureVault durations
     */
    function getDurations()
        external
        view
        override
        returns (uint256[] memory durationsList)
    {
        durationsList = new uint256[](durations.length());
        uint256 numberOfDurations = durations.length();
        for (uint256 i = 0; i < numberOfDurations; i++) {
            durationsList[i] = durations.at(i);
        }
    }

    /**
     * @notice Getter for the futures by period duration
     * @param _periodDuration the period duration of the futures to return
     */
    function getFuturesWithDuration(uint256 _periodDuration)
        external
        view
        override
        returns (address[] memory filteredFutures)
    {
        uint256 listLength = futureVaultsByDuration[_periodDuration].length();
        filteredFutures = new address[](listLength);
        for (uint256 i = 0; i < listLength; i++) {
            filteredFutures[i] = futureVaultsByDuration[_periodDuration].at(i);
        }
    }

    /* Security functions */

    /**
     * @notice Terminate a futureVault
     * @param _futureVault the interface of the futureVault to terminate
     * @dev should only be called in extraordinary situations by the admin of the contract
     */
    function setFutureToTerminate(IFutureVault _futureVault)
        external
        override
        onlyAdmin
    {
        toBeTerminatedByFutureVault[address(_futureVault)] = true;
        emit FutureSetToBeTerminated(_futureVault);
    }

    /**
     * @notice Getter for the futureVault period state
     * @param _futureVault the interface of the futureVault
     * @return true if the futureVault is terminated
     */
    function isFutureTerminated(address _futureVault)
        external
        view
        override
        returns (bool)
    {
        return futureVaultsTerminated.contains(_futureVault);
    }

    /**
     * @notice Getter for the futureVault period state
     * @param _futureVault the interface of the futureVault
     * @return true if the futureVault is set to be terminated at its expiration
     */
    function isFutureSetToBeTerminated(address _futureVault)
        external
        view
        override
        returns (bool)
    {
        return toBeTerminatedByFutureVault[_futureVault];
    }

    /**
     * @notice Toggle withdrawals
     * @param _futureVault the interface of the futureVault to toggle
     * @dev should only be called in extraordinary situations by the admin of the contract
     */
    function toggleWithdrawalPause(IFutureVault _futureVault)
        external
        onlyAdmin
    {
        bool withdrawalPaused = !withdrawalsPausedByFutureVault[
            address(_futureVault)
        ];
        withdrawalsPausedByFutureVault[
            address(_futureVault)
        ] = withdrawalPaused;
        emit WithdrawalPauseChanged(_futureVault, withdrawalPaused);
    }

    /**
     * @notice Getter for the futureVault withdrawals state
     * @param _futureVault the interface of the futureVault
     * @return true is new withdrawals are paused, false otherwise
     */
    function isWithdrawalsPaused(address _futureVault)
        external
        view
        override
        returns (bool)
    {
        return withdrawalsPausedByFutureVault[_futureVault];
    }

    /**
     * @notice Toggle deposit
     * @param _futureVault the interface of the futureVault to toggle
     * @dev should only be called in extraordinary situations by the admin of the contract
     */
    function toggleDepositPause(IFutureVault _futureVault) external onlyAdmin {
        bool depositPaused = !depositsPausedByFutureVault[
            address(_futureVault)
        ];
        depositsPausedByFutureVault[address(_futureVault)] = depositPaused;
        emit DepositPauseChanged(_futureVault, depositPaused);
    }

    /**
     * @notice Toggle delegation
     * @dev should only be called in extraordinary situations by the admin of the contract
     */
    function toggleDelegationPause() external onlyAdmin {
        DELEGATION_ENABLED = !DELEGATION_ENABLED;
        emit DelegationPauseChanged(DELEGATION_ENABLED);
    }

    /**
     * @notice Getter for the futureVault deposits state
     * @param _futureVault the interface of the futureVault
     * @return true is new deposits are paused, false otherwise
     */
    function isDepositsPaused(address _futureVault)
        external
        view
        override
        returns (bool)
    {
        return depositsPausedByFutureVault[_futureVault];
    }
}

File 2 of 20 : EnumerableSetUpgradeable.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

/**
 * @dev Library for managing
 * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
 * types.
 *
 * Sets have the following properties:
 *
 * - Elements are added, removed, and checked for existence in constant time
 * (O(1)).
 * - Elements are enumerated in O(n). No guarantees are made on the ordering.
 *
 * ```
 * contract Example {
 *     // Add the library methods
 *     using EnumerableSet for EnumerableSet.AddressSet;
 *
 *     // Declare a set state variable
 *     EnumerableSet.AddressSet private mySet;
 * }
 * ```
 *
 * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
 * and `uint256` (`UintSet`) are supported.
 */
library EnumerableSetUpgradeable {
    // To implement this library for multiple types with as little code
    // repetition as possible, we write it in terms of a generic Set type with
    // bytes32 values.
    // The Set implementation uses private functions, and user-facing
    // implementations (such as AddressSet) are just wrappers around the
    // underlying Set.
    // This means that we can only create new EnumerableSets for types that fit
    // in bytes32.

    struct Set {
        // Storage of set values
        bytes32[] _values;

        // Position of the value in the `values` array, plus 1 because index 0
        // means a value is not in the set.
        mapping (bytes32 => uint256) _indexes;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function _add(Set storage set, bytes32 value) private returns (bool) {
        if (!_contains(set, value)) {
            set._values.push(value);
            // The value is stored at length-1, but we add 1 to all indexes
            // and use 0 as a sentinel value
            set._indexes[value] = set._values.length;
            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function _remove(Set storage set, bytes32 value) private returns (bool) {
        // We read and store the value's index to prevent multiple reads from the same storage slot
        uint256 valueIndex = set._indexes[value];

        if (valueIndex != 0) { // Equivalent to contains(set, value)
            // To delete an element from the _values array in O(1), we swap the element to delete with the last one in
            // the array, and then remove the last element (sometimes called as 'swap and pop').
            // This modifies the order of the array, as noted in {at}.

            uint256 toDeleteIndex = valueIndex - 1;
            uint256 lastIndex = set._values.length - 1;

            // When the value to delete is the last one, the swap operation is unnecessary. However, since this occurs
            // so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement.

            bytes32 lastvalue = set._values[lastIndex];

            // Move the last value to the index where the value to delete is
            set._values[toDeleteIndex] = lastvalue;
            // Update the index for the moved value
            set._indexes[lastvalue] = toDeleteIndex + 1; // All indexes are 1-based

            // Delete the slot where the moved value was stored
            set._values.pop();

            // Delete the index for the deleted slot
            delete set._indexes[value];

            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function _contains(Set storage set, bytes32 value) private view returns (bool) {
        return set._indexes[value] != 0;
    }

    /**
     * @dev Returns the number of values on the set. O(1).
     */
    function _length(Set storage set) private view returns (uint256) {
        return set._values.length;
    }

   /**
    * @dev Returns the value stored at position `index` in the set. O(1).
    *
    * Note that there are no guarantees on the ordering of values inside the
    * array, and it may change when more values are added or removed.
    *
    * Requirements:
    *
    * - `index` must be strictly less than {length}.
    */
    function _at(Set storage set, uint256 index) private view returns (bytes32) {
        require(set._values.length > index, "EnumerableSet: index out of bounds");
        return set._values[index];
    }

    // Bytes32Set

    struct Bytes32Set {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {
        return _add(set._inner, value);
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {
        return _remove(set._inner, value);
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {
        return _contains(set._inner, value);
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(Bytes32Set storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

   /**
    * @dev Returns the value stored at position `index` in the set. O(1).
    *
    * Note that there are no guarantees on the ordering of values inside the
    * array, and it may change when more values are added or removed.
    *
    * Requirements:
    *
    * - `index` must be strictly less than {length}.
    */
    function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {
        return _at(set._inner, index);
    }

    // AddressSet

    struct AddressSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(AddressSet storage set, address value) internal returns (bool) {
        return _add(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(AddressSet storage set, address value) internal returns (bool) {
        return _remove(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(AddressSet storage set, address value) internal view returns (bool) {
        return _contains(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(AddressSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

   /**
    * @dev Returns the value stored at position `index` in the set. O(1).
    *
    * Note that there are no guarantees on the ordering of values inside the
    * array, and it may change when more values are added or removed.
    *
    * Requirements:
    *
    * - `index` must be strictly less than {length}.
    */
    function at(AddressSet storage set, uint256 index) internal view returns (address) {
        return address(uint160(uint256(_at(set._inner, index))));
    }


    // UintSet

    struct UintSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(UintSet storage set, uint256 value) internal returns (bool) {
        return _add(set._inner, bytes32(value));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(UintSet storage set, uint256 value) internal returns (bool) {
        return _remove(set._inner, bytes32(value));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(UintSet storage set, uint256 value) internal view returns (bool) {
        return _contains(set._inner, bytes32(value));
    }

    /**
     * @dev Returns the number of values on the set. O(1).
     */
    function length(UintSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

   /**
    * @dev Returns the value stored at position `index` in the set. O(1).
    *
    * Note that there are no guarantees on the ordering of values inside the
    * array, and it may change when more values are added or removed.
    *
    * Requirements:
    *
    * - `index` must be strictly less than {length}.
    */
    function at(UintSet storage set, uint256 index) internal view returns (uint256) {
        return uint256(_at(set._inner, index));
    }
}

File 3 of 20 : SafeERC20Upgradeable.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

import "./IERC20Upgradeable.sol";
import "../../math/SafeMathUpgradeable.sol";
import "../../utils/AddressUpgradeable.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 SafeERC20Upgradeable {
    using SafeMathUpgradeable for uint256;
    using AddressUpgradeable for address;

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

    function safeTransferFrom(IERC20Upgradeable 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(IERC20Upgradeable 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(IERC20Upgradeable 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(IERC20Upgradeable 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(IERC20Upgradeable 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 4 of 20 : SafeMathUpgradeable.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 SafeMathUpgradeable {
    /**
     * @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 20 : ReentrancyGuardUpgradeable.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;
import "../proxy/Initializable.sol";

/**
 * @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 ReentrancyGuardUpgradeable is Initializable {
    // 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;

    function __ReentrancyGuard_init() internal initializer {
        __ReentrancyGuard_init_unchained();
    }

    function __ReentrancyGuard_init_unchained() internal initializer {
        _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;
    }
    uint256[49] private __gap;
}

File 6 of 20 : IERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.7.6;

import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";

interface IERC20 is IERC20Upgradeable {
    /**
     * @dev Returns the name of the token.
     */
    function name() external returns (string memory);

    /**
     * @dev Returns the symbol of the token, usually a shorter version of the
     * name.
     */
    function symbol() external returns (string memory);

    /**
     * @dev Returns the number of decimals used to get its user representation.
     * For example, if `decimals` equals `2`, a balance of `505` tokens should
     * be displayed to a user as `5,05` (`505 / 10 ** 2`).
     *
     * Tokens usually opt for a value of 18, imitating the relationship between
     * Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is
     * called.
     *
     * NOTE: This information is only used for _display_ purposes: it in
     * no way affects any of the arithmetic of the contract, including
     * {IERC20-balanceOf} and {IERC20-transfer}.
     */
    function decimals() external view returns (uint8);

    /**
     * @dev Atomically increases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function increaseAllowance(address spender, uint256 addedValue)
        external
        returns (bool);

    /**
     * @dev Atomically decreases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `spender` must have allowance for the caller of at least
     * `subtractedValue`.
     */
    function decreaseAllowance(address spender, uint256 subtractedValue)
        external
        returns (bool);
}

File 7 of 20 : IFutureYieldToken.sol
// SPDX-License-Identifier: BUSL-1.1

pragma solidity 0.7.6;

import "contracts/Protocol/interfaces/apwine/IFutureVault.sol";

interface IFutureYieldToken {
    /**
     * @dev Destroys `amount` tokens from the caller.
     *
     * See {ERC20-_burn}.
     */
    function burn(uint256 amount) external;

    /**
     * @dev Destroys `amount` tokens from `account`, deducting from the caller's
     * allowance.
     *
     * See {ERC20-_burn} and {ERC20-allowance}.
     *
     * Requirements:
     *
     * - the caller must have allowance for ``accounts``'s tokens of at least
     * `amount`.
     */
    function burnFrom(address account, uint256 amount) external;

    /**
     * @dev Creates `amount` new tokens for `to`.
     *
     * See {ERC20-_mint}.
     *
     * Requirements:
     *
     * - the caller must have the `MINTER_ROLE`.
     */
    function mint(address to, uint256 amount) external;

    /**
     * @notice Returns the current balance of one user (without the claimable amount)
     * @param account the address of the account to check the balance of
     * @return the current fyt balance of this address
     */
    function recordedBalanceOf(address account) external view returns (uint256);

    /**
     * @notice Returns the current balance of one user including unclaimed FYT
     * @param account the address of the account to check the balance of
     * @return the total FYT balance of one address
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @notice Getter for the future vault link to this fyt
     * @return the address of the future vault
     */
    function futureVault() external view returns (IFutureVault);

    /**
     * @notice Getter for the internal period index of this fyt
     * @return the internal period index
     */
    function internalPeriodID() external view returns (uint256);

    /**
     * @dev See {IERC20-totalSupply}.
     */
    function totalSupply() external view returns (uint256);
}

File 8 of 20 : IFutureVault.sol
// SPDX-License-Identifier: BUSL-1.1

pragma solidity 0.7.6;

import "contracts/Protocol/interfaces/apwine/tokens/IPT.sol";
import "contracts/Protocol/interfaces/apwine/IRegistry.sol";
import "contracts/Protocol/interfaces/apwine/IFutureWallet.sol";
import "contracts/Protocol/interfaces/apwine/IRewardsRecipient.sol";

interface IFutureVault is IRewardsRecipient {
    /* Events */
    event NewPeriodStarted(uint256 indexed _newPeriodIndex);
    event FutureWalletSet(address indexed _futureWallet);
    event RegistrySet(IRegistry _registry);
    event FundsDeposited(address indexed _user, uint256 _amount);
    event FundsWithdrawn(address indexed _user, uint256 _amount);
    event PTSet(IPT _pt);
    event LiquidityTransfersPaused();
    event LiquidityTransfersResumed();
    event DelegationCreated(
        address indexed _delegator,
        address indexed _receiver,
        uint256 _amount
    );
    event DelegationRemoved(
        address indexed _delegator,
        address indexed _receiver,
        uint256 _amount
    );

    /* Params */
    /**
     * @notice Getter for the PERIOD future parameter
     * @return returns the period duration of the future
     */
    function PERIOD_DURATION() external view returns (uint256);

    /**
     * @notice Getter for the PLATFORM_NAME future parameter
     * @return returns the platform of the future
     */
    function PLATFORM_NAME() external view returns (string memory);

    /**
     * @notice Start a new period
     * @dev needs corresponding permissions for sender
     */
    function startNewPeriod() external;

    /**
     * @notice Exit a terminated pool
     * @param _user the user to exit from the pool
     * @dev only pt are required as there  aren't any new FYTs
     */
    function exitTerminatedFuture(address _user) external;

    /**
     * @notice Update the state of the user and mint claimable pt
     * @param _user user adress
     */
    function updateUserState(address _user) external;

    /**
     * @notice Send the user their owed FYT (and pt if there are some claimable)
     * @param _user address of the user to send the FYT to
     */
    function claimFYT(address _user, uint256 _amount) external;

    /**
     * @notice Deposit funds into ongoing period
     * @param _user user adress
     * @param _amount amount of funds to unlock
     * @dev part of the amount deposited will be used to buy back the yield already generated proportionally to the amount deposited
     */
    function deposit(address _user, uint256 _amount) external;

    /**
     * @notice Sender unlocks the locked funds corresponding to their pt holding
     * @param _user user adress
     * @param _amount amount of funds to unlock
     * @dev will require a transfer of FYT of the ongoing period corresponding to the funds unlocked
     */
    function withdraw(address _user, uint256 _amount) external;

    /**
     * @notice Create a delegation from one address to another
     * @param _delegator the address delegating its future FYTs
     * @param _receiver the address receiving the future FYTs
     * @param _amount the of future FYTs to delegate
     */
    function createFYTDelegationTo(
        address _delegator,
        address _receiver,
        uint256 _amount
    ) external;

    /**
     * @notice Remove a delegation from one address to another
     * @param _delegator the address delegating its future FYTs
     * @param _receiver the address receiving the future FYTs
     * @param _amount the of future FYTs to remove from the delegation
     */
    function withdrawFYTDelegationFrom(
        address _delegator,
        address _receiver,
        uint256 _amount
    ) external;

    /* Getters */

    /**
     * @notice Getter the total number of FYTs on address is delegating
     * @param _delegator the delegating address
     * @return totalDelegated the number of FYTs delegated
     */
    function getTotalDelegated(address _delegator)
        external
        view
        returns (uint256 totalDelegated);

    /**
     * @notice Getter for next period index
     * @return next period index
     * @dev index starts at 1
     */
    function getNextPeriodIndex() external view returns (uint256);

    /**
     * @notice Getter for current period index
     * @return current period index
     * @dev index starts at 1
     */
    function getCurrentPeriodIndex() external view returns (uint256);

    /**
     * @notice Getter for the amount of pt that the user can claim
     * @param _user user to check the check the claimable pt of
     * @return the amount of pt claimable by the user
     */
    function getClaimablePT(address _user, uint256 _totalDelegated)
        external
        view
        returns (uint256);

    /**
     * @notice Getter for user IBT amount that is unlockable
     * @param _user the user to unlock the IBT from
     * @return the amount of IBT the user can unlock
     */
    function getUnlockableFunds(address _user) external view returns (uint256);

    /**
     * @notice Getter for the amount of FYT that the user can claim for a certain period
     * @param _user the user to check the claimable FYT of
     * @param _periodIndex period ID to check the claimable FYT of
     * @return the amount of FYT claimable by the user for this period ID
     */
    function getClaimableFYTForPeriod(address _user, uint256 _periodIndex)
        external
        view
        returns (uint256);

    /**
     * @notice Getter for the yield currently generated by one pt for the current period
     * @return the amount of yield (in IBT) generated during the current period
     */
    function getUnrealisedYieldPerPT() external view returns (uint256);

    /**
     * @notice Getter for the number of pt that can be minted for an amoumt deposited now
     * @param _amount the amount to of IBT to deposit
     * @return the number of pt that can be minted for that amount
     */
    function getPTPerAmountDeposited(uint256 _amount)
        external
        view
        returns (uint256);

    /**
     * @notice Getter for total underlying deposited in the vault
     * @return the total amount of funds deposited in the vault (in underlying)
     */
    function getTotalUnderlyingDeposited() external view returns (uint256);

    /**
     * @notice Getter for the total yield generated during one period
     * @param _periodID the period id
     * @return the total yield in underlying value
     */
    function getYieldOfPeriod(uint256 _periodID)
        external
        view
        returns (uint256);

    /**
     * @notice Getter for controller address
     * @return the controller address
     */
    function getControllerAddress() external view returns (address);

    /**
     * @notice Getter for futureWallet address
     * @return futureWallet address
     */
    function getFutureWalletAddress() external view returns (address);

    /**
     * @notice Getter for the IBT address
     * @return IBT address
     */
    function getIBTAddress() external view returns (address);

    /**
     * @notice Getter for future pt address
     * @return pt address
     */
    function getPTAddress() external view returns (address);

    /**
     * @notice Getter for FYT address of a particular period
     * @param _periodIndex period index
     * @return FYT address
     */
    function getFYTofPeriod(uint256 _periodIndex)
        external
        view
        returns (address);

    /**
     * @notice Getter for the terminated state of the future
     * @return true if this vault is terminated
     */
    function isTerminated() external view returns (bool);

    /* Admin functions */

    /**
     * @notice Set futureWallet address
     */
    function setFutureWallet(IFutureWallet _futureWallet) external;

    /**
     * @notice Pause liquidity transfers
     */
    function pauseLiquidityTransfers() external;

    /**
     * @notice Resume liquidity transfers
     */
    function resumeLiquidityTransfers() external;

    /**
     * @notice Convert an amount of IBTs in its equivalent in underlying tokens
     * @param _amount the amount of IBTs
     * @return the corresponding amount of underlying
     */
    function convertIBTToUnderlying(uint256 _amount)
        external
        view
        returns (uint256);

    /**
     * @notice Convert an amount of underlying tokens in its equivalent in IBTs
     * @param _amount the amount of underlying tokens
     * @return the corresponding amount of IBTs
     */
    function convertUnderlyingtoIBT(uint256 _amount)
        external
        view
        returns (uint256);

    /**
     * @notice Convert an amount of IBTs in its equivalent in underlying tokens
     * @param _amount the amount of IBTs
     * @param _rate the rate to convert at
     * @return the corresponding amount of underlying
     */
    function convertIBTToUnderlyingWithRate(uint256 _amount, uint256 _rate)
        external
        view
        returns (uint256);

    /**
     * @notice Convert an amount of underlying tokens in its equivalent in IBTs
     * @param _amount the amount of underlying tokens
     * @param _rate the rate to convert at
     * @return the corresponding amount of IBTs
     */
    function convertUnderlyingtoIBTWithRate(uint256 _amount, uint256 _rate)
        external
        view
        returns (uint256);
}

File 9 of 20 : IFutureWallet.sol
// SPDX-License-Identifier: BUSL-1.1

pragma solidity 0.7.6;

import "contracts/Protocol/interfaces/apwine/IRewardsRecipient.sol";

interface IFutureWallet is IRewardsRecipient {
    /* Events */
    event YieldRedeemed(address indexed _user, uint256 _periodIndex);
    event WithdrawalsPauseChanged(bool _withdrawalPaused);

    /**
     * @notice register the yield of an expired period
     * @param _amount the amount of yield to be registered
     */
    function registerExpiredFuture(uint256 _amount) external;

    /**
     * @notice redeem the yield of the underlying yield of the FYT held by the sender
     * @param _periodIndex the index of the period to redeem the yield from
     */
    function redeemYield(uint256 _periodIndex) external;

    /**
     * @notice return the yield that could be redeemed by an address for a particular period
     * @param _periodIndex the index of the corresponding period
     * @param _user the FYT holder
     * @return the yield that could be redeemed by the token holder for this period
     */
    function getRedeemableYield(uint256 _periodIndex, address _user)
        external
        view
        returns (uint256);

    /**
     * @notice getter for the address of the future corresponding to this future wallet
     * @return the address of the future
     */
    function getFutureAddress() external view returns (address);

    /**
     * @notice getter for the address of the IBT corresponding to this future wallet
     * @return the address of the IBT
     */
    function getIBTAddress() external view returns (address);
}

File 10 of 20 : IController.sol
// SPDX-License-Identifier: BUSL-1.1

pragma solidity 0.7.6;
import "contracts/Protocol/interfaces/apwine/IFutureVault.sol";
import "contracts/Protocol/interfaces/apwine/IRegistry.sol";

interface IController {
    /* Events */

    event NextPeriodSwitchSet(
        uint256 indexed _periodDuration,
        uint256 _nextSwitchTimestamp
    );
    event NewPeriodDurationIndexSet(uint256 indexed _periodIndex);
    event FutureRegistered(IFutureVault indexed _futureVault);
    event FutureUnregistered(IFutureVault indexed _futureVault);
    event StartingDelaySet(uint256 _startingDelay);
    event FutureTerminated(IFutureVault indexed _futureVault);
    event DepositsPaused(IFutureVault _futureVault);
    event DepositsResumed(IFutureVault _futureVault);
    event WithdrawalsPaused(IFutureVault _futureVault);
    event WithdrawalsResumed(IFutureVault _futureVault);
    event FutureSetToBeTerminated(IFutureVault _futureVault);

    /* Params */

    function STARTING_DELAY() external view returns (uint256);

    /* User Methods */

    /**
     * @notice Deposit funds into ongoing period
     * @param _futureVault the address of the futureVault to be deposit the funds in
     * @param _amount the amount to deposit on the ongoing period
     * @dev part of the amount depostied will be used to buy back the yield already generated proportionaly to the amount deposited
     */
    function deposit(IFutureVault _futureVault, uint256 _amount) external;

    function depositForUser(
        IFutureVault _futureVault,
        address _user,
        uint256 _amount
    ) external;

    /**
     * @notice Withdraw deposited funds from APWine
     * @param _futureVault the address of the futureVault to withdraw the IBT from
     * @param _amount the amount to withdraw
     */
    function withdraw(IFutureVault _futureVault, uint256 _amount) external;

    /**
     * @notice Exit a terminated pool
     * @param _futureVault the address of the futureVault to exit from from
     * @dev only pt are required as there  aren't any new FYTs
     */
    function exitTerminatedFuture(IFutureVault _futureVault) external;

    /**
     * @notice Create a delegation from one address to another for a futureVault
     * @param _futureVault the corresponding futureVault address
     * @param _receiver the address receiving the futureVault FYTs
     * @param _amount the of futureVault FYTs to delegate
     */
    function createFYTDelegationTo(
        IFutureVault _futureVault,
        address _receiver,
        uint256 _amount
    ) external;

    /**
     * @notice Remove a delegation from one address to another for a futureVault
     * @param _futureVault the corresponding futureVault address
     * @param _receiver the address receiving the futureVault FYTs
     * @param _amount the of futureVault FYTs to remove from the delegation
     */
    function withdrawFYTDelegationFrom(
        IFutureVault _futureVault,
        address _receiver,
        uint256 _amount
    ) external;

    /**
     * @notice Register a newly created futureVault in the registry
     * @param _futureVault the interface of the new futureVault
     */
    function registerNewFutureVault(IFutureVault _futureVault) external;

    /**
     * @notice Unregister a futureVault from the registry
     * @param _futureVault the interface of the futureVault to unregister
     */
    function unregisterFutureVault(IFutureVault _futureVault) external;

    /**
     * @notice Change the delay for starting a new period
     * @param _startingDelay the new delay (+-) to start the next period
     */
    function setPeriodStartingDelay(uint256 _startingDelay) external;

    /**
     * @notice Start a specific future
     * @param _futureVault the interface of the futureVault to start
     * @dev should not be called if planning to use startFuturesByPeriodDuration in the same period
     */
    function startFuture(IFutureVault _futureVault) external;

    /**
     * @notice Set the next period switch timestamp for the futureVault with corresponding duration
     * @param _periodDuration the period duration
     * @param _nextPeriodTimestamp the next period switch timestamp
     */
    function setNextPeriodSwitchTimestamp(
        uint256 _periodDuration,
        uint256 _nextPeriodTimestamp
    ) external;

    /**
     * @notice Set the next period duration index
     * @param _periodDuration the period duration
     * @param _newPeriodIndex the next period duration index
     * @dev should only be called if there is a need of arbitrarily chaging the indexes in the FYT/PT naming
     */
    function setPeriodDurationIndex(
        uint256 _periodDuration,
        uint256 _newPeriodIndex
    ) external;

    /**
     * @notice Start all futures that have a defined period duration to synchronize them
     * @param _periodDuration the period duration of the futures to start
     */
    function startFuturesByPeriodDuration(uint256 _periodDuration) external;

    /* Getters */

    /**
     * @notice Getter for the registry address of the protocol
     * @return the address of the protocol registry
     */
    function getRegistryAddress() external view returns (address);

    /**
     * @notice Getter for the period index depending on the period duration of the futureVault
     * @param _periodDuration the duration of the periods
     * @return the period index
     */
    function getPeriodIndex(uint256 _periodDuration)
        external
        view
        returns (uint256);

    /**
     * @notice Getter for the beginning timestamp of the next period for the futures with a defined period duration
     * @param _periodDuration the duration of the periods
     * @return the timestamp of the beginning of the next period
     */
    function getNextPeriodStart(uint256 _periodDuration)
        external
        view
        returns (uint256);

    /**
     * @notice Getter for the list of futureVault durations registered in the contract
     * @return durationsList which consists of futureVault durations
     */
    function getDurations()
        external
        view
        returns (uint256[] memory durationsList);

    /**
     * @notice Getter for the futures by period duration
     * @param _periodDuration the period duration of the futures to return
     */
    function getFuturesWithDuration(uint256 _periodDuration)
        external
        view
        returns (address[] memory filteredFutures);

    /* Security functions */

    /**
     * @notice Terminate a futureVault
     * @param _futureVault the interface of the futureVault to terminate
     * @dev should only be called in extraordinary situations by the admin of the contract
     */
    function setFutureToTerminate(IFutureVault _futureVault) external;

    /**
     * @notice Getter for the futureVault period state
     * @param _futureVault the address of the futureVault
     * @return true if the futureVault is terminated
     */
    function isFutureTerminated(address _futureVault)
        external
        view
        returns (bool);

    /**
     * @notice Getter for the futureVault period state
     * @param _futureVault the address of the futureVault
     * @return true if the futureVault is set to be terminated at its expiration
     */
    function isFutureSetToBeTerminated(address _futureVault)
        external
        view
        returns (bool);

    /**
     * @notice Getter for the futureVault withdrawals state
     * @param _futureVault the address of the futureVault
     * @return true is new withdrawals are paused, false otherwise
     */
    function isWithdrawalsPaused(address _futureVault)
        external
        view
        returns (bool);

    /**
     * @notice Getter for the futureVault deposits state
     * @param _futureVault the address of the futureVault
     * @return true is new deposits are paused, false otherwise
     */
    function isDepositsPaused(address _futureVault)
        external
        view
        returns (bool);

    /* Future Vault rewards mechanism */

    function harvestVaultRewards(IFutureVault _futureVault) external;

    function redeemVaultRewards(IFutureVault _futureVault, address _rewardToken)
        external;

    function redeemAllVaultRewards(IFutureVault _futureVault) external;

    function harvestWalletRewards(IFutureVault _futureVault) external;

    function redeemAllWalletRewards(IFutureVault _futureVault) external;

    function redeemWalletRewards(
        IFutureVault _futureVault,
        address _rewardToken
    ) external;
}

File 11 of 20 : RegistryStorage.sol
// SPDX-License-Identifier: BUSL-1.1

pragma solidity 0.7.6;

import "contracts/Protocol/interfaces/apwine/IRegistry.sol";

import "contracts/Protocol/utils/RoleCheckable.sol";

contract RegistryStorage is RoleCheckable {
    IRegistry internal registry;

    event RegistryChanged(IRegistry _registry);

    /* User Methods */

    /**
     * @notice Setter for the registry address
     * @param _registry the address of the new registry
     */
    function setRegistry(IRegistry _registry) external onlyAdmin {
        registry = _registry;
        emit RegistryChanged(_registry);
    }
}

File 12 of 20 : IERC20Upgradeable.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 IERC20Upgradeable {
    /**
     * @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 13 of 20 : AddressUpgradeable.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.2 <0.8.0;

/**
 * @dev Collection of functions related to the address type
 */
library AddressUpgradeable {
    /**
     * @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);
    }

    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 14 of 20 : Initializable.sol
// SPDX-License-Identifier: MIT

// solhint-disable-next-line compiler-version
pragma solidity >=0.4.24 <0.8.0;

import "../utils/AddressUpgradeable.sol";

/**
 * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
 * behind a proxy. Since a proxied contract can't have a constructor, it's common to move constructor logic to an
 * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
 * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
 *
 * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
 * possible by providing the encoded function call as the `_data` argument to {UpgradeableProxy-constructor}.
 *
 * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
 * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
 */
abstract contract Initializable {

    /**
     * @dev Indicates that the contract has been initialized.
     */
    bool private _initialized;

    /**
     * @dev Indicates that the contract is in the process of being initialized.
     */
    bool private _initializing;

    /**
     * @dev Modifier to protect an initializer function from being invoked twice.
     */
    modifier initializer() {
        require(_initializing || _isConstructor() || !_initialized, "Initializable: contract is already initialized");

        bool isTopLevelCall = !_initializing;
        if (isTopLevelCall) {
            _initializing = true;
            _initialized = true;
        }

        _;

        if (isTopLevelCall) {
            _initializing = false;
        }
    }

    /// @dev Returns true if and only if the function is running in the constructor
    function _isConstructor() private view returns (bool) {
        return !AddressUpgradeable.isContract(address(this));
    }
}

File 15 of 20 : IPT.sol
// SPDX-License-Identifier: BUSL-1.1

pragma solidity 0.7.6;

import "contracts/Protocol/interfaces/apwine/IFutureVault.sol";

interface IPT {
    /**
     * @dev Destroys `amount` tokens from the caller.
     *
     * See {ERC20-_burn}.
     */
    function burn(uint256 amount) external;

    /**
     * @dev Creates `amount` new tokens for `to`.
     *
     * See {ERC20-_mint}.
     *
     * Requirements:
     *
     * - the caller must have the `MINTER_ROLE`.
     */
    function mint(address to, uint256 amount) external;

    /**
     * @dev Destroys `amount` tokens from `account`, deducting from the caller's
     * allowance.
     *
     * See {ERC20-_burn} and {ERC20-allowance}.
     *
     * Requirements:
     *
     * - the caller must have allowance for ``accounts``'s tokens of at least
     * `amount`.
     */
    function burnFrom(address account, uint256 amount) external;

    /**
     * @dev Pauses all token transfers.
     *
     * See {ERC20Pausable} and {Pausable-_pause}.
     *
     * Requirements:
     *
     * - the caller must have the `PAUSER_ROLE`.
     */
    function pause() external;

    /**
     * @dev Unpauses all token transfers.
     *
     * See {ERC20Pausable} and {Pausable-_unpause}.
     *
     * Requirements:
     *
     * - the caller must have the `PAUSER_ROLE`.
     */
    function unpause() external;

    /**
     * @notice Returns the current balance of one user (without the claimable amount)
     * @param account the address of the account to check the balance of
     * @return the current pt balance of this address
     */
    function recordedBalanceOf(address account) external view returns (uint256);

    /**
     * @notice Returns the current balance of one user including the pt that were not claimed yet
     * @param account the address of the account to check the balance of
     * @return the total pt balance of one address
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @notice Getter for the future vault link to this pt
     * @return the address of the future vault
     */
    function futureVault() external view returns (IFutureVault);
}

File 16 of 20 : IRegistry.sol
// SPDX-License-Identifier: BUSL-1.1

pragma solidity 0.7.6;
pragma experimental ABIEncoderV2;

interface IRegistry {
    /* Setters */
    /**
     * @notice Setter for the treasury address
     * @param _newTreasury the address of the new treasury
     */
    function setTreasury(address _newTreasury) external;

    /**
     * @notice Setter for the tokens factory addres
     * @param _newTokenFactory the address of the token factory
     */
    function setTokensFactory(address _newTokenFactory) external;

    /**
     * @notice Setter for the controller address
     * @param _newController the address of the new controller
     */
    function setController(address _newController) external;

    /**
     * @notice Setter for the APWine IBT logic address
     * @param _PTLogic the address of the new APWine IBT logic
     */
    function setPTLogic(address _PTLogic) external;

    /**
     * @notice Setter for the APWine FYT logic address
     * @param _FYTLogic the address of the new APWine FYT logic
     */
    function setFYTLogic(address _FYTLogic) external;

    /**
     * @notice Getter for the controller address
     * @return the address of the controller
     */
    function getControllerAddress() external view returns (address);

    /**
     * @notice Getter for the treasury address
     * @return the address of the treasury
     */
    function getTreasuryAddress() external view returns (address);

    /**
     * @notice Getter for the token factory address
     * @return the token factory address
     */
    function getTokensFactoryAddress() external view returns (address);

    /**
     * @notice Getter for APWine IBT logic address
     * @return the APWine IBT logic address
     */
    function getPTLogicAddress() external view returns (address);

    /**
     * @notice Getter for APWine FYT logic address
     * @return the APWine FYT logic address
     */
    function getFYTLogicAddress() external view returns (address);

    /* Futures */
    /**
     * @notice Add a future to the registry
     * @param _future the address of the future to add to the registry
     */
    function addFutureVault(address _future) external;

    /**
     * @notice Remove a future from the registry
     * @param _future the address of the future to remove from the registry
     */
    function removeFutureVault(address _future) external;

    /**
     * @notice Getter to check if a future is registered
     * @param _future the address of the future to check the registration of
     * @return true if it is, false otherwise
     */
    function isRegisteredFutureVault(address _future)
        external
        view
        returns (bool);

    /**
     * @notice Getter for the future registered at an index
     * @param _index the index of the future to return
     * @return the address of the corresponding future
     */
    function getFutureVaultAt(uint256 _index) external view returns (address);

    /**
     * @notice Getter for number of future registered
     * @return the number of future registered
     */
    function futureVaultCount() external view returns (uint256);
}

File 17 of 20 : IRewardsRecipient.sol
// SPDX-License-Identifier: BUSL-1.1

pragma solidity 0.7.6;

/**
 * @title Rewards future abstraction
 * @notice Handles all future mechanisms along with reward-specific functionality
 * @dev Allows for better decoupling of rewards logic with core future logic
 */
interface IRewardsRecipient {
    /* Events */
    event RewardsHarvested();
    event RewardTokenAdded(address _token);
    event RewardTokenRedeemed(address _token, uint256 _amount);
    event RewardsRecipientUpdated(address _recipient);

    /**
     * @notice Harvest all rewards from the vault
     */
    function harvestRewards() external;

    /**
     * @notice Transfer all the redeemable rewards to set defined recipient
     */
    function redeemAllVaultRewards() external;

    /**
     * @notice Transfer the specified token reward balance tot the defined recipient
     * @param _rewardToken the reward token to redeem the balance of
     */
    function redeemVaultRewards(address _rewardToken) external;

    /**
     * @notice Transfer all the redeemable rewards to set defined recipient
     */
    function redeemAllWalletRewards() external;

    /**
     * @notice Transfer the specified token reward balance tot the defined recipient
     * @param _rewardToken the reward token to redeem the balance of
     */
    function redeemWalletRewards(address _rewardToken) external;

    /**
     * @notice Add a token to the list of reward tokens
     * @param _token the reward token to add to the list
     * @dev the token must be different than the ibt
     */
    function addRewardsToken(address _token) external;

    /**
     * @notice Setter for the address of the rewards recipient
     */
    function setRewardRecipient(address _recipient) external;

    /**
     * @notice Getter to check if a token is in the reward tokens list
     * @param _token the token to check if it is in the list
     * @return true if the token is a reward token
     */
    function isRewardToken(address _token) external view returns (bool);

    /**
     * @notice Getter for the reward token at an index
     * @param _index the index of the reward token in the list
     * @return the address of the token at this index
     */
    function getRewardTokenAt(uint256 _index) external view returns (address);

    /**
     * @notice Getter for the size of the list of reward tokens
     * @return the number of token in the list
     */
    function getRewardTokensCount() external view returns (uint256);

    /**
     * @notice Getter for the address of the rewards recipient
     * @return the address of the rewards recipient
     */
    function getRewardsRecipient() external view returns (address);
}

File 18 of 20 : RoleCheckable.sol
// SPDX-License-Identifier: BUSL-1.1

pragma solidity 0.7.6;

import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";

contract RoleCheckable is AccessControlUpgradeable {
    /* ACR Roles*/

    // keccak256("DEFAULT_ADMIN_ROLE");
    bytes32 internal constant ADMIN_ROLE =
        0x1effbbff9c66c5e59634f24fe842750c60d18891155c32dd155fc2d661a4c86d;
    // keccak256("CONTROLLER_ROLE")
    bytes32 internal constant CONTROLLER_ROLE =
        0x7b765e0e932d348852a6f810bfa1ab891e259123f02db8cdcde614c570223357;
    // keccak256("START_FUTURE")
    bytes32 internal constant START_FUTURE =
        0xeb5092aab714e6356486bc97f25dd7a5c1dc5c7436a9d30e8d4a527fba24de1c;
    // keccak256("FUTURE_ROLE")
    bytes32 internal constant FUTURE_ROLE =
        0x52d2dbc4d362e84c42bdfb9941433968ba41423559d7559b32db1183b22b148f;
    // keccak256("HARVEST_REWARDS")
    bytes32 internal constant HARVEST_REWARDS =
        0xf2683e58e5a2a04c1ed32509bfdbf1e9ebc725c63f4c95425d2afd482bfdb0f8;

    /* Modifiers */

    modifier onlyAdmin() {
        require(
            hasRole(ADMIN_ROLE, msg.sender),
            "RoleCheckable: Caller should be ADMIN"
        );
        _;
    }

    modifier onlyStartFuture() {
        require(
            hasRole(START_FUTURE, msg.sender),
            "RoleCheckable: Caller should have START FUTURE Role"
        );
        _;
    }

    modifier onlyHarvestReward() {
        require(
            hasRole(HARVEST_REWARDS, msg.sender),
            "RoleCheckable: Caller should have HARVEST REWARDS Role"
        );
        _;
    }

    modifier onlyController() {
        require(
            hasRole(CONTROLLER_ROLE, msg.sender),
            "RoleCheckable: Caller should be CONTROLLER"
        );
        _;
    }
}

File 19 of 20 : AccessControlUpgradeable.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

import "../utils/EnumerableSetUpgradeable.sol";
import "../utils/AddressUpgradeable.sol";
import "../utils/ContextUpgradeable.sol";
import "../proxy/Initializable.sol";

/**
 * @dev Contract module that allows children to implement role-based access
 * control mechanisms.
 *
 * Roles are referred to by their `bytes32` identifier. These should be exposed
 * in the external API and be unique. The best way to achieve this is by
 * using `public constant` hash digests:
 *
 * ```
 * bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
 * ```
 *
 * Roles can be used to represent a set of permissions. To restrict access to a
 * function call, use {hasRole}:
 *
 * ```
 * function foo() public {
 *     require(hasRole(MY_ROLE, msg.sender));
 *     ...
 * }
 * ```
 *
 * Roles can be granted and revoked dynamically via the {grantRole} and
 * {revokeRole} functions. Each role has an associated admin role, and only
 * accounts that have a role's admin role can call {grantRole} and {revokeRole}.
 *
 * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
 * that only accounts with this role will be able to grant or revoke other
 * roles. More complex role relationships can be created by using
 * {_setRoleAdmin}.
 *
 * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
 * grant and revoke this role. Extra precautions should be taken to secure
 * accounts that have been granted it.
 */
abstract contract AccessControlUpgradeable is Initializable, ContextUpgradeable {
    function __AccessControl_init() internal initializer {
        __Context_init_unchained();
        __AccessControl_init_unchained();
    }

    function __AccessControl_init_unchained() internal initializer {
    }
    using EnumerableSetUpgradeable for EnumerableSetUpgradeable.AddressSet;
    using AddressUpgradeable for address;

    struct RoleData {
        EnumerableSetUpgradeable.AddressSet members;
        bytes32 adminRole;
    }

    mapping (bytes32 => RoleData) private _roles;

    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;

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

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

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

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

    /**
     * @dev Returns the number of accounts that have `role`. Can be used
     * together with {getRoleMember} to enumerate all bearers of a role.
     */
    function getRoleMemberCount(bytes32 role) public view returns (uint256) {
        return _roles[role].members.length();
    }

    /**
     * @dev Returns one of the accounts that have `role`. `index` must be a
     * value between 0 and {getRoleMemberCount}, non-inclusive.
     *
     * Role bearers are not sorted in any particular way, and their ordering may
     * change at any point.
     *
     * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure
     * you perform all queries on the same block. See the following
     * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]
     * for more information.
     */
    function getRoleMember(bytes32 role, uint256 index) public view returns (address) {
        return _roles[role].members.at(index);
    }

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

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function grantRole(bytes32 role, address account) public virtual {
        require(hasRole(_roles[role].adminRole, _msgSender()), "AccessControl: sender must be an admin to grant");

        _grantRole(role, account);
    }

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function revokeRole(bytes32 role, address account) public virtual {
        require(hasRole(_roles[role].adminRole, _msgSender()), "AccessControl: sender must be an admin to revoke");

        _revokeRole(role, account);
    }

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

        _revokeRole(role, account);
    }

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

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

    function _grantRole(bytes32 role, address account) private {
        if (_roles[role].members.add(account)) {
            emit RoleGranted(role, account, _msgSender());
        }
    }

    function _revokeRole(bytes32 role, address account) private {
        if (_roles[role].members.remove(account)) {
            emit RoleRevoked(role, account, _msgSender());
        }
    }
    uint256[49] private __gap;
}

File 20 of 20 : ContextUpgradeable.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;
import "../proxy/Initializable.sol";

/*
 * @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 ContextUpgradeable is Initializable {
    function __Context_init() internal initializer {
        __Context_init_unchained();
    }

    function __Context_init_unchained() internal initializer {
    }
    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;
    }
    uint256[50] private __gap;
}

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

Contract ABI

[{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"_delegationPaused","type":"bool"}],"name":"DelegationPauseChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"contract IFutureVault","name":"_futureVault","type":"address"},{"indexed":false,"internalType":"bool","name":"_depositPaused","type":"bool"}],"name":"DepositPauseChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"contract IFutureVault","name":"_futureVault","type":"address"}],"name":"DepositsPaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"contract IFutureVault","name":"_futureVault","type":"address"}],"name":"DepositsResumed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract IFutureVault","name":"_futureVault","type":"address"}],"name":"FutureRegistered","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"contract IFutureVault","name":"_futureVault","type":"address"}],"name":"FutureSetToBeTerminated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract IFutureVault","name":"_futureVault","type":"address"}],"name":"FutureTerminated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract IFutureVault","name":"_futureVault","type":"address"}],"name":"FutureUnregistered","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"_periodIndex","type":"uint256"}],"name":"NewPeriodDurationIndexSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"_periodDuration","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_nextSwitchTimestamp","type":"uint256"}],"name":"NextPeriodSwitchSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"_periodDuration","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_periodIndex","type":"uint256"}],"name":"PeriodSwitchedByDurationDisabled","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"contract IRegistry","name":"_registry","type":"address"}],"name":"RegistryChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_startingDelay","type":"uint256"}],"name":"StartingDelaySet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"contract IFutureVault","name":"_futureVault","type":"address"},{"indexed":false,"internalType":"bool","name":"_withdrawalPaused","type":"bool"}],"name":"WithdrawalPauseChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"contract IFutureVault","name":"_futureVault","type":"address"}],"name":"WithdrawalsPaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"contract IFutureVault","name":"_futureVault","type":"address"}],"name":"WithdrawalsResumed","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DELEGATION_ENABLED","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"STARTING_DELAY","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IFutureVault","name":"_futureVault","type":"address"},{"internalType":"address","name":"_receiver","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"createFYTDelegationTo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IFutureVault","name":"_futureVault","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"deposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IFutureVault","name":"_futureVault","type":"address"},{"internalType":"address","name":"_user","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"depositForUser","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IFutureVault","name":"_futureVault","type":"address"}],"name":"exitTerminatedFuture","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getDurations","outputs":[{"internalType":"uint256[]","name":"durationsList","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_periodDuration","type":"uint256"}],"name":"getFuturesWithDuration","outputs":[{"internalType":"address[]","name":"filteredFutures","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_periodDuration","type":"uint256"}],"name":"getNextPeriodStart","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_periodDuration","type":"uint256"}],"name":"getPeriodIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getRegistryAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getRoleMember","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleMemberCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IFutureVault","name":"_futureVault","type":"address"}],"name":"harvestVaultRewards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IFutureVault","name":"_futureVault","type":"address"}],"name":"harvestWalletRewards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IRegistry","name":"_registry","type":"address"},{"internalType":"address","name":"_admin","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_futureVault","type":"address"}],"name":"isDepositsPaused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_futureVault","type":"address"}],"name":"isFutureSetToBeTerminated","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_futureVault","type":"address"}],"name":"isFutureTerminated","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_futureVault","type":"address"}],"name":"isWithdrawalsPaused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IFutureVault","name":"_futureVault","type":"address"}],"name":"redeemAllVaultRewards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IFutureVault","name":"_futureVault","type":"address"}],"name":"redeemAllWalletRewards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IFutureVault","name":"_futureVault","type":"address"},{"internalType":"address","name":"_rewardToken","type":"address"}],"name":"redeemVaultRewards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IFutureVault","name":"_futureVault","type":"address"},{"internalType":"address","name":"_rewardToken","type":"address"}],"name":"redeemWalletRewards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IFutureVault","name":"_futureVault","type":"address"}],"name":"registerNewFutureVault","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IFutureVault","name":"_futureVault","type":"address"}],"name":"setFutureToTerminate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_periodDuration","type":"uint256"},{"internalType":"uint256","name":"_nextPeriodTimestamp","type":"uint256"}],"name":"setNextPeriodSwitchTimestamp","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_periodDuration","type":"uint256"},{"internalType":"uint256","name":"_newPeriodIndex","type":"uint256"}],"name":"setPeriodDurationIndex","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_startingDelay","type":"uint256"}],"name":"setPeriodStartingDelay","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IRegistry","name":"_registry","type":"address"}],"name":"setRegistry","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IFutureVault","name":"_futureVault","type":"address"}],"name":"startFuture","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_periodDuration","type":"uint256"}],"name":"startFuturesByPeriodDuration","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"toggleDelegationPause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IFutureVault","name":"_futureVault","type":"address"}],"name":"toggleDepositPause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IFutureVault","name":"_futureVault","type":"address"}],"name":"toggleWithdrawalPause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IFutureVault","name":"_futureVault","type":"address"}],"name":"unregisterFutureVault","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IFutureVault","name":"_futureVault","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IFutureVault","name":"_futureVault","type":"address"},{"internalType":"address","name":"_receiver","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"withdrawFYTDelegationFrom","outputs":[],"stateMutability":"nonpayable","type":"function"}]

608060405234801561001057600080fd5b50613892806100206000396000f3fe608060405234801561001057600080fd5b50600436106102f45760003560e01c80639c8975bc11610191578063cbe92708116100e3578063e812a4ec11610097578063f21de1e811610071578063f21de1e814610949578063f3fef3a314610951578063f5bc75381461097d576102f4565b8063e812a4ec146108e0578063ee21c3ce14610906578063efcb121b14610923576102f4565b8063dbfc9495116100c8578063dbfc94951461086e578063e4f98a2b14610894578063e74711a0146108ba576102f4565b8063cbe927081461081c578063d547741f14610842576102f4565b8063a91ee0dc11610145578063c21c152c1161011f578063c21c152c14610781578063c4d5b37d146107a7578063ca15c873146107ff576102f4565b8063a91ee0dc14610718578063b012818d1461073e578063bd669cc914610764576102f4565b8063a217fddf11610176578063a217fddf146106bc578063a42f3914146106c4578063a456888c146106ea576102f4565b80639c8975bc146106795780639d3164f11461069f576102f4565b80634a5d8cfa1161024a57806366bbb20b116101fe57806391d14854116101d857806391d1485414610601578063940e3e371461062d5780639bd3838a14610653576102f4565b806366bbb20b1461055e57806389fd8888146105945780639010d07c146105c2576102f4565b80634d613ade1161022f5780634d613ade146104df57806359b5e113146105155780635aacaf0e14610538576102f4565b80634a5d8cfa146104b15780634cb8745e146104b9576102f4565b80632f2ff15d116102ac5780634138319311610286578063413831931461041d57806347e7ef2414610457578063485cc95514610483576102f4565b80632f2ff15d146103bd578063338b8c49146103e957806336568abe146103f1576102f4565b80631b04bdad116102dd5780631b04bdad1461034d5780631c30eb6d14610383578063248a9ca3146103a0576102f4565b8063041c2120146102f9578063051339c214610328575b600080fd5b6103166004803603602081101561030f57600080fd5b5035610985565b60408051918252519081900360200190f35b61034b6004803603604081101561033e57600080fd5b5080359060200135610997565b005b61034b6004803603606081101561036357600080fd5b506001600160a01b03813581169160208101359091169060400135610a6e565b61034b6004803603602081101561039957600080fd5b5035610bb8565b610316600480360360208110156103b657600080fd5b5035610c46565b61034b600480360360408110156103d357600080fd5b50803590602001356001600160a01b0316610c5b565b610316610cc7565b61034b6004803603604081101561040757600080fd5b50803590602001356001600160a01b0316610ccd565b6104436004803603602081101561043357600080fd5b50356001600160a01b0316610d2e565b604080519115158252519081900360200190f35b61034b6004803603604081101561046d57600080fd5b506001600160a01b038135169060200135610d41565b61034b6004803603604081101561049957600080fd5b506001600160a01b0381358116916020013516610f5e565b61044361105a565b61034b600480360360208110156104cf57600080fd5b50356001600160a01b0316611063565b61034b600480360360608110156104f557600080fd5b506001600160a01b038135811691602081013590911690604001356111fb565b61034b6004803603604081101561052b57600080fd5b5080359060200135611368565b6104436004803603602081101561054e57600080fd5b50356001600160a01b031661144e565b61034b6004803603606081101561057457600080fd5b506001600160a01b0381358116916020810135909116906040013561146c565b61034b600480360360408110156105aa57600080fd5b506001600160a01b038135811691602001351661163d565b6105e5600480360360408110156105d857600080fd5b50803590602001356117c9565b604080516001600160a01b039092168252519081900360200190f35b6104436004803603604081101561061757600080fd5b50803590602001356001600160a01b03166117e8565b61034b6004803603602081101561064357600080fd5b50356001600160a01b0316611800565b61034b6004803603602081101561066957600080fd5b50356001600160a01b03166119fc565b6104436004803603602081101561068f57600080fd5b50356001600160a01b0316611bf9565b61034b600480360360208110156106b557600080fd5b5035611c17565b610316611dff565b61034b600480360360208110156106da57600080fd5b50356001600160a01b0316611e04565b61034b6004803603604081101561070057600080fd5b506001600160a01b0381358116916020013516611ec1565b61034b6004803603602081101561072e57600080fd5b50356001600160a01b03166120aa565b61034b6004803603602081101561075457600080fd5b50356001600160a01b031661215e565b6103166004803603602081101561077a57600080fd5b503561221b565b61034b6004803603602081101561079757600080fd5b50356001600160a01b031661222d565b6107af612388565b60408051602080825283518183015283519192839290830191858101910280838360005b838110156107eb5781810151838201526020016107d3565b505050509050019250505060405180910390f35b6103166004803603602081101561081557600080fd5b503561241f565b61034b6004803603602081101561083257600080fd5b50356001600160a01b0316612436565b61034b6004803603604081101561085857600080fd5b50803590602001356001600160a01b0316612600565b61034b6004803603602081101561088457600080fd5b50356001600160a01b0316612659565b61034b600480360360208110156108aa57600080fd5b50356001600160a01b031661283a565b61034b600480360360208110156108d057600080fd5b50356001600160a01b0316612955565b610443600480360360208110156108f657600080fd5b50356001600160a01b0316612a03565b6107af6004803603602081101561091c57600080fd5b5035612a21565b61034b6004803603602081101561093957600080fd5b50356001600160a01b0316612ad8565b6105e5612c33565b61034b6004803603604081101561096757600080fd5b506001600160a01b038135169060200135612c42565b61034b612d64565b60009081526098602052604090205490565b6109af6000805160206135e7833981519152336117e8565b6109ea5760405162461bcd60e51b81526004018080602001828103825260258152602001806137ac6025913960400191505060405180910390fd5b816109f6609b82612e04565b610a315760405162461bcd60e51b81526004018080602001828103825260258152602001806137296025913960400191505060405180910390fd5b6000838152609e60205260408082208490555183917fccd5e150ff3edf89bdc920f29b2dff17c43969f7a11cb5bcf050cb8dc450825291a2505050565b60655460408051631c7b981f60e31b81526001600160a01b03808716600483015291518693929092169163e3dcc0f891602480820192602092909190829003018186803b158015610abe57600080fd5b505afa158015610ad2573d6000803e3d6000fd5b505050506040513d6020811015610ae857600080fd5b5051610b29576040805162461bcd60e51b815260206004820152601e602482015260008051602061365c833981519152604482015290519081900360640190fd5b604080517f1b04bdad0000000000000000000000000000000000000000000000000000000081523360048201526001600160a01b03858116602483015260448201859052915191861691631b04bdad9160648082019260009290919082900301818387803b158015610b9a57600080fd5b505af1158015610bae573d6000803e3d6000fd5b5050505050505050565b610bd06000805160206135e7833981519152336117e8565b610c0b5760405162461bcd60e51b81526004018080602001828103825260258152602001806137ac6025913960400191505060405180910390fd5b60a48190556040805182815290517f0231d2bba9f0be98a6646ca3dc8184c854ce3e3691f77409d783eb88321a4b6c9181900360200190a150565b60009081526033602052604090206002015490565b600082815260336020526040902060020154610c7e90610c79612e10565b6117e8565b610cb95760405162461bcd60e51b815260040180806020018281038252602f81526020018061367c602f913960400191505060405180910390fd5b610cc38282612e14565b5050565b60a45481565b610cd5612e10565b6001600160a01b0316816001600160a01b031614610d245760405162461bcd60e51b815260040180806020018281038252602f81526020018061382e602f913960400191505060405180910390fd5b610cc38282612e7d565b6000610d3b60a083612ee6565b92915050565b60026066541415610d99576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b600260665560655460408051631c7b981f60e31b81526001600160a01b03808616600483015291518593929092169163e3dcc0f891602480820192602092909190829003018186803b158015610dee57600080fd5b505afa158015610e02573d6000803e3d6000fd5b505050506040513d6020811015610e1857600080fd5b5051610e59576040805162461bcd60e51b815260206004820152601e602482015260008051602061365c833981519152604482015290519081900360640190fd5b604080517f47e7ef240000000000000000000000000000000000000000000000000000000081523360048201526024810184905290516001600160a01b038516916347e7ef2491604480830192600092919082900301818387803b158015610ec057600080fd5b505af1158015610ed4573d6000803e3d6000fd5b50505050610f54338484866001600160a01b031663f018ae696040518163ffffffff1660e01b815260040160206040518083038186803b158015610f1757600080fd5b505afa158015610f2b573d6000803e3d6000fd5b505050506040513d6020811015610f4157600080fd5b50516001600160a01b0316929190612efb565b5050600160665550565b600054610100900460ff1680610f775750610f77612f89565b80610f85575060005460ff16155b610fc05760405162461bcd60e51b815260040180806020018281038252602e81526020018061377e602e913960400191505060405180910390fd5b600054610100900460ff16158015610feb576000805460ff1961ff0019909116610100171660011790555b610ff6600083610cb9565b61100e6000805160206135e783398151915283610cb9565b6065805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b03851617905560a5805460ff191660011790558015611055576000805461ff00191690555b505050565b60a55460ff1681565b61107b6000805160206135e7833981519152336117e8565b6110b65760405162461bcd60e51b81526004018080602001828103825260258152602001806137ac6025913960400191505060405180910390fd5b606554604080517fbc97cb180000000000000000000000000000000000000000000000000000000081526001600160a01b0384811660048301529151919092169163bc97cb1891602480830192600092919082900301818387803b15801561111d57600080fd5b505af1158015611131573d6000803e3d6000fd5b505050506000816001600160a01b0316636558954f6040518163ffffffff1660e01b815260040160206040518083038186803b15801561117057600080fd5b505afa158015611184573d6000803e3d6000fd5b505050506040513d602081101561119a57600080fd5b505190506111a9609b82612f9a565b506000818152609d602052604090206111c29083612fa6565b506040516001600160a01b038316907f4689c43367e2f2d63a4825749e54aeb0db216c23200a1998e4de8d4c4c07c6fa90600090a25050565b60a55460ff1661123c5760405162461bcd60e51b81526004018080602001828103825260228152602001806136ab6022913960400191505060405180910390fd5b60655460408051631c7b981f60e31b81526001600160a01b03808716600483015291518693929092169163e3dcc0f891602480820192602092909190829003018186803b15801561128c57600080fd5b505afa1580156112a0573d6000803e3d6000fd5b505050506040513d60208110156112b657600080fd5b50516112f7576040805162461bcd60e51b815260206004820152601e602482015260008051602061365c833981519152604482015290519081900360640190fd5b604080517f4d613ade0000000000000000000000000000000000000000000000000000000081523360048201526001600160a01b03858116602483015260448201859052915191861691634d613ade9160648082019260009290919082900301818387803b158015610b9a57600080fd5b6113806000805160206135e7833981519152336117e8565b6113bb5760405162461bcd60e51b81526004018080602001828103825260258152602001806137ac6025913960400191505060405180910390fd5b816113c7609b82612e04565b6114025760405162461bcd60e51b81526004018080602001828103825260258152602001806137296025913960400191505060405180910390fd5b6000838152609860209081526040918290208490558151848152915185927f7015405d264c65fb8d0c96f0d79b8f4c294c8dacbd821294e89649159494a9d992908290030190a2505050565b6001600160a01b0316600090815260a2602052604090205460ff1690565b600260665414156114c4576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b600260665560655460408051631c7b981f60e31b81526001600160a01b03808716600483015291518693929092169163e3dcc0f891602480820192602092909190829003018186803b15801561151957600080fd5b505afa15801561152d573d6000803e3d6000fd5b505050506040513d602081101561154357600080fd5b5051611584576040805162461bcd60e51b815260206004820152601e602482015260008051602061365c833981519152604482015290519081900360640190fd5b836001600160a01b03166347e7ef2484846040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050600060405180830381600087803b1580156115db57600080fd5b505af11580156115ef573d6000803e3d6000fd5b50505050611632338584876001600160a01b031663f018ae696040518163ffffffff1660e01b815260040160206040518083038186803b158015610f1757600080fd5b505060016066555050565b6116677ff2683e58e5a2a04c1ed32509bfdbf1e9ebc725c63f4c95425d2afd482bfdb0f8336117e8565b6116a25760405162461bcd60e51b81526004018080602001828103825260368152602001806136cd6036913960400191505060405180910390fd5b60655460408051631c7b981f60e31b81526001600160a01b03808616600483015291518593929092169163e3dcc0f891602480820192602092909190829003018186803b1580156116f257600080fd5b505afa158015611706573d6000803e3d6000fd5b505050506040513d602081101561171c57600080fd5b505161175d576040805162461bcd60e51b815260206004820152601e602482015260008051602061365c833981519152604482015290519081900360640190fd5b826001600160a01b0316638e484e0b836040518263ffffffff1660e01b815260040180826001600160a01b03168152602001915050600060405180830381600087803b1580156117ac57600080fd5b505af11580156117c0573d6000803e3d6000fd5b50505050505050565b60008281526033602052604081206117e19083612fbb565b9392505050565b60008281526033602052604081206117e19083612ee6565b61182a7feb5092aab714e6356486bc97f25dd7a5c1dc5c7436a9d30e8d4a527fba24de1c336117e8565b6118655760405162461bcd60e51b81526004018080602001828103825260338152602001806136296033913960400191505060405180910390fd5b60655460408051631c7b981f60e31b81526001600160a01b03808516600483015291518493929092169163e3dcc0f891602480820192602092909190829003018186803b1580156118b557600080fd5b505afa1580156118c9573d6000803e3d6000fd5b505050506040513d60208110156118df57600080fd5b5051611920576040805162461bcd60e51b815260206004820152601e602482015260008051602061365c833981519152604482015290519081900360640190fd5b6000826001600160a01b0316636558954f6040518163ffffffff1660e01b815260040160206040518083038186803b15801561195b57600080fd5b505afa15801561196f573d6000803e3d6000fd5b505050506040513d602081101561198557600080fd5b50516000818152609e6020908152604080832054609a8352818420818552909252909120805460ff191660011790559091506119c084612fc7565b60408051828152905183917fdc926b7032bfdcb253ace5d24cf95701f432680d49afa4aba3c21b75092466a5919081900360200190a250505050565b611a267ff2683e58e5a2a04c1ed32509bfdbf1e9ebc725c63f4c95425d2afd482bfdb0f8336117e8565b611a615760405162461bcd60e51b81526004018080602001828103825260368152602001806136cd6036913960400191505060405180910390fd5b60655460408051631c7b981f60e31b81526001600160a01b03808516600483015291518493929092169163e3dcc0f891602480820192602092909190829003018186803b158015611ab157600080fd5b505afa158015611ac5573d6000803e3d6000fd5b505050506040513d6020811015611adb57600080fd5b5051611b1c576040805162461bcd60e51b815260206004820152601e602482015260008051602061365c833981519152604482015290519081900360640190fd5b816001600160a01b0316639a6543496040518163ffffffff1660e01b815260040160206040518083038186803b158015611b5557600080fd5b505afa158015611b69573d6000803e3d6000fd5b505050506040513d6020811015611b7f57600080fd5b5051604080517f2be11ae200000000000000000000000000000000000000000000000000000000815290516001600160a01b0390921691632be11ae29160048082019260009290919082900301818387803b158015611bdd57600080fd5b505af1158015611bf1573d6000803e3d6000fd5b505050505050565b6001600160a01b0316600090815260a3602052604090205460ff1690565b611c417feb5092aab714e6356486bc97f25dd7a5c1dc5c7436a9d30e8d4a527fba24de1c336117e8565b611c7c5760405162461bcd60e51b81526004018080602001828103825260338152602001806136296033913960400191505060405180910390fd5b80611c88609b82612e04565b611cc35760405162461bcd60e51b81526004018080602001828103825260258152602001806137296025913960400191505060405180910390fd5b6000828152609e6020908152604080832054609a83528184208185529092529091205460ff1615611d255760405162461bcd60e51b81526004018080602001828103825260338152602001806137fb6033913960400191505060405180910390fd5b6000838152609d60205260408120611d3c90613103565b905060005b81811015611d75576000858152609d60205260408120611d619083612fbb565b9050611d6c81612fc7565b50600101611d41565b50600084815260986020526040902054611d8f908561310e565b600085815260986020526040902055611da982600161310e565b6000858152609e60209081526040808320939093556098815290829020548251908152915186927f7015405d264c65fb8d0c96f0d79b8f4c294c8dacbd821294e89649159494a9d992908290030190a250505050565b600081565b611e1c6000805160206135e7833981519152336117e8565b611e575760405162461bcd60e51b81526004018080602001828103825260258152602001806137ac6025913960400191505060405180910390fd5b6001600160a01b038116600081815260a36020908152604091829020805460ff81161560ff1990911681179091558251938452908301819052815190927fbbe36100f29c38cdeed7d485dad2bdb4f01017f0bedf089269d2de8ce5e5b1b192908290030190a15050565b611eeb7ff2683e58e5a2a04c1ed32509bfdbf1e9ebc725c63f4c95425d2afd482bfdb0f8336117e8565b611f265760405162461bcd60e51b81526004018080602001828103825260368152602001806136cd6036913960400191505060405180910390fd5b60655460408051631c7b981f60e31b81526001600160a01b03808616600483015291518593929092169163e3dcc0f891602480820192602092909190829003018186803b158015611f7657600080fd5b505afa158015611f8a573d6000803e3d6000fd5b505050506040513d6020811015611fa057600080fd5b5051611fe1576040805162461bcd60e51b815260206004820152601e602482015260008051602061365c833981519152604482015290519081900360640190fd5b826001600160a01b0316639a6543496040518163ffffffff1660e01b815260040160206040518083038186803b15801561201a57600080fd5b505afa15801561202e573d6000803e3d6000fd5b505050506040513d602081101561204457600080fd5b5051604080517fcb06038e0000000000000000000000000000000000000000000000000000000081526001600160a01b0385811660048301529151919092169163cb06038e91602480830192600092919082900301818387803b1580156117ac57600080fd5b6120c26000805160206135e7833981519152336117e8565b6120fd5760405162461bcd60e51b81526004018080602001828103825260258152602001806137ac6025913960400191505060405180910390fd5b606580546001600160a01b03831673ffffffffffffffffffffffffffffffffffffffff19909116811790915560408051918252517fdb0239c63d4033dcdd21bd44f8dd479a03efbae12f6bbe27c0a5f923d26514cc9181900360200190a150565b6121766000805160206135e7833981519152336117e8565b6121b15760405162461bcd60e51b81526004018080602001828103825260258152602001806137ac6025913960400191505060405180910390fd5b6001600160a01b038116600081815260a26020908152604091829020805460ff81161560ff1990911681179091558251938452908301819052815190927fec19f1e4d5895d5fdabfc5411a545df0e7b8356efcadbc13f0d44d08e51a3e7e92908290030190a15050565b6000908152609e602052604090205490565b6122577ff2683e58e5a2a04c1ed32509bfdbf1e9ebc725c63f4c95425d2afd482bfdb0f8336117e8565b6122925760405162461bcd60e51b81526004018080602001828103825260368152602001806136cd6036913960400191505060405180910390fd5b60655460408051631c7b981f60e31b81526001600160a01b03808516600483015291518493929092169163e3dcc0f891602480820192602092909190829003018186803b1580156122e257600080fd5b505afa1580156122f6573d6000803e3d6000fd5b505050506040513d602081101561230c57600080fd5b505161234d576040805162461bcd60e51b815260206004820152601e602482015260008051602061365c833981519152604482015290519081900360640190fd5b816001600160a01b0316632be11ae26040518163ffffffff1660e01b8152600401600060405180830381600087803b158015611bdd57600080fd5b6060612394609b613103565b67ffffffffffffffff811180156123aa57600080fd5b506040519080825280602002602001820160405280156123d4578160200160208202803683370190505b50905060006123e3609b613103565b905060005b8181101561241a576123fb609b82612fbb565b83828151811061240757fe5b60209081029190910101526001016123e8565b505090565b6000818152603360205260408120610d3b90613103565b61244e6000805160206135e7833981519152336117e8565b6124895760405162461bcd60e51b81526004018080602001828103825260258152602001806137ac6025913960400191505060405180910390fd5b606554604080517fb71c9b320000000000000000000000000000000000000000000000000000000081526001600160a01b0384811660048301529151919092169163b71c9b3291602480830192600092919082900301818387803b1580156124f057600080fd5b505af1158015612504573d6000803e3d6000fd5b505050506000816001600160a01b0316636558954f6040518163ffffffff1660e01b815260040160206040518083038186803b15801561254357600080fd5b505afa158015612557573d6000803e3d6000fd5b505050506040513d602081101561256d57600080fd5b50516000818152609d6020526040902090915061258a9083613168565b50612596609b82612e04565b80156125b657506000818152609d602052604090206125b490613103565b155b156125c8576125c6609b8261317d565b505b6040516001600160a01b038316907fd35b4ee91e78e24074c0bd7f0c93ead6223a97cbd73854b2d49910f413afc37590600090a25050565b60008281526033602052604090206002015461261e90610c79612e10565b610d245760405162461bcd60e51b815260040180806020018281038252603081526020018061374e6030913960400191505060405180910390fd5b6126837ff2683e58e5a2a04c1ed32509bfdbf1e9ebc725c63f4c95425d2afd482bfdb0f8336117e8565b6126be5760405162461bcd60e51b81526004018080602001828103825260368152602001806136cd6036913960400191505060405180910390fd5b60655460408051631c7b981f60e31b81526001600160a01b03808516600483015291518493929092169163e3dcc0f891602480820192602092909190829003018186803b15801561270e57600080fd5b505afa158015612722573d6000803e3d6000fd5b505050506040513d602081101561273857600080fd5b5051612779576040805162461bcd60e51b815260206004820152601e602482015260008051602061365c833981519152604482015290519081900360640190fd5b816001600160a01b0316639a6543496040518163ffffffff1660e01b815260040160206040518083038186803b1580156127b257600080fd5b505afa1580156127c6573d6000803e3d6000fd5b505050506040513d60208110156127dc57600080fd5b5051604080517f5d023fa400000000000000000000000000000000000000000000000000000000815290516001600160a01b0390921691635d023fa49160048082019260009290919082900301818387803b158015611bdd57600080fd5b60655460408051631c7b981f60e31b81526001600160a01b03808516600483015291518493929092169163e3dcc0f891602480820192602092909190829003018186803b15801561288a57600080fd5b505afa15801561289e573d6000803e3d6000fd5b505050506040513d60208110156128b457600080fd5b50516128f5576040805162461bcd60e51b815260206004820152601e602482015260008051602061365c833981519152604482015290519081900360640190fd5b604080517fe4f98a2b00000000000000000000000000000000000000000000000000000000815233600482015290516001600160a01b0384169163e4f98a2b91602480830192600092919082900301818387803b158015611bdd57600080fd5b61296d6000805160206135e7833981519152336117e8565b6129a85760405162461bcd60e51b81526004018080602001828103825260258152602001806137ac6025913960400191505060405180910390fd5b6001600160a01b0381166000818152609f6020908152604091829020805460ff19166001179055815192835290517fc3d76acd91fbc7fa857e2ecda0710c39b9f6a9ab7b7219f4d6bff71faca5b0d59281900390910190a150565b6001600160a01b03166000908152609f602052604090205460ff1690565b6000818152609d6020526040812060609190612a3c90613103565b90508067ffffffffffffffff81118015612a5557600080fd5b50604051908082528060200260200182016040528015612a7f578160200160208202803683370190505b50915060005b81811015612ad1576000848152609d60205260409020612aa59082612fbb565b838281518110612ab157fe5b6001600160a01b0390921660209283029190910190910152600101612a85565b5050919050565b612b027ff2683e58e5a2a04c1ed32509bfdbf1e9ebc725c63f4c95425d2afd482bfdb0f8336117e8565b612b3d5760405162461bcd60e51b81526004018080602001828103825260368152602001806136cd6036913960400191505060405180910390fd5b60655460408051631c7b981f60e31b81526001600160a01b03808516600483015291518493929092169163e3dcc0f891602480820192602092909190829003018186803b158015612b8d57600080fd5b505afa158015612ba1573d6000803e3d6000fd5b505050506040513d6020811015612bb757600080fd5b5051612bf8576040805162461bcd60e51b815260206004820152601e602482015260008051602061365c833981519152604482015290519081900360640190fd5b816001600160a01b031663732a4f9c6040518163ffffffff1660e01b8152600401600060405180830381600087803b158015611bdd57600080fd5b6065546001600160a01b031690565b60655460408051631c7b981f60e31b81526001600160a01b03808616600483015291518593929092169163e3dcc0f891602480820192602092909190829003018186803b158015612c9257600080fd5b505afa158015612ca6573d6000803e3d6000fd5b505050506040513d6020811015612cbc57600080fd5b5051612cfd576040805162461bcd60e51b815260206004820152601e602482015260008051602061365c833981519152604482015290519081900360640190fd5b604080517ff3fef3a30000000000000000000000000000000000000000000000000000000081523360048201526024810184905290516001600160a01b0385169163f3fef3a391604480830192600092919082900301818387803b1580156117ac57600080fd5b612d7c6000805160206135e7833981519152336117e8565b612db75760405162461bcd60e51b81526004018080602001828103825260258152602001806137ac6025913960400191505060405180910390fd5b60a5805460ff19811660ff918216151791829055604080519290911615158252517f135957c46972798c5a15876b659c2120a011bd0564253be543fcc3a4fd790fd89181900360200190a1565b60006117e18383613189565b3390565b6000828152603360205260409020612e2c9082612fa6565b15610cc357612e39612e10565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000828152603360205260409020612e959082613168565b15610cc357612ea2612e10565b6001600160a01b0316816001600160a01b0316837ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b60405160405180910390a45050565b60006117e1836001600160a01b038416613189565b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f23b872dd00000000000000000000000000000000000000000000000000000000179052612f839085906131a1565b50505050565b6000612f9430613252565b15905090565b60006117e18383613258565b60006117e1836001600160a01b038416613258565b60006117e183836132a2565b806001600160a01b031663b9d723eb6040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561300257600080fd5b505af1158015613016573d6000803e3d6000fd5b505050506001600160a01b0381166000908152609f602052604090205460ff16156131005761304660a082612fa6565b506130ca81609d6000846001600160a01b0316636558954f6040518163ffffffff1660e01b815260040160206040518083038186803b15801561308857600080fd5b505afa15801561309c573d6000803e3d6000fd5b505050506040513d60208110156130b257600080fd5b50518152602081019190915260400160002090613168565b506040516001600160a01b038216907f6fb9db917303291312a6cfd4550d853e3610593dc4d477069ce355cb8a8fa89b90600090a25b50565b6000610d3b82613306565b6000828201838110156117e1576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b60006117e1836001600160a01b03841661330a565b60006117e1838361330a565b60009081526001919091016020526040902054151590565b60006131f6826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166133d09092919063ffffffff16565b8051909150156110555780806020019051602081101561321557600080fd5b50516110555760405162461bcd60e51b815260040180806020018281038252602a8152602001806137d1602a913960400191505060405180910390fd5b3b151590565b60006132648383613189565b61329a57508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610d3b565b506000610d3b565b815460009082106132e45760405162461bcd60e51b81526004018080602001828103825260228152602001806136076022913960400191505060405180910390fd5b8260000182815481106132f357fe5b9060005260206000200154905092915050565b5490565b600081815260018301602052604081205480156133c6578354600019808301919081019060009087908390811061333d57fe5b906000526020600020015490508087600001848154811061335a57fe5b60009182526020808320909101929092558281526001898101909252604090209084019055865487908061338a57fe5b60019003818190600052602060002001600090559055866001016000878152602001908152602001600020600090556001945050505050610d3b565b6000915050610d3b565b60606133df84846000856133e7565b949350505050565b6060824710156134285760405162461bcd60e51b81526004018080602001828103825260268152602001806137036026913960400191505060405180910390fd5b61343185613252565b613482576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b600080866001600160a01b031685876040518082805190602001908083835b602083106134c05780518252601f1990920191602091820191016134a1565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114613522576040519150601f19603f3d011682016040523d82523d6000602084013e613527565b606091505b5091509150613537828286613542565b979650505050505050565b606083156135515750816117e1565b8251156135615782518084602001fd5b8160405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156135ab578181015183820152602001613593565b50505050905090810190601f1680156135d85780820380516001836020036101000a031916815260200191505b509250505060405180910390fdfe1effbbff9c66c5e59634f24fe842750c60d18891155c32dd155fc2d661a4c86d456e756d657261626c655365743a20696e646578206f7574206f6620626f756e6473526f6c65436865636b61626c653a2043616c6c65722073686f756c6420686176652053544152542046555455524520526f6c65436f6e74726f6c6c65723a204552525f4655545552455f414444524553530000416363657373436f6e74726f6c3a2073656e646572206d75737420626520616e2061646d696e20746f206772616e74436f6e74726f6c6c65723a2044656c65676174696f6e206e6f7420656e61626c6564526f6c65436865636b61626c653a2043616c6c65722073686f756c6420686176652048415256455354205245574152445320526f6c65416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c436f6e74726f6c6c65723a20506572696f64204475726174696f6e206e6f7420466f756e64416363657373436f6e74726f6c3a2073656e646572206d75737420626520616e2061646d696e20746f207265766f6b65496e697469616c697a61626c653a20636f6e747261637420697320616c726561647920696e697469616c697a6564526f6c65436865636b61626c653a2043616c6c65722073686f756c642062652041444d494e5361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564436f6e74726f6c6c65723a20706572696f642063616e6e6f742062652073776974636865642077697468206475726174696f6e416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636520726f6c657320666f722073656c66a26469706673582212208f7d50cafe46317dfb34aeaf237ce07b35b4ca7fea4f297b0f9a1b27ab4bc51664736f6c63430007060033

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106102f45760003560e01c80639c8975bc11610191578063cbe92708116100e3578063e812a4ec11610097578063f21de1e811610071578063f21de1e814610949578063f3fef3a314610951578063f5bc75381461097d576102f4565b8063e812a4ec146108e0578063ee21c3ce14610906578063efcb121b14610923576102f4565b8063dbfc9495116100c8578063dbfc94951461086e578063e4f98a2b14610894578063e74711a0146108ba576102f4565b8063cbe927081461081c578063d547741f14610842576102f4565b8063a91ee0dc11610145578063c21c152c1161011f578063c21c152c14610781578063c4d5b37d146107a7578063ca15c873146107ff576102f4565b8063a91ee0dc14610718578063b012818d1461073e578063bd669cc914610764576102f4565b8063a217fddf11610176578063a217fddf146106bc578063a42f3914146106c4578063a456888c146106ea576102f4565b80639c8975bc146106795780639d3164f11461069f576102f4565b80634a5d8cfa1161024a57806366bbb20b116101fe57806391d14854116101d857806391d1485414610601578063940e3e371461062d5780639bd3838a14610653576102f4565b806366bbb20b1461055e57806389fd8888146105945780639010d07c146105c2576102f4565b80634d613ade1161022f5780634d613ade146104df57806359b5e113146105155780635aacaf0e14610538576102f4565b80634a5d8cfa146104b15780634cb8745e146104b9576102f4565b80632f2ff15d116102ac5780634138319311610286578063413831931461041d57806347e7ef2414610457578063485cc95514610483576102f4565b80632f2ff15d146103bd578063338b8c49146103e957806336568abe146103f1576102f4565b80631b04bdad116102dd5780631b04bdad1461034d5780631c30eb6d14610383578063248a9ca3146103a0576102f4565b8063041c2120146102f9578063051339c214610328575b600080fd5b6103166004803603602081101561030f57600080fd5b5035610985565b60408051918252519081900360200190f35b61034b6004803603604081101561033e57600080fd5b5080359060200135610997565b005b61034b6004803603606081101561036357600080fd5b506001600160a01b03813581169160208101359091169060400135610a6e565b61034b6004803603602081101561039957600080fd5b5035610bb8565b610316600480360360208110156103b657600080fd5b5035610c46565b61034b600480360360408110156103d357600080fd5b50803590602001356001600160a01b0316610c5b565b610316610cc7565b61034b6004803603604081101561040757600080fd5b50803590602001356001600160a01b0316610ccd565b6104436004803603602081101561043357600080fd5b50356001600160a01b0316610d2e565b604080519115158252519081900360200190f35b61034b6004803603604081101561046d57600080fd5b506001600160a01b038135169060200135610d41565b61034b6004803603604081101561049957600080fd5b506001600160a01b0381358116916020013516610f5e565b61044361105a565b61034b600480360360208110156104cf57600080fd5b50356001600160a01b0316611063565b61034b600480360360608110156104f557600080fd5b506001600160a01b038135811691602081013590911690604001356111fb565b61034b6004803603604081101561052b57600080fd5b5080359060200135611368565b6104436004803603602081101561054e57600080fd5b50356001600160a01b031661144e565b61034b6004803603606081101561057457600080fd5b506001600160a01b0381358116916020810135909116906040013561146c565b61034b600480360360408110156105aa57600080fd5b506001600160a01b038135811691602001351661163d565b6105e5600480360360408110156105d857600080fd5b50803590602001356117c9565b604080516001600160a01b039092168252519081900360200190f35b6104436004803603604081101561061757600080fd5b50803590602001356001600160a01b03166117e8565b61034b6004803603602081101561064357600080fd5b50356001600160a01b0316611800565b61034b6004803603602081101561066957600080fd5b50356001600160a01b03166119fc565b6104436004803603602081101561068f57600080fd5b50356001600160a01b0316611bf9565b61034b600480360360208110156106b557600080fd5b5035611c17565b610316611dff565b61034b600480360360208110156106da57600080fd5b50356001600160a01b0316611e04565b61034b6004803603604081101561070057600080fd5b506001600160a01b0381358116916020013516611ec1565b61034b6004803603602081101561072e57600080fd5b50356001600160a01b03166120aa565b61034b6004803603602081101561075457600080fd5b50356001600160a01b031661215e565b6103166004803603602081101561077a57600080fd5b503561221b565b61034b6004803603602081101561079757600080fd5b50356001600160a01b031661222d565b6107af612388565b60408051602080825283518183015283519192839290830191858101910280838360005b838110156107eb5781810151838201526020016107d3565b505050509050019250505060405180910390f35b6103166004803603602081101561081557600080fd5b503561241f565b61034b6004803603602081101561083257600080fd5b50356001600160a01b0316612436565b61034b6004803603604081101561085857600080fd5b50803590602001356001600160a01b0316612600565b61034b6004803603602081101561088457600080fd5b50356001600160a01b0316612659565b61034b600480360360208110156108aa57600080fd5b50356001600160a01b031661283a565b61034b600480360360208110156108d057600080fd5b50356001600160a01b0316612955565b610443600480360360208110156108f657600080fd5b50356001600160a01b0316612a03565b6107af6004803603602081101561091c57600080fd5b5035612a21565b61034b6004803603602081101561093957600080fd5b50356001600160a01b0316612ad8565b6105e5612c33565b61034b6004803603604081101561096757600080fd5b506001600160a01b038135169060200135612c42565b61034b612d64565b60009081526098602052604090205490565b6109af6000805160206135e7833981519152336117e8565b6109ea5760405162461bcd60e51b81526004018080602001828103825260258152602001806137ac6025913960400191505060405180910390fd5b816109f6609b82612e04565b610a315760405162461bcd60e51b81526004018080602001828103825260258152602001806137296025913960400191505060405180910390fd5b6000838152609e60205260408082208490555183917fccd5e150ff3edf89bdc920f29b2dff17c43969f7a11cb5bcf050cb8dc450825291a2505050565b60655460408051631c7b981f60e31b81526001600160a01b03808716600483015291518693929092169163e3dcc0f891602480820192602092909190829003018186803b158015610abe57600080fd5b505afa158015610ad2573d6000803e3d6000fd5b505050506040513d6020811015610ae857600080fd5b5051610b29576040805162461bcd60e51b815260206004820152601e602482015260008051602061365c833981519152604482015290519081900360640190fd5b604080517f1b04bdad0000000000000000000000000000000000000000000000000000000081523360048201526001600160a01b03858116602483015260448201859052915191861691631b04bdad9160648082019260009290919082900301818387803b158015610b9a57600080fd5b505af1158015610bae573d6000803e3d6000fd5b5050505050505050565b610bd06000805160206135e7833981519152336117e8565b610c0b5760405162461bcd60e51b81526004018080602001828103825260258152602001806137ac6025913960400191505060405180910390fd5b60a48190556040805182815290517f0231d2bba9f0be98a6646ca3dc8184c854ce3e3691f77409d783eb88321a4b6c9181900360200190a150565b60009081526033602052604090206002015490565b600082815260336020526040902060020154610c7e90610c79612e10565b6117e8565b610cb95760405162461bcd60e51b815260040180806020018281038252602f81526020018061367c602f913960400191505060405180910390fd5b610cc38282612e14565b5050565b60a45481565b610cd5612e10565b6001600160a01b0316816001600160a01b031614610d245760405162461bcd60e51b815260040180806020018281038252602f81526020018061382e602f913960400191505060405180910390fd5b610cc38282612e7d565b6000610d3b60a083612ee6565b92915050565b60026066541415610d99576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b600260665560655460408051631c7b981f60e31b81526001600160a01b03808616600483015291518593929092169163e3dcc0f891602480820192602092909190829003018186803b158015610dee57600080fd5b505afa158015610e02573d6000803e3d6000fd5b505050506040513d6020811015610e1857600080fd5b5051610e59576040805162461bcd60e51b815260206004820152601e602482015260008051602061365c833981519152604482015290519081900360640190fd5b604080517f47e7ef240000000000000000000000000000000000000000000000000000000081523360048201526024810184905290516001600160a01b038516916347e7ef2491604480830192600092919082900301818387803b158015610ec057600080fd5b505af1158015610ed4573d6000803e3d6000fd5b50505050610f54338484866001600160a01b031663f018ae696040518163ffffffff1660e01b815260040160206040518083038186803b158015610f1757600080fd5b505afa158015610f2b573d6000803e3d6000fd5b505050506040513d6020811015610f4157600080fd5b50516001600160a01b0316929190612efb565b5050600160665550565b600054610100900460ff1680610f775750610f77612f89565b80610f85575060005460ff16155b610fc05760405162461bcd60e51b815260040180806020018281038252602e81526020018061377e602e913960400191505060405180910390fd5b600054610100900460ff16158015610feb576000805460ff1961ff0019909116610100171660011790555b610ff6600083610cb9565b61100e6000805160206135e783398151915283610cb9565b6065805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b03851617905560a5805460ff191660011790558015611055576000805461ff00191690555b505050565b60a55460ff1681565b61107b6000805160206135e7833981519152336117e8565b6110b65760405162461bcd60e51b81526004018080602001828103825260258152602001806137ac6025913960400191505060405180910390fd5b606554604080517fbc97cb180000000000000000000000000000000000000000000000000000000081526001600160a01b0384811660048301529151919092169163bc97cb1891602480830192600092919082900301818387803b15801561111d57600080fd5b505af1158015611131573d6000803e3d6000fd5b505050506000816001600160a01b0316636558954f6040518163ffffffff1660e01b815260040160206040518083038186803b15801561117057600080fd5b505afa158015611184573d6000803e3d6000fd5b505050506040513d602081101561119a57600080fd5b505190506111a9609b82612f9a565b506000818152609d602052604090206111c29083612fa6565b506040516001600160a01b038316907f4689c43367e2f2d63a4825749e54aeb0db216c23200a1998e4de8d4c4c07c6fa90600090a25050565b60a55460ff1661123c5760405162461bcd60e51b81526004018080602001828103825260228152602001806136ab6022913960400191505060405180910390fd5b60655460408051631c7b981f60e31b81526001600160a01b03808716600483015291518693929092169163e3dcc0f891602480820192602092909190829003018186803b15801561128c57600080fd5b505afa1580156112a0573d6000803e3d6000fd5b505050506040513d60208110156112b657600080fd5b50516112f7576040805162461bcd60e51b815260206004820152601e602482015260008051602061365c833981519152604482015290519081900360640190fd5b604080517f4d613ade0000000000000000000000000000000000000000000000000000000081523360048201526001600160a01b03858116602483015260448201859052915191861691634d613ade9160648082019260009290919082900301818387803b158015610b9a57600080fd5b6113806000805160206135e7833981519152336117e8565b6113bb5760405162461bcd60e51b81526004018080602001828103825260258152602001806137ac6025913960400191505060405180910390fd5b816113c7609b82612e04565b6114025760405162461bcd60e51b81526004018080602001828103825260258152602001806137296025913960400191505060405180910390fd5b6000838152609860209081526040918290208490558151848152915185927f7015405d264c65fb8d0c96f0d79b8f4c294c8dacbd821294e89649159494a9d992908290030190a2505050565b6001600160a01b0316600090815260a2602052604090205460ff1690565b600260665414156114c4576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b600260665560655460408051631c7b981f60e31b81526001600160a01b03808716600483015291518693929092169163e3dcc0f891602480820192602092909190829003018186803b15801561151957600080fd5b505afa15801561152d573d6000803e3d6000fd5b505050506040513d602081101561154357600080fd5b5051611584576040805162461bcd60e51b815260206004820152601e602482015260008051602061365c833981519152604482015290519081900360640190fd5b836001600160a01b03166347e7ef2484846040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050600060405180830381600087803b1580156115db57600080fd5b505af11580156115ef573d6000803e3d6000fd5b50505050611632338584876001600160a01b031663f018ae696040518163ffffffff1660e01b815260040160206040518083038186803b158015610f1757600080fd5b505060016066555050565b6116677ff2683e58e5a2a04c1ed32509bfdbf1e9ebc725c63f4c95425d2afd482bfdb0f8336117e8565b6116a25760405162461bcd60e51b81526004018080602001828103825260368152602001806136cd6036913960400191505060405180910390fd5b60655460408051631c7b981f60e31b81526001600160a01b03808616600483015291518593929092169163e3dcc0f891602480820192602092909190829003018186803b1580156116f257600080fd5b505afa158015611706573d6000803e3d6000fd5b505050506040513d602081101561171c57600080fd5b505161175d576040805162461bcd60e51b815260206004820152601e602482015260008051602061365c833981519152604482015290519081900360640190fd5b826001600160a01b0316638e484e0b836040518263ffffffff1660e01b815260040180826001600160a01b03168152602001915050600060405180830381600087803b1580156117ac57600080fd5b505af11580156117c0573d6000803e3d6000fd5b50505050505050565b60008281526033602052604081206117e19083612fbb565b9392505050565b60008281526033602052604081206117e19083612ee6565b61182a7feb5092aab714e6356486bc97f25dd7a5c1dc5c7436a9d30e8d4a527fba24de1c336117e8565b6118655760405162461bcd60e51b81526004018080602001828103825260338152602001806136296033913960400191505060405180910390fd5b60655460408051631c7b981f60e31b81526001600160a01b03808516600483015291518493929092169163e3dcc0f891602480820192602092909190829003018186803b1580156118b557600080fd5b505afa1580156118c9573d6000803e3d6000fd5b505050506040513d60208110156118df57600080fd5b5051611920576040805162461bcd60e51b815260206004820152601e602482015260008051602061365c833981519152604482015290519081900360640190fd5b6000826001600160a01b0316636558954f6040518163ffffffff1660e01b815260040160206040518083038186803b15801561195b57600080fd5b505afa15801561196f573d6000803e3d6000fd5b505050506040513d602081101561198557600080fd5b50516000818152609e6020908152604080832054609a8352818420818552909252909120805460ff191660011790559091506119c084612fc7565b60408051828152905183917fdc926b7032bfdcb253ace5d24cf95701f432680d49afa4aba3c21b75092466a5919081900360200190a250505050565b611a267ff2683e58e5a2a04c1ed32509bfdbf1e9ebc725c63f4c95425d2afd482bfdb0f8336117e8565b611a615760405162461bcd60e51b81526004018080602001828103825260368152602001806136cd6036913960400191505060405180910390fd5b60655460408051631c7b981f60e31b81526001600160a01b03808516600483015291518493929092169163e3dcc0f891602480820192602092909190829003018186803b158015611ab157600080fd5b505afa158015611ac5573d6000803e3d6000fd5b505050506040513d6020811015611adb57600080fd5b5051611b1c576040805162461bcd60e51b815260206004820152601e602482015260008051602061365c833981519152604482015290519081900360640190fd5b816001600160a01b0316639a6543496040518163ffffffff1660e01b815260040160206040518083038186803b158015611b5557600080fd5b505afa158015611b69573d6000803e3d6000fd5b505050506040513d6020811015611b7f57600080fd5b5051604080517f2be11ae200000000000000000000000000000000000000000000000000000000815290516001600160a01b0390921691632be11ae29160048082019260009290919082900301818387803b158015611bdd57600080fd5b505af1158015611bf1573d6000803e3d6000fd5b505050505050565b6001600160a01b0316600090815260a3602052604090205460ff1690565b611c417feb5092aab714e6356486bc97f25dd7a5c1dc5c7436a9d30e8d4a527fba24de1c336117e8565b611c7c5760405162461bcd60e51b81526004018080602001828103825260338152602001806136296033913960400191505060405180910390fd5b80611c88609b82612e04565b611cc35760405162461bcd60e51b81526004018080602001828103825260258152602001806137296025913960400191505060405180910390fd5b6000828152609e6020908152604080832054609a83528184208185529092529091205460ff1615611d255760405162461bcd60e51b81526004018080602001828103825260338152602001806137fb6033913960400191505060405180910390fd5b6000838152609d60205260408120611d3c90613103565b905060005b81811015611d75576000858152609d60205260408120611d619083612fbb565b9050611d6c81612fc7565b50600101611d41565b50600084815260986020526040902054611d8f908561310e565b600085815260986020526040902055611da982600161310e565b6000858152609e60209081526040808320939093556098815290829020548251908152915186927f7015405d264c65fb8d0c96f0d79b8f4c294c8dacbd821294e89649159494a9d992908290030190a250505050565b600081565b611e1c6000805160206135e7833981519152336117e8565b611e575760405162461bcd60e51b81526004018080602001828103825260258152602001806137ac6025913960400191505060405180910390fd5b6001600160a01b038116600081815260a36020908152604091829020805460ff81161560ff1990911681179091558251938452908301819052815190927fbbe36100f29c38cdeed7d485dad2bdb4f01017f0bedf089269d2de8ce5e5b1b192908290030190a15050565b611eeb7ff2683e58e5a2a04c1ed32509bfdbf1e9ebc725c63f4c95425d2afd482bfdb0f8336117e8565b611f265760405162461bcd60e51b81526004018080602001828103825260368152602001806136cd6036913960400191505060405180910390fd5b60655460408051631c7b981f60e31b81526001600160a01b03808616600483015291518593929092169163e3dcc0f891602480820192602092909190829003018186803b158015611f7657600080fd5b505afa158015611f8a573d6000803e3d6000fd5b505050506040513d6020811015611fa057600080fd5b5051611fe1576040805162461bcd60e51b815260206004820152601e602482015260008051602061365c833981519152604482015290519081900360640190fd5b826001600160a01b0316639a6543496040518163ffffffff1660e01b815260040160206040518083038186803b15801561201a57600080fd5b505afa15801561202e573d6000803e3d6000fd5b505050506040513d602081101561204457600080fd5b5051604080517fcb06038e0000000000000000000000000000000000000000000000000000000081526001600160a01b0385811660048301529151919092169163cb06038e91602480830192600092919082900301818387803b1580156117ac57600080fd5b6120c26000805160206135e7833981519152336117e8565b6120fd5760405162461bcd60e51b81526004018080602001828103825260258152602001806137ac6025913960400191505060405180910390fd5b606580546001600160a01b03831673ffffffffffffffffffffffffffffffffffffffff19909116811790915560408051918252517fdb0239c63d4033dcdd21bd44f8dd479a03efbae12f6bbe27c0a5f923d26514cc9181900360200190a150565b6121766000805160206135e7833981519152336117e8565b6121b15760405162461bcd60e51b81526004018080602001828103825260258152602001806137ac6025913960400191505060405180910390fd5b6001600160a01b038116600081815260a26020908152604091829020805460ff81161560ff1990911681179091558251938452908301819052815190927fec19f1e4d5895d5fdabfc5411a545df0e7b8356efcadbc13f0d44d08e51a3e7e92908290030190a15050565b6000908152609e602052604090205490565b6122577ff2683e58e5a2a04c1ed32509bfdbf1e9ebc725c63f4c95425d2afd482bfdb0f8336117e8565b6122925760405162461bcd60e51b81526004018080602001828103825260368152602001806136cd6036913960400191505060405180910390fd5b60655460408051631c7b981f60e31b81526001600160a01b03808516600483015291518493929092169163e3dcc0f891602480820192602092909190829003018186803b1580156122e257600080fd5b505afa1580156122f6573d6000803e3d6000fd5b505050506040513d602081101561230c57600080fd5b505161234d576040805162461bcd60e51b815260206004820152601e602482015260008051602061365c833981519152604482015290519081900360640190fd5b816001600160a01b0316632be11ae26040518163ffffffff1660e01b8152600401600060405180830381600087803b158015611bdd57600080fd5b6060612394609b613103565b67ffffffffffffffff811180156123aa57600080fd5b506040519080825280602002602001820160405280156123d4578160200160208202803683370190505b50905060006123e3609b613103565b905060005b8181101561241a576123fb609b82612fbb565b83828151811061240757fe5b60209081029190910101526001016123e8565b505090565b6000818152603360205260408120610d3b90613103565b61244e6000805160206135e7833981519152336117e8565b6124895760405162461bcd60e51b81526004018080602001828103825260258152602001806137ac6025913960400191505060405180910390fd5b606554604080517fb71c9b320000000000000000000000000000000000000000000000000000000081526001600160a01b0384811660048301529151919092169163b71c9b3291602480830192600092919082900301818387803b1580156124f057600080fd5b505af1158015612504573d6000803e3d6000fd5b505050506000816001600160a01b0316636558954f6040518163ffffffff1660e01b815260040160206040518083038186803b15801561254357600080fd5b505afa158015612557573d6000803e3d6000fd5b505050506040513d602081101561256d57600080fd5b50516000818152609d6020526040902090915061258a9083613168565b50612596609b82612e04565b80156125b657506000818152609d602052604090206125b490613103565b155b156125c8576125c6609b8261317d565b505b6040516001600160a01b038316907fd35b4ee91e78e24074c0bd7f0c93ead6223a97cbd73854b2d49910f413afc37590600090a25050565b60008281526033602052604090206002015461261e90610c79612e10565b610d245760405162461bcd60e51b815260040180806020018281038252603081526020018061374e6030913960400191505060405180910390fd5b6126837ff2683e58e5a2a04c1ed32509bfdbf1e9ebc725c63f4c95425d2afd482bfdb0f8336117e8565b6126be5760405162461bcd60e51b81526004018080602001828103825260368152602001806136cd6036913960400191505060405180910390fd5b60655460408051631c7b981f60e31b81526001600160a01b03808516600483015291518493929092169163e3dcc0f891602480820192602092909190829003018186803b15801561270e57600080fd5b505afa158015612722573d6000803e3d6000fd5b505050506040513d602081101561273857600080fd5b5051612779576040805162461bcd60e51b815260206004820152601e602482015260008051602061365c833981519152604482015290519081900360640190fd5b816001600160a01b0316639a6543496040518163ffffffff1660e01b815260040160206040518083038186803b1580156127b257600080fd5b505afa1580156127c6573d6000803e3d6000fd5b505050506040513d60208110156127dc57600080fd5b5051604080517f5d023fa400000000000000000000000000000000000000000000000000000000815290516001600160a01b0390921691635d023fa49160048082019260009290919082900301818387803b158015611bdd57600080fd5b60655460408051631c7b981f60e31b81526001600160a01b03808516600483015291518493929092169163e3dcc0f891602480820192602092909190829003018186803b15801561288a57600080fd5b505afa15801561289e573d6000803e3d6000fd5b505050506040513d60208110156128b457600080fd5b50516128f5576040805162461bcd60e51b815260206004820152601e602482015260008051602061365c833981519152604482015290519081900360640190fd5b604080517fe4f98a2b00000000000000000000000000000000000000000000000000000000815233600482015290516001600160a01b0384169163e4f98a2b91602480830192600092919082900301818387803b158015611bdd57600080fd5b61296d6000805160206135e7833981519152336117e8565b6129a85760405162461bcd60e51b81526004018080602001828103825260258152602001806137ac6025913960400191505060405180910390fd5b6001600160a01b0381166000818152609f6020908152604091829020805460ff19166001179055815192835290517fc3d76acd91fbc7fa857e2ecda0710c39b9f6a9ab7b7219f4d6bff71faca5b0d59281900390910190a150565b6001600160a01b03166000908152609f602052604090205460ff1690565b6000818152609d6020526040812060609190612a3c90613103565b90508067ffffffffffffffff81118015612a5557600080fd5b50604051908082528060200260200182016040528015612a7f578160200160208202803683370190505b50915060005b81811015612ad1576000848152609d60205260409020612aa59082612fbb565b838281518110612ab157fe5b6001600160a01b0390921660209283029190910190910152600101612a85565b5050919050565b612b027ff2683e58e5a2a04c1ed32509bfdbf1e9ebc725c63f4c95425d2afd482bfdb0f8336117e8565b612b3d5760405162461bcd60e51b81526004018080602001828103825260368152602001806136cd6036913960400191505060405180910390fd5b60655460408051631c7b981f60e31b81526001600160a01b03808516600483015291518493929092169163e3dcc0f891602480820192602092909190829003018186803b158015612b8d57600080fd5b505afa158015612ba1573d6000803e3d6000fd5b505050506040513d6020811015612bb757600080fd5b5051612bf8576040805162461bcd60e51b815260206004820152601e602482015260008051602061365c833981519152604482015290519081900360640190fd5b816001600160a01b031663732a4f9c6040518163ffffffff1660e01b8152600401600060405180830381600087803b158015611bdd57600080fd5b6065546001600160a01b031690565b60655460408051631c7b981f60e31b81526001600160a01b03808616600483015291518593929092169163e3dcc0f891602480820192602092909190829003018186803b158015612c9257600080fd5b505afa158015612ca6573d6000803e3d6000fd5b505050506040513d6020811015612cbc57600080fd5b5051612cfd576040805162461bcd60e51b815260206004820152601e602482015260008051602061365c833981519152604482015290519081900360640190fd5b604080517ff3fef3a30000000000000000000000000000000000000000000000000000000081523360048201526024810184905290516001600160a01b0385169163f3fef3a391604480830192600092919082900301818387803b1580156117ac57600080fd5b612d7c6000805160206135e7833981519152336117e8565b612db75760405162461bcd60e51b81526004018080602001828103825260258152602001806137ac6025913960400191505060405180910390fd5b60a5805460ff19811660ff918216151791829055604080519290911615158252517f135957c46972798c5a15876b659c2120a011bd0564253be543fcc3a4fd790fd89181900360200190a1565b60006117e18383613189565b3390565b6000828152603360205260409020612e2c9082612fa6565b15610cc357612e39612e10565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000828152603360205260409020612e959082613168565b15610cc357612ea2612e10565b6001600160a01b0316816001600160a01b0316837ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b60405160405180910390a45050565b60006117e1836001600160a01b038416613189565b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f23b872dd00000000000000000000000000000000000000000000000000000000179052612f839085906131a1565b50505050565b6000612f9430613252565b15905090565b60006117e18383613258565b60006117e1836001600160a01b038416613258565b60006117e183836132a2565b806001600160a01b031663b9d723eb6040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561300257600080fd5b505af1158015613016573d6000803e3d6000fd5b505050506001600160a01b0381166000908152609f602052604090205460ff16156131005761304660a082612fa6565b506130ca81609d6000846001600160a01b0316636558954f6040518163ffffffff1660e01b815260040160206040518083038186803b15801561308857600080fd5b505afa15801561309c573d6000803e3d6000fd5b505050506040513d60208110156130b257600080fd5b50518152602081019190915260400160002090613168565b506040516001600160a01b038216907f6fb9db917303291312a6cfd4550d853e3610593dc4d477069ce355cb8a8fa89b90600090a25b50565b6000610d3b82613306565b6000828201838110156117e1576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b60006117e1836001600160a01b03841661330a565b60006117e1838361330a565b60009081526001919091016020526040902054151590565b60006131f6826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166133d09092919063ffffffff16565b8051909150156110555780806020019051602081101561321557600080fd5b50516110555760405162461bcd60e51b815260040180806020018281038252602a8152602001806137d1602a913960400191505060405180910390fd5b3b151590565b60006132648383613189565b61329a57508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610d3b565b506000610d3b565b815460009082106132e45760405162461bcd60e51b81526004018080602001828103825260228152602001806136076022913960400191505060405180910390fd5b8260000182815481106132f357fe5b9060005260206000200154905092915050565b5490565b600081815260018301602052604081205480156133c6578354600019808301919081019060009087908390811061333d57fe5b906000526020600020015490508087600001848154811061335a57fe5b60009182526020808320909101929092558281526001898101909252604090209084019055865487908061338a57fe5b60019003818190600052602060002001600090559055866001016000878152602001908152602001600020600090556001945050505050610d3b565b6000915050610d3b565b60606133df84846000856133e7565b949350505050565b6060824710156134285760405162461bcd60e51b81526004018080602001828103825260268152602001806137036026913960400191505060405180910390fd5b61343185613252565b613482576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b600080866001600160a01b031685876040518082805190602001908083835b602083106134c05780518252601f1990920191602091820191016134a1565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114613522576040519150601f19603f3d011682016040523d82523d6000602084013e613527565b606091505b5091509150613537828286613542565b979650505050505050565b606083156135515750816117e1565b8251156135615782518084602001fd5b8160405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156135ab578181015183820152602001613593565b50505050905090810190601f1680156135d85780820380516001836020036101000a031916815260200191505b509250505060405180910390fdfe1effbbff9c66c5e59634f24fe842750c60d18891155c32dd155fc2d661a4c86d456e756d657261626c655365743a20696e646578206f7574206f6620626f756e6473526f6c65436865636b61626c653a2043616c6c65722073686f756c6420686176652053544152542046555455524520526f6c65436f6e74726f6c6c65723a204552525f4655545552455f414444524553530000416363657373436f6e74726f6c3a2073656e646572206d75737420626520616e2061646d696e20746f206772616e74436f6e74726f6c6c65723a2044656c65676174696f6e206e6f7420656e61626c6564526f6c65436865636b61626c653a2043616c6c65722073686f756c6420686176652048415256455354205245574152445320526f6c65416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c436f6e74726f6c6c65723a20506572696f64204475726174696f6e206e6f7420466f756e64416363657373436f6e74726f6c3a2073656e646572206d75737420626520616e2061646d696e20746f207265766f6b65496e697469616c697a61626c653a20636f6e747261637420697320616c726561647920696e697469616c697a6564526f6c65436865636b61626c653a2043616c6c65722073686f756c642062652041444d494e5361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564436f6e74726f6c6c65723a20706572696f642063616e6e6f742062652073776974636865642077697468206475726174696f6e416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636520726f6c657320666f722073656c66a26469706673582212208f7d50cafe46317dfb34aeaf237ce07b35b4ca7fea4f297b0f9a1b27ab4bc51664736f6c63430007060033

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