Contract 0x80d7413331afb37b30bc0ef6ae9d11a40bcf014b

Txn Hash Method
Block
From
To
Value [Txn Fee]
0xb36f1895ba169c99ba92c88ecef13681e064df3b1829600fb4e6c020a00f7f9aApprove420347042022-07-05 0:19:332 days 17 hrs ago0x88e09f1c4fd95fa3ad5a530b353849358692b760 IN  0x80d7413331afb37b30bc0ef6ae9d11a40bcf014b0 FTM0.000106120211
0xb05e9e8d2cad9b6a5ea220a16c9b42f4d66ae476ab4c444b1d87fbba67eb2cf8Approve415988042022-06-29 7:28:058 days 10 hrs ago0x98ed1eae1836fa93a20fa389fc386ba75bd07d5b IN  0x80d7413331afb37b30bc0ef6ae9d11a40bcf014b0 FTM0.000244920892
0x19544ffefd06e8cbce8f62e2103e867c3a59c061edfb926527bc04477afbbc4eApprove409644602022-06-20 22:23:3416 days 19 hrs ago0x42f22bd9dfeee33f78deed6f844166411e1d4dc6 IN  0x80d7413331afb37b30bc0ef6ae9d11a40bcf014b0 FTM0.002338065
0x96e7e2018e6c7f4952091a27b6020818843686c4b27e59e320c652fb41952f3dApprove409423752022-06-20 15:06:4217 days 2 hrs ago0xad90866de099ca6f5029b0deb72c2f9a6290b75c IN  0x80d7413331afb37b30bc0ef6ae9d11a40bcf014b0 FTM0.161107317844
0x26d80654e321f0ba3512ca0a64949866abcc0a83277c30cbfeaf4b8d9f975908Approve408318612022-06-19 3:10:1718 days 14 hrs ago0x9de89422aa486f9cb30aa308de9642b5bde9ad1e IN  0x80d7413331afb37b30bc0ef6ae9d11a40bcf014b0 FTM0.00273302247
0x9661a5eb8f894d819dd5fd30c51c1a889984063601099fbe79a298ee66cf80a5Approve407257642022-06-17 15:38:3220 days 1 hr ago0xc452fafc1af9b3e0f204959434b4a31c3838b9bd IN  0x80d7413331afb37b30bc0ef6ae9d11a40bcf014b0 FTM0.002047440297
0xb1519bc08e6e5e51b72608f109bb8a434fd055839325fb185d179fcd7d4c1e13Approve405187512022-06-14 18:30:3322 days 23 hrs ago0x4889bd3065ce3361b4632f4c1ecc8fab1c491f91 IN  0x80d7413331afb37b30bc0ef6ae9d11a40bcf014b0 FTM0.005027140464
0x250481f2c0269d6f944013a17f1de7619e59ec111767ed3072804350cfb23f6bApprove403949842022-06-13 2:28:1924 days 15 hrs ago0xe0f7a13e3b038ec45d2b2b6abf999fa20ea2355d IN  0x80d7413331afb37b30bc0ef6ae9d11a40bcf014b0 FTM0.055280984514
0x9baa76acd7fc0834c794907c0a586e649b0487cc4ccfdaf8e90403aedea3bc96Approve403569192022-06-12 13:47:0825 days 3 hrs ago0xa2551be946bdacb0452d32e364cb975819a8bbf0 IN  0x80d7413331afb37b30bc0ef6ae9d11a40bcf014b0 FTM0.007583747362
0x21b1b621795c7809bd090f669150c6374967bf6f9bc06596eb1ea6c3cb6afdbcApprove402246612022-06-10 17:42:0626 days 23 hrs ago0x91831208ef824bbb986996312f2f0d92cca7bb90 IN  0x80d7413331afb37b30bc0ef6ae9d11a40bcf014b0 FTM0.002021471498
0x965d6226146841ff6d9d7e261e1702246d74b47b6777ec6f12eeed890db91990Approve402224612022-06-10 16:58:5627 days 33 mins ago0xdc4f7440b1a7f2a4da873b428719ce81bb954d25 IN  0x80d7413331afb37b30bc0ef6ae9d11a40bcf014b0 FTM0.234738541918
0xb8b2f237c8e759fb91caaa3aa739eda780250f69b87f09f5dea557ad396aa828Approve399080262022-06-06 10:09:1431 days 7 hrs ago0x37fa02e7c49b9f7097c0d28e7053c1d632caa795 IN  0x80d7413331afb37b30bc0ef6ae9d11a40bcf014b0 FTM0.000383381943
0x135892632c711fc4b52d26e9c9dabe74bc8854075c1b4ac9339bcd37332c6ec0Approve398765672022-06-06 0:09:3131 days 17 hrs ago0x9fc8024682eead9139087778c8d5ab856462df7e IN  0x80d7413331afb37b30bc0ef6ae9d11a40bcf014b0 FTM0.000325893265
0xce449fb19f69deab2e0630374ab356480ed9f0de4554d1fe4e722181451512edApprove398574922022-06-05 18:07:5931 days 23 hrs ago0xcf1cf25e5cd7aea5f86d8400d600411be1d85d90 IN  0x80d7413331afb37b30bc0ef6ae9d11a40bcf014b0 FTM0.000131433448
0x5c377f4a8dafdf07b062af09d20bab4af978f14aa0a2a936a87fd2bb2228623cApprove398203232022-06-05 6:12:4832 days 11 hrs ago0x1b6617959114a29d97e1ab8949ebc78ea804275e IN  0x80d7413331afb37b30bc0ef6ae9d11a40bcf014b0 FTM0.000253304634
0x0440489329c3d1328c41e90708f1c8ecd363826f48a2670a90b170690f42aabaApprove398025872022-06-05 0:31:3232 days 17 hrs ago0x73b249b198ab6df73182075d0a1f5785ffc49a38 IN  0x80d7413331afb37b30bc0ef6ae9d11a40bcf014b0 FTM0.000284345388
0x7409b64816840437b0a18fa46c5559a2f8a8fe5681dc20d9c192c28e61030b8bApprove394580692022-05-31 9:35:5137 days 7 hrs ago0x6742c7e0ac87bd566baa0eb276aaf06cc66194d3 IN  0x80d7413331afb37b30bc0ef6ae9d11a40bcf014b0 FTM0.001210110094
0x12a59438d28cdebce185d61aa2697af0ca79cc4faa9dcfb6774e26d05c136e66Approve393660242022-05-30 3:13:1338 days 14 hrs ago0xcf1cf25e5cd7aea5f86d8400d600411be1d85d90 IN  0x80d7413331afb37b30bc0ef6ae9d11a40bcf014b0 FTM0.000212357882
0x37bcdaeef1a261ddfc903bf6d427cd0eabdd5dd7ddbfb1eac86c8241b1a53626Approve393533352022-05-29 23:00:2438 days 18 hrs ago0x205eabfd7b9a2f860a792326ff1056be1fce21a2 IN  0x80d7413331afb37b30bc0ef6ae9d11a40bcf014b0 FTM0.000173513335
0x771d02badafe2da0d16167b60f6c9e181dc2af31b4c5130db235d3ca5ca509d5Approve393380522022-05-29 17:54:1838 days 23 hrs ago0xe87a4c626eda72e1cb0acdf7ea4912b597d7daac IN  0x80d7413331afb37b30bc0ef6ae9d11a40bcf014b0 FTM0.000234891672
0xd6a6392abbb8a7eb54352997747731138f23e2dae84e7dd706115e67e97a96c7Approve393380522022-05-29 17:54:1838 days 23 hrs ago0xe87a4c626eda72e1cb0acdf7ea4912b597d7daac IN  0x80d7413331afb37b30bc0ef6ae9d11a40bcf014b0 FTM0.000196016517
0x441f5595b1b4ac04159d3ad6b13f9244d14d6eb77f629168fb3bffb6aef30ffcApprove393363032022-05-29 17:18:3539 days 13 mins ago0x2da6814c0b33c8476c6b384201fbd0949a4e1187 IN  0x80d7413331afb37b30bc0ef6ae9d11a40bcf014b0 FTM0.00018067414
0x1a0dd556cbdce054113e99d9f8fe80119e6cd13a77d5f27b12a0b7b91800c32bApprove393172032022-05-29 10:55:2139 days 6 hrs ago0x81a5f3c04f2a7558b0f7fe7bd0c9f40a52aafead IN  0x80d7413331afb37b30bc0ef6ae9d11a40bcf014b0 FTM0.000139289827
0xca2e1f0d6407e8587e7a3fda6fe04411524aa59dffad9846d0adced2d9e9ed32Approve392782862022-05-28 22:42:3839 days 18 hrs ago0x3ab05b82b47222b46618bb245369bfa7959c1938 IN  0x80d7413331afb37b30bc0ef6ae9d11a40bcf014b0 FTM0.000132821872
0xc3580acbac260d451f0a1074cf4c431eebcee5478ca60f517be0997e1a1a2708Approve392732542022-05-28 21:06:3739 days 20 hrs ago0x70ce50e48c856c030f034ede5c7919dd43972a27 IN  0x80d7413331afb37b30bc0ef6ae9d11a40bcf014b0 FTM0.000124460075
[ Download CSV Export 
Latest 1 internal transaction
Parent Txn Hash Block From To Value
0x6f8898cf4cc96b1b42f6adf2bd7ae48f0e4801fcb7d48a322ed2f071b9dbb21c348211332022-03-30 20:06:0098 days 21 hrs ago Tarot: Deployer  Contract Creation0 FTM
[ Download CSV Export 
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
SupplyVault

Compiler Version
v0.6.12+commit.27d51765

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity Standard Json-Input format)

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

pragma solidity 0.6.12;

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

import "./libraries/StringHelpers.sol";
import "./libraries/BorrowableHelpers.sol";
import "./interfaces/ISupplyVaultStrategy.sol";
import "./interfaces/ISupplyVault.sol";
import "./interfaces/IBorrowable.sol";

contract SupplyVault is ERC20, ISupplyVault, Ownable, Pausable, ReentrancyGuard {
    using Math for uint256;
    using SafeMath for uint256;
    using SafeERC20 for IERC20;
    using BorrowableHelpers for IBorrowable;
    using StringHelpers for string;

    uint256 constant MAX_BPS = 10_000;
    uint256 constant MIN_FEE_BPS = 0;
    uint256 constant MAX_FEE_BPS = MAX_BPS / 2;

    IERC20 public immutable override underlying;
    IBorrowable[] public override borrowables;
    struct BorrowableInfo {
        bool enabled;
        bool exists;
    }
    mapping(IBorrowable => BorrowableInfo) borrowableInfo;

    uint public constant GRACE_PERIOD = 14 days;
    uint public constant MIN_DELAY = 2 days;
    uint public constant MAX_DELAY = 30 days;

    ISupplyVaultStrategy public override strategy;
    ISupplyVaultStrategy public override pendingStrategy;
    uint256 public override pendingStrategyNotBefore;

    address public override reallocateManager;

    address public override feeTo;
    uint256 public override feeBps = (MAX_BPS * 10) / 100;

    uint256 checkpointBalance;

    constructor(
        IERC20 _underlying,
        ISupplyVaultStrategy _strategy,
        string memory _name,
        string memory _symbol,
        uint8 _decimals
    )
        public
        ERC20(
            _name.orElse(string("Tarot ").append(ERC20(address(_underlying)).symbol()).append(" Supply Vault")),
            _symbol.orElse(string("t").append(ERC20(address(_underlying)).symbol()))
        )
    {
        if (_decimals == 0) {
            _decimals = ERC20(address(_underlying)).decimals();
        }
        _setupDecimals(_decimals);
        underlying = _underlying;
        strategy = _strategy;

        _pause();
    }

    function _addBorrowable(address _address) private {
        // Strategy interprets argument and returns a borrowable
        IBorrowable borrowable = strategy.getBorrowable(_address);
        require(address(borrowable.underlying()) == address(underlying), "V:INVLD_UL");
        require(!borrowableInfo[borrowable].exists, "V:B_X");

        borrowableInfo[borrowable].exists = true;
        borrowableInfo[borrowable].enabled = true;
        borrowables.push(borrowable);

        emit AddBorrowable(address(borrowable));
    }

    function addBorrowable(address _address) external override onlyOwner nonReentrant {
        _addBorrowable(_address);
    }

    function addBorrowables(address[] calldata _addressList) external override onlyOwner nonReentrant {
        for (uint256 i = 0; i < _addressList.length; i++) {
            _addBorrowable(_addressList[i]);
        }
    }

    function indexOfBorrowable(IBorrowable borrowable) public view override returns (uint256) {
        uint256 numBorrowables = borrowables.length;
        for (uint256 i = 0; i < numBorrowables; i++) {
            if (borrowables[i] == borrowable) {
                return i;
            }
        }
        require(false, "V:B_NOT_FOUND");
    }

    function removeBorrowable(IBorrowable borrowable) external override onlyOwner nonReentrant {
        require(borrowables.length > 0, "V:NO_B");
        require(borrowableInfo[borrowable].exists, "V:NO_B");
        require(!borrowableInfo[borrowable].enabled, "V:B_E");
        require(borrowable.balanceOf(address(this)) == 0, "V:B_NOT_EMPTY");

        uint256 lastIndex = borrowables.length - 1;
        uint256 index = indexOfBorrowable(borrowable);

        borrowables[index] = borrowables[lastIndex];
        borrowables.pop();
        delete borrowableInfo[borrowable];

        emit RemoveBorrowable(address(borrowable));
    }

    function disableBorrowable(IBorrowable borrowable) external override onlyOwner nonReentrant {
        require(borrowableInfo[borrowable].exists, "V:B_X");
        require(borrowableInfo[borrowable].enabled, "V:B_DSBLD");

        borrowableInfo[borrowable].enabled = false;

        emit DisableBorrowable(address(borrowable));
    }

    function enableBorrowable(IBorrowable borrowable) external override onlyOwner nonReentrant {
        require(borrowableInfo[borrowable].exists, "V:B_X");
        require(!borrowableInfo[borrowable].enabled, "V:B_E");

        borrowableInfo[borrowable].enabled = true;

        emit EnableBorrowable(address(borrowable));
    }

    function unwindBorrowable(IBorrowable borrowable, uint256 borrowableAmount) external override onlyOwner {
        require(borrowableInfo[borrowable].exists, "V:B_X");
        require(!borrowableInfo[borrowable].enabled, "V:B_E");

        // Apply any outstanding fees and get the amount of underlying locked in the contract
        bool belowCheckpoint;
        {
            // NOTE: Checkpoint may be below total underlying
            uint256 totalUnderlying = _applyFee();
            belowCheckpoint = totalUnderlying < checkpointBalance;
        }

        if (borrowableAmount == 0) {
            // If value is zero then unwind the entire borrowable
            borrowableAmount = borrowable.balanceOf(address(this));
        }
        require(borrowableAmount > 0, "V:B_ZERO");

        uint256 borrowableAmountAsUnderlying = borrowable.underlyingValueOf(borrowableAmount);
        require(borrowableAmountAsUnderlying > 0, "V:U_ZERO");

        uint256 available = Math.min(borrowable.myUnderlyingBalance(), underlying.balanceOf(address(borrowable)));
        require(borrowableAmountAsUnderlying <= available, "V:NEED_B");

        uint256 underlyingBalanceBefore = underlying.balanceOf(address(this));
        IERC20(address(borrowable)).safeTransfer(address(borrowable), borrowableAmount);
        borrowable.redeem(address(this));
        uint256 underlyingAmount = underlying.balanceOf(address(this)).sub(underlyingBalanceBefore);

        if (belowCheckpoint) {
            // We were below the checkpoint prior to this unwinding so do not touch checkpoint
        } else {
            // Checkpoint matched beforehand so make sure it matches afterward
            _updateCheckpointBalance(_getTotalUnderlying());
        }

        emit UnwindBorrowable(address(borrowable), underlyingAmount, borrowableAmount);
    }

    function updatePendingStrategy(ISupplyVaultStrategy _newPendingStrategy, uint256 _notBefore)
        external
        override
        onlyOwner
        nonReentrant
    {
        if (address(_newPendingStrategy) == address(0)) {
            require(_notBefore == 0, "V:NOT_BEFORE");
        } else {
            require(address(_newPendingStrategy) != address(0), "V:INVLD_STRAT");
            require(_newPendingStrategy != strategy, "V:SAME_STRAT");
            require(_notBefore >= block.timestamp + MIN_DELAY, "V:TOO_SOON");
            require(_notBefore < block.timestamp + MAX_DELAY, "V:TOO_LATE");
        }
        pendingStrategy = _newPendingStrategy;
        pendingStrategyNotBefore = _notBefore;

        emit UpdatePendingStrategy(address(_newPendingStrategy), _notBefore);
    }

    function updateStrategy() external override onlyOwner nonReentrant {
        require(address(pendingStrategy) != address(0), "V:INVLD_STRAT");
        require(block.timestamp >= pendingStrategyNotBefore, "V:TOO_SOON");
        require(block.timestamp < pendingStrategyNotBefore + GRACE_PERIOD, "V:TOO_LATE");
        require(pendingStrategy != strategy, "V:SAME_STRAT");

        strategy = pendingStrategy;
        delete pendingStrategy;
        delete pendingStrategyNotBefore;

        emit UpdateStrategy(address(strategy));
    }

    function updateFeeBps(uint256 _newFeeBps) external override onlyOwner nonReentrant {
        require(_newFeeBps >= MIN_FEE_BPS && _newFeeBps <= MAX_FEE_BPS, "V:INVLD_FEE");

        _applyFee();
        feeBps = _newFeeBps;

        emit UpdateFeeBps(_newFeeBps);
    }

    function updateFeeTo(address _newFeeTo) external override onlyOwner nonReentrant {
        require(_newFeeTo != feeTo, "V:SAME_FEE_TO");

        _applyFee();
        feeTo = _newFeeTo;

        emit UpdateFeeTo(_newFeeTo);
    }

    function updateReallocateManager(address _newReallocateManager) external override onlyOwner nonReentrant {
        require(_newReallocateManager != reallocateManager, "V:REALLOC_MGR");

        reallocateManager = _newReallocateManager;

        emit UpdateReallocateManager(_newReallocateManager);
    }

    function pause() external override onlyOwner nonReentrant {
        _pause();
    }

    function unpause() external override onlyOwner nonReentrant {
        _unpause();
    }

    function getBorrowablesLength() external view override returns (uint256) {
        return borrowables.length;
    }

    function getBorrowableEnabled(IBorrowable borrowable) external view override returns (bool) {
        return borrowableInfo[borrowable].enabled;
    }

    function getBorrowableExists(IBorrowable borrowable) external view override returns (bool) {
        return borrowableInfo[borrowable].exists;
    }

    function getTotalUnderlying() external override nonReentrant returns (uint256 totalUnderlying) {
        totalUnderlying = _applyFee();
    }

    function _getTotalUnderlying() private returns (uint256 totalUnderlying) {
        totalUnderlying = underlying.balanceOf(address(this));

        uint256 numBorrowables = borrowables.length;
        for (uint256 i = 0; i < numBorrowables; i++) {
            IBorrowable borrowable = borrowables[i];
            totalUnderlying = totalUnderlying.add(borrowable.myUnderlyingBalance());
        }
    }

    function enter(uint256 _amount) external override whenNotPaused nonReentrant returns (uint256 share) {
        share = _enterWithToken(address(underlying), _amount);
    }

    function enterWithToken(address _tokenAddress, uint256 _tokenAmount)
        public
        override
        whenNotPaused
        nonReentrant
        returns (uint256 share)
    {
        share = _enterWithToken(_tokenAddress, _tokenAmount);
    }

    // Deposit underlying and mint supply vault tokens
    function _enterWithToken(address _tokenAddress, uint256 _tokenAmount) private returns (uint256 share) {
        require(_tokenAmount > 0, "V:TKN_ZERO");

        uint256 underlyingAmount;
        if (_tokenAddress == address(underlying)) {
            underlyingAmount = _tokenAmount;
        } else if (borrowableInfo[IBorrowable(_tokenAddress)].enabled) {
            // _tokenAddress is a valid Borrowable
            // _amount is in Borrowable
            underlyingAmount = IBorrowable(_tokenAddress).underlyingValueOf(_tokenAmount);
        } else {
            require(false, "V:INVLD_TKN");
        }
        require(underlyingAmount > 0, "V:U_ZERO");

        // Apply any outstanding fees and get the amount of underlying locked in the contract
        uint256 totalUnderlying = _applyFee();

        // After applying fees we must be exactly at checkpoint to continue
        require(totalUnderlying == checkpointBalance, "V:DEP_PAUSE");

        uint256 totalShares = totalSupply();

        if (totalShares == 0) {
            if (totalUnderlying == 0) {
                // If no shares exists, mint it 1:1 to the amount put in
                share = underlyingAmount;
            } else {
                // No shares but we have a non-zero balance of underlying so mint 1:1 including existing balance
                share = underlyingAmount.add(totalUnderlying);
            }
        } else {
            // Shares are non-zero but we have a zero balance of underlying
            // Cannot happen because checkpoint balance would have been above zero
            require(totalUnderlying > 0, "V:TU_ZERO");

            // Calculate and mint the amount of shares the underlying is worth.
            // The ratio will change overtime, as shares are burned/minted and underlying deposited + gained from fees / withdrawn.
            share = underlyingAmount.mul(totalShares).div(totalUnderlying);
        }
        mint(msg.sender, share);

        // Lock the underlying in the contract (does not support taxed tokens)
        IERC20(_tokenAddress).safeTransferFrom(msg.sender, address(this), _tokenAmount);

        // Directly update the checkpoint balance to the new watermark so that it is in sync when we call strategy.allocate()
        checkpointBalance = checkpointBalance.add(underlyingAmount);
        // At this point checkpointBalance == getTotalUnderlying()

        strategy.allocate(); // should not change total

        _updateCheckpointBalance(_getTotalUnderlying()); // force a sync after allocation

        emit Enter(msg.sender, _tokenAddress, _tokenAmount, underlyingAmount, share);
    }

    // Unlocks the staked + gained underlying and burns share
    function leave(uint256 _share) external override whenNotPaused nonReentrant returns (uint256 underlyingAmount) {
        require(_share > 0, "V:S_ZERO");

        // if total is above checkpoint then it should be >= checkpoint after
        // if total is below checkpoint then it should be <= checkpoint after

        // Apply any outstanding fees and get the amount of underlying locked in the contract
        uint256 totalUnderlyingBefore = _applyFee();
        // NOTE: Checkpoint may be below total underlying
        bool belowCheckpoint = totalUnderlyingBefore < checkpointBalance;

        // Gets the amount of share in existence
        uint256 totalShares = totalSupply();
        // _share must be positive so this also ensures that totalShares is positive
        require(_share <= totalShares, "V:INVLD_S");

        uint256 needUnderlyingAmount = _share.mul(totalUnderlyingBefore).div(totalShares);
        uint256 haveUnderlyingAmount = underlying.balanceOf(address(this));
        if (needUnderlyingAmount > haveUnderlyingAmount) {
            needUnderlyingAmount = needUnderlyingAmount.sub(haveUnderlyingAmount);
            strategy.deallocate(needUnderlyingAmount); // deallocate what we need
        }
        // After deallocation we will have at least _share/totalShares available as underlying

        // Update our total to reflect costs of unwinding
        uint256 totalUnderlying = _getTotalUnderlying();

        // Calculates the amount of underlying the shares is worth
        underlyingAmount = _share.mul(totalUnderlying).div(totalShares);
        require(underlyingAmount > 0, "V:ZERO_REDEEM");
        require(underlyingAmount <= underlying.balanceOf(address(this)), "V:BAD_STRAT_DEALLOC");

        {
            uint256 newCheckpointBalance;
            if (belowCheckpoint) {
                // Scale the checkpoint to match the new total
                // C = C * (S - s) / S;
                newCheckpointBalance = checkpointBalance.mul(totalShares.sub(_share)).div(totalShares);
            } else {
                // Checkpoint balance matched beforehand so make sure it matches afterward
                newCheckpointBalance = totalUnderlying.sub(underlyingAmount);
            }
            _updateCheckpointBalance(newCheckpointBalance);
        }

        burn(msg.sender, _share);
        underlying.safeTransfer(msg.sender, underlyingAmount);

        emit Leave(msg.sender, _share, underlyingAmount);
    }

    function _transferShareOfToken(
        address _token,
        uint256 _share,
        uint256 _totalShares
    ) private returns (uint256 transferredAmount) {
        uint256 totalAmount = IERC20(_token).balanceOf(address(this));
        if (totalAmount > 0) {
            transferredAmount = totalAmount.mul(_share).div(_totalShares);
            if (transferredAmount > 0) {
                IERC20(_token).safeTransfer(msg.sender, transferredAmount);
            }
        }
    }

    function leaveInKind(uint256 _share) external override nonReentrant {
        require(_share > 0, "V:S_ZERO");

        bool belowCheckpoint;
        {
            // NOTE: Checkpoint may be below total underlying
            uint256 totalUnderlying = _applyFee();
            belowCheckpoint = totalUnderlying < checkpointBalance;
        }
        uint256 totalShares = totalSupply();

        // _share must be positive so this also ensures that totalShares is positive
        require(_share <= totalShares, "V:INVLD_S");

        burn(msg.sender, _share);

        // Send share of underlying
        bool sentSomething = _transferShareOfToken(address(underlying), _share, totalShares) > 0;
        // Send share of each borrowable
        uint256 numBorrowables = borrowables.length;
        for (uint256 i = 0; i < numBorrowables; i++) {
            IBorrowable borrowable = borrowables[i];
            if (_transferShareOfToken(address(borrowable), _share, totalShares) > 0) {
                sentSomething = true;
            }
        }

        // Ensure we sent something
        require(sentSomething, "V:ZERO_AMOUNT");

        {
            uint256 newCheckpointBalance;
            if (belowCheckpoint) {
                // Scale the checkpoint to match the new total
                // C = C * (S - s) / S;
                newCheckpointBalance = checkpointBalance.mul(totalShares.sub(_share)).div(totalShares);
            } else {
                // Checkpoint balance matched beforehand so make sure it matches afterward
                newCheckpointBalance = _getTotalUnderlying();
            }
            _updateCheckpointBalance(newCheckpointBalance);
        }

        emit LeaveInKind(msg.sender, _share);
    }

    function reallocate(uint256 _share, bytes calldata _data) external override nonReentrant {
        require(msg.sender == owner() || msg.sender == reallocateManager, "V:NOT_AUTHORIZED");

        // Apply any outstanding fees and get the amount of underlying locked in the contract
        uint256 totalUnderlyingBefore = _applyFee();
        // NOTE: Checkpoint may be below total underlying
        bool belowCheckpoint = totalUnderlyingBefore < checkpointBalance;

        // Gets the amount of share in existence
        uint256 totalShares = totalSupply();
        // _share must be positive so this also ensures that totalShares is positive
        require(_share <= totalShares, "V:INVLD_S");

        uint256 underlyingAmount = _share.mul(totalUnderlyingBefore).div(totalShares);
        strategy.reallocate(underlyingAmount, _data);

        if (belowCheckpoint) {
            // no-op
        } else {
            // Checkpoint balance matched beforehand so make sure it matches afterward
            _updateCheckpointBalance(_getTotalUnderlying());
        }

        emit Reallocate(msg.sender, _share);
    }

    function allocateIntoBorrowable(IBorrowable borrowable, uint256 underlyingAmount) external override onlyStrategy {
        require(borrowableInfo[borrowable].enabled, "V:NOT_ENABLED");

        uint256 borrowableBalanceBefore = borrowable.balanceOf(address(this));
        underlying.safeTransfer(address(borrowable), underlyingAmount);
        borrowable.mint(address(this));
        uint256 borrowableAmount = borrowable.balanceOf(address(this)).sub(borrowableBalanceBefore);

        emit AllocateBorrowable(address(borrowable), underlyingAmount, borrowableAmount);
    }

    function deallocateFromBorrowable(IBorrowable borrowable, uint256 borrowableAmount) external override onlyStrategy {
        require(borrowableInfo[borrowable].exists, "V:NOT_EXISTS");

        uint256 underlyingBalanceBefore = underlying.balanceOf(address(this));
        IERC20(address(borrowable)).safeTransfer(address(borrowable), borrowableAmount);
        borrowable.redeem(address(this));
        uint256 underlyingAmount = underlying.balanceOf(address(this)).sub(underlyingBalanceBefore);

        emit DeallocateBorrowable(address(borrowable), borrowableAmount, underlyingAmount);
    }

    // returns the total amount of underlying an address has in the supply vault
    function underlyingBalanceForAccount(address _account)
        external
        override
        nonReentrant
        returns (uint256 underlyingBalance)
    {
        uint256 totalUnderlying = _applyFee();
        uint256 shareAmount = balanceOf(_account);
        uint256 totalShares = totalSupply();
        underlyingBalance = shareAmount.mul(totalUnderlying).div(totalShares);
    }

    // Returns how much underlying we get for a given amount of share
    function shareValuedAsUnderlying(uint256 _share)
        external
        override
        nonReentrant
        returns (uint256 underlyingAmount_)
    {
        uint256 totalUnderlying = _applyFee();
        uint256 totalShares = totalSupply();
        underlyingAmount_ = _share.mul(totalUnderlying).div(totalShares);
    }

    // Returns how much share we get for depositing a given amount of underlying
    function underlyingValuedAsShare(uint256 _underlyingAmount)
        external
        override
        nonReentrant
        returns (uint256 share_)
    {
        uint256 totalUnderlying = _applyFee();
        uint256 totalShares = totalSupply();

        if (totalShares == 0) {
            if (totalUnderlying == 0) {
                // If no shares exists, mint it 1:1 to the amount put in
                share_ = _underlyingAmount;
            } else {
                // No shares but we have a non-zero balance of underlying so mint 1:1 including existing balance
                share_ = _underlyingAmount.add(totalUnderlying);
            }
        } else {
            // Shares are non-zero but we have a zero balance of underlying
            // Cannot happen because checkpoint balance would have been above zero
            require(totalUnderlying > 0, "V:TU_ZERO");

            // Calculate and mint the amount of shares the underlying is worth.
            // The ratio will change overtime, as shares are burned/minted and underlying deposited + gained from fees / withdrawn.
            share_ = _underlyingAmount.mul(totalShares).div(totalUnderlying);
        }
    }

    function getSupplyRate() external override nonReentrant returns (uint256 supplyRate_) {
        if (address(strategy) == address(0)) {
            return 0;
        }
        return strategy.getSupplyRate();
    }

    function applyFee() external override nonReentrant {
        _applyFee();
    }

    function _updateCheckpointBalance(uint256 _newCheckpointBalance) private {
        checkpointBalance = _newCheckpointBalance;
        emit UpdateCheckpoint(_newCheckpointBalance);
    }

    // Apply fees and return back the total underlying
    function _applyFee() private returns (uint256 totalUnderlying) {
        totalUnderlying = _getTotalUnderlying();

        if (totalUnderlying > checkpointBalance) {
            if (feeTo != address(0)) {
                uint256 gain = totalUnderlying.sub(checkpointBalance);
                uint256 fee = gain.mul(feeBps).div(MAX_BPS); // fee < gain
                // gain >= fee * MAX_BPS / feeBps
                // totalBalance - gain >= 0
                // totalBalance - fee > 0

                // (gain * Fee%) * Supply / (U - (gain * Fee%))
                if (fee > 0) {
                    uint256 totalShares = totalSupply();
                    // X = F * S / (U - F)
                    uint256 feeShares = fee.mul(totalShares).div(totalUnderlying.sub(fee));
                    if (feeShares > 0) {
                        mint(feeTo, feeShares);

                        emit ApplyFee(feeTo, gain, fee, feeShares);
                    }
                }
            }

            // Update our fee collection checkpoint watermark
            _updateCheckpointBalance(totalUnderlying);
        }
    }

    modifier onlyStrategy() {
        require(msg.sender == address(strategy), "V:STRAT");
        _;
    }

    //////
    // Copied and modified from YAM code:
    // https://github.com/yam-finance/yam-protocol/blob/master/contracts/token/YAMGovernanceStorage.sol
    // https://github.com/yam-finance/yam-protocol/blob/master/contracts/token/YAMGovernance.sol
    // Which is copied and modified from COMPOUND:
    // https://github.com/compound-finance/compound-protocol/blob/master/contracts/Governance/Comp.sol

    // A record of each accounts delegate
    mapping(address => address) internal _delegates;

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

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

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

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

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

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

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

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

    function burn(address _from, uint256 _amount) private {
        _burn(_from, _amount);
        _moveDelegates(_delegates[_from], address(0), _amount);
    }

    function mint(address recipient, uint256 _amount) private {
        _mint(recipient, _amount);

        _initDelegates(recipient);

        _moveDelegates(address(0), _delegates[recipient], _amount);
    }

    function transferFrom(
        address sender,
        address recipient,
        uint256 amount
    ) public virtual override returns (bool) {
        bool result = super.transferFrom(sender, recipient, amount); // Call parent hook

        _initDelegates(recipient);

        _moveDelegates(_delegates[sender], _delegates[recipient], amount);

        return result;
    }

    function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
        bool result = super.transfer(recipient, amount); // Call parent hook

        _initDelegates(recipient);

        _moveDelegates(_delegates[_msgSender()], _delegates[recipient], amount);

        return result;
    }

    // initialize delegates mapping of recipient if not already
    function _initDelegates(address recipient) internal {
        if (_delegates[recipient] == address(0)) {
            _delegates[recipient] = recipient;
        }
    }

    /**
     * @param delegator The address to get delegates for
     */
    function delegates(address delegator) external view override returns (address) {
        return _delegates[delegator];
    }

    /**
     * @notice Delegate votes from `msg.sender` to `delegatee`
     * @param delegatee The address to delegate votes to
     */
    function delegate(address delegatee) external override {
        return _delegate(msg.sender, delegatee);
    }

    /**
     * @notice Delegates votes from signatory to `delegatee`
     * @param delegatee The address to delegate votes to
     * @param nonce The contract state required to match the signature
     * @param expiry The time at which to expire the signature
     * @param v The recovery byte of the signature
     * @param r Half of the ECDSA signature pair
     * @param s Half of the ECDSA signature pair
     */
    function delegateBySig(
        address delegatee,
        uint nonce,
        uint expiry,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external override {
        bytes32 domainSeparator = keccak256(
            abi.encode(DOMAIN_TYPEHASH, keccak256(bytes(name())), getChainId(), address(this))
        );

        bytes32 structHash = keccak256(abi.encode(DELEGATION_TYPEHASH, delegatee, nonce, expiry));

        bytes32 digest = keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));

        address signatory = ecrecover(digest, v, r, s);
        require(signatory != address(0), "V::delegateBySig: invalid signature");
        require(nonce == nonces[signatory]++, "V::delegateBySig: invalid nonce");
        require(block.timestamp <= expiry, "V::delegateBySig: signature expired");
        return _delegate(signatory, delegatee);
    }

    /**
     * @notice Gets the current votes balance for `account`
     * @param account The address to get votes balance
     * @return The number of current votes for `account`
     */
    function getCurrentVotes(address account) external view override returns (uint256) {
        uint32 nCheckpoints = numCheckpoints[account];
        return nCheckpoints > 0 ? checkpoints[account][nCheckpoints - 1].votes : 0;
    }

    /**
     * @notice Determine the prior number of votes for an account as of a block number
     * @dev Block number must be a finalized block or else this function will revert to prevent misinformation.
     * @param account The address of the account to check
     * @param blockNumber The block number to get the vote balance at
     * @return The number of votes the account had as of the given block
     */
    function getPriorVotes(address account, uint blockNumber) external view override returns (uint256) {
        require(blockNumber < block.number, "V::getPriorVotes: not yet determined");

        uint32 nCheckpoints = numCheckpoints[account];
        if (nCheckpoints == 0) {
            return 0;
        }

        // First check most recent balance
        if (checkpoints[account][nCheckpoints - 1].fromBlock <= blockNumber) {
            return checkpoints[account][nCheckpoints - 1].votes;
        }

        // Next check implicit zero balance
        if (checkpoints[account][0].fromBlock > blockNumber) {
            return 0;
        }

        uint32 lower = 0;
        uint32 upper = nCheckpoints - 1;
        while (upper > lower) {
            uint32 center = upper - (upper - lower) / 2; // ceil, avoiding overflow
            Checkpoint memory cp = checkpoints[account][center];
            if (cp.fromBlock == blockNumber) {
                return cp.votes;
            } else if (cp.fromBlock < blockNumber) {
                lower = center;
            } else {
                upper = center - 1;
            }
        }
        return checkpoints[account][lower].votes;
    }

    function _delegate(address delegator, address delegatee) internal {
        address currentDelegate = _delegates[delegator];
        uint256 delegatorBalance = balanceOf(delegator); // balance of underlying BOOs (not scaled);
        _delegates[delegator] = delegatee;

        emit DelegateChanged(delegator, currentDelegate, delegatee);

        _moveDelegates(currentDelegate, delegatee, delegatorBalance);
    }

    function _moveDelegates(
        address srcRep,
        address dstRep,
        uint256 amount
    ) internal {
        if (srcRep != dstRep && amount > 0) {
            if (srcRep != address(0)) {
                // decrease old representative
                uint32 srcRepNum = numCheckpoints[srcRep];
                uint256 srcRepOld = srcRepNum > 0 ? checkpoints[srcRep][srcRepNum - 1].votes : 0;
                uint256 srcRepNew = srcRepOld - amount;
                _writeCheckpoint(srcRep, srcRepNum, srcRepOld, srcRepNew);
            }

            if (dstRep != address(0)) {
                // increase new representative
                uint32 dstRepNum = numCheckpoints[dstRep];
                uint256 dstRepOld = dstRepNum > 0 ? checkpoints[dstRep][dstRepNum - 1].votes : 0;
                uint256 dstRepNew = dstRepOld + amount;
                _writeCheckpoint(dstRep, dstRepNum, dstRepOld, dstRepNew);
            }
        }
    }

    function _writeCheckpoint(
        address delegatee,
        uint32 nCheckpoints,
        uint256 oldVotes,
        uint256 newVotes
    ) internal {
        uint32 blockNumber = safe32(block.number, "V::_writeCheckpoint: block number exceeds 32 bits");

        if (nCheckpoints > 0 && checkpoints[delegatee][nCheckpoints - 1].fromBlock == blockNumber) {
            checkpoints[delegatee][nCheckpoints - 1].votes = newVotes;
        } else {
            checkpoints[delegatee][nCheckpoints] = Checkpoint(blockNumber, newVotes);
            numCheckpoints[delegatee] = nCheckpoints + 1;
        }

        emit DelegateVotesChanged(delegatee, oldVotes, newVotes);
    }

    function safe32(uint n, string memory errorMessage) internal pure returns (uint32) {
        require(n < 2**32, errorMessage);
        return uint32(n);
    }

    function getChainId() internal view returns (uint) {
        uint256 chainId;
        assembly {
            chainId := chainid()
        }
        return chainId;
    }
}

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

pragma solidity >=0.6.0 <0.8.0;

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

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

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

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

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

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

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

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

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

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

pragma solidity >=0.6.0 <0.8.0;

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

/**
 * @dev Implementation of the {IERC20} interface.
 *
 * This implementation is agnostic to the way tokens are created. This means
 * that a supply mechanism has to be added in a derived contract using {_mint}.
 * For a generic mechanism see {ERC20PresetMinterPauser}.
 *
 * TIP: For a detailed writeup see our guide
 * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
 * to implement supply mechanisms].
 *
 * We have followed general OpenZeppelin guidelines: functions revert instead
 * of returning `false` on failure. This behavior is nonetheless conventional
 * and does not conflict with the expectations of ERC20 applications.
 *
 * Additionally, an {Approval} event is emitted on calls to {transferFrom}.
 * This allows applications to reconstruct the allowance for all accounts just
 * by listening to said events. Other implementations of the EIP may not emit
 * these events, as it isn't required by the specification.
 *
 * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
 * functions have been added to mitigate the well-known issues around setting
 * allowances. See {IERC20-approve}.
 */
contract ERC20 is Context, IERC20 {
    using SafeMath for uint256;

    mapping (address => uint256) private _balances;

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

    uint256 private _totalSupply;

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

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

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

    /**
     * @dev Returns the symbol of the token, usually a shorter version of the
     * name.
     */
    function symbol() public view virtual returns (string memory) {
        return _symbol;
    }

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

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

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

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

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

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

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

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

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

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

        _beforeTokenTransfer(sender, recipient, amount);

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

    /** @dev Creates `amount` tokens and assigns them to `account`, increasing
     * the total supply.
     *
     * Emits a {Transfer} event with `from` set to the zero address.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     */
    function _mint(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: mint to the zero address");

        _beforeTokenTransfer(address(0), account, amount);

        _totalSupply = _totalSupply.add(amount);
        _balances[account] = _balances[account].add(amount);
        emit Transfer(address(0), account, amount);
    }

    /**
     * @dev Destroys `amount` tokens from `account`, reducing the
     * total supply.
     *
     * Emits a {Transfer} event with `to` set to the zero address.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     * - `account` must have at least `amount` tokens.
     */
    function _burn(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: burn from the zero address");

        _beforeTokenTransfer(account, address(0), amount);

        _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
        _totalSupply = _totalSupply.sub(amount);
        emit Transfer(account, address(0), amount);
    }

    /**
     * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
     *
     * This internal function is equivalent to `approve`, and can be used to
     * e.g. set automatic allowances for certain subsystems, etc.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `owner` cannot be the zero address.
     * - `spender` cannot be the zero address.
     */
    function _approve(address owner, address spender, uint256 amount) internal virtual {
        require(owner != address(0), "ERC20: approve from the zero address");
        require(spender != address(0), "ERC20: approve to the zero address");

        _allowances[owner][spender] = amount;
        emit Approval(owner, spender, amount);
    }

    /**
     * @dev Sets {decimals} to a value other than the default one of 18.
     *
     * WARNING: This function should only be called from the constructor. Most
     * applications that interact with token contracts will not expect
     * {decimals} to ever change, and may work incorrectly if it does.
     */
    function _setupDecimals(uint8 decimals_) internal virtual {
        _decimals = decimals_;
    }

    /**
     * @dev Hook that is called before any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * will be to transferred to `to`.
     * - when `from` is zero, `amount` tokens will be minted for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens will be burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
}

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

pragma solidity >=0.6.0 <0.8.0;

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

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

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

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

pragma solidity >=0.6.0 <0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

pragma solidity >=0.6.0 <0.8.0;

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

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

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

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

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

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

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

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

pragma solidity >=0.6.0 <0.8.0;

import "./Context.sol";

/**
 * @dev Contract module which allows children to implement an emergency stop
 * mechanism that can be triggered by an authorized account.
 *
 * This module is used through inheritance. It will make available the
 * modifiers `whenNotPaused` and `whenPaused`, which can be applied to
 * the functions of your contract. Note that they will not be pausable by
 * simply including this module, only once the modifiers are put in place.
 */
abstract contract Pausable is Context {
    /**
     * @dev Emitted when the pause is triggered by `account`.
     */
    event Paused(address account);

    /**
     * @dev Emitted when the pause is lifted by `account`.
     */
    event Unpaused(address account);

    bool private _paused;

    /**
     * @dev Initializes the contract in unpaused state.
     */
    constructor () internal {
        _paused = false;
    }

    /**
     * @dev Returns true if the contract is paused, and false otherwise.
     */
    function paused() public view virtual returns (bool) {
        return _paused;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is not paused.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    modifier whenNotPaused() {
        require(!paused(), "Pausable: paused");
        _;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is paused.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    modifier whenPaused() {
        require(paused(), "Pausable: not paused");
        _;
    }

    /**
     * @dev Triggers stopped state.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    function _pause() internal virtual whenNotPaused {
        _paused = true;
        emit Paused(_msgSender());
    }

    /**
     * @dev Returns to normal state.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    function _unpause() internal virtual whenPaused {
        _paused = false;
        emit Unpaused(_msgSender());
    }
}

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

pragma solidity >=0.6.0 <0.8.0;

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

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

    uint256 private _status;

    constructor () internal {
        _status = _NOT_ENTERED;
    }

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

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

        _;

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

File 9 of 16 : StringHelpers.sol
pragma solidity 0.6.12;

library StringHelpers {
    function append(string memory a, string memory b) internal pure returns (string memory) {
        return string(abi.encodePacked(a, b));
    }

    /**
     * Returns the first string if it is not-empty, otherwise the second.
     */
    function orElse(string memory a, string memory b) internal pure returns (string memory) {
        if (bytes(a).length > 0) {
            return a;
        }
        return b;
    }
}

File 10 of 16 : BorrowableHelpers.sol
pragma solidity 0.6.12;

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

import "../interfaces/IBorrowable.sol";

library BorrowableHelpers {
    using SafeMath for uint256;

    uint256 private constant RATE_SCALE = 1e18;

    function borrowableValueOf(IBorrowable borrowable, uint256 underlyingAmount) internal returns (uint256) {
        if (underlyingAmount == 0) {
            return 0;
        }
        uint256 exchangeRate = borrowable.exchangeRate();
        return underlyingAmount.mul(1e18).div(exchangeRate);
    }

    function underlyingValueOf(IBorrowable borrowable, uint256 borrowableAmount) internal returns (uint256) {
        if (borrowableAmount == 0) {
            return 0;
        }
        uint256 exchangeRate = borrowable.exchangeRate();
        return borrowableAmount.mul(exchangeRate).div(1e18);
    }

    function underlyingBalanceOf(IBorrowable borrowable, address account) internal returns (uint256) {
        return underlyingValueOf(borrowable, borrowable.balanceOf(account));
    }

    function myUnderlyingBalance(IBorrowable borrowable) internal returns (uint256) {
        return underlyingValueOf(borrowable, borrowable.balanceOf(address(this)));
    }

    function getNextBorrowRate(
        IBorrowable borrowable,
        uint256 depositAmount,
        uint256 withdrawAmount
    ) internal returns (uint256 borrowRate_, uint256 utilizationRate_) {
        require(depositAmount == 0 || withdrawAmount == 0, "BH: INVLD_DELTA");
        borrowable.accrueInterest();
        {
            uint256 totalBorrows = borrowable.totalBorrows();
            uint256 nextBalance = borrowable.totalBalance().add(totalBorrows);
            if (depositAmount > 0) {
                nextBalance = nextBalance.add(depositAmount);
            }
            if (withdrawAmount > 0) {
                nextBalance = nextBalance.sub(withdrawAmount);
            }
            utilizationRate_ = (nextBalance == 0) ? 0 : totalBorrows.mul(RATE_SCALE).div(nextBalance);
        }

        uint256 kinkUtilizationRate = borrowable.kinkUtilizationRate(); // gas savings

        if (utilizationRate_ <= kinkUtilizationRate) {
            borrowRate_ = borrowable.kinkBorrowRate().mul(utilizationRate_).div(kinkUtilizationRate);
        } else {
            borrowRate_ = borrowable.KINK_MULTIPLIER().sub(1);

            {
                // utilizationRate_ is strictly less than kinkUtilizationRate
                uint256 overUtilization = utilizationRate_.sub(kinkUtilizationRate).mul(RATE_SCALE).div(
                    RATE_SCALE.sub(kinkUtilizationRate)
                );
                borrowRate_ = borrowRate_.mul(overUtilization);
            }

            borrowRate_ = borrowRate_.add(RATE_SCALE).mul(borrowable.kinkBorrowRate()).div(RATE_SCALE);
        }

        borrowRate_ = uint48(borrowRate_);
    }

    function getNextSupplyRate(
        IBorrowable borrowable,
        uint256 depositAmount,
        uint256 withdrawAmount
    )
        internal
        returns (
            uint256 supplyRate_,
            uint256 borrowRate_,
            uint256 utilizationRate_
        )
    {
        (borrowRate_, utilizationRate_) = getNextBorrowRate(borrowable, depositAmount, withdrawAmount);

        supplyRate_ = borrowRate_
            .mul(utilizationRate_)
            .div(RATE_SCALE)
            .mul(RATE_SCALE.sub(borrowable.reserveFactor()))
            .div(RATE_SCALE);
    }

    function getCurrentBorrowRate(IBorrowable borrowable)
        internal
        returns (uint256 borrowRate_, uint256 utilizationRate_)
    {
        return getNextBorrowRate(borrowable, 0, 0);
    }

    function getCurrentSupplyRate(IBorrowable borrowable)
        internal
        returns (
            uint256 supplyRate_,
            uint256 borrowRate_,
            uint256 utilizationRate_
        )
    {
        return getNextSupplyRate(borrowable, 0, 0);
    }
}

File 11 of 16 : ISupplyVaultStrategy.sol
pragma solidity >=0.5.0;

import "./IBorrowable.sol";
import "./ISupplyVault.sol";

interface ISupplyVaultStrategy {
    function getBorrowable(address _address) external view returns (IBorrowable);

    function getSupplyRate() external returns (uint256 supplyRate_);

    function allocate() external;

    function deallocate(uint256 _underlyingAmount) external;

    function reallocate(uint256 _underlyingAmount, bytes calldata _data) external;
}

File 12 of 16 : ISupplyVault.sol
pragma solidity >=0.5.0;

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "./IBorrowable.sol";
import "./ISupplyVaultStrategy.sol";

interface ISupplyVault {
    /* Vault */
    function enter(uint256 _amount) external returns (uint256 share);

    function enterWithToken(address _tokenAddress, uint256 _tokenAmount) external returns (uint256 share);

    function leave(uint256 _share) external returns (uint256 underlyingAmount);

    function leaveInKind(uint256 _share) external;

    function applyFee() external;

    /** Read */

    function getBorrowablesLength() external view returns (uint256);

    function getBorrowableEnabled(IBorrowable borrowable) external view returns (bool);

    function getBorrowableExists(IBorrowable borrowable) external view returns (bool);

    function indexOfBorrowable(IBorrowable borrowable) external view returns (uint256);

    function borrowables(uint256) external view returns (IBorrowable);

    function underlying() external view returns (IERC20);

    function strategy() external view returns (ISupplyVaultStrategy);

    function pendingStrategy() external view returns (ISupplyVaultStrategy);

    function pendingStrategyNotBefore() external view returns (uint256);

    function feeBps() external view returns (uint256);

    function feeTo() external view returns (address);

    function reallocateManager() external view returns (address);

    /* Read functions that are non-view due to updating exchange rates */
    function underlyingBalanceForAccount(address _account) external returns (uint256 underlyingBalance);

    function shareValuedAsUnderlying(uint256 _share) external returns (uint256 underlyingAmount_);

    function underlyingValuedAsShare(uint256 _underlyingAmount) external returns (uint256 share_);

    function getTotalUnderlying() external returns (uint256 totalUnderlying);

    function getSupplyRate() external returns (uint256 supplyRate_);

    /* Only from strategy */

    function allocateIntoBorrowable(IBorrowable borrowable, uint256 underlyingAmount) external;

    function deallocateFromBorrowable(IBorrowable borrowable, uint256 borrowableAmount) external;

    function reallocate(uint256 _share, bytes calldata _data) external;

    /* Only owner */
    function addBorrowable(address _address) external;

    function addBorrowables(address[] calldata _addressList) external;

    function removeBorrowable(IBorrowable borrowable) external;

    function disableBorrowable(IBorrowable borrowable) external;

    function enableBorrowable(IBorrowable borrowable) external;

    function unwindBorrowable(IBorrowable borrowable, uint256 borowableAmount) external;

    function updatePendingStrategy(ISupplyVaultStrategy _newPendingStrategy, uint256 _notBefore) external;

    function updateStrategy() external;

    function updateFeeBps(uint256 _newFeeBps) external;

    function updateFeeTo(address _newFeeTo) external;

    function updateReallocateManager(address _newReallocateManager) external;

    function pause() external;

    function unpause() external;

    /* Voting */
    function delegates(address delegator) external view returns (address);

    function delegate(address delegatee) external;

    function delegateBySig(
        address delegatee,
        uint nonce,
        uint expiry,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

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

    function getPriorVotes(address account, uint blockNumber) external view returns (uint256);

    /* Events */
    event AddBorrowable(address indexed borrowable);
    event RemoveBorrowable(address indexed borrowable);
    event EnableBorrowable(address indexed borrowable);
    event DisableBorrowable(address indexed borrowable);
    event UpdatePendingStrategy(address indexed strategy, uint256 notBefore);
    event UpdateStrategy(address indexed strategy);
    event UpdateFeeBps(uint256 newFeeBps);
    event UpdateFeeTo(address indexed newFeeTo);
    event UpdateReallocateManager(address indexed newReallocateManager);
    event UnwindBorrowable(address indexed borrowable, uint256 underlyingAmount, uint256 borrowableAmount);
    event Enter(
        address indexed who,
        address indexed token,
        uint256 tokenAmount,
        uint256 underlyingAmount,
        uint256 share
    );
    event Leave(address indexed who, uint256 share, uint256 underlyingAmount);
    event LeaveInKind(address indexed who, uint256 share);
    event Reallocate(address indexed sender, uint256 share);
    event AllocateBorrowable(address indexed borrowable, uint256 underlyingAmount, uint256 borrowableAmount);
    event DeallocateBorrowable(address indexed borrowable, uint256 borrowableAmount, uint256 underlyingAmount);

    event ApplyFee(address indexed feeTo, uint256 gain, uint256 fee, uint256 feeShare);
    event UpdateCheckpoint(uint256 checkpointBalance);
}

File 13 of 16 : IBorrowable.sol
pragma solidity >=0.5.0;

interface IBorrowable {
    /*** Tarot ERC20 ***/

    event Transfer(address indexed from, address indexed to, uint256 value);
    event Approval(
        address indexed owner,
        address indexed spender,
        uint256 value
    );

    function name() external pure returns (string memory);

    function symbol() external pure returns (string memory);

    function decimals() external pure returns (uint8);

    function totalSupply() external view returns (uint256);

    function balanceOf(address owner) external view returns (uint256);

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

    function approve(address spender, uint256 value) external returns (bool);

    function transfer(address to, uint256 value) external returns (bool);

    function transferFrom(
        address from,
        address to,
        uint256 value
    ) external returns (bool);

    function DOMAIN_SEPARATOR() external view returns (bytes32);

    function PERMIT_TYPEHASH() external pure returns (bytes32);

    function nonces(address owner) external view returns (uint256);

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

    /*** Pool Token ***/

    event Mint(
        address indexed sender,
        address indexed minter,
        uint256 mintAmount,
        uint256 mintTokens
    );
    event Redeem(
        address indexed sender,
        address indexed redeemer,
        uint256 redeemAmount,
        uint256 redeemTokens
    );
    event Sync(uint256 totalBalance);

    function underlying() external view returns (address);

    function factory() external view returns (address);

    function totalBalance() external view returns (uint256);

    function MINIMUM_LIQUIDITY() external pure returns (uint256);

    function exchangeRate() external returns (uint256);

    function mint(address minter) external returns (uint256 mintTokens);

    function redeem(address redeemer) external returns (uint256 redeemAmount);

    function skim(address to) external;

    function sync() external;

    function _setFactory() external;

    /*** Borrowable ***/

    event BorrowApproval(
        address indexed owner,
        address indexed spender,
        uint256 value
    );
    event Borrow(
        address indexed sender,
        address indexed borrower,
        address indexed receiver,
        uint256 borrowAmount,
        uint256 repayAmount,
        uint256 accountBorrowsPrior,
        uint256 accountBorrows,
        uint256 totalBorrows
    );
    event Liquidate(
        address indexed sender,
        address indexed borrower,
        address indexed liquidator,
        uint256 seizeTokens,
        uint256 repayAmount,
        uint256 accountBorrowsPrior,
        uint256 accountBorrows,
        uint256 totalBorrows
    );

    function BORROW_FEE() external pure returns (uint256);

    function collateral() external view returns (address);

    function reserveFactor() external view returns (uint256);

    function exchangeRateLast() external view returns (uint256);

    function borrowIndex() external view returns (uint256);

    function totalBorrows() external view returns (uint256);

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

    function borrowBalance(address borrower) external view returns (uint256);

    function borrowTracker() external view returns (address);

    function BORROW_PERMIT_TYPEHASH() external pure returns (bytes32);

    function borrowApprove(address spender, uint256 value)
        external
        returns (bool);

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

    function borrow(
        address borrower,
        address receiver,
        uint256 borrowAmount,
        bytes calldata data
    ) external;

    function liquidate(address borrower, address liquidator)
        external
        returns (uint256 seizeTokens);

    function trackBorrow(address borrower) external;

    /*** Borrowable Interest Rate Model ***/

    event AccrueInterest(
        uint256 interestAccumulated,
        uint256 borrowIndex,
        uint256 totalBorrows
    );
    event CalculateKink(uint256 kinkRate);
    event CalculateBorrowRate(uint256 borrowRate);

    function KINK_BORROW_RATE_MAX() external pure returns (uint256);

    function KINK_BORROW_RATE_MIN() external pure returns (uint256);

    function KINK_MULTIPLIER() external pure returns (uint256);

    function borrowRate() external view returns (uint256);

    function kinkBorrowRate() external view returns (uint256);

    function kinkUtilizationRate() external view returns (uint256);

    function adjustSpeed() external view returns (uint256);

    function rateUpdateTimestamp() external view returns (uint32);

    function accrualTimestamp() external view returns (uint32);

    function accrueInterest() external;

    /*** Borrowable Setter ***/

    event NewReserveFactor(uint256 newReserveFactor);
    event NewKinkUtilizationRate(uint256 newKinkUtilizationRate);
    event NewAdjustSpeed(uint256 newAdjustSpeed);
    event NewBorrowTracker(address newBorrowTracker);

    function RESERVE_FACTOR_MAX() external pure returns (uint256);

    function KINK_UR_MIN() external pure returns (uint256);

    function KINK_UR_MAX() external pure returns (uint256);

    function ADJUST_SPEED_MIN() external pure returns (uint256);

    function ADJUST_SPEED_MAX() external pure returns (uint256);

    function _initialize(
        string calldata _name,
        string calldata _symbol,
        address _underlying,
        address _collateral
    ) external;

    function _setReserveFactor(uint256 newReserveFactor) external;

    function _setKinkUtilizationRate(uint256 newKinkUtilizationRate) external;

    function _setAdjustSpeed(uint256 newAdjustSpeed) external;

    function _setBorrowTracker(address newBorrowTracker) external;
}

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

pragma solidity >=0.6.0 <0.8.0;

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

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

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

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

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

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

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

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

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

pragma solidity >=0.6.2 <0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

pragma solidity >=0.6.0 <0.8.0;

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

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

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"contract IERC20","name":"_underlying","type":"address"},{"internalType":"contract ISupplyVaultStrategy","name":"_strategy","type":"address"},{"internalType":"string","name":"_name","type":"string"},{"internalType":"string","name":"_symbol","type":"string"},{"internalType":"uint8","name":"_decimals","type":"uint8"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"borrowable","type":"address"}],"name":"AddBorrowable","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"borrowable","type":"address"},{"indexed":false,"internalType":"uint256","name":"underlyingAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"borrowableAmount","type":"uint256"}],"name":"AllocateBorrowable","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"feeTo","type":"address"},{"indexed":false,"internalType":"uint256","name":"gain","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"fee","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"feeShare","type":"uint256"}],"name":"ApplyFee","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"borrowable","type":"address"},{"indexed":false,"internalType":"uint256","name":"borrowableAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"underlyingAmount","type":"uint256"}],"name":"DeallocateBorrowable","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"delegator","type":"address"},{"indexed":true,"internalType":"address","name":"fromDelegate","type":"address"},{"indexed":true,"internalType":"address","name":"toDelegate","type":"address"}],"name":"DelegateChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"delegate","type":"address"},{"indexed":false,"internalType":"uint256","name":"previousBalance","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newBalance","type":"uint256"}],"name":"DelegateVotesChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"borrowable","type":"address"}],"name":"DisableBorrowable","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"borrowable","type":"address"}],"name":"EnableBorrowable","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"who","type":"address"},{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"underlyingAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"share","type":"uint256"}],"name":"Enter","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"who","type":"address"},{"indexed":false,"internalType":"uint256","name":"share","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"underlyingAmount","type":"uint256"}],"name":"Leave","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"who","type":"address"},{"indexed":false,"internalType":"uint256","name":"share","type":"uint256"}],"name":"LeaveInKind","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"share","type":"uint256"}],"name":"Reallocate","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"borrowable","type":"address"}],"name":"RemoveBorrowable","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"borrowable","type":"address"},{"indexed":false,"internalType":"uint256","name":"underlyingAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"borrowableAmount","type":"uint256"}],"name":"UnwindBorrowable","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"checkpointBalance","type":"uint256"}],"name":"UpdateCheckpoint","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newFeeBps","type":"uint256"}],"name":"UpdateFeeBps","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"newFeeTo","type":"address"}],"name":"UpdateFeeTo","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"strategy","type":"address"},{"indexed":false,"internalType":"uint256","name":"notBefore","type":"uint256"}],"name":"UpdatePendingStrategy","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"newReallocateManager","type":"address"}],"name":"UpdateReallocateManager","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"strategy","type":"address"}],"name":"UpdateStrategy","type":"event"},{"inputs":[],"name":"DELEGATION_TYPEHASH","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DOMAIN_TYPEHASH","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"GRACE_PERIOD","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_DELAY","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MIN_DELAY","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"}],"name":"addBorrowable","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_addressList","type":"address[]"}],"name":"addBorrowables","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IBorrowable","name":"borrowable","type":"address"},{"internalType":"uint256","name":"underlyingAmount","type":"uint256"}],"name":"allocateIntoBorrowable","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"applyFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"borrowables","outputs":[{"internalType":"contract IBorrowable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint32","name":"","type":"uint32"}],"name":"checkpoints","outputs":[{"internalType":"uint32","name":"fromBlock","type":"uint32"},{"internalType":"uint256","name":"votes","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IBorrowable","name":"borrowable","type":"address"},{"internalType":"uint256","name":"borrowableAmount","type":"uint256"}],"name":"deallocateFromBorrowable","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"delegatee","type":"address"}],"name":"delegate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"delegatee","type":"address"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"uint256","name":"expiry","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"delegateBySig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"delegator","type":"address"}],"name":"delegates","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IBorrowable","name":"borrowable","type":"address"}],"name":"disableBorrowable","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IBorrowable","name":"borrowable","type":"address"}],"name":"enableBorrowable","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"enter","outputs":[{"internalType":"uint256","name":"share","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_tokenAddress","type":"address"},{"internalType":"uint256","name":"_tokenAmount","type":"uint256"}],"name":"enterWithToken","outputs":[{"internalType":"uint256","name":"share","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"feeBps","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"feeTo","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IBorrowable","name":"borrowable","type":"address"}],"name":"getBorrowableEnabled","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IBorrowable","name":"borrowable","type":"address"}],"name":"getBorrowableExists","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getBorrowablesLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"getCurrentVotes","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"blockNumber","type":"uint256"}],"name":"getPriorVotes","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getSupplyRate","outputs":[{"internalType":"uint256","name":"supplyRate_","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getTotalUnderlying","outputs":[{"internalType":"uint256","name":"totalUnderlying","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IBorrowable","name":"borrowable","type":"address"}],"name":"indexOfBorrowable","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_share","type":"uint256"}],"name":"leave","outputs":[{"internalType":"uint256","name":"underlyingAmount","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_share","type":"uint256"}],"name":"leaveInKind","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"nonces","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"numCheckpoints","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingStrategy","outputs":[{"internalType":"contract ISupplyVaultStrategy","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingStrategyNotBefore","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_share","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"reallocate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"reallocateManager","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IBorrowable","name":"borrowable","type":"address"}],"name":"removeBorrowable","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_share","type":"uint256"}],"name":"shareValuedAsUnderlying","outputs":[{"internalType":"uint256","name":"underlyingAmount_","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"strategy","outputs":[{"internalType":"contract ISupplyVaultStrategy","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"underlying","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"}],"name":"underlyingBalanceForAccount","outputs":[{"internalType":"uint256","name":"underlyingBalance","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_underlyingAmount","type":"uint256"}],"name":"underlyingValuedAsShare","outputs":[{"internalType":"uint256","name":"share_","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IBorrowable","name":"borrowable","type":"address"},{"internalType":"uint256","name":"borrowableAmount","type":"uint256"}],"name":"unwindBorrowable","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_newFeeBps","type":"uint256"}],"name":"updateFeeBps","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_newFeeTo","type":"address"}],"name":"updateFeeTo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract ISupplyVaultStrategy","name":"_newPendingStrategy","type":"address"},{"internalType":"uint256","name":"_notBefore","type":"uint256"}],"name":"updatePendingStrategy","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_newReallocateManager","type":"address"}],"name":"updateReallocateManager","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"updateStrategy","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60a06040526103e8600e553480156200001757600080fd5b50604051620068d7380380620068d7833981810160405260a08110156200003d57600080fd5b815160208301516040808501805191519395929483019291846401000000008211156200006957600080fd5b9083019060208201858111156200007f57600080fd5b82516401000000008111828201881017156200009a57600080fd5b82525081516020918201929091019080838360005b83811015620000c9578181015183820152602001620000af565b50505050905090810190601f168015620000f75780820380516001836020036101000a031916815260200191505b50604052602001805160405193929190846401000000008211156200011b57600080fd5b9083019060208201858111156200013157600080fd5b82516401000000008111828201881017156200014c57600080fd5b82525081516020918201929091019080838360005b838110156200017b57818101518382015260200162000161565b50505050905090810190601f168015620001a95780820380516001836020036101000a031916815260200191505b50604052602001805190602001909291905050506200037a620003656040518060400160405280600d81526020016c0814dd5c1c1b1e4815985d5b1d609a1b81525062000351886001600160a01b03166395d89b416040518163ffffffff1660e01b815260040160006040518083038186803b1580156200022957600080fd5b505afa1580156200023e573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405260208110156200026857600080fd5b81019080805160405193929190846401000000008211156200028957600080fd5b9083019060208201858111156200029f57600080fd5b8251640100000000811182820188101715620002ba57600080fd5b82525081516020918201929091019080838360005b83811015620002e9578181015183820152602001620002cf565b50505050905090810190601f168015620003175780820380516001836020036101000a031916815260200191505b506040525050506040518060400160405280600681526020016502a30b937ba160d51b8152506200064f60201b620043261790919060201c565b6200064f60201b620043261790919060201c565b846200070f60201b620043e11790919060201c565b620004df62000365876001600160a01b03166395d89b416040518163ffffffff1660e01b815260040160006040518083038186803b158015620003bc57600080fd5b505afa158015620003d1573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526020811015620003fb57600080fd5b81019080805160405193929190846401000000008211156200041c57600080fd5b9083019060208201858111156200043257600080fd5b82516401000000008111828201881017156200044d57600080fd5b82525081516020918201929091019080838360005b838110156200047c57818101518382015260200162000462565b50505050905090810190601f168015620004aa5780820380516001836020036101000a031916815260200191505b50604052505050604051806040016040528060018152602001601d60fa1b8152506200064f60201b620043261790919060201c565b8151620004f4906003906020850190620007fd565b5080516200050a906004906020840190620007fd565b50506005805460ff191660121790555060006200052662000728565b60058054610100600160a81b0319166101006001600160a01b03841690810291909117909155604051919250906000907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a3506005805460ff60a81b19169055600160065560ff81166200060257846001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b158015620005d157600080fd5b505afa158015620005e6573d6000803e3d6000fd5b505050506040513d6020811015620005fd57600080fd5b505190505b6200060d816200072c565b606085901b6001600160601b031916608052600980546001600160a01b0319166001600160a01b0386161790556200064462000742565b505050505062000899565b606082826040516020018083805190602001908083835b60208310620006875780518252601f19909201916020918201910162000666565b51815160209384036101000a600019018019909216911617905285519190930192850191508083835b60208310620006d15780518252601f199092019160209182019101620006b0565b6001836020036101000a0380198251168184511680821785525050505050509050019250505060405160208183030381529060405290505b92915050565b8151606090156200072257508162000709565b50919050565b3390565b6005805460ff191660ff92909216919091179055565b6200074c620007ed565b1562000792576040805162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015290519081900360640190fd5b6005805460ff60a81b1916600160a81b1790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258620007d062000728565b604080516001600160a01b039092168252519081900360200190a1565b600554600160a81b900460ff1690565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106200084057805160ff191683800117855562000870565b8280016001018555821562000870579182015b828111156200087057825182559160200191906001019062000853565b506200087e92915062000882565b5090565b5b808211156200087e576000815560010162000883565b60805160601c615fda620008fd60003980610fa2528061108452806111ce528061202952806121be52806122d1528061234b5280612db55280612fad52806132a55280614036528061418052806147d9528061499f52806150105250615fda6000f3fe608060405234801561001057600080fd5b50600436106103e65760003560e01c80637df78afd1161020a578063b40494e511610125578063db160f75116100b8578063eb1ea9f411610087578063eb1ea9f414610b9a578063ed8c2d2d14610bc0578063f1127ed814610bec578063f26a584514610c3e578063f2fde38b14610c6a576103e6565b8063db160f7514610b3f578063dcc9def514610b5c578063dd62ed3e14610b64578063e7a324dc14610b92576103e6565b8063c3cda520116100f4578063c3cda52014610a86578063c6b0dec114610acd578063cdec2f2314610af3578063d65444e814610b19576103e6565b8063b40494e514610a33578063b4b5ea5714610a3b578063bb2190bb14610a61578063c1a287e214610a7e576103e6565b806396a1cd271161019d578063a8c62e761161016c578063a8c62e76146109b6578063a9059cbb146109be578063ade37c13146109ea578063b4039d9e14610a07576103e6565b806396a1cd27146109485780639f81aed714610965578063a457c2d71461096d578063a59f3e0c14610999576103e6565b806384bdc9a8116101d957806384bdc9a8146108b95780638670d9dc146108c15780638da5cb5b1461093857806395d89b4114610940576103e6565b80637df78afd146108575780637ecebe0014610883578063821beaf5146108a95780638456cb59146108b1576103e6565b8063465fc5d2116103055780636052693b116102985780636fcfff45116102675780636fcfff45146107b657806370a08231146107f5578063715018a61461081b57806371736d3214610823578063782d6fe11461082b576103e6565b80636052693b1461076357806367dfd4c9146107895780636a68ea50146107a65780636f307dc3146107ae576103e6565b8063587cde1e116102d4578063587cde1e146106e95780635c19a95c1461070f5780635c975abb146107355780635c98f2931461073d576103e6565b8063465fc5d2146106785780634a5763ba14610680578063506fb0861461069d57806352ac4b02146106c3576103e6565b806323b872dd1161037d57806332fe35fd1161034c57806332fe35fd14610616578063395093511461063c5780633f4ba83a146106685780634125ff9014610670576103e6565b806323b872dd146105b257806324a9d853146105e85780632fddd913146105f0578063313ce567146105f8576103e6565b80630eb2f648116103b95780630eb2f648146104fa57806318160ddd1461056a57806320606b7014610584578063218b5b811461058c576103e6565b8063017e7e58146103eb57806306fdde031461040f578063095ea7b31461048c5780630e0a1589146104cc575b600080fd5b6103f3610c90565b604080516001600160a01b039092168252519081900360200190f35b610417610c9f565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610451578181015183820152602001610439565b50505050905090810190601f16801561047e5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6104b8600480360360408110156104a257600080fd5b506001600160a01b038135169060200135610d36565b604080519115158252519081900360200190f35b6104f8600480360360408110156104e257600080fd5b506001600160a01b038135169060200135610d54565b005b6104f86004803603602081101561051057600080fd5b81019060208101813564010000000081111561052b57600080fd5b82018360208201111561053d57600080fd5b8035906020019184602083028401116401000000008311171561055f57600080fd5b5090925090506112b0565b61057261139e565b60408051918252519081900360200190f35b6105726113a4565b6104f8600480360360208110156105a257600080fd5b50356001600160a01b03166113c8565b6104b8600480360360608110156105c857600080fd5b506001600160a01b03813581169160208101359091169060400135611486565b6105726114db565b6104f86114e1565b61060061171f565b6040805160ff9092168252519081900360200190f35b6104f86004803603602081101561062c57600080fd5b50356001600160a01b0316611728565b6104b86004803603604081101561065257600080fd5b506001600160a01b0381351690602001356118d6565b6104f8611929565b6105726119e5565b6103f36119ec565b6105726004803603602081101561069657600080fd5b50356119fb565b610572600480360360208110156106b357600080fd5b50356001600160a01b0316611a81565b6104f8600480360360208110156106d957600080fd5b50356001600160a01b0316611b17565b6103f3600480360360208110156106ff57600080fd5b50356001600160a01b0316611cc5565b6104f86004803603602081101561072557600080fd5b50356001600160a01b0316611ce3565b6104b8611cf0565b6104f86004803603602081101561075357600080fd5b50356001600160a01b0316611d00565b6105726004803603602081101561077957600080fd5b50356001600160a01b0316611e4f565b6105726004803603602081101561079f57600080fd5b5035611edd565b610572612343565b6103f3612349565b6107dc600480360360208110156107cc57600080fd5b50356001600160a01b031661236d565b6040805163ffffffff9092168252519081900360200190f35b6105726004803603602081101561080b57600080fd5b50356001600160a01b0316612385565b6104f86123a0565b6103f3612452565b6105726004803603604081101561084157600080fd5b506001600160a01b038135169060200135612461565b6105726004803603604081101561086d57600080fd5b506001600160a01b038135169060200135612669565b6105726004803603602081101561089957600080fd5b50356001600160a01b0316612719565b61057261272b565b6104f8612731565b6105726127e6565b6104f8600480360360408110156108d757600080fd5b813591908101906040810160208201356401000000008111156108f957600080fd5b82018360208201111561090b57600080fd5b8035906020019184600183028401116401000000008311171561092d57600080fd5b5090925090506128d2565b6103f3612af7565b610417612b0b565b6104f86004803603602081101561095e57600080fd5b5035612b6c565b610572612ca7565b6104b86004803603604081101561098357600080fd5b506001600160a01b038135169060200135612cae565b610572600480360360208110156109af57600080fd5b5035612d16565b6103f3612de5565b6104b8600480360360408110156109d457600080fd5b506001600160a01b038135169060200135612df4565b6103f360048036036020811015610a0057600080fd5b5035612e56565b6104f860048036036040811015610a1d57600080fd5b506001600160a01b038135169060200135612e7d565b6105726130e9565b61057260048036036020811015610a5157600080fd5b50356001600160a01b0316613148565b6104f860048036036020811015610a7757600080fd5b50356131ab565b6105726133db565b6104f8600480360360c0811015610a9c57600080fd5b506001600160a01b038135169060208101359060408101359060ff6060820135169060808101359060a001356133e2565b6104b860048036036020811015610ae357600080fd5b50356001600160a01b031661366b565b6104f860048036036020811015610b0957600080fd5b50356001600160a01b031661368e565b6104b860048036036020811015610b2f57600080fd5b50356001600160a01b03166137e6565b61057260048036036020811015610b5557600080fd5b5035613804565b6104f86138e8565b61057260048036036040811015610b7a57600080fd5b506001600160a01b038135811691602001351661393b565b610572613966565b6104f860048036036020811015610bb057600080fd5b50356001600160a01b031661398a565b6104f860048036036040811015610bd657600080fd5b506001600160a01b038135169060200135613ccf565b610c1e60048036036040811015610c0257600080fd5b5080356001600160a01b0316906020013563ffffffff16613f5b565b6040805163ffffffff909316835260208301919091528051918290030190f35b6104f860048036036040811015610c5457600080fd5b506001600160a01b038135169060200135613f88565b6104f860048036036020811015610c8057600080fd5b50356001600160a01b0316614218565b600d546001600160a01b031681565b60038054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610d2b5780601f10610d0057610100808354040283529160200191610d2b565b820191906000526020600020905b815481529060010190602001808311610d0e57829003601f168201915b505050505090505b90565b6000610d4a610d436143f8565b84846143fc565b5060015b92915050565b610d5c6143f8565b6001600160a01b0316610d6d612af7565b6001600160a01b031614610db6576040805162461bcd60e51b81526020600482018190526024820152600080516020615e9b833981519152604482015290519081900360640190fd5b6001600160a01b038216600090815260086020526040902054610100900460ff16610e10576040805162461bcd60e51b81526020600482015260056024820152640ac7484beb60db1b604482015290519081900360640190fd5b6001600160a01b03821660009081526008602052604090205460ff1615610e66576040805162461bcd60e51b8152602060048201526005602482015264563a425f4560d81b604482015290519081900360640190fd5b600080610e716144e8565b600f541191505081610ef257604080516370a0823160e01b815230600482015290516001600160a01b038516916370a08231916024808301926020929190829003018186803b158015610ec357600080fd5b505afa158015610ed7573d6000803e3d6000fd5b505050506040513d6020811015610eed57600080fd5b505191505b60008211610f32576040805162461bcd60e51b8152602060048201526008602482015267563a425f5a45524f60c01b604482015290519081900360640190fd5b6000610f476001600160a01b038516846145ef565b905060008111610f89576040805162461bcd60e51b8152602060048201526008602482015267563a555f5a45524f60c01b604482015290519081900360640190fd5b600061103e610fa0866001600160a01b0316614687565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166370a08231886040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561100d57600080fd5b505afa158015611021573d6000803e3d6000fd5b505050506040513d602081101561103757600080fd5b505161470b565b905080821115611080576040805162461bcd60e51b81526020600482015260086024820152672b1d2722a2a22fa160c11b604482015290519081900360640190fd5b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b1580156110ef57600080fd5b505afa158015611103573d6000803e3d6000fd5b505050506040513d602081101561111957600080fd5b505190506111316001600160a01b0387168787614721565b604080516395a2251f60e01b815230600482015290516001600160a01b038816916395a2251f9160248083019260209291908290030181600087803b15801561117957600080fd5b505af115801561118d573d6000803e3d6000fd5b505050506040513d60208110156111a357600080fd5b5050604080516370a0823160e01b815230600482015290516000916112479184916001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016916370a0823191602480820192602092909190829003018186803b15801561121557600080fd5b505afa158015611229573d6000803e3d6000fd5b505050506040513d602081101561123f57600080fd5b505190614778565b9050841561125457611264565b61126461125f6147d5565b6148ca565b604080518281526020810188905281516001600160a01b038a16927f05750bc9042b6da04fdebec7b024caed5c2e2b35c707bd1fde571f31cdaeb566928290030190a250505050505050565b6112b86143f8565b6001600160a01b03166112c9612af7565b6001600160a01b031614611312576040805162461bcd60e51b81526020600482018190526024820152600080516020615e9b833981519152604482015290519081900360640190fd5b60026006541415611358576040805162461bcd60e51b815260206004820152601f6024820152600080516020615d12833981519152604482015290519081900360640190fd5b600260065560005b818110156113945761138c83838381811061137757fe5b905060200201356001600160a01b0316614905565b600101611360565b5050600160065550565b60025490565b7f8cad95687ba82c2ce50e74f7b754645e5117c3a5bec8151c0726d5857980a86681565b6113d06143f8565b6001600160a01b03166113e1612af7565b6001600160a01b03161461142a576040805162461bcd60e51b81526020600482018190526024820152600080516020615e9b833981519152604482015290519081900360640190fd5b60026006541415611470576040805162461bcd60e51b815260206004820152601f6024820152600080516020615d12833981519152604482015290519081900360640190fd5b600260065561147e81614905565b506001600655565b600080611494858585614b51565b905061149f84614bd3565b6001600160a01b038086166000908152601060205260408082205487841683529120546114d192918216911685614c1c565b90505b9392505050565b600e5481565b6114e96143f8565b6001600160a01b03166114fa612af7565b6001600160a01b031614611543576040805162461bcd60e51b81526020600482018190526024820152600080516020615e9b833981519152604482015290519081900360640190fd5b60026006541415611589576040805162461bcd60e51b815260206004820152601f6024820152600080516020615d12833981519152604482015290519081900360640190fd5b6002600655600a546001600160a01b03166115db576040805162461bcd60e51b815260206004820152600d60248201526c158e925395931117d4d5149055609a1b604482015290519081900360640190fd5b600b5442101561161f576040805162461bcd60e51b815260206004820152600a6024820152692b1d2a27a7afa9a7a7a760b11b604482015290519081900360640190fd5b62127500600b54014210611667576040805162461bcd60e51b815260206004820152600a602482015269563a544f4f5f4c41544560b01b604482015290519081900360640190fd5b600954600a546001600160a01b03908116911614156116bc576040805162461bcd60e51b815260206004820152600c60248201526b158e94d0535157d4d514905560a21b604482015290519081900360640190fd5b600a8054600980546001600160a01b038084166001600160a01b0319928316179283905592169092556000600b81905560405192909116917f351ac3b801ef52eee542597618621efdaafc5a2e9469f78505486074ea9b92719190a26001600655565b60055460ff1690565b6117306143f8565b6001600160a01b0316611741612af7565b6001600160a01b03161461178a576040805162461bcd60e51b81526020600482018190526024820152600080516020615e9b833981519152604482015290519081900360640190fd5b600260065414156117d0576040805162461bcd60e51b815260206004820152601f6024820152600080516020615d12833981519152604482015290519081900360640190fd5b60026006556001600160a01b038116600090815260086020526040902054610100900460ff1661182f576040805162461bcd60e51b81526020600482015260056024820152640ac7484beb60db1b604482015290519081900360640190fd5b6001600160a01b03811660009081526008602052604090205460ff1615611885576040805162461bcd60e51b8152602060048201526005602482015264563a425f4560d81b604482015290519081900360640190fd5b6001600160a01b038116600081815260086020526040808220805460ff19166001179055517f54ba33e4b0861b4d81b3384c3b5130b25b55df191223d9e48b317dc289fac3a99190a2506001600655565b6000610d4a6118e36143f8565b8461192485600160006118f46143f8565b6001600160a01b03908116825260208083019390935260409182016000908120918c168152925290205490614d43565b6143fc565b6119316143f8565b6001600160a01b0316611942612af7565b6001600160a01b03161461198b576040805162461bcd60e51b81526020600482018190526024820152600080516020615e9b833981519152604482015290519081900360640190fd5b600260065414156119d1576040805162461bcd60e51b815260206004820152601f6024820152600080516020615d12833981519152604482015290519081900360640190fd5b60026006556119de614d9d565b6001600655565b62278d0081565b600a546001600160a01b031681565b600060026006541415611a43576040805162461bcd60e51b815260206004820152601f6024820152600080516020615d12833981519152604482015290519081900360640190fd5b60026006556000611a526144e8565b90506000611a5e61139e565b9050611a7481611a6e8685614e40565b90614e99565b6001600655949350505050565b600754600090815b81811015611ad457836001600160a01b031660078281548110611aa857fe5b6000918252602090912001546001600160a01b03161415611acc579150611b129050565b600101611a89565b506040805162461bcd60e51b815260206004820152600d60248201526c158e9097d393d517d193d55391609a1b604482015290519081900360640190fd5b919050565b611b1f6143f8565b6001600160a01b0316611b30612af7565b6001600160a01b031614611b79576040805162461bcd60e51b81526020600482018190526024820152600080516020615e9b833981519152604482015290519081900360640190fd5b60026006541415611bbf576040805162461bcd60e51b815260206004820152601f6024820152600080516020615d12833981519152604482015290519081900360640190fd5b60026006556001600160a01b038116600090815260086020526040902054610100900460ff16611c1e576040805162461bcd60e51b81526020600482015260056024820152640ac7484beb60db1b604482015290519081900360640190fd5b6001600160a01b03811660009081526008602052604090205460ff16611c77576040805162461bcd60e51b8152602060048201526009602482015268158e9097d114d0931160ba1b604482015290519081900360640190fd5b6001600160a01b038116600081815260086020526040808220805460ff19169055517f6149acc591caf5f3d506cb615abb39ea3847de4e2aa83f4382531de216bdc6809190a2506001600655565b6001600160a01b039081166000908152601060205260409020541690565b611ced3382614f00565b50565b600554600160a81b900460ff1690565b611d086143f8565b6001600160a01b0316611d19612af7565b6001600160a01b031614611d62576040805162461bcd60e51b81526020600482018190526024820152600080516020615e9b833981519152604482015290519081900360640190fd5b60026006541415611da8576040805162461bcd60e51b815260206004820152601f6024820152600080516020615d12833981519152604482015290519081900360640190fd5b6002600655600c546001600160a01b0382811691161415611e00576040805162461bcd60e51b815260206004820152600d60248201526c2b1d2922a0a62627a1afa6a3a960991b604482015290519081900360640190fd5b600c80546001600160a01b0319166001600160a01b0383169081179091556040517fa06271564c176b7d57ad09f68b0a7f6dce53ebd54ae6147444f291f64242e3d690600090a2506001600655565b600060026006541415611e97576040805162461bcd60e51b815260206004820152601f6024820152600080516020615d12833981519152604482015290519081900360640190fd5b60026006556000611ea66144e8565b90506000611eb384612385565b90506000611ebf61139e565b9050611ecf81611a6e8486614e40565b600160065595945050505050565b6000611ee7611cf0565b15611f2c576040805162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015290519081900360640190fd5b60026006541415611f72576040805162461bcd60e51b815260206004820152601f6024820152600080516020615d12833981519152604482015290519081900360640190fd5b600260065581611fb4576040805162461bcd60e51b8152602060048201526008602482015267563a535f5a45524f60c01b604482015290519081900360640190fd5b6000611fbe6144e8565b600f5490915081106000611fd061139e565b905080851115612013576040805162461bcd60e51b8152602060048201526009602482015268563a494e564c445f5360b81b604482015290519081900360640190fd5b600061202382611a6e8887614e40565b905060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561209457600080fd5b505afa1580156120a8573d6000803e3d6000fd5b505050506040513d60208110156120be57600080fd5b505190508082111561213d576120d48282614778565b60095460408051636f6c441f60e01b81526004810184905290519294506001600160a01b0390911691636f6c441f9160248082019260009290919082900301818387803b15801561212457600080fd5b505af1158015612138573d6000803e3d6000fd5b505050505b60006121476147d5565b905061215784611a6e8a84614e40565b96506000871161219e576040805162461bcd60e51b815260206004820152600d60248201526c563a5a45524f5f52454445454d60981b604482015290519081900360640190fd5b604080516370a0823160e01b815230600482015290516001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016916370a08231916024808301926020929190829003018186803b15801561220457600080fd5b505afa158015612218573d6000803e3d6000fd5b505050506040513d602081101561222e57600080fd5b505187111561227a576040805162461bcd60e51b8152602060048201526013602482015272563a4241445f53545241545f4445414c4c4f4360681b604482015290519081900360640190fd5b600085156122a35761229c85611a6e612293828d614778565b600f5490614e40565b90506122b0565b6122ad8289614778565b90505b6122b9816148ca565b506122c43389614f95565b6122f86001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000163389614721565b6040805189815260208101899052815133927f0f0f7f8153c6d63a5696720d4cc434e56bb5ac1cf8c791ed9c180defb6e92153928290030190a2505060016006555092949350505050565b600b5481565b7f000000000000000000000000000000000000000000000000000000000000000081565b60126020526000908152604090205463ffffffff1681565b6001600160a01b031660009081526020819052604090205490565b6123a86143f8565b6001600160a01b03166123b9612af7565b6001600160a01b031614612402576040805162461bcd60e51b81526020600482018190526024820152600080516020615e9b833981519152604482015290519081900360640190fd5b60055460405160009161010090046001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a360058054610100600160a81b0319169055565b600c546001600160a01b031681565b60004382106124a15760405162461bcd60e51b8152600401808060200182810382526024815260200180615e2e6024913960400191505060405180910390fd5b6001600160a01b03831660009081526012602052604090205463ffffffff16806124cf576000915050610d4e565b6001600160a01b038416600090815260116020908152604080832063ffffffff60001986018116855292529091205416831061253e576001600160a01b03841660009081526011602090815260408083206000199490940163ffffffff16835292905220600101549050610d4e565b6001600160a01b038416600090815260116020908152604080832083805290915290205463ffffffff16831015612579576000915050610d4e565b600060001982015b8163ffffffff168163ffffffff16111561263257600282820363ffffffff160481036125ab615cd7565b506001600160a01b038716600090815260116020908152604080832063ffffffff80861685529083529281902081518083019092528054909316808252600190930154918101919091529087141561260d57602001519450610d4e9350505050565b805163ffffffff168711156126245781935061262b565b6001820392505b5050612581565b506001600160a01b038516600090815260116020908152604080832063ffffffff9094168352929052206001015491505092915050565b6000612673611cf0565b156126b8576040805162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015290519081900360640190fd5b600260065414156126fe576040805162461bcd60e51b815260206004820152601f6024820152600080516020615d12833981519152604482015290519081900360640190fd5b600260065561270d8383614fc9565b60016006559392505050565b60136020526000908152604090205481565b60075490565b6127396143f8565b6001600160a01b031661274a612af7565b6001600160a01b031614612793576040805162461bcd60e51b81526020600482018190526024820152600080516020615e9b833981519152604482015290519081900360640190fd5b600260065414156127d9576040805162461bcd60e51b815260206004820152601f6024820152600080516020615d12833981519152604482015290519081900360640190fd5b60026006556119de6152c5565b60006002600654141561282e576040805162461bcd60e51b815260206004820152601f6024820152600080516020615d12833981519152604482015290519081900360640190fd5b60026006556009546001600160a01b031661284b575060006128ca565b600960009054906101000a90046001600160a01b03166001600160a01b03166384bdc9a86040518163ffffffff1660e01b8152600401602060405180830381600087803b15801561289b57600080fd5b505af11580156128af573d6000803e3d6000fd5b505050506040513d60208110156128c557600080fd5b505190505b600160065590565b60026006541415612918576040805162461bcd60e51b815260206004820152601f6024820152600080516020615d12833981519152604482015290519081900360640190fd5b6002600655612925612af7565b6001600160a01b0316336001600160a01b0316148061294e5750600c546001600160a01b031633145b612992576040805162461bcd60e51b815260206004820152601060248201526f158e9393d517d055551213d49256915160821b604482015290519081900360640190fd5b600061299c6144e8565b600f54909150811060006129ae61139e565b9050808611156129f1576040805162461bcd60e51b8152602060048201526009602482015268563a494e564c445f5360b81b604482015290519081900360640190fd5b6000612a0182611a6e8987614e40565b6009546040805163219c367760e21b81526004810184815260248201928352604482018a90529394506001600160a01b0390921692638670d9dc9285928b928b92909190606401848480828437600081840152601f19601f820116905080830192505050945050505050600060405180830381600087803b158015612a8557600080fd5b505af1158015612a99573d6000803e3d6000fd5b505050508215612aa857612ab3565b612ab361125f6147d5565b60408051888152905133917fd35c705a8cdf375ece95697aaa843eaeabf8aef05c602b44d4a3e1bfee4f5a4d919081900360200190a2505060016006555050505050565b60055461010090046001600160a01b031690565b60048054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610d2b5780601f10610d0057610100808354040283529160200191610d2b565b612b746143f8565b6001600160a01b0316612b85612af7565b6001600160a01b031614612bce576040805162461bcd60e51b81526020600482018190526024820152600080516020615e9b833981519152604482015290519081900360640190fd5b60026006541415612c14576040805162461bcd60e51b815260206004820152601f6024820152600080516020615d12833981519152604482015290519081900360640190fd5b6002600655611388811115612c5e576040805162461bcd60e51b815260206004820152600b60248201526a563a494e564c445f46454560a81b604482015290519081900360640190fd5b612c666144e8565b50600e8190556040805182815290517f464285156ea7288194429c32afd38e4980047fef24f2f2c851d9749260435b6f9181900360200190a1506001600655565b6202a30081565b6000610d4a612cbb6143f8565b8461192485604051806060016040528060258152602001615f806025913960016000612ce56143f8565b6001600160a01b03908116825260208083019390935260409182016000908120918d1681529252902054919061534e565b6000612d20611cf0565b15612d65576040805162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015290519081900360640190fd5b60026006541415612dab576040805162461bcd60e51b815260206004820152601f6024820152600080516020615d12833981519152604482015290519081900360640190fd5b6002600655612dda7f000000000000000000000000000000000000000000000000000000000000000083614fc9565b600160065592915050565b6009546001600160a01b031681565b600080612e0184846153e5565b9050612e0c84614bd3565b6114d460106000612e1b6143f8565b6001600160a01b0390811682526020808301939093526040918201600090812054898316825260109094529190912054918116911685614c1c565b60078181548110612e6357fe5b6000918252602090912001546001600160a01b0316905081565b6009546001600160a01b03163314612ec6576040805162461bcd60e51b8152602060048201526007602482015266158e94d514905560ca1b604482015290519081900360640190fd5b6001600160a01b03821660009081526008602052604090205460ff16612f23576040805162461bcd60e51b815260206004820152600d60248201526c158e9393d517d1539050931151609a1b604482015290519081900360640190fd5b6000826001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b158015612f7257600080fd5b505afa158015612f86573d6000803e3d6000fd5b505050506040513d6020811015612f9c57600080fd5b50519050612fd46001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168484614721565b604080516335313c2160e11b815230600482015290516001600160a01b03851691636a6278429160248083019260209291908290030181600087803b15801561301c57600080fd5b505af1158015613030573d6000803e3d6000fd5b505050506040513d602081101561304657600080fd5b5050604080516370a0823160e01b815230600482015290516000916130989184916001600160a01b038816916370a0823191602480820192602092909190829003018186803b15801561121557600080fd5b9050836001600160a01b03167fab631c4d3a490acf827e1489efbfdb91b68ac12b6c0d8ae6953aaf30e1608b888483604051808381526020018281526020019250505060405180910390a250505050565b600060026006541415613131576040805162461bcd60e51b815260206004820152601f6024820152600080516020615d12833981519152604482015290519081900360640190fd5b600260065561313e6144e8565b6001600655919050565b6001600160a01b03811660009081526012602052604081205463ffffffff16806131735760006114d4565b6001600160a01b038316600090815260116020908152604080832063ffffffff60001986011684529091529020600101549392505050565b600260065414156131f1576040805162461bcd60e51b815260206004820152601f6024820152600080516020615d12833981519152604482015290519081900360640190fd5b600260065580613233576040805162461bcd60e51b8152602060048201526008602482015267563a535f5a45524f60c01b604482015290519081900360640190fd5b60008061323e6144e8565b600f541191506000905061325061139e565b905080831115613293576040805162461bcd60e51b8152602060048201526009602482015268563a494e564c445f5360b81b604482015290519081900360640190fd5b61329d3384614f95565b6000806132cb7f000000000000000000000000000000000000000000000000000000000000000086856153f9565b6007549110915060005b81811015613321576000600782815481106132ec57fe5b60009182526020822001546001600160a01b0316915061330d8289886153f9565b111561331857600193505b506001016132d5565b5081613364576040805162461bcd60e51b815260206004820152600d60248201526c158e96915493d7d05353d55395609a1b604482015290519081900360640190fd5b600084156133845761337d84611a6e612293828a614778565b905061338f565b61338c6147d5565b90505b613398816148ca565b5060408051868152905133917f3dc2d815bcedc7575f9894e925f089e22559cc012af3029b00b58292da27664c919081900360200190a250506001600655505050565b6212750081565b60007f8cad95687ba82c2ce50e74f7b754645e5117c3a5bec8151c0726d5857980a86661340d610c9f565b8051906020012061341c6154af565b60408051602080820195909552808201939093526060830191909152306080808401919091528151808403909101815260a0830182528051908401207fe48329057bfd03d55e49b547132e39cffd9c1820ad7b9d4c5307691425d15adf60c08401526001600160a01b038b1660e084015261010083018a90526101208084018a9052825180850390910181526101408401835280519085012061190160f01b6101608501526101628401829052610182808501829052835180860390910181526101a285018085528151918701919091206000918290526101c2860180865281905260ff8b166101e287015261020286018a90526102228601899052935192965090949293909260019261024280840193601f198301929081900390910190855afa15801561354f573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166135a15760405162461bcd60e51b8152600401808060200182810382526023815260200180615e0b6023913960400191505060405180910390fd5b6001600160a01b03811660009081526013602052604090208054600181019091558914613615576040805162461bcd60e51b815260206004820152601f60248201527f563a3a64656c656761746542795369673a20696e76616c6964206e6f6e636500604482015290519081900360640190fd5b874211156136545760405162461bcd60e51b8152600401808060200182810382526023815260200180615d9c6023913960400191505060405180910390fd5b61365e818b614f00565b505050505b505050505050565b6001600160a01b0316600090815260086020526040902054610100900460ff1690565b6136966143f8565b6001600160a01b03166136a7612af7565b6001600160a01b0316146136f0576040805162461bcd60e51b81526020600482018190526024820152600080516020615e9b833981519152604482015290519081900360640190fd5b60026006541415613736576040805162461bcd60e51b815260206004820152601f6024820152600080516020615d12833981519152604482015290519081900360640190fd5b6002600655600d546001600160a01b038281169116141561378e576040805162461bcd60e51b815260206004820152600d60248201526c563a53414d455f4645455f544f60981b604482015290519081900360640190fd5b6137966144e8565b50600d80546001600160a01b0319166001600160a01b0383169081179091556040517fcb2efb9ac9d76fd38ee396f04826fab474b9d684a0131ed439d676632ad605f990600090a2506001600655565b6001600160a01b031660009081526008602052604090205460ff1690565b60006002600654141561384c576040805162461bcd60e51b815260206004820152601f6024820152600080516020615d12833981519152604482015290519081900360640190fd5b6002600655600061385b6144e8565b9050600061386761139e565b90508061388d578161387b57839250613888565b6138858483614d43565b92505b6138dc565b600082116138ce576040805162461bcd60e51b8152602060048201526009602482015268563a54555f5a45524f60b81b604482015290519081900360640190fd5b611a7482611a6e8684614e40565b50506001600655919050565b6002600654141561392e576040805162461bcd60e51b815260206004820152601f6024820152600080516020615d12833981519152604482015290519081900360640190fd5b600260065561147e6144e8565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b7fe48329057bfd03d55e49b547132e39cffd9c1820ad7b9d4c5307691425d15adf81565b6139926143f8565b6001600160a01b03166139a3612af7565b6001600160a01b0316146139ec576040805162461bcd60e51b81526020600482018190526024820152600080516020615e9b833981519152604482015290519081900360640190fd5b60026006541415613a32576040805162461bcd60e51b815260206004820152601f6024820152600080516020615d12833981519152604482015290519081900360640190fd5b6002600655600754613a74576040805162461bcd60e51b81526020600482015260066024820152652b1d2727afa160d11b604482015290519081900360640190fd5b6001600160a01b038116600090815260086020526040902054610100900460ff16613acf576040805162461bcd60e51b81526020600482015260066024820152652b1d2727afa160d11b604482015290519081900360640190fd5b6001600160a01b03811660009081526008602052604090205460ff1615613b25576040805162461bcd60e51b8152602060048201526005602482015264563a425f4560d81b604482015290519081900360640190fd5b604080516370a0823160e01b815230600482015290516001600160a01b038316916370a08231916024808301926020929190829003018186803b158015613b6b57600080fd5b505afa158015613b7f573d6000803e3d6000fd5b505050506040513d6020811015613b9557600080fd5b505115613bd9576040805162461bcd60e51b815260206004820152600d60248201526c563a425f4e4f545f454d50545960981b604482015290519081900360640190fd5b600754600019016000613beb83611a81565b905060078281548110613bfa57fe5b600091825260209091200154600780546001600160a01b039092169183908110613c2057fe5b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055506007805480613c5957fe5b60008281526020808220830160001990810180546001600160a01b03191690559092019092556001600160a01b03851680835260089091526040808320805461ffff191690555190917f1f537c1571c0e7fa29083762436cadb3e57564c0f78e857e498cf428124c710e91a25050600160065550565b613cd76143f8565b6001600160a01b0316613ce8612af7565b6001600160a01b031614613d31576040805162461bcd60e51b81526020600482018190526024820152600080516020615e9b833981519152604482015290519081900360640190fd5b60026006541415613d77576040805162461bcd60e51b815260206004820152601f6024820152600080516020615d12833981519152604482015290519081900360640190fd5b60026006556001600160a01b038216613dd1578015613dcc576040805162461bcd60e51b815260206004820152600c60248201526b563a4e4f545f4245464f524560a01b604482015290519081900360640190fd5b613efb565b6001600160a01b038216613e1c576040805162461bcd60e51b815260206004820152600d60248201526c158e925395931117d4d5149055609a1b604482015290519081900360640190fd5b6009546001600160a01b0383811691161415613e6e576040805162461bcd60e51b815260206004820152600c60248201526b158e94d0535157d4d514905560a21b604482015290519081900360640190fd5b6202a3004201811015613eb5576040805162461bcd60e51b815260206004820152600a6024820152692b1d2a27a7afa9a7a7a760b11b604482015290519081900360640190fd5b62278d0042018110613efb576040805162461bcd60e51b815260206004820152600a602482015269563a544f4f5f4c41544560b01b604482015290519081900360640190fd5b600a80546001600160a01b0384166001600160a01b03199091168117909155600b8290556040805183815290517fdc7940cd625f859a15f646158208f9cd0680f644a605e23c218002d4225c4adb9181900360200190a250506001600655565b60116020908152600092835260408084209091529082529020805460019091015463ffffffff9091169082565b6009546001600160a01b03163314613fd1576040805162461bcd60e51b8152602060048201526007602482015266158e94d514905560ca1b604482015290519081900360640190fd5b6001600160a01b038216600090815260086020526040902054610100900460ff16614032576040805162461bcd60e51b815260206004820152600c60248201526b563a4e4f545f45584953545360a01b604482015290519081900360640190fd5b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b1580156140a157600080fd5b505afa1580156140b5573d6000803e3d6000fd5b505050506040513d60208110156140cb57600080fd5b505190506140e36001600160a01b0384168484614721565b604080516395a2251f60e01b815230600482015290516001600160a01b038516916395a2251f9160248083019260209291908290030181600087803b15801561412b57600080fd5b505af115801561413f573d6000803e3d6000fd5b505050506040513d602081101561415557600080fd5b5050604080516370a0823160e01b815230600482015290516000916141c79184916001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016916370a0823191602480820192602092909190829003018186803b15801561121557600080fd5b9050836001600160a01b03167f27d47976f09b31322ff3e902364eaaa83ebd9438ae8a8d4e9c25f536c8d34fa58483604051808381526020018281526020019250505060405180910390a250505050565b6142206143f8565b6001600160a01b0316614231612af7565b6001600160a01b03161461427a576040805162461bcd60e51b81526020600482018190526024820152600080516020615e9b833981519152604482015290519081900360640190fd5b6001600160a01b0381166142bf5760405162461bcd60e51b8152600401808060200182810382526026815260200180615d546026913960400191505060405180910390fd5b6005546040516001600160a01b0380841692610100900416907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3600580546001600160a01b0390921661010002610100600160a81b0319909216919091179055565b606082826040516020018083805190602001908083835b6020831061435c5780518252601f19909201916020918201910161433d565b51815160209384036101000a600019018019909216911617905285519190930192850191508083835b602083106143a45780518252601f199092019160209182019101614385565b6001836020036101000a03801982511681845116808217855250505050505090500192505050604051602081830303815290604052905092915050565b8151606090156143f2575081610d4e565b50919050565b3390565b6001600160a01b0383166144415760405162461bcd60e51b8152600401808060200182810382526024815260200180615f016024913960400191505060405180910390fd5b6001600160a01b0382166144865760405162461bcd60e51b8152600401808060200182810382526022815260200180615d7a6022913960400191505060405180910390fd5b6001600160a01b03808416600081815260016020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b60006144f26147d5565b9050600f54811115610d3357600d546001600160a01b0316156145e6576000614526600f548361477890919063ffffffff16565b90506000614545612710611a6e600e5485614e4090919063ffffffff16565b905080156145e357600061455761139e565b905060006145726145688685614778565b611a6e8585614e40565b905080156145e057600d54614590906001600160a01b0316826154b3565b600d54604080518681526020810186905280820184905290516001600160a01b03909216917fa729e13b67d4c409a310d4d00dc9ac67b5540cc4cc9ba903f31857937ae13db59181900360600190a25b50505b50505b610d33816148ca565b6000816145fe57506000610d4e565b6000836001600160a01b0316633ba0b9a96040518163ffffffff1660e01b8152600401602060405180830381600087803b15801561463b57600080fd5b505af115801561464f573d6000803e3d6000fd5b505050506040513d602081101561466557600080fd5b5051905061467f670de0b6b3a7640000611a6e8584614e40565b949350505050565b6000610d4e82836001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b1580156146da57600080fd5b505afa1580156146ee573d6000803e3d6000fd5b505050506040513d602081101561470457600080fd5b50516145ef565b600081831061471a57816114d4565b5090919050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b1790526147739084906154eb565b505050565b6000828211156147cf576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561484457600080fd5b505afa158015614858573d6000803e3d6000fd5b505050506040513d602081101561486e57600080fd5b505160075490915060005b818110156148c55760006007828154811061489057fe5b6000918252602090912001546001600160a01b031690506148ba6148b382614687565b8590614d43565b935050600101614879565b505090565b600f8190556040805182815290517f7fdf3fc2767b3889dcc1d6da49f38fe1be5d6f2d834718fd49b75bb5cf364a749181900360200190a150565b60095460408051634b42f38b60e11b81526001600160a01b03848116600483015291516000939290921691639685e71691602480820192602092909190829003018186803b15801561495657600080fd5b505afa15801561496a573d6000803e3d6000fd5b505050506040513d602081101561498057600080fd5b505160408051636f307dc360e01b815290519192506001600160a01b037f000000000000000000000000000000000000000000000000000000000000000081169290841691636f307dc3916004808301926020929190829003018186803b1580156149ea57600080fd5b505afa1580156149fe573d6000803e3d6000fd5b505050506040513d6020811015614a1457600080fd5b50516001600160a01b031614614a5e576040805162461bcd60e51b815260206004820152600a602482015269158e925395931117d55360b21b604482015290519081900360640190fd5b6001600160a01b038116600090815260086020526040902054610100900460ff1615614ab9576040805162461bcd60e51b81526020600482015260056024820152640ac7484beb60db1b604482015290519081900360640190fd5b6001600160a01b038116600081815260086020526040808220805460ff1961ff00199091166101001716600190811790915560078054918201815583527fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c6880180546001600160a01b03191684179055517f3b94e6c56297c3ab2913d31d1c1adf8279146dbfb5624cc473e7af7a22d9c8469190a25050565b6000614b5e84848461559c565b614bc984614b6a6143f8565b61192485604051806060016040528060288152602001615e73602891396001600160a01b038a16600090815260016020526040812090614ba86143f8565b6001600160a01b03168152602081019190915260400160002054919061534e565b5060019392505050565b6001600160a01b0381811660009081526010602052604090205416611ced576001600160a01b0316600081815260106020526040902080546001600160a01b0319169091179055565b816001600160a01b0316836001600160a01b031614158015614c3e5750600081115b15614773576001600160a01b03831615614cc5576001600160a01b03831660009081526012602052604081205463ffffffff169081614c7e576000614cb0565b6001600160a01b038516600090815260116020908152604080832063ffffffff60001987011684529091529020600101545b9050828103614cc1868484846156f7565b5050505b6001600160a01b03821615614773576001600160a01b03821660009081526012602052604081205463ffffffff169081614d00576000614d32565b6001600160a01b038416600090815260116020908152604080832063ffffffff60001987011684529091529020600101545b9050828101613663858484846156f7565b6000828201838110156114d4576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b614da5611cf0565b614ded576040805162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b604482015290519081900360640190fd5b6005805460ff60a81b191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa614e236143f8565b604080516001600160a01b039092168252519081900360200190a1565b600082614e4f57506000610d4e565b82820282848281614e5c57fe5b04146114d45760405162461bcd60e51b8152600401808060200182810382526021815260200180615e526021913960400191505060405180910390fd5b6000808211614eef576040805162461bcd60e51b815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b818381614ef857fe5b049392505050565b6001600160a01b0380831660009081526010602052604081205490911690614f2784612385565b6001600160a01b0385811660008181526010602052604080822080546001600160a01b031916898616908117909155905194955093928616927f3134e8a2e6d97e929a7e54011ea5485d7d196dd5f0ba4d4ef95803e8e3fc257f9190a4614f8f828483614c1c565b50505050565b614f9f828261585c565b6001600160a01b03808316600090815260106020526040812054614fc592169083614c1c565b5050565b600080821161500c576040805162461bcd60e51b815260206004820152600a602482015269563a544b4e5f5a45524f60b01b604482015290519081900360640190fd5b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316846001600160a01b0316141561504f5750816150c5565b6001600160a01b03841660009081526008602052604090205460ff161561508a576150836001600160a01b038516846145ef565b90506150c5565b6040805162461bcd60e51b815260206004820152600b60248201526a2b1d24a72b26222faa25a760a91b604482015290519081900360640190fd5b60008111615105576040805162461bcd60e51b8152602060048201526008602482015267563a555f5a45524f60c01b604482015290519081900360640190fd5b600061510f6144e8565b9050600f548114615155576040805162461bcd60e51b815260206004820152600b60248201526a563a4445505f504155534560a81b604482015290519081900360640190fd5b600061515f61139e565b905080615185578161517357829350615180565b61517d8383614d43565b93505b6151d7565b600082116151c6576040805162461bcd60e51b8152602060048201526009602482015268563a54555f5a45524f60b81b604482015290519081900360640190fd5b6151d482611a6e8584614e40565b93505b6151e133856154b3565b6151f66001600160a01b038716333088615958565b600f546152039084614d43565b600f55600954604080516355d54c8b60e11b815290516001600160a01b039092169163abaa99169160048082019260009290919082900301818387803b15801561524c57600080fd5b505af1158015615260573d6000803e3d6000fd5b5050505061526f61125f6147d5565b604080518681526020810185905280820186905290516001600160a01b0388169133917f471ac35cb462beae9030056edb1a926ac4cc8451cb2803b2a23c9f2a59d3fac69181900360600190a350505092915050565b6152cd611cf0565b15615312576040805162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015290519081900360640190fd5b6005805460ff60a81b1916600160a81b1790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258614e236143f8565b600081848411156153dd5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156153a257818101518382015260200161538a565b50505050905090810190601f1680156153cf5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b6000610d4a6153f26143f8565b848461559c565b600080846001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561544957600080fd5b505afa15801561545d573d6000803e3d6000fd5b505050506040513d602081101561547357600080fd5b5051905080156154a75761548b83611a6e8387614e40565b915081156154a7576154a76001600160a01b0386163384614721565b509392505050565b4690565b6154bd82826159b2565b6154c682614bd3565b6001600160a01b03808316600090815260106020526040812054614fc5921683614c1c565b6060615540826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316615aa29092919063ffffffff16565b8051909150156147735780806020019051602081101561555f57600080fd5b50516147735760405162461bcd60e51b815260040180806020018281038252602a815260200180615f25602a913960400191505060405180910390fd5b6001600160a01b0383166155e15760405162461bcd60e51b8152600401808060200182810382526025815260200180615edc6025913960400191505060405180910390fd5b6001600160a01b0382166156265760405162461bcd60e51b8152600401808060200182810382526023815260200180615cef6023913960400191505060405180910390fd5b615631838383614773565b61566e81604051806060016040528060268152602001615dbf602691396001600160a01b038616600090815260208190526040902054919061534e565b6001600160a01b03808516600090815260208190526040808220939093559084168152205461569d9082614d43565b6001600160a01b038084166000818152602081815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b600061571b43604051806060016040528060318152602001615f4f60319139615ab1565b905060008463ffffffff1611801561576457506001600160a01b038516600090815260116020908152604080832063ffffffff6000198901811685529252909120548282169116145b156157a1576001600160a01b038516600090815260116020908152604080832063ffffffff60001989011684529091529020600101829055615812565b60408051808201825263ffffffff808416825260208083018681526001600160a01b038a166000818152601184528681208b8616825284528681209551865490861663ffffffff19918216178755925160019687015590815260129092529390208054928801909116919092161790555b604080518481526020810184905281516001600160a01b038816927fdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a724928290030190a25050505050565b6001600160a01b0382166158a15760405162461bcd60e51b8152600401808060200182810382526021815260200180615ebb6021913960400191505060405180910390fd5b6158ad82600083614773565b6158ea81604051806060016040528060228152602001615d32602291396001600160a01b038516600090815260208190526040902054919061534e565b6001600160a01b0383166000908152602081905260409020556002546159109082614778565b6002556040805182815290516000916001600160a01b038516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a35050565b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052614f8f9085906154eb565b6001600160a01b038216615a0d576040805162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015290519081900360640190fd5b615a1960008383614773565b600254615a269082614d43565b6002556001600160a01b038216600090815260208190526040902054615a4c9082614d43565b6001600160a01b0383166000818152602081815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b60606114d18484600085615b0f565b6000816401000000008410615b075760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156153a257818101518382015260200161538a565b509192915050565b606082471015615b505760405162461bcd60e51b8152600401808060200182810382526026815260200180615de56026913960400191505060405180910390fd5b615b5985615c6b565b615baa576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b60006060866001600160a01b031685876040518082805190602001908083835b60208310615be95780518252601f199092019160209182019101615bca565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114615c4b576040519150601f19603f3d011682016040523d82523d6000602084013e615c50565b606091505b5091509150615c60828286615c71565b979650505050505050565b3b151590565b60608315615c805750816114d4565b825115615c905782518084602001fd5b60405162461bcd60e51b81526020600482018181528451602484015284518593919283926044019190850190808383600083156153a257818101518382015260200161538a565b60408051808201909152600080825260208201529056fe45524332303a207472616e7366657220746f20746865207a65726f20616464726573735265656e7472616e637947756172643a207265656e7472616e742063616c6c0045524332303a206275726e20616d6f756e7420657863656564732062616c616e63654f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f2061646472657373563a3a64656c656761746542795369673a207369676e6174757265206578706972656445524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e6365416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c563a3a64656c656761746542795369673a20696e76616c6964207369676e6174757265563a3a6765745072696f72566f7465733a206e6f74207965742064657465726d696e6564536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63654f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657245524332303a206275726e2066726f6d20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f20616464726573735361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564563a3a5f7772697465436865636b706f696e743a20626c6f636b206e756d6265722065786365656473203332206269747345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220d2110daafb5bec27c10c0c7beba2b5779392f82c9fba7c09e6e98d733902c88964736f6c634300060c0033000000000000000000000000fb98b335551a418cd0737375a2ea0ded62ea213b0000000000000000000000001c2ae35e346dc4cdfadc252cd5d4172334f0b59b00000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000165461726f74204d414920537570706c79205661756c74000000000000000000000000000000000000000000000000000000000000000000000000000000000004744d414900000000000000000000000000000000000000000000000000000000

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

000000000000000000000000fb98b335551a418cd0737375a2ea0ded62ea213b0000000000000000000000001c2ae35e346dc4cdfadc252cd5d4172334f0b59b00000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000165461726f74204d414920537570706c79205661756c74000000000000000000000000000000000000000000000000000000000000000000000000000000000004744d414900000000000000000000000000000000000000000000000000000000

-----Decoded View---------------
Arg [0] : _underlying (address): 0xfb98b335551a418cd0737375a2ea0ded62ea213b
Arg [1] : _strategy (address): 0x1c2ae35e346dc4cdfadc252cd5d4172334f0b59b
Arg [2] : _name (string): Tarot MAI Supply Vault
Arg [3] : _symbol (string): tMAI
Arg [4] : _decimals (uint8): 0

-----Encoded View---------------
9 Constructor Arguments found :
Arg [0] : 000000000000000000000000fb98b335551a418cd0737375a2ea0ded62ea213b
Arg [1] : 0000000000000000000000001c2ae35e346dc4cdfadc252cd5d4172334f0b59b
Arg [2] : 00000000000000000000000000000000000000000000000000000000000000a0
Arg [3] : 00000000000000000000000000000000000000000000000000000000000000e0
Arg [4] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [5] : 0000000000000000000000000000000000000000000000000000000000000016
Arg [6] : 5461726f74204d414920537570706c79205661756c7400000000000000000000
Arg [7] : 0000000000000000000000000000000000000000000000000000000000000004
Arg [8] : 744d414900000000000000000000000000000000000000000000000000000000


Block Transaction Gas Used Reward
Age Block Fee Address BC Fee Address Voting Power Jailed Incoming
Validator ID :
0 FTM

Amount Staked
0

Amount Delegated
0

Staking Total
0

Staking Start Epoch
0

Staking Start Time
0

Proof of Importance
0

Origination Score
0

Validation Score
0

Active
0

Online
0

Downtime
0 s
Address Amount claimed Rewards Created On Epoch Created On
Block Uncle Number Difficulty Gas Used Reward
Loading
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.