Contract 0x74D1D2A851e339B8cB953716445Be7E8aBdf92F4

Txn Hash Method
Block
From
To
Value [Txn Fee]
0x6c317a9343523559ff794b3594e690446713b5e3d6d74ccbd080c85ea930a8adApprove242418222021-12-07 9:46:312 hrs 40 mins ago0xd1bdbf7bec76d6e3918cd3aa34028caadd3f424b IN  Tarot: xTAROT Token0 FTM0.006840170497
0x20baf44a5d5eba22a7c9af1c30fffc728d1b9912988fadb4193b5585eaaad459Approve242417092021-12-07 9:44:442 hrs 41 mins ago0xb70d4ddd9a8e89349b5f0a2476910cc9d69b27e1 IN  Tarot: xTAROT Token0 FTM0.003863346937
0x051803f49df09044da85c3d912066a81fd30e37ec2147ad9b0bed24a8b4465ecApprove242416682021-12-07 9:44:132 hrs 42 mins ago0xb70d4ddd9a8e89349b5f0a2476910cc9d69b27e1 IN  Tarot: xTAROT Token0 FTM0.006798114937
0x6f87121151ccd990cecaf53745297d9f8338830a7c7eea846fae851ceebf295cApprove242334592021-12-07 7:42:354 hrs 44 mins ago0x83102b618ee7080de7bdfb4a4ec525de76fc0820 IN  Tarot: xTAROT Token0 FTM0.009458916315
0x47793977805cba12cdd6d28ff921e61e7d5cb8c6d3e6ea64092efbf70a4e52d9Approve242325892021-12-07 7:30:144 hrs 56 mins ago0x62c9fe8bd0dde3da3c54b984d54b718e3a7522b1 IN  Tarot: xTAROT Token0 FTM0.008457815197
0xbaf7640e52d172d2ca617d71cd0725cbcfad9214ea7705955814d50f6122d2ccApprove242295042021-12-07 6:48:015 hrs 38 mins ago0x24be7d398e09b054a00ae6c1914081da50ba2a4e IN  Tarot: xTAROT Token0 FTM0.009977085645
0xe67fc74531b44c478280fef7182f69688de74eeafed6053f4866c7b62d24d76aApprove242221122021-12-07 5:03:037 hrs 23 mins ago0xc821cae32abcf7ccf98e288ea8185c2e554012f8 IN  Tarot: xTAROT Token0 FTM0.0096179856
0x03145060a939a4f47110c669da06b7416ab78246a1c56441f045980d4415de67Approve242177952021-12-07 3:57:408 hrs 29 mins ago0x1258d953fa8b712a0077b725781b91d80ea784b8 IN  Tarot: xTAROT Token0 FTM0.007046965905
0x7ee13e40993b16d11867cf292aa49f81c91d3800dcced4e0f34921317ef8e60cApprove242176462021-12-07 3:55:308 hrs 31 mins ago0xc5a0b5a6cac7f859099589c2a1f6d4f3a315f85e IN  Tarot: xTAROT Token0 FTM0.006694016752
0x147bf312f96f3ffc237b947f160a3e3bfa90709e0f611a0bc3a7112d89d5a95aApprove242077932021-12-07 1:30:3710 hrs 56 mins ago0x4eadab718136c72c3ca1cf0a7f5c20df7e1dacdd IN  Tarot: xTAROT Token0 FTM0.00437811528
0x79df18a38018d00b7f657c51dea36b051fcb5c5a74bcce9f6eb59faee703019eApprove242077462021-12-07 1:29:5910 hrs 56 mins ago0x4eadab718136c72c3ca1cf0a7f5c20df7e1dacdd IN  Tarot: xTAROT Token0 FTM0.007486454512
0xb5099512de6086437d7ef27f8b24dfe5225ea10916479188b8ccc5b7c6fd5b86Approve242075392021-12-07 1:26:2511 hrs ago0x7fb15ce26ab114302f0fc003350534fbc8b65ec9 IN  Tarot: xTAROT Token0 FTM0.00748147776
0xa61e47e3a32e23dd0f6d60dea1a2f9b7bb0b4063a24042cc0d55555dd8c41e70Approve242074162021-12-07 1:24:3011 hrs 2 mins ago0xa556a5239bec88ee0aca8bbd59e9317f402fef2e IN  Tarot: xTAROT Token0 FTM0.008314129815
0x1433352d5aaf4fd90b926f8c52b797858745a21df617e4bfb3f919d6000dab26Approve242057352021-12-07 0:57:0811 hrs 29 mins ago0x3d91ad906c3969f86c588c988f721d5a735c6f81 IN  Tarot: xTAROT Token0 FTM0.007126433835
0x8f2498b136b49a235420d8292c3dbd00201ea0d00fc1b8975f97ac892fbcd71fApprove242031812021-12-07 0:19:1112 hrs 7 mins ago0xaf570dea98d5cdd6851b3972b4296154f3396d4b IN  Tarot: xTAROT Token0 FTM0.007448468415
0x96fff2d2b258f812eab5452202cbc6f1f2388b6e59955e12e8700ac88f372779Approve241988892021-12-06 23:19:0813 hrs 7 mins ago0xbfa4d296e419cb37d11b75faeaaf25b8a4d81655 IN  Tarot: xTAROT Token0 FTM0.010003917412
0x3ca5bdff234e06a377061c2b6c37cf256530ed10e7bf3e26f364b578eb398c1aApprove241965992021-12-06 22:47:1713 hrs 39 mins ago0x856b63349fb6c818ea7cd7305483ae0ef6956f6c IN  Tarot: xTAROT Token0 FTM0.01180113882
0xa83f5850cc6f24c2432fca35a47605a382bff3a853b72b6115f184914e240786Approve241961172021-12-06 22:40:2813 hrs 46 mins ago0x6a39b1ccb51cc0d95de5cf55aa6b2df213ebae98 IN  Tarot: xTAROT Token0 FTM0.010417868475
0x2dae546b78c725cd6744373b2c0755daeaac568e82452b30cca37f9eba776618Approve241950402021-12-06 22:24:5914 hrs 1 min ago0x42ab9c98807eab8469b55a72786ff1d436663810 IN  Tarot: xTAROT Token0 FTM0.011056533922
0xbac6be3602fdcc31d3135f72a7b6bcc9d78a7b9f71c050b43426e141b49f4e71Approve241939212021-12-06 22:09:4514 hrs 16 mins ago0xbdb21e816e455e1642dbe8cef6668a62e180657b IN  Tarot: xTAROT Token0 FTM0.0094287
0x81e4931f54878f3c34e442ba968755e230db4bff2fbd2063d9f046d0f79dece9Update Strategy241920542021-12-06 21:37:5414 hrs 48 mins agoTarot: Deployer IN  Tarot: xTAROT Token0 FTM0.003803142362
0xa8ef05d1c8f13c9d69903a0cdc6d8af88be66114f066d37bae26bc61849bb73dApprove241919482021-12-06 21:36:0814 hrs 50 mins ago0x097f3dacdbcc4752c5950985023b590b9d39a15d IN  Tarot: xTAROT Token0 FTM0.004054941547
0x99dc3db0e970cc760941ce0be2e0c5b33e2ad17466e70c108248017f6ab28f7cApprove241919202021-12-06 21:35:4314 hrs 50 mins ago0x097f3dacdbcc4752c5950985023b590b9d39a15d IN  Tarot: xTAROT Token0 FTM0.007135253227
0xea2667b1f8bc783ddc2206c0846d922a62139b7b8e4727df9f0d6f50cef4a3a1Approve241915272021-12-06 21:29:5514 hrs 56 mins ago0x5e190617c7cfb30c3c87dd55920e117280d3f8e6 IN  Tarot: xTAROT Token0 FTM0.007292414535
0xd1953f45abe542ab825632e731d15ac48b0ee5e52e8fd7551328329a6ab7f82bApprove241908722021-12-06 21:21:2015 hrs 5 mins ago0xa2b2b62a6d8b24291d65e359e7e85d9f59c89617 IN  Tarot: xTAROT Token0 FTM0.009023417115
[ Download CSV Export 

OVERVIEW

Tarot is a decentralized lending protocol on Fantom Opera where users can participate as lenders or borrowers in isolated lending pools.

Latest 1 internal transaction
Parent Txn Hash Block From To Value
0xb3c589660765dea5ba94460a1f07607ff024b065e5456dd1f3d9083f84074c13231250452021-11-25 21:28:2611 days 14 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
    )
        public
        ERC20(
            _name.orElse(string("Tarot ").append(ERC20(address(_underlying)).symbol()).append(" Supply Vault")),
            _symbol.orElse(string("t").append(ERC20(address(_underlying)).symbol()))
        )
    {
        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"}],"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"}]

60a06040526103e8600e553480156200001757600080fd5b506040516200683438038062006834833981810160405260808110156200003d57600080fd5b815160208301516040808501805191519395929483019291846401000000008211156200006957600080fd5b9083019060208201858111156200007f57600080fd5b82516401000000008111828201881017156200009a57600080fd5b82525081516020918201929091019080838360005b83811015620000c9578181015183820152602001620000af565b50505050905090810190601f168015620000f75780820380516001836020036101000a031916815260200191505b50604052602001805160405193929190846401000000008211156200011b57600080fd5b9083019060208201858111156200013157600080fd5b82516401000000008111828201881017156200014c57600080fd5b82525081516020918201929091019080838360005b838110156200017b57818101518382015260200162000161565b50505050905090810190601f168015620001a95780820380516001836020036101000a031916815260200191505b506040525050506200036d620003586040518060400160405280600d81526020016c0814dd5c1c1b1e4815985d5b1d609a1b81525062000344876001600160a01b03166395d89b416040518163ffffffff1660e01b815260040160006040518083038186803b1580156200021c57600080fd5b505afa15801562000231573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405260208110156200025b57600080fd5b81019080805160405193929190846401000000008211156200027c57600080fd5b9083019060208201858111156200029257600080fd5b8251640100000000811182820188101715620002ad57600080fd5b82525081516020918201929091019080838360005b83811015620002dc578181015183820152602001620002c2565b50505050905090810190601f1680156200030a5780820380516001836020036101000a031916815260200191505b506040525050506040518060400160405280600681526020016502a30b937ba160d51b815250620005c260201b620043261790919060201c565b620005c260201b620043261790919060201c565b836200068260201b620043e11790919060201c565b620004d262000358866001600160a01b03166395d89b416040518163ffffffff1660e01b815260040160006040518083038186803b158015620003af57600080fd5b505afa158015620003c4573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526020811015620003ee57600080fd5b81019080805160405193929190846401000000008211156200040f57600080fd5b9083019060208201858111156200042557600080fd5b82516401000000008111828201881017156200044057600080fd5b82525081516020918201929091019080838360005b838110156200046f57818101518382015260200162000455565b50505050905090810190601f1680156200049d5780820380516001836020036101000a031916815260200191505b50604052505050604051806040016040528060018152602001601d60fa1b815250620005c260201b620043261790919060201c565b8151620004e79060039060208501906200075a565b508051620004fd9060049060208401906200075a565b50506005805460ff19166012179055506000620005196200069b565b60058054610100600160a81b0319166101006001600160a01b03841690810291909117909155604051919250906000907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a3506005805460ff60a81b191690556001600655606084901b6001600160601b031916608052600980546001600160a01b0319166001600160a01b038516179055620005b86200069f565b50505050620007f6565b606082826040516020018083805190602001908083835b60208310620005fa5780518252601f199092019160209182019101620005d9565b51815160209384036101000a600019018019909216911617905285519190930192850191508083835b60208310620006445780518252601f19909201916020918201910162000623565b6001836020036101000a0380198251168184511680821785525050505050509050019250505060405160208183030381529060405290505b92915050565b815160609015620006955750816200067c565b50919050565b3390565b620006a96200074a565b15620006ef576040805162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015290519081900360640190fd5b6005805460ff60a81b1916600160a81b1790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586200072d6200069b565b604080516001600160a01b039092168252519081900360200190a1565b600554600160a81b900460ff1690565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106200079d57805160ff1916838001178555620007cd565b82800160010185558215620007cd579182015b82811115620007cd578251825591602001919060010190620007b0565b50620007db929150620007df565b5090565b5b80821115620007db5760008155600101620007e0565b60805160601c615fda6200085a60003980610fa2528061108452806111ce528061202952806121be52806122d1528061234b5280612db55280612fad52806132a55280614036528061418052806147d9528061499f52806150105250615fda6000f3fe608060405234801561001057600080fd5b50600436106103e65760003560e01c80637df78afd1161020a578063b40494e511610125578063db160f75116100b8578063eb1ea9f411610087578063eb1ea9f414610b9a578063ed8c2d2d14610bc0578063f1127ed814610bec578063f26a584514610c3e578063f2fde38b14610c6a576103e6565b8063db160f7514610b3f578063dcc9def514610b5c578063dd62ed3e14610b64578063e7a324dc14610b92576103e6565b8063c3cda520116100f4578063c3cda52014610a86578063c6b0dec114610acd578063cdec2f2314610af3578063d65444e814610b19576103e6565b8063b40494e514610a33578063b4b5ea5714610a3b578063bb2190bb14610a61578063c1a287e214610a7e576103e6565b806396a1cd271161019d578063a8c62e761161016c578063a8c62e76146109b6578063a9059cbb146109be578063ade37c13146109ea578063b4039d9e14610a07576103e6565b806396a1cd27146109485780639f81aed714610965578063a457c2d71461096d578063a59f3e0c14610999576103e6565b806384bdc9a8116101d957806384bdc9a8146108b95780638670d9dc146108c15780638da5cb5b1461093857806395d89b4114610940576103e6565b80637df78afd146108575780637ecebe0014610883578063821beaf5146108a95780638456cb59146108b1576103e6565b8063465fc5d2116103055780636052693b116102985780636fcfff45116102675780636fcfff45146107b657806370a08231146107f5578063715018a61461081b57806371736d3214610823578063782d6fe11461082b576103e6565b80636052693b1461076357806367dfd4c9146107895780636a68ea50146107a65780636f307dc3146107ae576103e6565b8063587cde1e116102d4578063587cde1e146106e95780635c19a95c1461070f5780635c975abb146107355780635c98f2931461073d576103e6565b8063465fc5d2146106785780634a5763ba14610680578063506fb0861461069d57806352ac4b02146106c3576103e6565b806323b872dd1161037d57806332fe35fd1161034c57806332fe35fd14610616578063395093511461063c5780633f4ba83a146106685780634125ff9014610670576103e6565b806323b872dd146105b257806324a9d853146105e85780632fddd913146105f0578063313ce567146105f8576103e6565b80630eb2f648116103b95780630eb2f648146104fa57806318160ddd1461056a57806320606b7014610584578063218b5b811461058c576103e6565b8063017e7e58146103eb57806306fdde031461040f578063095ea7b31461048c5780630e0a1589146104cc575b600080fd5b6103f3610c90565b604080516001600160a01b039092168252519081900360200190f35b610417610c9f565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610451578181015183820152602001610439565b50505050905090810190601f16801561047e5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6104b8600480360360408110156104a257600080fd5b506001600160a01b038135169060200135610d36565b604080519115158252519081900360200190f35b6104f8600480360360408110156104e257600080fd5b506001600160a01b038135169060200135610d54565b005b6104f86004803603602081101561051057600080fd5b81019060208101813564010000000081111561052b57600080fd5b82018360208201111561053d57600080fd5b8035906020019184602083028401116401000000008311171561055f57600080fd5b5090925090506112b0565b61057261139e565b60408051918252519081900360200190f35b6105726113a4565b6104f8600480360360208110156105a257600080fd5b50356001600160a01b03166113c8565b6104b8600480360360608110156105c857600080fd5b506001600160a01b03813581169160208101359091169060400135611486565b6105726114db565b6104f86114e1565b61060061171f565b6040805160ff9092168252519081900360200190f35b6104f86004803603602081101561062c57600080fd5b50356001600160a01b0316611728565b6104b86004803603604081101561065257600080fd5b506001600160a01b0381351690602001356118d6565b6104f8611929565b6105726119e5565b6103f36119ec565b6105726004803603602081101561069657600080fd5b50356119fb565b610572600480360360208110156106b357600080fd5b50356001600160a01b0316611a81565b6104f8600480360360208110156106d957600080fd5b50356001600160a01b0316611b17565b6103f3600480360360208110156106ff57600080fd5b50356001600160a01b0316611cc5565b6104f86004803603602081101561072557600080fd5b50356001600160a01b0316611ce3565b6104b8611cf0565b6104f86004803603602081101561075357600080fd5b50356001600160a01b0316611d00565b6105726004803603602081101561077957600080fd5b50356001600160a01b0316611e4f565b6105726004803603602081101561079f57600080fd5b5035611edd565b610572612343565b6103f3612349565b6107dc600480360360208110156107cc57600080fd5b50356001600160a01b031661236d565b6040805163ffffffff9092168252519081900360200190f35b6105726004803603602081101561080b57600080fd5b50356001600160a01b0316612385565b6104f86123a0565b6103f3612452565b6105726004803603604081101561084157600080fd5b506001600160a01b038135169060200135612461565b6105726004803603604081101561086d57600080fd5b506001600160a01b038135169060200135612669565b6105726004803603602081101561089957600080fd5b50356001600160a01b0316612719565b61057261272b565b6104f8612731565b6105726127e6565b6104f8600480360360408110156108d757600080fd5b813591908101906040810160208201356401000000008111156108f957600080fd5b82018360208201111561090b57600080fd5b8035906020019184600183028401116401000000008311171561092d57600080fd5b5090925090506128d2565b6103f3612af7565b610417612b0b565b6104f86004803603602081101561095e57600080fd5b5035612b6c565b610572612ca7565b6104b86004803603604081101561098357600080fd5b506001600160a01b038135169060200135612cae565b610572600480360360208110156109af57600080fd5b5035612d16565b6103f3612de5565b6104b8600480360360408110156109d457600080fd5b506001600160a01b038135169060200135612df4565b6103f360048036036020811015610a0057600080fd5b5035612e56565b6104f860048036036040811015610a1d57600080fd5b506001600160a01b038135169060200135612e7d565b6105726130e9565b61057260048036036020811015610a5157600080fd5b50356001600160a01b0316613148565b6104f860048036036020811015610a7757600080fd5b50356131ab565b6105726133db565b6104f8600480360360c0811015610a9c57600080fd5b506001600160a01b038135169060208101359060408101359060ff6060820135169060808101359060a001356133e2565b6104b860048036036020811015610ae357600080fd5b50356001600160a01b031661366b565b6104f860048036036020811015610b0957600080fd5b50356001600160a01b031661368e565b6104b860048036036020811015610b2f57600080fd5b50356001600160a01b03166137e6565b61057260048036036020811015610b5557600080fd5b5035613804565b6104f86138e8565b61057260048036036040811015610b7a57600080fd5b506001600160a01b038135811691602001351661393b565b610572613966565b6104f860048036036020811015610bb057600080fd5b50356001600160a01b031661398a565b6104f860048036036040811015610bd657600080fd5b506001600160a01b038135169060200135613ccf565b610c1e60048036036040811015610c0257600080fd5b5080356001600160a01b0316906020013563ffffffff16613f5b565b6040805163ffffffff909316835260208301919091528051918290030190f35b6104f860048036036040811015610c5457600080fd5b506001600160a01b038135169060200135613f88565b6104f860048036036020811015610c8057600080fd5b50356001600160a01b0316614218565b600d546001600160a01b031681565b60038054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610d2b5780601f10610d0057610100808354040283529160200191610d2b565b820191906000526020600020905b815481529060010190602001808311610d0e57829003601f168201915b505050505090505b90565b6000610d4a610d436143f8565b84846143fc565b5060015b92915050565b610d5c6143f8565b6001600160a01b0316610d6d612af7565b6001600160a01b031614610db6576040805162461bcd60e51b81526020600482018190526024820152600080516020615e9b833981519152604482015290519081900360640190fd5b6001600160a01b038216600090815260086020526040902054610100900460ff16610e10576040805162461bcd60e51b81526020600482015260056024820152640ac7484beb60db1b604482015290519081900360640190fd5b6001600160a01b03821660009081526008602052604090205460ff1615610e66576040805162461bcd60e51b8152602060048201526005602482015264563a425f4560d81b604482015290519081900360640190fd5b600080610e716144e8565b600f541191505081610ef257604080516370a0823160e01b815230600482015290516001600160a01b038516916370a08231916024808301926020929190829003018186803b158015610ec357600080fd5b505afa158015610ed7573d6000803e3d6000fd5b505050506040513d6020811015610eed57600080fd5b505191505b60008211610f32576040805162461bcd60e51b8152602060048201526008602482015267563a425f5a45524f60c01b604482015290519081900360640190fd5b6000610f476001600160a01b038516846145ef565b905060008111610f89576040805162461bcd60e51b8152602060048201526008602482015267563a555f5a45524f60c01b604482015290519081900360640190fd5b600061103e610fa0866001600160a01b0316614687565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166370a08231886040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561100d57600080fd5b505afa158015611021573d6000803e3d6000fd5b505050506040513d602081101561103757600080fd5b505161470b565b905080821115611080576040805162461bcd60e51b81526020600482015260086024820152672b1d2722a2a22fa160c11b604482015290519081900360640190fd5b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b1580156110ef57600080fd5b505afa158015611103573d6000803e3d6000fd5b505050506040513d602081101561111957600080fd5b505190506111316001600160a01b0387168787614721565b604080516395a2251f60e01b815230600482015290516001600160a01b038816916395a2251f9160248083019260209291908290030181600087803b15801561117957600080fd5b505af115801561118d573d6000803e3d6000fd5b505050506040513d60208110156111a357600080fd5b5050604080516370a0823160e01b815230600482015290516000916112479184916001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016916370a0823191602480820192602092909190829003018186803b15801561121557600080fd5b505afa158015611229573d6000803e3d6000fd5b505050506040513d602081101561123f57600080fd5b505190614778565b9050841561125457611264565b61126461125f6147d5565b6148ca565b604080518281526020810188905281516001600160a01b038a16927f05750bc9042b6da04fdebec7b024caed5c2e2b35c707bd1fde571f31cdaeb566928290030190a250505050505050565b6112b86143f8565b6001600160a01b03166112c9612af7565b6001600160a01b031614611312576040805162461bcd60e51b81526020600482018190526024820152600080516020615e9b833981519152604482015290519081900360640190fd5b60026006541415611358576040805162461bcd60e51b815260206004820152601f6024820152600080516020615d12833981519152604482015290519081900360640190fd5b600260065560005b818110156113945761138c83838381811061137757fe5b905060200201356001600160a01b0316614905565b600101611360565b5050600160065550565b60025490565b7f8cad95687ba82c2ce50e74f7b754645e5117c3a5bec8151c0726d5857980a86681565b6113d06143f8565b6001600160a01b03166113e1612af7565b6001600160a01b03161461142a576040805162461bcd60e51b81526020600482018190526024820152600080516020615e9b833981519152604482015290519081900360640190fd5b60026006541415611470576040805162461bcd60e51b815260206004820152601f6024820152600080516020615d12833981519152604482015290519081900360640190fd5b600260065561147e81614905565b506001600655565b600080611494858585614b51565b905061149f84614bd3565b6001600160a01b038086166000908152601060205260408082205487841683529120546114d192918216911685614c1c565b90505b9392505050565b600e5481565b6114e96143f8565b6001600160a01b03166114fa612af7565b6001600160a01b031614611543576040805162461bcd60e51b81526020600482018190526024820152600080516020615e9b833981519152604482015290519081900360640190fd5b60026006541415611589576040805162461bcd60e51b815260206004820152601f6024820152600080516020615d12833981519152604482015290519081900360640190fd5b6002600655600a546001600160a01b03166115db576040805162461bcd60e51b815260206004820152600d60248201526c158e925395931117d4d5149055609a1b604482015290519081900360640190fd5b600b5442101561161f576040805162461bcd60e51b815260206004820152600a6024820152692b1d2a27a7afa9a7a7a760b11b604482015290519081900360640190fd5b62127500600b54014210611667576040805162461bcd60e51b815260206004820152600a602482015269563a544f4f5f4c41544560b01b604482015290519081900360640190fd5b600954600a546001600160a01b03908116911614156116bc576040805162461bcd60e51b815260206004820152600c60248201526b158e94d0535157d4d514905560a21b604482015290519081900360640190fd5b600a8054600980546001600160a01b038084166001600160a01b0319928316179283905592169092556000600b81905560405192909116917f351ac3b801ef52eee542597618621efdaafc5a2e9469f78505486074ea9b92719190a26001600655565b60055460ff1690565b6117306143f8565b6001600160a01b0316611741612af7565b6001600160a01b03161461178a576040805162461bcd60e51b81526020600482018190526024820152600080516020615e9b833981519152604482015290519081900360640190fd5b600260065414156117d0576040805162461bcd60e51b815260206004820152601f6024820152600080516020615d12833981519152604482015290519081900360640190fd5b60026006556001600160a01b038116600090815260086020526040902054610100900460ff1661182f576040805162461bcd60e51b81526020600482015260056024820152640ac7484beb60db1b604482015290519081900360640190fd5b6001600160a01b03811660009081526008602052604090205460ff1615611885576040805162461bcd60e51b8152602060048201526005602482015264563a425f4560d81b604482015290519081900360640190fd5b6001600160a01b038116600081815260086020526040808220805460ff19166001179055517f54ba33e4b0861b4d81b3384c3b5130b25b55df191223d9e48b317dc289fac3a99190a2506001600655565b6000610d4a6118e36143f8565b8461192485600160006118f46143f8565b6001600160a01b03908116825260208083019390935260409182016000908120918c168152925290205490614d43565b6143fc565b6119316143f8565b6001600160a01b0316611942612af7565b6001600160a01b03161461198b576040805162461bcd60e51b81526020600482018190526024820152600080516020615e9b833981519152604482015290519081900360640190fd5b600260065414156119d1576040805162461bcd60e51b815260206004820152601f6024820152600080516020615d12833981519152604482015290519081900360640190fd5b60026006556119de614d9d565b6001600655565b62278d0081565b600a546001600160a01b031681565b600060026006541415611a43576040805162461bcd60e51b815260206004820152601f6024820152600080516020615d12833981519152604482015290519081900360640190fd5b60026006556000611a526144e8565b90506000611a5e61139e565b9050611a7481611a6e8685614e40565b90614e99565b6001600655949350505050565b600754600090815b81811015611ad457836001600160a01b031660078281548110611aa857fe5b6000918252602090912001546001600160a01b03161415611acc579150611b129050565b600101611a89565b506040805162461bcd60e51b815260206004820152600d60248201526c158e9097d393d517d193d55391609a1b604482015290519081900360640190fd5b919050565b611b1f6143f8565b6001600160a01b0316611b30612af7565b6001600160a01b031614611b79576040805162461bcd60e51b81526020600482018190526024820152600080516020615e9b833981519152604482015290519081900360640190fd5b60026006541415611bbf576040805162461bcd60e51b815260206004820152601f6024820152600080516020615d12833981519152604482015290519081900360640190fd5b60026006556001600160a01b038116600090815260086020526040902054610100900460ff16611c1e576040805162461bcd60e51b81526020600482015260056024820152640ac7484beb60db1b604482015290519081900360640190fd5b6001600160a01b03811660009081526008602052604090205460ff16611c77576040805162461bcd60e51b8152602060048201526009602482015268158e9097d114d0931160ba1b604482015290519081900360640190fd5b6001600160a01b038116600081815260086020526040808220805460ff19169055517f6149acc591caf5f3d506cb615abb39ea3847de4e2aa83f4382531de216bdc6809190a2506001600655565b6001600160a01b039081166000908152601060205260409020541690565b611ced3382614f00565b50565b600554600160a81b900460ff1690565b611d086143f8565b6001600160a01b0316611d19612af7565b6001600160a01b031614611d62576040805162461bcd60e51b81526020600482018190526024820152600080516020615e9b833981519152604482015290519081900360640190fd5b60026006541415611da8576040805162461bcd60e51b815260206004820152601f6024820152600080516020615d12833981519152604482015290519081900360640190fd5b6002600655600c546001600160a01b0382811691161415611e00576040805162461bcd60e51b815260206004820152600d60248201526c2b1d2922a0a62627a1afa6a3a960991b604482015290519081900360640190fd5b600c80546001600160a01b0319166001600160a01b0383169081179091556040517fa06271564c176b7d57ad09f68b0a7f6dce53ebd54ae6147444f291f64242e3d690600090a2506001600655565b600060026006541415611e97576040805162461bcd60e51b815260206004820152601f6024820152600080516020615d12833981519152604482015290519081900360640190fd5b60026006556000611ea66144e8565b90506000611eb384612385565b90506000611ebf61139e565b9050611ecf81611a6e8486614e40565b600160065595945050505050565b6000611ee7611cf0565b15611f2c576040805162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015290519081900360640190fd5b60026006541415611f72576040805162461bcd60e51b815260206004820152601f6024820152600080516020615d12833981519152604482015290519081900360640190fd5b600260065581611fb4576040805162461bcd60e51b8152602060048201526008602482015267563a535f5a45524f60c01b604482015290519081900360640190fd5b6000611fbe6144e8565b600f5490915081106000611fd061139e565b905080851115612013576040805162461bcd60e51b8152602060048201526009602482015268563a494e564c445f5360b81b604482015290519081900360640190fd5b600061202382611a6e8887614e40565b905060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561209457600080fd5b505afa1580156120a8573d6000803e3d6000fd5b505050506040513d60208110156120be57600080fd5b505190508082111561213d576120d48282614778565b60095460408051636f6c441f60e01b81526004810184905290519294506001600160a01b0390911691636f6c441f9160248082019260009290919082900301818387803b15801561212457600080fd5b505af1158015612138573d6000803e3d6000fd5b505050505b60006121476147d5565b905061215784611a6e8a84614e40565b96506000871161219e576040805162461bcd60e51b815260206004820152600d60248201526c563a5a45524f5f52454445454d60981b604482015290519081900360640190fd5b604080516370a0823160e01b815230600482015290516001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016916370a08231916024808301926020929190829003018186803b15801561220457600080fd5b505afa158015612218573d6000803e3d6000fd5b505050506040513d602081101561222e57600080fd5b505187111561227a576040805162461bcd60e51b8152602060048201526013602482015272563a4241445f53545241545f4445414c4c4f4360681b604482015290519081900360640190fd5b600085156122a35761229c85611a6e612293828d614778565b600f5490614e40565b90506122b0565b6122ad8289614778565b90505b6122b9816148ca565b506122c43389614f95565b6122f86001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000163389614721565b6040805189815260208101899052815133927f0f0f7f8153c6d63a5696720d4cc434e56bb5ac1cf8c791ed9c180defb6e92153928290030190a2505060016006555092949350505050565b600b5481565b7f000000000000000000000000000000000000000000000000000000000000000081565b60126020526000908152604090205463ffffffff1681565b6001600160a01b031660009081526020819052604090205490565b6123a86143f8565b6001600160a01b03166123b9612af7565b6001600160a01b031614612402576040805162461bcd60e51b81526020600482018190526024820152600080516020615e9b833981519152604482015290519081900360640190fd5b60055460405160009161010090046001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a360058054610100600160a81b0319169055565b600c546001600160a01b031681565b60004382106124a15760405162461bcd60e51b8152600401808060200182810382526024815260200180615e2e6024913960400191505060405180910390fd5b6001600160a01b03831660009081526012602052604090205463ffffffff16806124cf576000915050610d4e565b6001600160a01b038416600090815260116020908152604080832063ffffffff60001986018116855292529091205416831061253e576001600160a01b03841660009081526011602090815260408083206000199490940163ffffffff16835292905220600101549050610d4e565b6001600160a01b038416600090815260116020908152604080832083805290915290205463ffffffff16831015612579576000915050610d4e565b600060001982015b8163ffffffff168163ffffffff16111561263257600282820363ffffffff160481036125ab615cd7565b506001600160a01b038716600090815260116020908152604080832063ffffffff80861685529083529281902081518083019092528054909316808252600190930154918101919091529087141561260d57602001519450610d4e9350505050565b805163ffffffff168711156126245781935061262b565b6001820392505b5050612581565b506001600160a01b038516600090815260116020908152604080832063ffffffff9094168352929052206001015491505092915050565b6000612673611cf0565b156126b8576040805162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015290519081900360640190fd5b600260065414156126fe576040805162461bcd60e51b815260206004820152601f6024820152600080516020615d12833981519152604482015290519081900360640190fd5b600260065561270d8383614fc9565b60016006559392505050565b60136020526000908152604090205481565b60075490565b6127396143f8565b6001600160a01b031661274a612af7565b6001600160a01b031614612793576040805162461bcd60e51b81526020600482018190526024820152600080516020615e9b833981519152604482015290519081900360640190fd5b600260065414156127d9576040805162461bcd60e51b815260206004820152601f6024820152600080516020615d12833981519152604482015290519081900360640190fd5b60026006556119de6152c5565b60006002600654141561282e576040805162461bcd60e51b815260206004820152601f6024820152600080516020615d12833981519152604482015290519081900360640190fd5b60026006556009546001600160a01b031661284b575060006128ca565b600960009054906101000a90046001600160a01b03166001600160a01b03166384bdc9a86040518163ffffffff1660e01b8152600401602060405180830381600087803b15801561289b57600080fd5b505af11580156128af573d6000803e3d6000fd5b505050506040513d60208110156128c557600080fd5b505190505b600160065590565b60026006541415612918576040805162461bcd60e51b815260206004820152601f6024820152600080516020615d12833981519152604482015290519081900360640190fd5b6002600655612925612af7565b6001600160a01b0316336001600160a01b0316148061294e5750600c546001600160a01b031633145b612992576040805162461bcd60e51b815260206004820152601060248201526f158e9393d517d055551213d49256915160821b604482015290519081900360640190fd5b600061299c6144e8565b600f54909150811060006129ae61139e565b9050808611156129f1576040805162461bcd60e51b8152602060048201526009602482015268563a494e564c445f5360b81b604482015290519081900360640190fd5b6000612a0182611a6e8987614e40565b6009546040805163219c367760e21b81526004810184815260248201928352604482018a90529394506001600160a01b0390921692638670d9dc9285928b928b92909190606401848480828437600081840152601f19601f820116905080830192505050945050505050600060405180830381600087803b158015612a8557600080fd5b505af1158015612a99573d6000803e3d6000fd5b505050508215612aa857612ab3565b612ab361125f6147d5565b60408051888152905133917fd35c705a8cdf375ece95697aaa843eaeabf8aef05c602b44d4a3e1bfee4f5a4d919081900360200190a2505060016006555050505050565b60055461010090046001600160a01b031690565b60048054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610d2b5780601f10610d0057610100808354040283529160200191610d2b565b612b746143f8565b6001600160a01b0316612b85612af7565b6001600160a01b031614612bce576040805162461bcd60e51b81526020600482018190526024820152600080516020615e9b833981519152604482015290519081900360640190fd5b60026006541415612c14576040805162461bcd60e51b815260206004820152601f6024820152600080516020615d12833981519152604482015290519081900360640190fd5b6002600655611388811115612c5e576040805162461bcd60e51b815260206004820152600b60248201526a563a494e564c445f46454560a81b604482015290519081900360640190fd5b612c666144e8565b50600e8190556040805182815290517f464285156ea7288194429c32afd38e4980047fef24f2f2c851d9749260435b6f9181900360200190a1506001600655565b6202a30081565b6000610d4a612cbb6143f8565b8461192485604051806060016040528060258152602001615f806025913960016000612ce56143f8565b6001600160a01b03908116825260208083019390935260409182016000908120918d1681529252902054919061534e565b6000612d20611cf0565b15612d65576040805162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015290519081900360640190fd5b60026006541415612dab576040805162461bcd60e51b815260206004820152601f6024820152600080516020615d12833981519152604482015290519081900360640190fd5b6002600655612dda7f000000000000000000000000000000000000000000000000000000000000000083614fc9565b600160065592915050565b6009546001600160a01b031681565b600080612e0184846153e5565b9050612e0c84614bd3565b6114d460106000612e1b6143f8565b6001600160a01b0390811682526020808301939093526040918201600090812054898316825260109094529190912054918116911685614c1c565b60078181548110612e6357fe5b6000918252602090912001546001600160a01b0316905081565b6009546001600160a01b03163314612ec6576040805162461bcd60e51b8152602060048201526007602482015266158e94d514905560ca1b604482015290519081900360640190fd5b6001600160a01b03821660009081526008602052604090205460ff16612f23576040805162461bcd60e51b815260206004820152600d60248201526c158e9393d517d1539050931151609a1b604482015290519081900360640190fd5b6000826001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b158015612f7257600080fd5b505afa158015612f86573d6000803e3d6000fd5b505050506040513d6020811015612f9c57600080fd5b50519050612fd46001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168484614721565b604080516335313c2160e11b815230600482015290516001600160a01b03851691636a6278429160248083019260209291908290030181600087803b15801561301c57600080fd5b505af1158015613030573d6000803e3d6000fd5b505050506040513d602081101561304657600080fd5b5050604080516370a0823160e01b815230600482015290516000916130989184916001600160a01b038816916370a0823191602480820192602092909190829003018186803b15801561121557600080fd5b9050836001600160a01b03167fab631c4d3a490acf827e1489efbfdb91b68ac12b6c0d8ae6953aaf30e1608b888483604051808381526020018281526020019250505060405180910390a250505050565b600060026006541415613131576040805162461bcd60e51b815260206004820152601f6024820152600080516020615d12833981519152604482015290519081900360640190fd5b600260065561313e6144e8565b6001600655919050565b6001600160a01b03811660009081526012602052604081205463ffffffff16806131735760006114d4565b6001600160a01b038316600090815260116020908152604080832063ffffffff60001986011684529091529020600101549392505050565b600260065414156131f1576040805162461bcd60e51b815260206004820152601f6024820152600080516020615d12833981519152604482015290519081900360640190fd5b600260065580613233576040805162461bcd60e51b8152602060048201526008602482015267563a535f5a45524f60c01b604482015290519081900360640190fd5b60008061323e6144e8565b600f541191506000905061325061139e565b905080831115613293576040805162461bcd60e51b8152602060048201526009602482015268563a494e564c445f5360b81b604482015290519081900360640190fd5b61329d3384614f95565b6000806132cb7f000000000000000000000000000000000000000000000000000000000000000086856153f9565b6007549110915060005b81811015613321576000600782815481106132ec57fe5b60009182526020822001546001600160a01b0316915061330d8289886153f9565b111561331857600193505b506001016132d5565b5081613364576040805162461bcd60e51b815260206004820152600d60248201526c158e96915493d7d05353d55395609a1b604482015290519081900360640190fd5b600084156133845761337d84611a6e612293828a614778565b905061338f565b61338c6147d5565b90505b613398816148ca565b5060408051868152905133917f3dc2d815bcedc7575f9894e925f089e22559cc012af3029b00b58292da27664c919081900360200190a250506001600655505050565b6212750081565b60007f8cad95687ba82c2ce50e74f7b754645e5117c3a5bec8151c0726d5857980a86661340d610c9f565b8051906020012061341c6154af565b60408051602080820195909552808201939093526060830191909152306080808401919091528151808403909101815260a0830182528051908401207fe48329057bfd03d55e49b547132e39cffd9c1820ad7b9d4c5307691425d15adf60c08401526001600160a01b038b1660e084015261010083018a90526101208084018a9052825180850390910181526101408401835280519085012061190160f01b6101608501526101628401829052610182808501829052835180860390910181526101a285018085528151918701919091206000918290526101c2860180865281905260ff8b166101e287015261020286018a90526102228601899052935192965090949293909260019261024280840193601f198301929081900390910190855afa15801561354f573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166135a15760405162461bcd60e51b8152600401808060200182810382526023815260200180615e0b6023913960400191505060405180910390fd5b6001600160a01b03811660009081526013602052604090208054600181019091558914613615576040805162461bcd60e51b815260206004820152601f60248201527f563a3a64656c656761746542795369673a20696e76616c6964206e6f6e636500604482015290519081900360640190fd5b874211156136545760405162461bcd60e51b8152600401808060200182810382526023815260200180615d9c6023913960400191505060405180910390fd5b61365e818b614f00565b505050505b505050505050565b6001600160a01b0316600090815260086020526040902054610100900460ff1690565b6136966143f8565b6001600160a01b03166136a7612af7565b6001600160a01b0316146136f0576040805162461bcd60e51b81526020600482018190526024820152600080516020615e9b833981519152604482015290519081900360640190fd5b60026006541415613736576040805162461bcd60e51b815260206004820152601f6024820152600080516020615d12833981519152604482015290519081900360640190fd5b6002600655600d546001600160a01b038281169116141561378e576040805162461bcd60e51b815260206004820152600d60248201526c563a53414d455f4645455f544f60981b604482015290519081900360640190fd5b6137966144e8565b50600d80546001600160a01b0319166001600160a01b0383169081179091556040517fcb2efb9ac9d76fd38ee396f04826fab474b9d684a0131ed439d676632ad605f990600090a2506001600655565b6001600160a01b031660009081526008602052604090205460ff1690565b60006002600654141561384c576040805162461bcd60e51b815260206004820152601f6024820152600080516020615d12833981519152604482015290519081900360640190fd5b6002600655600061385b6144e8565b9050600061386761139e565b90508061388d578161387b57839250613888565b6138858483614d43565b92505b6138dc565b600082116138ce576040805162461bcd60e51b8152602060048201526009602482015268563a54555f5a45524f60b81b604482015290519081900360640190fd5b611a7482611a6e8684614e40565b50506001600655919050565b6002600654141561392e576040805162461bcd60e51b815260206004820152601f6024820152600080516020615d12833981519152604482015290519081900360640190fd5b600260065561147e6144e8565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b7fe48329057bfd03d55e49b547132e39cffd9c1820ad7b9d4c5307691425d15adf81565b6139926143f8565b6001600160a01b03166139a3612af7565b6001600160a01b0316146139ec576040805162461bcd60e51b81526020600482018190526024820152600080516020615e9b833981519152604482015290519081900360640190fd5b60026006541415613a32576040805162461bcd60e51b815260206004820152601f6024820152600080516020615d12833981519152604482015290519081900360640190fd5b6002600655600754613a74576040805162461bcd60e51b81526020600482015260066024820152652b1d2727afa160d11b604482015290519081900360640190fd5b6001600160a01b038116600090815260086020526040902054610100900460ff16613acf576040805162461bcd60e51b81526020600482015260066024820152652b1d2727afa160d11b604482015290519081900360640190fd5b6001600160a01b03811660009081526008602052604090205460ff1615613b25576040805162461bcd60e51b8152602060048201526005602482015264563a425f4560d81b604482015290519081900360640190fd5b604080516370a0823160e01b815230600482015290516001600160a01b038316916370a08231916024808301926020929190829003018186803b158015613b6b57600080fd5b505afa158015613b7f573d6000803e3d6000fd5b505050506040513d6020811015613b9557600080fd5b505115613bd9576040805162461bcd60e51b815260206004820152600d60248201526c563a425f4e4f545f454d50545960981b604482015290519081900360640190fd5b600754600019016000613beb83611a81565b905060078281548110613bfa57fe5b600091825260209091200154600780546001600160a01b039092169183908110613c2057fe5b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055506007805480613c5957fe5b60008281526020808220830160001990810180546001600160a01b03191690559092019092556001600160a01b03851680835260089091526040808320805461ffff191690555190917f1f537c1571c0e7fa29083762436cadb3e57564c0f78e857e498cf428124c710e91a25050600160065550565b613cd76143f8565b6001600160a01b0316613ce8612af7565b6001600160a01b031614613d31576040805162461bcd60e51b81526020600482018190526024820152600080516020615e9b833981519152604482015290519081900360640190fd5b60026006541415613d77576040805162461bcd60e51b815260206004820152601f6024820152600080516020615d12833981519152604482015290519081900360640190fd5b60026006556001600160a01b038216613dd1578015613dcc576040805162461bcd60e51b815260206004820152600c60248201526b563a4e4f545f4245464f524560a01b604482015290519081900360640190fd5b613efb565b6001600160a01b038216613e1c576040805162461bcd60e51b815260206004820152600d60248201526c158e925395931117d4d5149055609a1b604482015290519081900360640190fd5b6009546001600160a01b0383811691161415613e6e576040805162461bcd60e51b815260206004820152600c60248201526b158e94d0535157d4d514905560a21b604482015290519081900360640190fd5b6202a3004201811015613eb5576040805162461bcd60e51b815260206004820152600a6024820152692b1d2a27a7afa9a7a7a760b11b604482015290519081900360640190fd5b62278d0042018110613efb576040805162461bcd60e51b815260206004820152600a602482015269563a544f4f5f4c41544560b01b604482015290519081900360640190fd5b600a80546001600160a01b0384166001600160a01b03199091168117909155600b8290556040805183815290517fdc7940cd625f859a15f646158208f9cd0680f644a605e23c218002d4225c4adb9181900360200190a250506001600655565b60116020908152600092835260408084209091529082529020805460019091015463ffffffff9091169082565b6009546001600160a01b03163314613fd1576040805162461bcd60e51b8152602060048201526007602482015266158e94d514905560ca1b604482015290519081900360640190fd5b6001600160a01b038216600090815260086020526040902054610100900460ff16614032576040805162461bcd60e51b815260206004820152600c60248201526b563a4e4f545f45584953545360a01b604482015290519081900360640190fd5b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b1580156140a157600080fd5b505afa1580156140b5573d6000803e3d6000fd5b505050506040513d60208110156140cb57600080fd5b505190506140e36001600160a01b0384168484614721565b604080516395a2251f60e01b815230600482015290516001600160a01b038516916395a2251f9160248083019260209291908290030181600087803b15801561412b57600080fd5b505af115801561413f573d6000803e3d6000fd5b505050506040513d602081101561415557600080fd5b5050604080516370a0823160e01b815230600482015290516000916141c79184916001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016916370a0823191602480820192602092909190829003018186803b15801561121557600080fd5b9050836001600160a01b03167f27d47976f09b31322ff3e902364eaaa83ebd9438ae8a8d4e9c25f536c8d34fa58483604051808381526020018281526020019250505060405180910390a250505050565b6142206143f8565b6001600160a01b0316614231612af7565b6001600160a01b03161461427a576040805162461bcd60e51b81526020600482018190526024820152600080516020615e9b833981519152604482015290519081900360640190fd5b6001600160a01b0381166142bf5760405162461bcd60e51b8152600401808060200182810382526026815260200180615d546026913960400191505060405180910390fd5b6005546040516001600160a01b0380841692610100900416907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3600580546001600160a01b0390921661010002610100600160a81b0319909216919091179055565b606082826040516020018083805190602001908083835b6020831061435c5780518252601f19909201916020918201910161433d565b51815160209384036101000a600019018019909216911617905285519190930192850191508083835b602083106143a45780518252601f199092019160209182019101614385565b6001836020036101000a03801982511681845116808217855250505050505090500192505050604051602081830303815290604052905092915050565b8151606090156143f2575081610d4e565b50919050565b3390565b6001600160a01b0383166144415760405162461bcd60e51b8152600401808060200182810382526024815260200180615f016024913960400191505060405180910390fd5b6001600160a01b0382166144865760405162461bcd60e51b8152600401808060200182810382526022815260200180615d7a6022913960400191505060405180910390fd5b6001600160a01b03808416600081815260016020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b60006144f26147d5565b9050600f54811115610d3357600d546001600160a01b0316156145e6576000614526600f548361477890919063ffffffff16565b90506000614545612710611a6e600e5485614e4090919063ffffffff16565b905080156145e357600061455761139e565b905060006145726145688685614778565b611a6e8585614e40565b905080156145e057600d54614590906001600160a01b0316826154b3565b600d54604080518681526020810186905280820184905290516001600160a01b03909216917fa729e13b67d4c409a310d4d00dc9ac67b5540cc4cc9ba903f31857937ae13db59181900360600190a25b50505b50505b610d33816148ca565b6000816145fe57506000610d4e565b6000836001600160a01b0316633ba0b9a96040518163ffffffff1660e01b8152600401602060405180830381600087803b15801561463b57600080fd5b505af115801561464f573d6000803e3d6000fd5b505050506040513d602081101561466557600080fd5b5051905061467f670de0b6b3a7640000611a6e8584614e40565b949350505050565b6000610d4e82836001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b1580156146da57600080fd5b505afa1580156146ee573d6000803e3d6000fd5b505050506040513d602081101561470457600080fd5b50516145ef565b600081831061471a57816114d4565b5090919050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b1790526147739084906154eb565b505050565b6000828211156147cf576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561484457600080fd5b505afa158015614858573d6000803e3d6000fd5b505050506040513d602081101561486e57600080fd5b505160075490915060005b818110156148c55760006007828154811061489057fe5b6000918252602090912001546001600160a01b031690506148ba6148b382614687565b8590614d43565b935050600101614879565b505090565b600f8190556040805182815290517f7fdf3fc2767b3889dcc1d6da49f38fe1be5d6f2d834718fd49b75bb5cf364a749181900360200190a150565b60095460408051634b42f38b60e11b81526001600160a01b03848116600483015291516000939290921691639685e71691602480820192602092909190829003018186803b15801561495657600080fd5b505afa15801561496a573d6000803e3d6000fd5b505050506040513d602081101561498057600080fd5b505160408051636f307dc360e01b815290519192506001600160a01b037f000000000000000000000000000000000000000000000000000000000000000081169290841691636f307dc3916004808301926020929190829003018186803b1580156149ea57600080fd5b505afa1580156149fe573d6000803e3d6000fd5b505050506040513d6020811015614a1457600080fd5b50516001600160a01b031614614a5e576040805162461bcd60e51b815260206004820152600a602482015269158e925395931117d55360b21b604482015290519081900360640190fd5b6001600160a01b038116600090815260086020526040902054610100900460ff1615614ab9576040805162461bcd60e51b81526020600482015260056024820152640ac7484beb60db1b604482015290519081900360640190fd5b6001600160a01b038116600081815260086020526040808220805460ff1961ff00199091166101001716600190811790915560078054918201815583527fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c6880180546001600160a01b03191684179055517f3b94e6c56297c3ab2913d31d1c1adf8279146dbfb5624cc473e7af7a22d9c8469190a25050565b6000614b5e84848461559c565b614bc984614b6a6143f8565b61192485604051806060016040528060288152602001615e73602891396001600160a01b038a16600090815260016020526040812090614ba86143f8565b6001600160a01b03168152602081019190915260400160002054919061534e565b5060019392505050565b6001600160a01b0381811660009081526010602052604090205416611ced576001600160a01b0316600081815260106020526040902080546001600160a01b0319169091179055565b816001600160a01b0316836001600160a01b031614158015614c3e5750600081115b15614773576001600160a01b03831615614cc5576001600160a01b03831660009081526012602052604081205463ffffffff169081614c7e576000614cb0565b6001600160a01b038516600090815260116020908152604080832063ffffffff60001987011684529091529020600101545b9050828103614cc1868484846156f7565b5050505b6001600160a01b03821615614773576001600160a01b03821660009081526012602052604081205463ffffffff169081614d00576000614d32565b6001600160a01b038416600090815260116020908152604080832063ffffffff60001987011684529091529020600101545b9050828101613663858484846156f7565b6000828201838110156114d4576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b614da5611cf0565b614ded576040805162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b604482015290519081900360640190fd5b6005805460ff60a81b191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa614e236143f8565b604080516001600160a01b039092168252519081900360200190a1565b600082614e4f57506000610d4e565b82820282848281614e5c57fe5b04146114d45760405162461bcd60e51b8152600401808060200182810382526021815260200180615e526021913960400191505060405180910390fd5b6000808211614eef576040805162461bcd60e51b815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b818381614ef857fe5b049392505050565b6001600160a01b0380831660009081526010602052604081205490911690614f2784612385565b6001600160a01b0385811660008181526010602052604080822080546001600160a01b031916898616908117909155905194955093928616927f3134e8a2e6d97e929a7e54011ea5485d7d196dd5f0ba4d4ef95803e8e3fc257f9190a4614f8f828483614c1c565b50505050565b614f9f828261585c565b6001600160a01b03808316600090815260106020526040812054614fc592169083614c1c565b5050565b600080821161500c576040805162461bcd60e51b815260206004820152600a602482015269563a544b4e5f5a45524f60b01b604482015290519081900360640190fd5b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316846001600160a01b0316141561504f5750816150c5565b6001600160a01b03841660009081526008602052604090205460ff161561508a576150836001600160a01b038516846145ef565b90506150c5565b6040805162461bcd60e51b815260206004820152600b60248201526a2b1d24a72b26222faa25a760a91b604482015290519081900360640190fd5b60008111615105576040805162461bcd60e51b8152602060048201526008602482015267563a555f5a45524f60c01b604482015290519081900360640190fd5b600061510f6144e8565b9050600f548114615155576040805162461bcd60e51b815260206004820152600b60248201526a563a4445505f504155534560a81b604482015290519081900360640190fd5b600061515f61139e565b905080615185578161517357829350615180565b61517d8383614d43565b93505b6151d7565b600082116151c6576040805162461bcd60e51b8152602060048201526009602482015268563a54555f5a45524f60b81b604482015290519081900360640190fd5b6151d482611a6e8584614e40565b93505b6151e133856154b3565b6151f66001600160a01b038716333088615958565b600f546152039084614d43565b600f55600954604080516355d54c8b60e11b815290516001600160a01b039092169163abaa99169160048082019260009290919082900301818387803b15801561524c57600080fd5b505af1158015615260573d6000803e3d6000fd5b5050505061526f61125f6147d5565b604080518681526020810185905280820186905290516001600160a01b0388169133917f471ac35cb462beae9030056edb1a926ac4cc8451cb2803b2a23c9f2a59d3fac69181900360600190a350505092915050565b6152cd611cf0565b15615312576040805162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015290519081900360640190fd5b6005805460ff60a81b1916600160a81b1790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258614e236143f8565b600081848411156153dd5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156153a257818101518382015260200161538a565b50505050905090810190601f1680156153cf5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b6000610d4a6153f26143f8565b848461559c565b600080846001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561544957600080fd5b505afa15801561545d573d6000803e3d6000fd5b505050506040513d602081101561547357600080fd5b5051905080156154a75761548b83611a6e8387614e40565b915081156154a7576154a76001600160a01b0386163384614721565b509392505050565b4690565b6154bd82826159b2565b6154c682614bd3565b6001600160a01b03808316600090815260106020526040812054614fc5921683614c1c565b6060615540826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316615aa29092919063ffffffff16565b8051909150156147735780806020019051602081101561555f57600080fd5b50516147735760405162461bcd60e51b815260040180806020018281038252602a815260200180615f25602a913960400191505060405180910390fd5b6001600160a01b0383166155e15760405162461bcd60e51b8152600401808060200182810382526025815260200180615edc6025913960400191505060405180910390fd5b6001600160a01b0382166156265760405162461bcd60e51b8152600401808060200182810382526023815260200180615cef6023913960400191505060405180910390fd5b615631838383614773565b61566e81604051806060016040528060268152602001615dbf602691396001600160a01b038616600090815260208190526040902054919061534e565b6001600160a01b03808516600090815260208190526040808220939093559084168152205461569d9082614d43565b6001600160a01b038084166000818152602081815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b600061571b43604051806060016040528060318152602001615f4f60319139615ab1565b905060008463ffffffff1611801561576457506001600160a01b038516600090815260116020908152604080832063ffffffff6000198901811685529252909120548282169116145b156157a1576001600160a01b038516600090815260116020908152604080832063ffffffff60001989011684529091529020600101829055615812565b60408051808201825263ffffffff808416825260208083018681526001600160a01b038a166000818152601184528681208b8616825284528681209551865490861663ffffffff19918216178755925160019687015590815260129092529390208054928801909116919092161790555b604080518481526020810184905281516001600160a01b038816927fdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a724928290030190a25050505050565b6001600160a01b0382166158a15760405162461bcd60e51b8152600401808060200182810382526021815260200180615ebb6021913960400191505060405180910390fd5b6158ad82600083614773565b6158ea81604051806060016040528060228152602001615d32602291396001600160a01b038516600090815260208190526040902054919061534e565b6001600160a01b0383166000908152602081905260409020556002546159109082614778565b6002556040805182815290516000916001600160a01b038516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a35050565b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052614f8f9085906154eb565b6001600160a01b038216615a0d576040805162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015290519081900360640190fd5b615a1960008383614773565b600254615a269082614d43565b6002556001600160a01b038216600090815260208190526040902054615a4c9082614d43565b6001600160a01b0383166000818152602081815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b60606114d18484600085615b0f565b6000816401000000008410615b075760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156153a257818101518382015260200161538a565b509192915050565b606082471015615b505760405162461bcd60e51b8152600401808060200182810382526026815260200180615de56026913960400191505060405180910390fd5b615b5985615c6b565b615baa576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b60006060866001600160a01b031685876040518082805190602001908083835b60208310615be95780518252601f199092019160209182019101615bca565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114615c4b576040519150601f19603f3d011682016040523d82523d6000602084013e615c50565b606091505b5091509150615c60828286615c71565b979650505050505050565b3b151590565b60608315615c805750816114d4565b825115615c905782518084602001fd5b60405162461bcd60e51b81526020600482018181528451602484015284518593919283926044019190850190808383600083156153a257818101518382015260200161538a565b60408051808201909152600080825260208201529056fe45524332303a207472616e7366657220746f20746865207a65726f20616464726573735265656e7472616e637947756172643a207265656e7472616e742063616c6c0045524332303a206275726e20616d6f756e7420657863656564732062616c616e63654f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f2061646472657373563a3a64656c656761746542795369673a207369676e6174757265206578706972656445524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e6365416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c563a3a64656c656761746542795369673a20696e76616c6964207369676e6174757265563a3a6765745072696f72566f7465733a206e6f74207965742064657465726d696e6564536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63654f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657245524332303a206275726e2066726f6d20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f20616464726573735361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564563a3a5f7772697465436865636b706f696e743a20626c6f636b206e756d6265722065786365656473203332206269747345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220319bb6de0a65b467be1191cd60b90c3d78ae733f35626f635c6d9b561315c4ab64736f6c634300060c0033000000000000000000000000c5e2b037d30a390e62180970b3aa4e91868764cd00000000000000000000000093d01402fc51dd906bbaadb2431ddc2ff535eaac000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000000c5374616b6564205441524f5400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006785441524f540000000000000000000000000000000000000000000000000000

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

000000000000000000000000c5e2b037d30a390e62180970b3aa4e91868764cd00000000000000000000000093d01402fc51dd906bbaadb2431ddc2ff535eaac000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000000c5374616b6564205441524f5400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006785441524f540000000000000000000000000000000000000000000000000000

-----Decoded View---------------
Arg [0] : _underlying (address): 0xc5e2b037d30a390e62180970b3aa4e91868764cd
Arg [1] : _strategy (address): 0x93d01402fc51dd906bbaadb2431ddc2ff535eaac
Arg [2] : _name (string): Staked TAROT
Arg [3] : _symbol (string): xTAROT

-----Encoded View---------------
8 Constructor Arguments found :
Arg [0] : 000000000000000000000000c5e2b037d30a390e62180970b3aa4e91868764cd
Arg [1] : 00000000000000000000000093d01402fc51dd906bbaadb2431ddc2ff535eaac
Arg [2] : 0000000000000000000000000000000000000000000000000000000000000080
Arg [3] : 00000000000000000000000000000000000000000000000000000000000000c0
Arg [4] : 000000000000000000000000000000000000000000000000000000000000000c
Arg [5] : 5374616b6564205441524f540000000000000000000000000000000000000000
Arg [6] : 0000000000000000000000000000000000000000000000000000000000000006
Arg [7] : 785441524f540000000000000000000000000000000000000000000000000000


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.