Contract 0xcb9f1d39df5f06f93e2133e078ae1a20d7cf0eac

 
 
Txn Hash Method
Block
From
To
Value [Txn Fee]
0xd64cd66ce5c852591e8b5d2aa5c3cd306f1820a82e99c4e34dd2a471f9e34c4eCompound299814682022-06-25 13:01:4511 days 9 hrs ago0x9ada2d55b11298adb88a6168ebd28d69d3ab545f IN  0xcb9f1d39df5f06f93e2133e078ae1a20d7cf0eac0 MATIC0.058677342058 93.516265776
0x5bc7d824863ed5938b45948bf088821aa046a5c85bcec4fbfe69249e09d19943Compound299799082022-06-25 12:01:4511 days 10 hrs ago0x9ada2d55b11298adb88a6168ebd28d69d3ab545f IN  0xcb9f1d39df5f06f93e2133e078ae1a20d7cf0eac0 MATIC0.056602812847 90.210011295
0x66b6f979e050dfb2ab25fec7b23125ba2cbf837ce3f03645afda9668ffc53982Compound299784792022-06-25 11:01:4511 days 11 hrs ago0x9ada2d55b11298adb88a6168ebd28d69d3ab545f IN  0xcb9f1d39df5f06f93e2133e078ae1a20d7cf0eac0 MATIC0.056471040033 90.000000054
0x375d1e3bb629f9a5a74632ac326ad04b0e87894d21a9078e2313966cb44dd50bCompound299769702022-06-25 10:01:4511 days 12 hrs ago0x9ada2d55b11298adb88a6168ebd28d69d3ab545f IN  0xcb9f1d39df5f06f93e2133e078ae1a20d7cf0eac0 MATIC0.067640406013 107.801034675
0x4ffeabda056ad8eb8a2fb01930b5ed3f22e2a915d5c4f26e38147e036ef37b5aCompound299756712022-06-25 9:01:4511 days 13 hrs ago0x9ada2d55b11298adb88a6168ebd28d69d3ab545f IN  0xcb9f1d39df5f06f93e2133e078ae1a20d7cf0eac0 MATIC0.057717732804 91.986900762
0x169e4eab6d1f3fe52ed58edba57bc82d9f6f2457fbedc83f17d8c0bee363b870Compound299742842022-06-25 8:01:4511 days 14 hrs ago0x9ada2d55b11298adb88a6168ebd28d69d3ab545f IN  0xcb9f1d39df5f06f93e2133e078ae1a20d7cf0eac0 MATIC0.203149593836 323.767075041
0xabe2118dbc71cfe1d2206bd116f8dc76aba175e45e1a5c522c1653b923ba7c1cCompound299729582022-06-25 7:01:4711 days 15 hrs ago0x9ada2d55b11298adb88a6168ebd28d69d3ab545f IN  0xcb9f1d39df5f06f93e2133e078ae1a20d7cf0eac0 MATIC0.056471040077 90.000000123
0x88ceadca5a11ba53cb9c56275676e7d72435950eff8692d85522db7cb075c435Compound299715522022-06-25 6:01:4511 days 16 hrs ago0x9ada2d55b11298adb88a6168ebd28d69d3ab545f IN  0xcb9f1d39df5f06f93e2133e078ae1a20d7cf0eac0 MATIC0.056471040028 90.000000045
0x26d2e80595d92d2c97111089f4fe8b0cf5a603750db1445044ee4a82e0ade3c5Compound299700562022-06-25 5:01:4611 days 17 hrs ago0x9ada2d55b11298adb88a6168ebd28d69d3ab545f IN  0xcb9f1d39df5f06f93e2133e078ae1a20d7cf0eac0 MATIC0.056471040033 90.000000054
0x7516979ac255da2017e83e6b5411ccac57c464e876fc39097dcb2cf5df90301fCompound299685642022-06-25 4:01:4611 days 18 hrs ago0x9ada2d55b11298adb88a6168ebd28d69d3ab545f IN  0xcb9f1d39df5f06f93e2133e078ae1a20d7cf0eac0 MATIC0.05647111274 90.000115929
0xbda9e15f2ea32370a98e70e02a4c2be1c93f0418a25c5c3a552df0a604cbf5fcCompound299670732022-06-25 3:01:4511 days 19 hrs ago0x9ada2d55b11298adb88a6168ebd28d69d3ab545f IN  0xcb9f1d39df5f06f93e2133e078ae1a20d7cf0eac0 MATIC0.021034659545 90.574109832
0x402b35fcc63871496a2b0ee140ec548e05f4ca91ef7500933e5509a962221aa1Compound299664622022-06-25 2:40:4311 days 19 hrs ago0x9ada2d55b11298adb88a6168ebd28d69d3ab545f IN  0xcb9f1d39df5f06f93e2133e078ae1a20d7cf0eac0 MATIC0.105091145319 452.51680533
0x8d7f397f0060cf333f28b0dc51fa606dbb17b05e574733ec1d4995a747db8121Compound299664622022-06-25 2:40:4311 days 19 hrs ago0x9ada2d55b11298adb88a6168ebd28d69d3ab545f IN  0xcb9f1d39df5f06f93e2133e078ae1a20d7cf0eac0 MATIC0.04960518484 213.59725126
0x24ff6962485de6558de61c381da4ca4cc8eebfcdd5de529b53f9e94cfe5020adCompound299648642022-06-25 1:30:5511 days 21 hrs ago0x9ada2d55b11298adb88a6168ebd28d69d3ab545f IN  0xcb9f1d39df5f06f93e2133e078ae1a20d7cf0eac0 MATIC0.032063721247 138.064654845
0x887d65ba3bbcea4c19ab5627c1fc0c9202fb3eaccd364974abda0f16557d37edCompound299648432022-06-25 1:30:0911 days 21 hrs ago0x9ada2d55b11298adb88a6168ebd28d69d3ab545f IN  0xcb9f1d39df5f06f93e2133e078ae1a20d7cf0eac0 MATIC0.04160101562 179.131730175
0x6451297a503531e13ab9bef143a9e307a326e086c14adf221871e6a0217dc58fCompound299648432022-06-25 1:30:0911 days 21 hrs ago0x9ada2d55b11298adb88a6168ebd28d69d3ab545f IN  0xcb9f1d39df5f06f93e2133e078ae1a20d7cf0eac0 MATIC0.016182531472 69.681107973
0x47ea3bc83fae18cae8a24c20d88e353b76a255e637f07495a0a61e8eaa1b50e8Withdraw Fees296968402022-06-18 1:15:3618 days 21 hrs ago0x7a4b9d6e497c1492fb9239da8e5ae0a2ec0f66fc IN  0xcb9f1d39df5f06f93e2133e078ae1a20d7cf0eac0 MATIC0.009580558128 64.120028163
0x134994af9ed0c256ffb51f24205b00f11e730f206a101af526f6c0bbf49db94fCompound296964392022-06-18 1:01:4618 days 21 hrs ago0x9ada2d55b11298adb88a6168ebd28d69d3ab545f IN  0xcb9f1d39df5f06f93e2133e078ae1a20d7cf0eac0 MATIC0.023584501199 37.587498086
0x5f5bcac4ca626334427c9fa3a7b64dc4b6bfc43afae8006d33ac7a5f1fefb68bCompound296948792022-06-18 0:01:4618 days 22 hrs ago0x9ada2d55b11298adb88a6168ebd28d69d3ab545f IN  0xcb9f1d39df5f06f93e2133e078ae1a20d7cf0eac0 MATIC0.023608032 37.625000001
0x7da4caccbf4d960cbabd3d8a8029c9e8db26b55766055b2c1a1cbfd78477e2adCompound296931952022-06-17 23:01:4618 days 23 hrs ago0x9ada2d55b11298adb88a6168ebd28d69d3ab545f IN  0xcb9f1d39df5f06f93e2133e078ae1a20d7cf0eac0 MATIC0.023529600008 37.500000013
0xa5d5c874ceecebe17749a923b19a898112621184b128bb763911e2f8f6391f7cCompound296916362022-06-17 22:01:4419 days 37 mins ago0x9ada2d55b11298adb88a6168ebd28d69d3ab545f IN  0xcb9f1d39df5f06f93e2133e078ae1a20d7cf0eac0 MATIC0.025527824832 40.68464535
0x8ebaff334be4ccbfe9d80dde19938475deaf3ab3e1733579cf2fbbf1454b50dfCompound296900772022-06-17 21:01:4619 days 1 hr ago0x9ada2d55b11298adb88a6168ebd28d69d3ab545f IN  0xcb9f1d39df5f06f93e2133e078ae1a20d7cf0eac0 MATIC0.023584502398 37.587499997
0x4bf7954edb8310884e10620875502883107520c4b92eb5c1160d5ac98484c797Compound296883932022-06-17 20:01:4419 days 2 hrs ago0x9ada2d55b11298adb88a6168ebd28d69d3ab545f IN  0xcb9f1d39df5f06f93e2133e078ae1a20d7cf0eac0 MATIC0.025164659455 40.10585516
0x9c4b5216d2571fd88f20790853cd387671bc2af19c9ffb3ce21690bcc19268bfCompound296868362022-06-17 19:01:4419 days 3 hrs ago0x9ada2d55b11298adb88a6168ebd28d69d3ab545f IN  0xcb9f1d39df5f06f93e2133e078ae1a20d7cf0eac0 MATIC0.029305369641 46.705059225
0x7cd9813e1c5d6479c7b1a252ac04ba4446ded341e03f46a88e142c9cc4f98fe5Compound296851232022-06-17 18:01:4619 days 4 hrs ago0x9ada2d55b11298adb88a6168ebd28d69d3ab545f IN  0xcb9f1d39df5f06f93e2133e078ae1a20d7cf0eac0 MATIC0.02352961568 37.500024991
[ Download CSV Export 
Parent Txn Hash Block From To Value
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
rCompoundCrLpErc20Strategy

Compiler Version
v0.8.4+commit.c7e474f2

Optimization Enabled:
No with 200 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity Standard Json-Input format)

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

pragma solidity ^0.8.0;

// import "hardhat/console.sol";

import "@uniswap/v2-core/contracts/interfaces/IUniswapV2Pair.sol";
import "@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol";
import "./IRaiderStaking.sol";
import "./rStrategy.sol";
import "./IrOracle.sol";

/**
 * @author Oighty (h/t to Nat Eliason for authoring the RaiderStaking contract). Please contact me on Twitter (@oightytag) or Discord (Oighty #4287) if you have any questions about this contract.
 */

contract rCompoundCrLpErc20Strategy is rStrategy {
    using SafeMath for uint256;
    using SafeERC20 for IERC20;

    //  -------------------- CONTRACT VARIABLES --------------------
    // Tokens and Contracts to Interface with
    IRaiderStaking internal _stakingContract; // The staking contract that the vault will compound into
    IUniswapV2Pair internal _stakingToken; // The LP token people can stake
    IERC20 internal _pairedToken; // The project token in the staking LP pair
    IERC20 internal _stakingLpBaseToken; // The base token in the staking LP pair
    
    IUniswapV2Pair internal _rewardLpToken; // The LP token for the reward token paired with MATIC
    IERC20 internal _rewardToken; // The project token people will be rewarded with
    IERC20 internal _rewardLpBaseToken; //  The base token in the reward LP pair

    IUniswapV2Router02 internal _router; // Sushiswap Router to swap tokens and provide liquidity
    address internal _wmaticAddr; // The WMATIC token address
    address[] internal _swapPath; // Path array needed for routing uniswapv2 swaps

    IrOracle internal _oracle; // Price oracle to use for swaps

    // Parameters
    uint public compoundFrequency; // number of seconds to wait between compounding
    uint public lastCompoundTime; // For calculating how recently the vault was compounded
    uint internal _priceSlippage; // Slippage tolerance on DEX transactions in big units
    uint internal _dexFee; // Amount charged by the DEX for trading fees

    //  -------------------- EVENTS ----------------------------------
    event Compounded(uint timestamp, uint256 amount);
    
    //  -------------------- CONSTRUCTOR FUNCTION --------------------
    constructor(
        string memory _name,
        address _vaultAddr,
        address _stakingContractAddr,
        address _stakingTokenAddr,
        address _rewardTokenAddr,
        address _rewardTokenLpAddr,
        address _routerAddr,
        uint _compoundFrequency,
        uint _feePercent,
        address _managerAddr,
        address _oracleAddr
    ) rStrategy(
        _name,
        _vaultAddr,
        _stakingTokenAddr,
        _feePercent,
        _managerAddr
    )
    {
        // Assign initial variable values        
        _stakingContract = IRaiderStaking(_stakingContractAddr);
        _stakingToken = IUniswapV2Pair(_stakingTokenAddr);
        _pairedToken = IERC20(_stakingToken.token1());
        _stakingLpBaseToken = IERC20(_stakingToken.token0());
        _rewardToken = IERC20(_rewardTokenAddr);
        _rewardLpToken = IUniswapV2Pair(_rewardTokenLpAddr);
        _rewardLpBaseToken = IERC20(_rewardLpToken.token0());

        _router = IUniswapV2Router02(_routerAddr);
        _wmaticAddr = _router.WETH();
        _oracle = IrOracle(_oracleAddr);

        lastCompoundTime = block.timestamp;
        compoundFrequency = _compoundFrequency;
        _priceSlippage = 2 * 10**16; // 2% slippage by default from TWAP
        _dexFee = 3 * 10**15; // 0.3% fee charged by UniswapV2
        
        // Approve Reward Token and Token to Pair for LP on Router
        _pairedToken.approve(_routerAddr, MAX_UNIT);
        if (_rewardTokenAddr != address(_pairedToken)) {
            _rewardToken.approve(_routerAddr, MAX_UNIT);
            if (address(_rewardLpBaseToken) != _wmaticAddr) {
                _rewardLpBaseToken.approve(_routerAddr, MAX_UNIT);
            }
        }

        // Approve LP Token on Router
        _stakingToken.approve(_routerAddr, MAX_UNIT);

        // Approve LP base token on the router
        _stakingLpBaseToken.approve(_routerAddr, MAX_UNIT);

        // Approve staking contract for LP Token
        _stakingToken.approve(_stakingContractAddr, MAX_UNIT);
    }

    //  -------------------- VIEW FUNCTIONS -------------------------
    // function timeSinceLastCompound() public view returns (uint) {
    //     return block.timestamp.sub(lastCompoundTime);
    // }

    function getStakingContract() external view returns (address) {
        return address(_stakingContract);
    }

    //  -------------------- UTILITY FUNCTIONS ---------------------

    function _invest(uint _amount) internal override whenNotPaused {
        _stakingContract.createStake(_amount);
        _externalContractTokenBalance = _externalContractTokenBalance.add(_amount);
    }

    function _divest(uint _amount) internal override {
        _stakingContract.removeStake(_amount);
        _externalContractTokenBalance = _externalContractTokenBalance.sub(_amount);
    }

    //  -------------------- MANAGER FUNCTIONS --------------------
    function compound() external payable whenNotPaused nonReentrant onlyRole(MANAGER_ROLE) {
        // Get outstanding rewards
        _stakingContract.getRewards();
        uint rewardsToCompound = _rewardToken.balanceOf(address(this));

        // Declare variables for swaps
        uint minAmountBaseToken;
        uint minAmountPairedToken;
        uint desiredAmountBaseToken;
        uint desiredAmountPairedToken;
        uint oracleAmount;
        uint reserveA;
        uint reserveB;
        uint[] memory amounts;

        // Swap tokens to get the right amounts for providing liquidity
        if (address(_rewardToken) == address(_pairedToken)) { // RAIDER/(ERC20) LP Case
            //// Swap 1/2 of the reward token for the LP base token
            // Get the current price from the exchange
            (reserveA, reserveB, ) = _stakingToken.getReserves();
            minAmountBaseToken = _router.getAmountOut(rewardsToCompound.mul(50 * (10 ** 16)).div(BIG_UNIT), reserveB, reserveA);

            // Compare exchange quote with oracle to make sure it's within our tolerance
            oracleAmount = _oracle.consult(
                address(_rewardToken), // address tokenIn
                rewardsToCompound.mul(50 * (10 ** 16)).div(BIG_UNIT), // uint amountIn
                address(_stakingLpBaseToken) // address tokenOut
            );

            require(
                (minAmountBaseToken >= oracleAmount.mul(BIG_UNIT.sub(_dexFee).sub(_priceSlippage)).div(BIG_UNIT)) &&
                (minAmountBaseToken <= oracleAmount.mul(BIG_UNIT.sub(_dexFee).add(_priceSlippage)).div(BIG_UNIT)),
                "Price out of bounds."
            );

            // Create the swap path
            _swapPath.push(address(_rewardToken));
            _swapPath.push(address(_stakingLpBaseToken));
            
            // Execute the swap
            amounts = _router.swapExactTokensForTokens(
                rewardsToCompound.mul(50 * (10 ** 16)).div(BIG_UNIT), // amount of _pairedToken in
                minAmountBaseToken, // minimum amonut of _stakingLpBaseToken out
                _swapPath, // _router path
                address(this), // address to send matic to (this contract)
                block.timestamp + 30 // deadline for executing the swap
            );
            
            desiredAmountBaseToken = amounts[1];
            delete amounts;
            delete _swapPath;

            desiredAmountPairedToken = _pairedToken.balanceOf(address(this));
            
        } else { //// AURUM/(ERC20) LP Case
            //// Swap the rewards for AURUM
            // Create swap path for multi-hop quote and swap
            _swapPath.push(address(_rewardToken));
            _swapPath.push(address(_rewardLpBaseToken));
            _swapPath.push(address(_pairedToken));

            // Get the current price from the exchange
            amounts = _router.getAmountsOut(rewardsToCompound, _swapPath);
            minAmountPairedToken = amounts[2];
            delete amounts;

            // Compare exchange quote with oracle to make sure it's within our tolerance
            oracleAmount = _oracle.consult(
                address(_rewardToken), // address tokenIn
                rewardsToCompound, // uint amountIn
                address(_rewardLpBaseToken) // address tokenOut
            );
            oracleAmount = _oracle.consult(
                address(_rewardLpBaseToken), // address tokenIn
                oracleAmount, // uint amountIn
                address(_pairedToken) // address tokenOut
            );

            require(
                (minAmountPairedToken >= oracleAmount.mul(BIG_UNIT.sub(_dexFee).sub(_priceSlippage)).div(BIG_UNIT)) &&
                (minAmountPairedToken <= oracleAmount.mul(BIG_UNIT.sub(_dexFee).add(_priceSlippage)).div(BIG_UNIT)),
                "Price out of bounds."
            );

            // Execute the swap
            amounts = _router.swapExactTokensForTokens(
                rewardsToCompound, // amount of _rewardToken in
                minAmountPairedToken, // minAmount of _pairedToken out
                _swapPath, // _router path
                address(this), // address to send matic to (this contract)
                block.timestamp + 20 // deadline for executing the swap
            );
            desiredAmountPairedToken = amounts[2].mul(50 * (10 ** 16)).div(BIG_UNIT);
            delete amounts;
            delete _swapPath;

            //// Swap 1/2 of the paired token for the stakingLpBaseToken
            // Get the current price from the exchange
            (reserveA, reserveB, ) = _stakingToken.getReserves(); // Token A is the base token in all of the Raider Pairs and Token B is the _pairedToken
            minAmountBaseToken = _router.getAmountOut(desiredAmountPairedToken, reserveB, reserveA); // accounts for slippage and fees
            
            // Compare exchange quote with oracle to make sure it's within our tolerance
            oracleAmount = _oracle.consult(
                address(_pairedToken), // address tokenIn
                desiredAmountPairedToken, // uint amountIn
                address(_stakingLpBaseToken) // address tokenOut
            );
            require(
                (minAmountBaseToken >= oracleAmount.mul(BIG_UNIT.sub(_dexFee).sub(_priceSlippage)).div(BIG_UNIT)) &&
                (minAmountBaseToken <= oracleAmount.mul(BIG_UNIT.sub(_dexFee).add(_priceSlippage)).div(BIG_UNIT)),
                "Price out of bounds."
            );
            
            // Create the swap path
            _swapPath.push(address(_pairedToken));
            _swapPath.push(address(_stakingLpBaseToken));
            
            // Execute the swap
            _router.swapExactTokensForTokens(
                desiredAmountPairedToken, // amount of _pairedToken in
                minAmountBaseToken, // minimum amonut of _stakingLpBaseToken out
                _swapPath, // _router path
                address(this), // address to send matic to (this contract)
                block.timestamp + 40 // deadline for executing the swap
            );
            delete _swapPath;

            desiredAmountBaseToken = _stakingLpBaseToken.balanceOf(address(this));
        }

        { // Enclose in brackets to get around compiler issues                
            //// Calculate the remaining variables for the adding the liquidity
            // Calculate the amounts based on exchange reserves (No need to use oracle here because the values have been checked already on this block)
            minAmountPairedToken = _router.getAmountOut(desiredAmountBaseToken, reserveA, reserveB);
            minAmountBaseToken = _router.quote(minAmountPairedToken, reserveB, reserveA);

            //// Add the liquidity, handle WMATIC or ERC20 base function calls
            (,, uint newStakingTokens) = _router.addLiquidity(
                address(_stakingLpBaseToken), // base token for the LP
                address(_pairedToken), // token to pair address
                desiredAmountBaseToken, // desired amount of base token
                desiredAmountPairedToken, // desired amount of token to pair
                minAmountBaseToken, // minimum amount of base token to pair - same as minimum received from swap
                minAmountPairedToken, // minimum amount of token to pair
                address(this), // address to receive the LP tokens (this contract)
                block.timestamp + 60 // deadline for supplying the liquidity
            );

            //// Update the fee balance
            _updateFeeBalance(newStakingTokens);
        }

        //// Deposit new tokens, including any deposited recently, into the staking contract
        _invest(_availableBalance());

        //// Emit event and update last compound time
        lastCompoundTime = block.timestamp;
        emit Compounded(lastCompoundTime, rewardsToCompound);
    }

    function invest(uint _amount) public whenNotPaused nonReentrant onlyRole(MANAGER_ROLE) {
        _invest(_amount);
    }

    function divest(uint _amount) public nonReentrant onlyRole(MANAGER_ROLE) {
        _divest(_amount);
    }

    //  -------------------- OWNER FUNCTIONS --------------------
    function setCompoundFrequency(uint _seconds) external onlyRole(OWNER_ROLE) {
        compoundFrequency = _seconds;
    }

    function priceSlippage() external view onlyRole(OWNER_ROLE) returns (uint) {
        return _priceSlippage;
    }

    function setPriceSlippage(uint _slippage) external onlyRole(OWNER_ROLE) {
        _priceSlippage = _slippage;
    }
}

File 2 of 20 : IUniswapV2Pair.sol
pragma solidity >=0.5.0;

interface IUniswapV2Pair {
    event Approval(address indexed owner, address indexed spender, uint value);
    event Transfer(address indexed from, address indexed to, uint value);

    function name() external pure returns (string memory);
    function symbol() external pure returns (string memory);
    function decimals() external pure returns (uint8);
    function totalSupply() external view returns (uint);
    function balanceOf(address owner) external view returns (uint);
    function allowance(address owner, address spender) external view returns (uint);

    function approve(address spender, uint value) external returns (bool);
    function transfer(address to, uint value) external returns (bool);
    function transferFrom(address from, address to, uint value) external returns (bool);

    function DOMAIN_SEPARATOR() external view returns (bytes32);
    function PERMIT_TYPEHASH() external pure returns (bytes32);
    function nonces(address owner) external view returns (uint);

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

    event Mint(address indexed sender, uint amount0, uint amount1);
    event Burn(address indexed sender, uint amount0, uint amount1, address indexed to);
    event Swap(
        address indexed sender,
        uint amount0In,
        uint amount1In,
        uint amount0Out,
        uint amount1Out,
        address indexed to
    );
    event Sync(uint112 reserve0, uint112 reserve1);

    function MINIMUM_LIQUIDITY() external pure returns (uint);
    function factory() external view returns (address);
    function token0() external view returns (address);
    function token1() external view returns (address);
    function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
    function price0CumulativeLast() external view returns (uint);
    function price1CumulativeLast() external view returns (uint);
    function kLast() external view returns (uint);

    function mint(address to) external returns (uint liquidity);
    function burn(address to) external returns (uint amount0, uint amount1);
    function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external;
    function skim(address to) external;
    function sync() external;

    function initialize(address, address) external;
}

File 3 of 20 : IUniswapV2Router02.sol
pragma solidity >=0.6.2;

import './IUniswapV2Router01.sol';

interface IUniswapV2Router02 is IUniswapV2Router01 {
    function removeLiquidityETHSupportingFeeOnTransferTokens(
        address token,
        uint liquidity,
        uint amountTokenMin,
        uint amountETHMin,
        address to,
        uint deadline
    ) external returns (uint amountETH);
    function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(
        address token,
        uint liquidity,
        uint amountTokenMin,
        uint amountETHMin,
        address to,
        uint deadline,
        bool approveMax, uint8 v, bytes32 r, bytes32 s
    ) external returns (uint amountETH);

    function swapExactTokensForTokensSupportingFeeOnTransferTokens(
        uint amountIn,
        uint amountOutMin,
        address[] calldata path,
        address to,
        uint deadline
    ) external;
    function swapExactETHForTokensSupportingFeeOnTransferTokens(
        uint amountOutMin,
        address[] calldata path,
        address to,
        uint deadline
    ) external payable;
    function swapExactTokensForETHSupportingFeeOnTransferTokens(
        uint amountIn,
        uint amountOutMin,
        address[] calldata path,
        address to,
        uint deadline
    ) external;
}

File 4 of 20 : IRaiderStaking.sol
pragma solidity ^0.8.0;

interface IRaiderStaking {
    // --------- UTILITY FUNCTIONS ------------
    function isStaker(address _address) external view returns(bool);

    // ----------- STAKING ACTIONS ------------
    function createStake(uint _amount) external;
    function removeStake(uint _amount) external;
    // Backup function in case something happens with the update rewards functions
    function emergencyUnstake(uint _amount) external;

    // ------------ REWARD ACTIONS ---------------
    function getRewards() external;
    function updateAddressRewardsBalance(address _address) external returns (uint);
    function updateBigRewardsPerToken() external;
    function userPendingRewards(address _address) external view returns (uint);

    // ------------ ADMIN ACTIONS ---------------
    function withdrawRewards(uint _amount) external;
    function depositRewards(uint _amount) external;
    function setDailyEmissions(uint _amount) external;
    function pause() external;
    function unpause() external;

    // ------------ VIEW FUNCTIONS ---------------
    function timeSinceLastReward() external view returns (uint);
    function rewardsBalance() external view returns (uint);
    function addressStakedBalance(address _address) external view returns (uint);
    function showStakingToken() external view returns (address);
    function showRewardToken() external view returns (address);
    function showBigRewardsPerToken() external view returns (uint);
    function showBigUserRewardsCollected() external view returns (uint);
}

File 5 of 20 : rStrategy.sol
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

// import "hardhat/console.sol";

// !! IMPORTANT !! The most up to date SafeMath relies on Solidity 0.8.0's new overflow protection. 
// If you use an older version of Soliditiy you MUST also use an older version of SafeMath

import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/security/Pausable.sol";
import "./IrVault.sol";

/**
 * @author Oighty. Please contact me on Twitter (@oightytag) or Discord (Oighty #4287) if you have any questions about this contract.
 */

abstract contract rStrategy is AccessControl, ReentrancyGuard, Pausable {
    using SafeMath for uint256;
    using SafeERC20 for IERC20;
    
    //  -------------------- CONTRACT VARIABLES --------------------
    string public name;

    // Tokens and Contracts to Interface with
    IrVault internal immutable _vault; // The vault contract that this strategy is deployed for, immutable
    IERC20 internal immutable _depositToken; // The depositToken that the vault can deposit in this strategy, immutable

    // Access Control
    bytes32 constant OWNER_ROLE = keccak256("OWNER");
    bytes32 constant MANAGER_ROLE = keccak256("MANAGER");
    bytes32 constant VAULT_ROLE = keccak256("VAULT");
    address public owner; // Address that has admin control over the strategy
    address public manager; // Address that calls investment actions on the vault

    // Constants
    uint constant MAX_UNIT = (2 ** 256) - 1;
    uint constant BIG_UNIT = 10 ** 18;

    // Balances
    uint internal _externalContractTokenBalance; // Total balance of deposit tokens provided to external contracts
    uint internal _feeBalance; // Balance of deposit tokens that have been accumulated by the vault as fees

    // Parameters
    uint public feePercent; // Percentage fee for performance and operations (in big units of percent * 10 ** 18)

    //  -------------------- EVENTS --------------------
    event Deposited(address indexed user, uint256 amount);
    event Withdrawn(address indexed user, uint256 amount);
    event Received(address sender, uint amount);
    
    //  -------------------- CONSTRUCTOR FUNCTION --------------------
    constructor(
        string memory _name,
        address _vaultAddr,
        address _depositTokenAddr,
        uint _feePercent,
        address _managerAddr
    ) {
        // Assign initial variable values
        name = _name;
        _vault = IrVault(_vaultAddr);
        _depositToken = IERC20(_depositTokenAddr);
        feePercent = _feePercent;

        // Assign roles for access control
        owner = msg.sender;
        _setupRole(DEFAULT_ADMIN_ROLE, owner);
        _setupRole(OWNER_ROLE, owner);

        manager = _managerAddr;
        _setupRole(MANAGER_ROLE, manager);

        _setupRole(VAULT_ROLE, _vaultAddr);
    }

    //  -------------------- VIEW FUNCTIONS ----------------------
    function totalBalance() public view returns (uint) {
        return _depositToken.balanceOf(address(this)).add(_externalContractTokenBalance).sub(_feeBalance);
    }
    
    function getDepositToken() external view returns (address) {
        return address(_depositToken);
    }

    //  -------------------- UTILITY FUNCTIONS --------------------

    receive() external payable { // Receive function required by the Sushiswap Router
        emit Received(msg.sender, msg.value);
    }

    function _availableBalance() internal view returns (uint) {
        return _depositToken.balanceOf(address(this));
    }

    function _updateFeeBalance(uint _amountNewTokens) internal {
        _feeBalance = _feeBalance.add(
            _amountNewTokens
            .mul(feePercent)
            .div(BIG_UNIT)
        );
    }

    function _invest(uint _amount) internal virtual;
    function _divest(uint _amount) internal virtual;

    //  -------------------- MANAGER FUNCTIONS --------------------


    //  -------------------- OWNER FUNCTIONS ----------------------    
    function setManager(address _managerAddr) external onlyRole(OWNER_ROLE) {
        revokeRole(MANAGER_ROLE, manager);
        manager = _managerAddr;
        grantRole(MANAGER_ROLE, manager);
    }

    function setOwner(address _ownerAddr)  external onlyRole(OWNER_ROLE) {
        address currentOwner = msg.sender;
        owner = _ownerAddr;
        grantRole(OWNER_ROLE, owner);
        grantRole(DEFAULT_ADMIN_ROLE, owner);
        renounceRole(OWNER_ROLE, currentOwner);
        renounceRole(DEFAULT_ADMIN_ROLE, currentOwner);
    }

    function setFeePercent(uint _percent) external onlyRole(OWNER_ROLE) {
        feePercent = _percent;
    }

    function feeBalance() external view onlyRole(OWNER_ROLE) returns (uint) {
        return _feeBalance;
    }

    function withdrawFees() external onlyRole(OWNER_ROLE) nonReentrant {
        require(_feeBalance > 0, "Cannot withdraw 0.");
        // Check if vault has enough to withdraw, otherwise withdraw from the strategy
        uint _balance = _availableBalance();
        if (_balance < _feeBalance) {
            uint _withdraw = _feeBalance.sub(_balance);
            _divest(_withdraw);
            uint _after = _availableBalance();
            uint _diff = _after.sub(_balance);
            if (_diff < _withdraw) { // Check is for deflationary tokens
                _feeBalance = _balance.add(_diff);
            }
        }

        // Transfer the tokens to the owner
        _depositToken.safeTransfer(owner, _feeBalance);

        // Set fee balance to zero
        _feeBalance = 0;
    }

    function pause() external onlyRole(OWNER_ROLE) {
        _pause();
    }

    function unpause() external onlyRole(OWNER_ROLE) {
        _unpause();
    }

    //  -------------------- VAULT FUNCTIONS --------------------
    function deposit(uint _amount) external whenNotPaused nonReentrant onlyRole(VAULT_ROLE) {
        // Require the deposit to be non-zero
        require(_amount > 0, "Cannot deposit 0.");

        // Transfer the staking tokens to the vault
        _depositToken.transferFrom(msg.sender, address(this), _amount);

        // Emit deposit event
        emit Deposited(msg.sender, _amount);
    }
    
    function withdraw(uint _amount) external nonReentrant onlyRole(VAULT_ROLE) {
        // Require the amount be greater than zero and the sender to have a balance greater than or equal to the amount
        require(_amount > 0, "Cannot withdraw 0.");
        require(totalBalance() >= _amount, "Cannot withdraw > your balance.");

        // Check if vault has enough to withdraw, otherwise withdraw from the strategy
        uint _balance = _availableBalance();
        if (_balance < _amount) {
            uint _withdraw = _amount.sub(_balance);
            _divest(_withdraw);
            uint _after = _availableBalance();
            uint _diff = _after.sub(_balance);
            if (_diff < _withdraw) { // Check is for deflationary tokens
                _amount = _balance.add(_diff);
            }
        }

        // Transfer the tokens to the caller
        _depositToken.transfer(msg.sender, _amount);
        emit Withdrawn(msg.sender, _amount);
    }

    function withdrawAll() external nonReentrant onlyRole(VAULT_ROLE) {
        // Require the amount be greater than zero and the sender to have a balance greater than or equal to the amount
        uint _total = totalBalance();
        require(_total >= 0, "Cannot withdraw 0.");

        // Check if vault has enough to withdraw, otherwise withdraw from the strategy
        uint _balance = _availableBalance();
        if (_balance < _total) {
            uint _withdraw = _total.sub(_balance);
            _divest(_withdraw);
            uint _after = _availableBalance();
            uint _diff = _after.sub(_balance);
            if (_diff < _withdraw) { // Check is for deflationary tokens
                _total = _balance.add(_diff);
            }
        }

        // Transfer the tokens to the caller
        _depositToken.transfer(msg.sender, _total);
        emit Withdrawn(msg.sender, _total);
    }
}

File 6 of 20 : IrOracle.sol
pragma solidity ^0.8.0;

interface IrOracle {
    function observationIndexOf(uint timestamp) external view returns (uint8 index);

    // update the cumulative price for the observation at the current timestamp. each observation is updated at most
    // once per epoch period.
    function update(address tokenA, address tokenB) external;

    // returns the amount out corresponding to the amount in for a given token using the moving average over the time
    // range [now - [windowSize, windowSize - periodSize * 2], now]
    // update must have been called for the bucket corresponding to timestamp `now - windowSize`
    function consult(address tokenIn, uint amountIn, address tokenOut) external view returns (uint amountOut);
}

File 7 of 20 : IUniswapV2Router01.sol
pragma solidity >=0.6.2;

interface IUniswapV2Router01 {
    function factory() external pure returns (address);
    function WETH() external pure returns (address);

    function addLiquidity(
        address tokenA,
        address tokenB,
        uint amountADesired,
        uint amountBDesired,
        uint amountAMin,
        uint amountBMin,
        address to,
        uint deadline
    ) external returns (uint amountA, uint amountB, uint liquidity);
    function addLiquidityETH(
        address token,
        uint amountTokenDesired,
        uint amountTokenMin,
        uint amountETHMin,
        address to,
        uint deadline
    ) external payable returns (uint amountToken, uint amountETH, uint liquidity);
    function removeLiquidity(
        address tokenA,
        address tokenB,
        uint liquidity,
        uint amountAMin,
        uint amountBMin,
        address to,
        uint deadline
    ) external returns (uint amountA, uint amountB);
    function removeLiquidityETH(
        address token,
        uint liquidity,
        uint amountTokenMin,
        uint amountETHMin,
        address to,
        uint deadline
    ) external returns (uint amountToken, uint amountETH);
    function removeLiquidityWithPermit(
        address tokenA,
        address tokenB,
        uint liquidity,
        uint amountAMin,
        uint amountBMin,
        address to,
        uint deadline,
        bool approveMax, uint8 v, bytes32 r, bytes32 s
    ) external returns (uint amountA, uint amountB);
    function removeLiquidityETHWithPermit(
        address token,
        uint liquidity,
        uint amountTokenMin,
        uint amountETHMin,
        address to,
        uint deadline,
        bool approveMax, uint8 v, bytes32 r, bytes32 s
    ) external returns (uint amountToken, uint amountETH);
    function swapExactTokensForTokens(
        uint amountIn,
        uint amountOutMin,
        address[] calldata path,
        address to,
        uint deadline
    ) external returns (uint[] memory amounts);
    function swapTokensForExactTokens(
        uint amountOut,
        uint amountInMax,
        address[] calldata path,
        address to,
        uint deadline
    ) external returns (uint[] memory amounts);
    function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline)
        external
        payable
        returns (uint[] memory amounts);
    function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline)
        external
        returns (uint[] memory amounts);
    function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline)
        external
        returns (uint[] memory amounts);
    function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline)
        external
        payable
        returns (uint[] memory amounts);

    function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB);
    function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut);
    function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn);
    function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts);
    function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts);
}

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

pragma solidity ^0.8.0;

import "../IERC20.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 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'
        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) + value;
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
    }

    function safeDecreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        unchecked {
            uint256 oldAllowance = token.allowance(address(this), spender);
            require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
            uint256 newAllowance = oldAllowance - value;
            _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
            require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
        }
    }
}

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

pragma solidity ^0.8.0;

// CAUTION
// This version of SafeMath should only be used with Solidity 0.8 or later,
// because it relies on the compiler's built in overflow checks.

/**
 * @dev Wrappers over Solidity's arithmetic operations.
 *
 * NOTE: `SafeMath` is no longer needed starting with Solidity 0.8. The compiler
 * now has built in overflow checking.
 */
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) {
        unchecked {
            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) {
        unchecked {
            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) {
        unchecked {
            // 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) {
        unchecked {
            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) {
        unchecked {
            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) {
        return a + b;
    }

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

    /**
     * @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.
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        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) {
        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) {
        unchecked {
            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.
     *
     * 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) {
        unchecked {
            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) {
        unchecked {
            require(b > 0, errorMessage);
            return a % b;
        }
    }
}

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

pragma solidity ^0.8.0;

import "./IAccessControl.sol";
import "../utils/Context.sol";
import "../utils/Strings.sol";
import "../utils/introspection/ERC165.sol";

/**
 * @dev Contract module that allows children to implement role-based access
 * control mechanisms. This is a lightweight version that doesn't allow enumerating role
 * members except through off-chain means by accessing the contract event logs. Some
 * applications may benefit from on-chain enumerability, for those cases see
 * {AccessControlEnumerable}.
 *
 * Roles are referred to by their `bytes32` identifier. These should be exposed
 * in the external API and be unique. The best way to achieve this is by
 * using `public constant` hash digests:
 *
 * ```
 * bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
 * ```
 *
 * Roles can be used to represent a set of permissions. To restrict access to a
 * function call, use {hasRole}:
 *
 * ```
 * function foo() public {
 *     require(hasRole(MY_ROLE, msg.sender));
 *     ...
 * }
 * ```
 *
 * Roles can be granted and revoked dynamically via the {grantRole} and
 * {revokeRole} functions. Each role has an associated admin role, and only
 * accounts that have a role's admin role can call {grantRole} and {revokeRole}.
 *
 * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
 * that only accounts with this role will be able to grant or revoke other
 * roles. More complex role relationships can be created by using
 * {_setRoleAdmin}.
 *
 * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
 * grant and revoke this role. Extra precautions should be taken to secure
 * accounts that have been granted it.
 */
abstract contract AccessControl is Context, IAccessControl, ERC165 {
    struct RoleData {
        mapping(address => bool) members;
        bytes32 adminRole;
    }

    mapping(bytes32 => RoleData) private _roles;

    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;

    /**
     * @dev Modifier that checks that an account has a specific role. Reverts
     * with a standardized message including the required role.
     *
     * The format of the revert reason is given by the following regular expression:
     *
     *  /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
     *
     * _Available since v4.1._
     */
    modifier onlyRole(bytes32 role) {
        _checkRole(role, _msgSender());
        _;
    }

    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);
    }

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

    /**
     * @dev Revert with a standard message if `account` is missing `role`.
     *
     * The format of the revert reason is given by the following regular expression:
     *
     *  /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
     */
    function _checkRole(bytes32 role, address account) internal view {
        if (!hasRole(role, account)) {
            revert(
                string(
                    abi.encodePacked(
                        "AccessControl: account ",
                        Strings.toHexString(uint160(account), 20),
                        " is missing role ",
                        Strings.toHexString(uint256(role), 32)
                    )
                )
            );
        }
    }

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

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
        _grantRole(role, account);
    }

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
        _revokeRole(role, account);
    }

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

        _revokeRole(role, account);
    }

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

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

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

    function _revokeRole(bytes32 role, address account) private {
        if (hasRole(role, account)) {
            _roles[role].members[account] = false;
            emit RoleRevoked(role, account, _msgSender());
        }
    }
}

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

pragma solidity ^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() {
        _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 12 of 20 : Pausable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../utils/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() {
        _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 13 of 20 : IrVault.sol
/// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface IrVault {
    //  -------------------- EVENTS --------------------
    event Deposited(address indexed user, uint256 amount);
    event Withdrawn(address indexed user, uint256 amount);
    //  -------------------- VIEW FUNCTIONS --------------------
    function getDepositToken() external view returns (address);
    function totalBalance() external view returns (uint);
    function getPricePerFullShare() external view returns (uint256);
    function getTokensFromShares() external view returns (uint256);
    //  -------------------- ADMIN FUNCTIONS --------------------
    function setStrategy(address _strategyAddr) external;
    function pause() external;
    function unpause() external;
    function emergencyWithdrawFromStrategy() external;
    //  -------------------- USER FUNCTIONS --------------------
    function deposit(uint _amount) external payable;
    function withdraw(uint _shares) external;
    function withdrawAll() external;
}

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

pragma solidity ^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 20 : Address.sol
// SPDX-License-Identifier: MIT

pragma solidity ^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;
        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");

        (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");

        (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");

        (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");

        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal 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

                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

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

pragma solidity ^0.8.0;

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

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

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

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) external view returns (bool);

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {AccessControl-_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) external view returns (bytes32);

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function grantRole(bytes32 role, address account) external;

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function revokeRole(bytes32 role, address account) external;

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

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

pragma solidity ^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 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) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }
}

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

pragma solidity ^0.8.0;

/**
 * @dev String operations.
 */
library Strings {
    bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";

    /**
     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
     */
    function toString(uint256 value) internal pure returns (string memory) {
        // Inspired by OraclizeAPI's implementation - MIT licence
        // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol

        if (value == 0) {
            return "0";
        }
        uint256 temp = value;
        uint256 digits;
        while (temp != 0) {
            digits++;
            temp /= 10;
        }
        bytes memory buffer = new bytes(digits);
        while (value != 0) {
            digits -= 1;
            buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
            value /= 10;
        }
        return string(buffer);
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
     */
    function toHexString(uint256 value) internal pure returns (string memory) {
        if (value == 0) {
            return "0x00";
        }
        uint256 temp = value;
        uint256 length = 0;
        while (temp != 0) {
            length++;
            temp >>= 8;
        }
        return toHexString(value, length);
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
     */
    function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
        bytes memory buffer = new bytes(2 * length + 2);
        buffer[0] = "0";
        buffer[1] = "x";
        for (uint256 i = 2 * length + 1; i > 1; --i) {
            buffer[i] = _HEX_SYMBOLS[value & 0xf];
            value >>= 4;
        }
        require(value == 0, "Strings: hex length insufficient");
        return string(buffer);
    }
}

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

pragma solidity ^0.8.0;

import "./IERC165.sol";

/**
 * @dev Implementation of the {IERC165} interface.
 *
 * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
 * for the additional interface id that will be supported. For example:
 *
 * ```solidity
 * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
 *     return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
 * }
 * ```
 *
 * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
 */
abstract contract ERC165 is IERC165 {
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IERC165).interfaceId;
    }
}

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

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC165 standard, as defined in the
 * https://eips.ethereum.org/EIPS/eip-165[EIP].
 *
 * Implementers can declare support of contract interfaces, which can then be
 * queried by others ({ERC165Checker}).
 *
 * For an implementation, see {ERC165}.
 */
interface IERC165 {
    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) external view returns (bool);
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"string","name":"_name","type":"string"},{"internalType":"address","name":"_vaultAddr","type":"address"},{"internalType":"address","name":"_stakingContractAddr","type":"address"},{"internalType":"address","name":"_stakingTokenAddr","type":"address"},{"internalType":"address","name":"_rewardTokenAddr","type":"address"},{"internalType":"address","name":"_rewardTokenLpAddr","type":"address"},{"internalType":"address","name":"_routerAddr","type":"address"},{"internalType":"uint256","name":"_compoundFrequency","type":"uint256"},{"internalType":"uint256","name":"_feePercent","type":"uint256"},{"internalType":"address","name":"_managerAddr","type":"address"},{"internalType":"address","name":"_oracleAddr","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Compounded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Deposited","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Received","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Withdrawn","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"compound","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"compoundFrequency","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"deposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"divest","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"feeBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"feePercent","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getDepositToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getStakingContract","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"invest","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"lastCompoundTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"manager","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"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":"priceSlippage","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_seconds","type":"uint256"}],"name":"setCompoundFrequency","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_percent","type":"uint256"}],"name":"setFeePercent","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_managerAddr","type":"address"}],"name":"setManager","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_ownerAddr","type":"address"}],"name":"setOwner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_slippage","type":"uint256"}],"name":"setPriceSlippage","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdrawAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdrawFees","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]

60c06040523480156200001157600080fd5b506040516200678a3803806200678a8339818101604052810190620000379190620010e1565b8a8a898585600180819055506000600260006101000a81548160ff02191690831515021790555084600390805190602001906200007692919062000f22565b508373ffffffffffffffffffffffffffffffffffffffff1660808173ffffffffffffffffffffffffffffffffffffffff1660601b815250508273ffffffffffffffffffffffffffffffffffffffff1660a08173ffffffffffffffffffffffffffffffffffffffff1660601b815250508160088190555033600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550620001646000801b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1662000da960201b60201c565b620001b87f6270edb7c868f86fda4adedba75108201087268ea345934db8bad688e1feb91b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1662000da960201b60201c565b80600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506200024d7faf290d8680820aad922855f39b306097b20e28774d6c1ad35a20325630c3a02c600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1662000da960201b60201c565b6200027f7f68fc488efe30251cadb6ac88bdeef3f1a5e6048808baf387258d1d78e986720c8562000da960201b60201c565b505050505088600960006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555087600a60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663d21220a76040518163ffffffff1660e01b815260040160206040518083038186803b1580156200036f57600080fd5b505afa15801562000384573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620003aa919062001089565b600b60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b1580156200045357600080fd5b505afa15801562000468573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200048e919062001089565b600c60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555086600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555085600d60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b158015620005b957600080fd5b505afa158015620005ce573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620005f4919062001089565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555084601060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015620006de57600080fd5b505afa158015620006f3573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000719919062001089565b601160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080601360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550426015819055508360148190555066470de4df820000601681905550660aa87bee538000601781905550600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3867fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b81526004016200084392919062001223565b602060405180830381600087803b1580156200085e57600080fd5b505af115801562000873573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620008999190620010b5565b50600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff161462000b1657600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3867fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b81526004016200096f92919062001223565b602060405180830381600087803b1580156200098a57600080fd5b505af11580156200099f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620009c59190620010b5565b50601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161462000b1557600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3867fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040162000abd92919062001223565b602060405180830381600087803b15801562000ad857600080fd5b505af115801562000aed573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000b139190620010b5565b505b5b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3867fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040162000b9592919062001223565b602060405180830381600087803b15801562000bb057600080fd5b505af115801562000bc5573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000beb9190620010b5565b50600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3867fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040162000c6b92919062001223565b602060405180830381600087803b15801562000c8657600080fd5b505af115801562000c9b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000cc19190620010b5565b50600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b38a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040162000d4192919062001223565b602060405180830381600087803b15801562000d5c57600080fd5b505af115801562000d71573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000d979190620010b5565b50505050505050505050505062001458565b62000dbb828262000dbf60201b60201c565b5050565b62000dd1828262000eb060201b60201c565b62000eac57600160008084815260200190815260200160002060000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555062000e5162000f1a60201b60201c565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45b5050565b600080600084815260200190815260200160002060000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b600033905090565b82805462000f30906200132f565b90600052602060002090601f01602090048101928262000f54576000855562000fa0565b82601f1062000f6f57805160ff191683800117855562000fa0565b8280016001018555821562000fa0579182015b8281111562000f9f57825182559160200191906001019062000f82565b5b50905062000faf919062000fb3565b5090565b5b8082111562000fce57600081600090555060010162000fb4565b5090565b600062000fe962000fe38462001279565b62001250565b9050828152602081018484840111156200100257600080fd5b6200100f848285620012f9565b509392505050565b60008151905062001028816200140a565b92915050565b6000815190506200103f8162001424565b92915050565b600082601f8301126200105757600080fd5b81516200106984826020860162000fd2565b91505092915050565b60008151905062001083816200143e565b92915050565b6000602082840312156200109c57600080fd5b6000620010ac8482850162001017565b91505092915050565b600060208284031215620010c857600080fd5b6000620010d8848285016200102e565b91505092915050565b60008060008060008060008060008060006101608c8e0312156200110457600080fd5b60008c015167ffffffffffffffff8111156200111f57600080fd5b6200112d8e828f0162001045565b9b50506020620011408e828f0162001017565b9a50506040620011538e828f0162001017565b9950506060620011668e828f0162001017565b9850506080620011798e828f0162001017565b97505060a06200118c8e828f0162001017565b96505060c06200119f8e828f0162001017565b95505060e0620011b28e828f0162001072565b945050610100620011c68e828f0162001072565b935050610120620011da8e828f0162001017565b925050610140620011ee8e828f0162001017565b9150509295989b509295989b9093969950565b6200120c81620012af565b82525050565b6200121d81620012ef565b82525050565b60006040820190506200123a600083018562001201565b62001249602083018462001212565b9392505050565b60006200125c6200126f565b90506200126a828262001365565b919050565b6000604051905090565b600067ffffffffffffffff821115620012975762001296620013ca565b5b620012a282620013f9565b9050602081019050919050565b6000620012bc82620012cf565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b60005b8381101562001319578082015181840152602081019050620012fc565b8381111562001329576000848401525b50505050565b600060028204905060018216806200134857607f821691505b602082108114156200135f576200135e6200139b565b5b50919050565b6200137082620013f9565b810181811067ffffffffffffffff82111715620013925762001391620013ca565b5b80604052505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b6200141581620012af565b81146200142157600080fd5b50565b6200142f81620012c3565b81146200143b57600080fd5b50565b6200144981620012ef565b81146200145557600080fd5b50565b60805160601c60a05160601c6152df620014ab60003960008181610c2901528181610f890152818161122501528181611490015281816116650152818161329801526134c20152600050506152df6000f3fe6080604052600436106101f25760003560e01c8063853828b61161010d578063bbfe5d7f116100a0578063e3ebc30a1161006f578063e3ebc30a146106bd578063e586fd8b146106e6578063e7f714281461070f578063f69e20461461073a578063fb1b5c7b1461074457610232565b8063bbfe5d7f14610615578063d0ebdbe714610640578063d547741f14610669578063dd7d46701461069257610232565b806391d14854116100dc57806391d1485414610559578063a217fddf14610596578063ad7a672f146105c1578063b6b55f25146105ec57610232565b8063853828b6146104c35780638ca17995146104da5780638da5cb5b146105035780638e68dce41461052e57610232565b80633f4ba83a1161018557806360b71d4e1161015457806360b71d4e1461042d5780637ce3489b146104585780637fd6f15c146104815780638456cb59146104ac57610232565b80633f4ba83a146103a9578063476343ee146103c0578063481c6a75146103d75780635c975abb1461040257610232565b80632afcf480116101c15780632afcf480146103055780632e1a7d4d1461032e5780632f2ff15d1461035757806336568abe1461038057610232565b806301ffc9a71461023757806306fdde031461027457806313af40351461029f578063248a9ca3146102c857610232565b36610232577f88a5966d370b9919b20f3e2c13ff65706f196a4e32cc2c12bf57088f8852587433346040516102289291906147ab565b60405180910390a1005b600080fd5b34801561024357600080fd5b5061025e60048036038101906102599190614224565b61076f565b60405161026b919061480b565b60405180910390f35b34801561028057600080fd5b506102896107e9565b6040516102969190614841565b60405180910390f35b3480156102ab57600080fd5b506102c660048036038101906102c1919061412c565b610877565b005b3480156102d457600080fd5b506102ef60048036038101906102ea91906141bf565b6109a6565b6040516102fc9190614826565b60405180910390f35b34801561031157600080fd5b5061032c6004803603810190610327919061429c565b6109c5565b005b34801561033a57600080fd5b506103556004803603810190610350919061429c565b610aa1565b005b34801561036357600080fd5b5061037e600480360381019061037991906141e8565b610d2f565b005b34801561038c57600080fd5b506103a760048036038101906103a291906141e8565b610d58565b005b3480156103b557600080fd5b506103be610ddb565b005b3480156103cc57600080fd5b506103d5610e18565b005b3480156103e357600080fd5b506103ec610fe0565b6040516103f991906146db565b60405180910390f35b34801561040e57600080fd5b50610417611006565b604051610424919061480b565b60405180910390f35b34801561043957600080fd5b5061044261101d565b60405161044f91906149e3565b60405180910390f35b34801561046457600080fd5b5061047f600480360381019061047a919061429c565b61105a565b005b34801561048d57600080fd5b50610496611097565b6040516104a391906149e3565b60405180910390f35b3480156104b857600080fd5b506104c161109d565b005b3480156104cf57600080fd5b506104d86110da565b005b3480156104e657600080fd5b5061050160048036038101906104fc919061429c565b61132b565b005b34801561050f57600080fd5b506105186113bf565b60405161052591906146db565b60405180910390f35b34801561053a57600080fd5b506105436113e5565b60405161055091906146db565b60405180910390f35b34801561056557600080fd5b50610580600480360381019061057b91906141e8565b61140f565b60405161058d919061480b565b60405180910390f35b3480156105a257600080fd5b506105ab611479565b6040516105b89190614826565b60405180910390f35b3480156105cd57600080fd5b506105d6611480565b6040516105e391906149e3565b60405180910390f35b3480156105f857600080fd5b50610613600480360381019061060e919061429c565b611558565b005b34801561062157600080fd5b5061062a61176c565b60405161063791906149e3565b60405180910390f35b34801561064c57600080fd5b506106676004803603810190610662919061412c565b611772565b005b34801561067557600080fd5b50610690600480360381019061068b91906141e8565b611881565b005b34801561069e57600080fd5b506106a76118aa565b6040516106b491906149e3565b60405180910390f35b3480156106c957600080fd5b506106e460048036038101906106df919061429c565b6118b0565b005b3480156106f257600080fd5b5061070d6004803603810190610708919061429c565b6118ed565b005b34801561071b57600080fd5b5061072461192a565b60405161073191906149e3565b60405180910390f35b610742611967565b005b34801561075057600080fd5b50610759613294565b60405161076691906146db565b60405180910390f35b60007f7965db0b000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614806107e257506107e1826132bc565b5b9050919050565b600380546107f690614dee565b80601f016020809104026020016040519081016040528092919081815260200182805461082290614dee565b801561086f5780601f106108445761010080835404028352916020019161086f565b820191906000526020600020905b81548152906001019060200180831161085257829003601f168201915b505050505081565b7f6270edb7c868f86fda4adedba75108201087268ea345934db8bad688e1feb91b6108a9816108a4613326565b61332e565b600033905082600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061093b7f6270edb7c868f86fda4adedba75108201087268ea345934db8bad688e1feb91b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610d2f565b61096a6000801b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610d2f565b6109947f6270edb7c868f86fda4adedba75108201087268ea345934db8bad688e1feb91b82610d58565b6109a16000801b82610d58565b505050565b6000806000838152602001908152602001600020600101549050919050565b6109cd611006565b15610a0d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a0490614903565b60405180910390fd5b60026001541415610a53576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a4a906149a3565b60405180910390fd5b60026001819055507faf290d8680820aad922855f39b306097b20e28774d6c1ad35a20325630c3a02c610a8d81610a88613326565b61332e565b610a96826133cb565b506001808190555050565b60026001541415610ae7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ade906149a3565b60405180910390fd5b60026001819055507f68fc488efe30251cadb6ac88bdeef3f1a5e6048808baf387258d1d78e986720c610b2181610b1c613326565b61332e565b60008211610b64576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b5b90614923565b60405180910390fd5b81610b6d611480565b1015610bae576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ba590614943565b60405180910390fd5b6000610bb86134be565b905082811015610c27576000610bd7828561356e90919063ffffffff16565b9050610be281613584565b6000610bec6134be565b90506000610c03848361356e90919063ffffffff16565b905082811015610c2357610c20818561362f90919063ffffffff16565b95505b5050505b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33856040518363ffffffff1660e01b8152600401610c829291906147ab565b602060405180830381600087803b158015610c9c57600080fd5b505af1158015610cb0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cd49190614196565b503373ffffffffffffffffffffffffffffffffffffffff167f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d584604051610d1b91906149e3565b60405180910390a250506001808190555050565b610d38826109a6565b610d4981610d44613326565b61332e565b610d538383613645565b505050565b610d60613326565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614610dcd576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610dc4906149c3565b60405180910390fd5b610dd78282613725565b5050565b7f6270edb7c868f86fda4adedba75108201087268ea345934db8bad688e1feb91b610e0d81610e08613326565b61332e565b610e15613806565b50565b7f6270edb7c868f86fda4adedba75108201087268ea345934db8bad688e1feb91b610e4a81610e45613326565b61332e565b60026001541415610e90576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e87906149a3565b60405180910390fd5b6002600181905550600060075411610edd576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ed490614923565b60405180910390fd5b6000610ee76134be565b9050600754811015610f5e576000610f0a8260075461356e90919063ffffffff16565b9050610f1581613584565b6000610f1f6134be565b90506000610f36848361356e90919063ffffffff16565b905082811015610f5a57610f53818561362f90919063ffffffff16565b6007819055505b5050505b610fcd600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166007547f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166138a89092919063ffffffff16565b6000600781905550506001808190555050565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600260009054906101000a900460ff16905090565b60007f6270edb7c868f86fda4adedba75108201087268ea345934db8bad688e1feb91b6110518161104c613326565b61332e565b60075491505090565b7f6270edb7c868f86fda4adedba75108201087268ea345934db8bad688e1feb91b61108c81611087613326565b61332e565b816008819055505050565b60085481565b7f6270edb7c868f86fda4adedba75108201087268ea345934db8bad688e1feb91b6110cf816110ca613326565b61332e565b6110d761392e565b50565b60026001541415611120576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611117906149a3565b60405180910390fd5b60026001819055507f68fc488efe30251cadb6ac88bdeef3f1a5e6048808baf387258d1d78e986720c61115a81611155613326565b61332e565b6000611164611480565b905060008110156111aa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111a190614923565b60405180910390fd5b60006111b46134be565b9050818110156112235760006111d3828461356e90919063ffffffff16565b90506111de81613584565b60006111e86134be565b905060006111ff848361356e90919063ffffffff16565b90508281101561121f5761121c818561362f90919063ffffffff16565b94505b5050505b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33846040518363ffffffff1660e01b815260040161127e9291906147ab565b602060405180830381600087803b15801561129857600080fd5b505af11580156112ac573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112d09190614196565b503373ffffffffffffffffffffffffffffffffffffffff167f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d58360405161131791906149e3565b60405180910390a250505060018081905550565b60026001541415611371576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611368906149a3565b60405180910390fd5b60026001819055507faf290d8680820aad922855f39b306097b20e28774d6c1ad35a20325630c3a02c6113ab816113a6613326565b61332e565b6113b482613584565b506001808190555050565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b600080600084815260200190815260200160002060000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b6000801b81565b60006115536007546115456006547f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b81526004016114e791906146db565b60206040518083038186803b1580156114ff57600080fd5b505afa158015611513573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061153791906142c5565b61362f90919063ffffffff16565b61356e90919063ffffffff16565b905090565b611560611006565b156115a0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161159790614903565b60405180910390fd5b600260015414156115e6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115dd906149a3565b60405180910390fd5b60026001819055507f68fc488efe30251cadb6ac88bdeef3f1a5e6048808baf387258d1d78e986720c6116208161161b613326565b61332e565b60008211611663576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161165a90614883565b60405180910390fd5b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166323b872dd3330856040518463ffffffff1660e01b81526004016116c0939291906146f6565b602060405180830381600087803b1580156116da57600080fd5b505af11580156116ee573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117129190614196565b503373ffffffffffffffffffffffffffffffffffffffff167f2da466a7b24304f47e87fa2e1e5a81b9831ce54fec19055ce277ca2f39ba42c48360405161175991906149e3565b60405180910390a2506001808190555050565b60145481565b7f6270edb7c868f86fda4adedba75108201087268ea345934db8bad688e1feb91b6117a48161179f613326565b61332e565b6117f07faf290d8680820aad922855f39b306097b20e28774d6c1ad35a20325630c3a02c600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16611881565b81600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061187d7faf290d8680820aad922855f39b306097b20e28774d6c1ad35a20325630c3a02c600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610d2f565b5050565b61188a826109a6565b61189b81611896613326565b61332e565b6118a58383613725565b505050565b60155481565b7f6270edb7c868f86fda4adedba75108201087268ea345934db8bad688e1feb91b6118e2816118dd613326565b61332e565b816016819055505050565b7f6270edb7c868f86fda4adedba75108201087268ea345934db8bad688e1feb91b61191f8161191a613326565b61332e565b816014819055505050565b60007f6270edb7c868f86fda4adedba75108201087268ea345934db8bad688e1feb91b61195e81611959613326565b61332e565b60165491505090565b61196f611006565b156119af576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119a690614903565b60405180910390fd5b600260015414156119f5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119ec906149a3565b60405180910390fd5b60026001819055507faf290d8680820aad922855f39b306097b20e28774d6c1ad35a20325630c3a02c611a2f81611a2a613326565b61332e565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16630572b0cc6040518163ffffffff1660e01b8152600401600060405180830381600087803b158015611a9957600080fd5b505af1158015611aad573d6000803e3d6000fd5b505050506000600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401611b0e91906146db565b60206040518083038186803b158015611b2657600080fd5b505afa158015611b3a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b5e91906142c5565b905060008060008060008060006060600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614156122d857600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b158015611c4d57600080fd5b505afa158015611c61573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c85919061424d565b826dffffffffffffffffffffffffffff169250816dffffffffffffffffffffffffffff169150508093508194505050601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663054d50d4611d27670de0b6b3a7640000611d196706f05b59d3b200008e6139d190919063ffffffff16565b6139e790919063ffffffff16565b84866040518463ffffffff1660e01b8152600401611d4793929190614ab1565b60206040518083038186803b158015611d5f57600080fd5b505afa158015611d73573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d9791906142c5565b9750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16638c86f1e4600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16611e2f670de0b6b3a7640000611e216706f05b59d3b200008f6139d190919063ffffffff16565b6139e790919063ffffffff16565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040518463ffffffff1660e01b8152600401611e70939291906147d4565b60206040518083038186803b158015611e8857600080fd5b505afa158015611e9c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ec091906142c5565b9350611f1f670de0b6b3a7640000611f11611f02601654611ef4601754670de0b6b3a764000061356e90919063ffffffff16565b61356e90919063ffffffff16565b876139d190919063ffffffff16565b6139e790919063ffffffff16565b8810158015611f8a5750611f86670de0b6b3a7640000611f78611f69601654611f5b601754670de0b6b3a764000061356e90919063ffffffff16565b61362f90919063ffffffff16565b876139d190919063ffffffff16565b6139e790919063ffffffff16565b8811155b611fc9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611fc0906148c3565b60405180910390fd5b6012600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506012600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166338ed1739612146670de0b6b3a76400006121386706f05b59d3b200008e6139d190919063ffffffff16565b6139e790919063ffffffff16565b8a601230601e426121579190614bb4565b6040518663ffffffff1660e01b8152600401612177959493929190614a57565b600060405180830381600087803b15801561219157600080fd5b505af11580156121a5573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f820116820180604052508101906121ce9190614155565b90508060018151811061220a577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020026020010151955060609050601260006122269190613fb0565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b815260040161228191906146db565b60206040518083038186803b15801561229957600080fd5b505afa1580156122ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122d191906142c5565b9450612fb2565b6012600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506012600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506012600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663d06ca61f8a60126040518363ffffffff1660e01b81526004016124c59291906149fe565b60006040518083038186803b1580156124dd57600080fd5b505afa1580156124f1573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f8201168201806040525081019061251a9190614155565b905080600281518110612556577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020026020010151965060609050601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16638c86f1e4600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040518463ffffffff1660e01b8152600401612607939291906147d4565b60206040518083038186803b15801561261f57600080fd5b505afa158015612633573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061265791906142c5565b9350601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16638c86f1e4600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1686600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040518463ffffffff1660e01b81526004016126fc939291906147d4565b60206040518083038186803b15801561271457600080fd5b505afa158015612728573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061274c91906142c5565b93506127ab670de0b6b3a764000061279d61278e601654612780601754670de0b6b3a764000061356e90919063ffffffff16565b61356e90919063ffffffff16565b876139d190919063ffffffff16565b6139e790919063ffffffff16565b87101580156128165750612812670de0b6b3a76400006128046127f56016546127e7601754670de0b6b3a764000061356e90919063ffffffff16565b61362f90919063ffffffff16565b876139d190919063ffffffff16565b6139e790919063ffffffff16565b8711155b612855576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161284c906148c3565b60405180910390fd5b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166338ed17398a896012306014426128a59190614bb4565b6040518663ffffffff1660e01b81526004016128c5959493929190614a57565b600060405180830381600087803b1580156128df57600080fd5b505af11580156128f3573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f8201168201806040525081019061291c9190614155565b9050612994670de0b6b3a76400006129866706f05b59d3b2000084600281518110612970577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200260200101516139d190919063ffffffff16565b6139e790919063ffffffff16565b945060609050601260006129a89190613fb0565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b158015612a1057600080fd5b505afa158015612a24573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a48919061424d565b826dffffffffffffffffffffffffffff169250816dffffffffffffffffffffffffffff169150508093508194505050601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663054d50d48684866040518463ffffffff1660e01b8152600401612ad693929190614ab1565b60206040518083038186803b158015612aee57600080fd5b505afa158015612b02573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b2691906142c5565b9750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16638c86f1e4600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1687600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040518463ffffffff1660e01b8152600401612bcb939291906147d4565b60206040518083038186803b158015612be357600080fd5b505afa158015612bf7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c1b91906142c5565b9350612c7a670de0b6b3a7640000612c6c612c5d601654612c4f601754670de0b6b3a764000061356e90919063ffffffff16565b61356e90919063ffffffff16565b876139d190919063ffffffff16565b6139e790919063ffffffff16565b8810158015612ce55750612ce1670de0b6b3a7640000612cd3612cc4601654612cb6601754670de0b6b3a764000061356e90919063ffffffff16565b61362f90919063ffffffff16565b876139d190919063ffffffff16565b6139e790919063ffffffff16565b8811155b612d24576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612d1b906148c3565b60405180910390fd5b6012600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506012600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166338ed1739868a601230602842612e7e9190614bb4565b6040518663ffffffff1660e01b8152600401612e9e959493929190614a57565b600060405180830381600087803b158015612eb857600080fd5b505af1158015612ecc573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f82011682018060405250810190612ef59190614155565b5060126000612f049190613fb0565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401612f5f91906146db565b60206040518083038186803b158015612f7757600080fd5b505afa158015612f8b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612faf91906142c5565b95505b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663054d50d48785856040518463ffffffff1660e01b815260040161301193929190614ab1565b60206040518083038186803b15801561302957600080fd5b505afa15801561303d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061306191906142c5565b9650601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad615dec8884866040518463ffffffff1660e01b81526004016130c293929190614ab1565b60206040518083038186803b1580156130da57600080fd5b505afa1580156130ee573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061311291906142c5565b97506000601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663e8e33700600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168a8a8e8e30603c426131ac9190614bb4565b6040518963ffffffff1660e01b81526004016131cf98979695949392919061472d565b606060405180830381600087803b1580156131e957600080fd5b505af11580156131fd573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061322191906142ee565b9250505061322e816139fd565b5061323f61323a6134be565b6133cb565b426015819055507f8082b0dab6d73a8025e5f15e4fdd54b68197a613e361810d4a2446c634b98ada6015548a604051613279929190614a2e565b60405180910390a15050505050505050505060018081905550565b60007f0000000000000000000000000000000000000000000000000000000000000000905090565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b600033905090565b613338828261140f565b6133c75761335d8173ffffffffffffffffffffffffffffffffffffffff166014613a49565b61336b8360001c6020613a49565b60405160200161337c9291906146a1565b6040516020818303038152906040526040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016133be9190614841565b60405180910390fd5b5050565b6133d3611006565b15613413576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161340a90614903565b60405180910390fd5b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16631bf6ddae826040518263ffffffff1660e01b815260040161346e91906149e3565b600060405180830381600087803b15801561348857600080fd5b505af115801561349c573d6000803e3d6000fd5b505050506134b58160065461362f90919063ffffffff16565b60068190555050565b60007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b815260040161351991906146db565b60206040518083038186803b15801561353157600080fd5b505afa158015613545573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061356991906142c5565b905090565b6000818361357c9190614c95565b905092915050565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663939624ab826040518263ffffffff1660e01b81526004016135df91906149e3565b600060405180830381600087803b1580156135f957600080fd5b505af115801561360d573d6000803e3d6000fd5b505050506136268160065461356e90919063ffffffff16565b60068190555050565b6000818361363d9190614bb4565b905092915050565b61364f828261140f565b61372157600160008084815260200190815260200160002060000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506136c6613326565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45b5050565b61372f828261140f565b1561380257600080600084815260200190815260200160002060000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506137a7613326565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16837ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b60405160405180910390a45b5050565b61380e611006565b61384d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401613844906148a3565b60405180910390fd5b6000600260006101000a81548160ff0219169083151502179055507f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa613891613326565b60405161389e91906146db565b60405180910390a1565b6139298363a9059cbb60e01b84846040516024016138c79291906147ab565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050613d43565b505050565b613936611006565b15613976576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161396d90614903565b60405180910390fd5b6001600260006101000a81548160ff0219169083151502179055507f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586139ba613326565b6040516139c791906146db565b60405180910390a1565b600081836139df9190614c3b565b905092915050565b600081836139f59190614c0a565b905092915050565b613a40613a2f670de0b6b3a7640000613a21600854856139d190919063ffffffff16565b6139e790919063ffffffff16565b60075461362f90919063ffffffff16565b60078190555050565b606060006002836002613a5c9190614c3b565b613a669190614bb4565b67ffffffffffffffff811115613aa5577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015613ad75781602001600182028036833780820191505090505b5090507f300000000000000000000000000000000000000000000000000000000000000081600081518110613b35577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f780000000000000000000000000000000000000000000000000000000000000081600181518110613bbf577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060006001846002613bff9190614c3b565b613c099190614bb4565b90505b6001811115613cf5577f3031323334353637383961626364656600000000000000000000000000000000600f861660108110613c71577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b1a60f81b828281518110613cae577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600485901c945080613cee90614dc4565b9050613c0c565b5060008414613d39576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401613d3090614863565b60405180910390fd5b8091505092915050565b6000613da5826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16613e0a9092919063ffffffff16565b9050600081511115613e055780806020019051810190613dc59190614196565b613e04576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401613dfb90614983565b60405180910390fd5b5b505050565b6060613e198484600085613e22565b90509392505050565b606082471015613e67576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401613e5e906148e3565b60405180910390fd5b613e7085613f36565b613eaf576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401613ea690614963565b60405180910390fd5b6000808673ffffffffffffffffffffffffffffffffffffffff168587604051613ed8919061468a565b60006040518083038185875af1925050503d8060008114613f15576040519150601f19603f3d011682016040523d82523d6000602084013e613f1a565b606091505b5091509150613f2a828286613f49565b92505050949350505050565b600080823b905060008111915050919050565b60608315613f5957829050613fa9565b600083511115613f6c5782518084602001fd5b816040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401613fa09190614841565b60405180910390fd5b9392505050565b5080546000825590600052602060002090810190613fce9190613fd1565b50565b5b80821115613fea576000816000905550600101613fd2565b5090565b6000614001613ffc84614b0d565b614ae8565b9050808382526020820190508285602086028201111561402057600080fd5b60005b8581101561405057816140368882614102565b845260208401935060208301925050600181019050614023565b5050509392505050565b60008135905061406981615208565b92915050565b600082601f83011261408057600080fd5b8151614090848260208601613fee565b91505092915050565b6000815190506140a88161521f565b92915050565b6000813590506140bd81615236565b92915050565b6000813590506140d28161524d565b92915050565b6000815190506140e781615264565b92915050565b6000813590506140fc8161527b565b92915050565b6000815190506141118161527b565b92915050565b60008151905061412681615292565b92915050565b60006020828403121561413e57600080fd5b600061414c8482850161405a565b91505092915050565b60006020828403121561416757600080fd5b600082015167ffffffffffffffff81111561418157600080fd5b61418d8482850161406f565b91505092915050565b6000602082840312156141a857600080fd5b60006141b684828501614099565b91505092915050565b6000602082840312156141d157600080fd5b60006141df848285016140ae565b91505092915050565b600080604083850312156141fb57600080fd5b6000614209858286016140ae565b925050602061421a8582860161405a565b9150509250929050565b60006020828403121561423657600080fd5b6000614244848285016140c3565b91505092915050565b60008060006060848603121561426257600080fd5b6000614270868287016140d8565b9350506020614281868287016140d8565b925050604061429286828701614117565b9150509250925092565b6000602082840312156142ae57600080fd5b60006142bc848285016140ed565b91505092915050565b6000602082840312156142d757600080fd5b60006142e584828501614102565b91505092915050565b60008060006060848603121561430357600080fd5b600061431186828701614102565b935050602061432286828701614102565b925050604061433386828701614102565b9150509250925092565b60006143498383614355565b60208301905092915050565b61435e81614ce9565b82525050565b61436d81614ce9565b82525050565b600061437e82614b4e565b6143888185614b7c565b935061439383614b39565b8060005b838110156143cb576143a882614f27565b6143b2888261433d565b97506143bd83614b6f565b925050600181019050614397565b5085935050505092915050565b6143e181614cfb565b82525050565b6143f081614d07565b82525050565b600061440182614b59565b61440b8185614b8d565b935061441b818560208601614d91565b80840191505092915050565b600061443282614b64565b61443c8185614b98565b935061444c818560208601614d91565b61445581614f3a565b840191505092915050565b600061446b82614b64565b6144758185614ba9565b9350614485818560208601614d91565b80840191505092915050565b600061449e602083614b98565b91506144a982614f58565b602082019050919050565b60006144c1601183614b98565b91506144cc82614f81565b602082019050919050565b60006144e4601483614b98565b91506144ef82614faa565b602082019050919050565b6000614507601483614b98565b915061451282614fd3565b602082019050919050565b600061452a602683614b98565b915061453582614ffc565b604082019050919050565b600061454d601083614b98565b91506145588261504b565b602082019050919050565b6000614570601283614b98565b915061457b82615074565b602082019050919050565b6000614593601f83614b98565b915061459e8261509d565b602082019050919050565b60006145b6601d83614b98565b91506145c1826150c6565b602082019050919050565b60006145d9601783614ba9565b91506145e4826150ef565b601782019050919050565b60006145fc602a83614b98565b915061460782615118565b604082019050919050565b600061461f601f83614b98565b915061462a82615167565b602082019050919050565b6000614642601183614ba9565b915061464d82615190565b601182019050919050565b6000614665602f83614b98565b9150614670826151b9565b604082019050919050565b61468481614d77565b82525050565b600061469682846143f6565b915081905092915050565b60006146ac826145cc565b91506146b88285614460565b91506146c382614635565b91506146cf8284614460565b91508190509392505050565b60006020820190506146f06000830184614364565b92915050565b600060608201905061470b6000830186614364565b6147186020830185614364565b614725604083018461467b565b949350505050565b600061010082019050614743600083018b614364565b614750602083018a614364565b61475d604083018961467b565b61476a606083018861467b565b614777608083018761467b565b61478460a083018661467b565b61479160c0830185614364565b61479e60e083018461467b565b9998505050505050505050565b60006040820190506147c06000830185614364565b6147cd602083018461467b565b9392505050565b60006060820190506147e96000830186614364565b6147f6602083018561467b565b6148036040830184614364565b949350505050565b600060208201905061482060008301846143d8565b92915050565b600060208201905061483b60008301846143e7565b92915050565b6000602082019050818103600083015261485b8184614427565b905092915050565b6000602082019050818103600083015261487c81614491565b9050919050565b6000602082019050818103600083015261489c816144b4565b9050919050565b600060208201905081810360008301526148bc816144d7565b9050919050565b600060208201905081810360008301526148dc816144fa565b9050919050565b600060208201905081810360008301526148fc8161451d565b9050919050565b6000602082019050818103600083015261491c81614540565b9050919050565b6000602082019050818103600083015261493c81614563565b9050919050565b6000602082019050818103600083015261495c81614586565b9050919050565b6000602082019050818103600083015261497c816145a9565b9050919050565b6000602082019050818103600083015261499c816145ef565b9050919050565b600060208201905081810360008301526149bc81614612565b9050919050565b600060208201905081810360008301526149dc81614658565b9050919050565b60006020820190506149f8600083018461467b565b92915050565b6000604082019050614a13600083018561467b565b8181036020830152614a258184614373565b90509392505050565b6000604082019050614a43600083018561467b565b614a50602083018461467b565b9392505050565b600060a082019050614a6c600083018861467b565b614a79602083018761467b565b8181036040830152614a8b8186614373565b9050614a9a6060830185614364565b614aa7608083018461467b565b9695505050505050565b6000606082019050614ac6600083018661467b565b614ad3602083018561467b565b614ae0604083018461467b565b949350505050565b6000614af2614b03565b9050614afe8282614e3a565b919050565b6000604051905090565b600067ffffffffffffffff821115614b2857614b27614ef8565b5b602082029050602081019050919050565b60008190508160005260206000209050919050565b600081549050919050565b600081519050919050565b600081519050919050565b6000600182019050919050565b600082825260208201905092915050565b600081905092915050565b600082825260208201905092915050565b600081905092915050565b6000614bbf82614d77565b9150614bca83614d77565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115614bff57614bfe614e6b565b5b828201905092915050565b6000614c1582614d77565b9150614c2083614d77565b925082614c3057614c2f614e9a565b5b828204905092915050565b6000614c4682614d77565b9150614c5183614d77565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615614c8a57614c89614e6b565b5b828202905092915050565b6000614ca082614d77565b9150614cab83614d77565b925082821015614cbe57614cbd614e6b565b5b828203905092915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000614cf482614d57565b9050919050565b60008115159050919050565b6000819050919050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b60006dffffffffffffffffffffffffffff82169050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600063ffffffff82169050919050565b60005b83811015614daf578082015181840152602081019050614d94565b83811115614dbe576000848401525b50505050565b6000614dcf82614d77565b91506000821415614de357614de2614e6b565b5b600182039050919050565b60006002820490506001821680614e0657607f821691505b60208210811415614e1a57614e19614ec9565b5b50919050565b6000614e33614e2e83614f4b565b614cc9565b9050919050565b614e4382614f3a565b810181811067ffffffffffffffff82111715614e6257614e61614ef8565b5b80604052505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000614f338254614e20565b9050919050565b6000601f19601f8301169050919050565b60008160001c9050919050565b7f537472696e67733a20686578206c656e67746820696e73756666696369656e74600082015250565b7f43616e6e6f74206465706f73697420302e000000000000000000000000000000600082015250565b7f5061757361626c653a206e6f7420706175736564000000000000000000000000600082015250565b7f5072696365206f7574206f6620626f756e64732e000000000000000000000000600082015250565b7f416464726573733a20696e73756666696369656e742062616c616e636520666f60008201527f722063616c6c0000000000000000000000000000000000000000000000000000602082015250565b7f5061757361626c653a2070617573656400000000000000000000000000000000600082015250565b7f43616e6e6f7420776974686472617720302e0000000000000000000000000000600082015250565b7f43616e6e6f74207769746864726177203e20796f75722062616c616e63652e00600082015250565b7f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000600082015250565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000600082015250565b7f5361666545524332303a204552433230206f7065726174696f6e20646964206e60008201527f6f74207375636365656400000000000000000000000000000000000000000000602082015250565b7f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00600082015250565b7f206973206d697373696e6720726f6c6520000000000000000000000000000000600082015250565b7f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560008201527f20726f6c657320666f722073656c660000000000000000000000000000000000602082015250565b61521181614ce9565b811461521c57600080fd5b50565b61522881614cfb565b811461523357600080fd5b50565b61523f81614d07565b811461524a57600080fd5b50565b61525681614d11565b811461526157600080fd5b50565b61526d81614d3d565b811461527857600080fd5b50565b61528481614d77565b811461528f57600080fd5b50565b61529b81614d81565b81146152a657600080fd5b5056fea2646970667358221220b0cb1e1f4a1902fc068b008f358bef7baa61f6e92ef4ac59a78729f56b89e5ef64736f6c634300080400330000000000000000000000000000000000000000000000000000000000000160000000000000000000000000dc679b7b1e396a67ec3e3a2d0c0c2b75930fe2fd0000000000000000000000003bfc2f02d8d7e09902d203dff3ad6c0e1a614106000000000000000000000000abee7668a96c49d27886d1a8914a54a5f9805041000000000000000000000000cd7361ac3307d1c5a46b63086a90742ff44c63b30000000000000000000000002e7d6490526c7d7e2fdea5c6ec4b0d1b9f8b25b70000000000000000000000001b02da8cb0d097eb8d57a175b88c7d8b479975060000000000000000000000000000000000000000000000000000000000000e100000000000000000000000000000000000000000000000000058d15e176280000000000000000000000000009ada2d55b11298adb88a6168ebd28d69d3ab545f0000000000000000000000009cba03cbb5995537e5fd1ac119f77789b46c616a0000000000000000000000000000000000000000000000000000000000000022436f6d706f756e6420415552554d2f55534443204c50205374726174656779207632000000000000000000000000000000000000000000000000000000000000

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

0000000000000000000000000000000000000000000000000000000000000160000000000000000000000000dc679b7b1e396a67ec3e3a2d0c0c2b75930fe2fd0000000000000000000000003bfc2f02d8d7e09902d203dff3ad6c0e1a614106000000000000000000000000abee7668a96c49d27886d1a8914a54a5f9805041000000000000000000000000cd7361ac3307d1c5a46b63086a90742ff44c63b30000000000000000000000002e7d6490526c7d7e2fdea5c6ec4b0d1b9f8b25b70000000000000000000000001b02da8cb0d097eb8d57a175b88c7d8b479975060000000000000000000000000000000000000000000000000000000000000e100000000000000000000000000000000000000000000000000058d15e176280000000000000000000000000009ada2d55b11298adb88a6168ebd28d69d3ab545f0000000000000000000000009cba03cbb5995537e5fd1ac119f77789b46c616a0000000000000000000000000000000000000000000000000000000000000022436f6d706f756e6420415552554d2f55534443204c50205374726174656779207632000000000000000000000000000000000000000000000000000000000000

-----Decoded View---------------
Arg [0] : _name (string): Compound AURUM/USDC LP Strategy v2
Arg [1] : _vaultAddr (address): 0xdc679b7b1e396a67ec3e3a2d0c0c2b75930fe2fd
Arg [2] : _stakingContractAddr (address): 0x3bfc2f02d8d7e09902d203dff3ad6c0e1a614106
Arg [3] : _stakingTokenAddr (address): 0xabee7668a96c49d27886d1a8914a54a5f9805041
Arg [4] : _rewardTokenAddr (address): 0xcd7361ac3307d1c5a46b63086a90742ff44c63b3
Arg [5] : _rewardTokenLpAddr (address): 0x2e7d6490526c7d7e2fdea5c6ec4b0d1b9f8b25b7
Arg [6] : _routerAddr (address): 0x1b02da8cb0d097eb8d57a175b88c7d8b47997506
Arg [7] : _compoundFrequency (uint256): 3600
Arg [8] : _feePercent (uint256): 25000000000000000
Arg [9] : _managerAddr (address): 0x9ada2d55b11298adb88a6168ebd28d69d3ab545f
Arg [10] : _oracleAddr (address): 0x9cba03cbb5995537e5fd1ac119f77789b46c616a

-----Encoded View---------------
14 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000160
Arg [1] : 000000000000000000000000dc679b7b1e396a67ec3e3a2d0c0c2b75930fe2fd
Arg [2] : 0000000000000000000000003bfc2f02d8d7e09902d203dff3ad6c0e1a614106
Arg [3] : 000000000000000000000000abee7668a96c49d27886d1a8914a54a5f9805041
Arg [4] : 000000000000000000000000cd7361ac3307d1c5a46b63086a90742ff44c63b3
Arg [5] : 0000000000000000000000002e7d6490526c7d7e2fdea5c6ec4b0d1b9f8b25b7
Arg [6] : 0000000000000000000000001b02da8cb0d097eb8d57a175b88c7d8b47997506
Arg [7] : 0000000000000000000000000000000000000000000000000000000000000e10
Arg [8] : 0000000000000000000000000000000000000000000000000058d15e17628000
Arg [9] : 0000000000000000000000009ada2d55b11298adb88a6168ebd28d69d3ab545f
Arg [10] : 0000000000000000000000009cba03cbb5995537e5fd1ac119f77789b46c616a
Arg [11] : 0000000000000000000000000000000000000000000000000000000000000022
Arg [12] : 436f6d706f756e6420415552554d2f55534443204c5020537472617465677920
Arg [13] : 7632000000000000000000000000000000000000000000000000000000000000


Block Transaction Gas Used Reward
Age Block Fee Address BC Fee Address Voting Power Jailed Incoming
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.