Contract Address Details
contract

0xdDCbf776dF3dE60163066A5ddDF2277cB445E0F3

Contract Name
MiniChefV2
Creator
0x8f54c8–976312 at 0x358d8a–e777e8
Balance
0 xDAI ( )
Tokens
Fetching tokens...
Transactions
32,794 Transactions
Transfers
39,460 Transfers
Gas Used
4,583,295,139
Last Balance Update
22248855
Contract name:
MiniChefV2




Optimization enabled
true
Compiler version
v0.6.12+commit.27d51765




Optimization runs
200
EVM Version
default




Verified at
2021-06-19T11:24:07.580228Z

Constructor Arguments

0000000000000000000000002995d1317dcd4f0ab89f4ae60f3f020a4f17c7ce

Arg [0] (address) : 0x2995d1317dcd4f0ab89f4ae60f3f020a4f17c7ce

              

Contract source code

/**
 *Submitted for verification at polygonscan.com on 2021-06-09
*/

// Sources flattened with hardhat v2.0.11 https://hardhat.org

// File @boringcrypto/boring-solidity/contracts/libraries/[email protected]

// SPDX-License-Identifier: MIT

pragma solidity 0.6.12;
// a library for performing overflow-safe math, updated with awesomeness from of DappHub (https://github.com/dapphub/ds-math)
library BoringMath {
    function add(uint256 a, uint256 b) internal pure returns (uint256 c) {require((c = a + b) >= b, "BoringMath: Add Overflow");}
    function sub(uint256 a, uint256 b) internal pure returns (uint256 c) {require((c = a - b) <= a, "BoringMath: Underflow");}
    function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {require(b == 0 || (c = a * b)/b == a, "BoringMath: Mul Overflow");}
    function to128(uint256 a) internal pure returns (uint128 c) {
        require(a <= uint128(-1), "BoringMath: uint128 Overflow");
        c = uint128(a);
    }
    function to64(uint256 a) internal pure returns (uint64 c) {
        require(a <= uint64(-1), "BoringMath: uint64 Overflow");
        c = uint64(a);
    }
    function to32(uint256 a) internal pure returns (uint32 c) {
        require(a <= uint32(-1), "BoringMath: uint32 Overflow");
        c = uint32(a);
    }
}

library BoringMath128 {
    function add(uint128 a, uint128 b) internal pure returns (uint128 c) {require((c = a + b) >= b, "BoringMath: Add Overflow");}
    function sub(uint128 a, uint128 b) internal pure returns (uint128 c) {require((c = a - b) <= a, "BoringMath: Underflow");}
}

library BoringMath64 {
    function add(uint64 a, uint64 b) internal pure returns (uint64 c) {require((c = a + b) >= b, "BoringMath: Add Overflow");}
    function sub(uint64 a, uint64 b) internal pure returns (uint64 c) {require((c = a - b) <= a, "BoringMath: Underflow");}
}

library BoringMath32 {
    function add(uint32 a, uint32 b) internal pure returns (uint32 c) {require((c = a + b) >= b, "BoringMath: Add Overflow");}
    function sub(uint32 a, uint32 b) internal pure returns (uint32 c) {require((c = a - b) <= a, "BoringMath: Underflow");}
}


// File @boringcrypto/boring-solidity/contracts/interfaces/[email protected]

pragma solidity 0.6.12;

interface IERC20 {
    function totalSupply() external view returns (uint256);
    function balanceOf(address account) external view returns (uint256);
    function allowance(address owner, address spender) external view returns (uint256);
    function approve(address spender, uint256 amount) external returns (bool);
    event Transfer(address indexed from, address indexed to, uint256 value);
    event Approval(address indexed owner, address indexed spender, uint256 value);

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


// File @boringcrypto/boring-solidity/contracts/libraries/[email protected]

pragma solidity 0.6.12;
library BoringERC20 {
    function safeSymbol(IERC20 token) internal view returns(string memory) {
        (bool success, bytes memory data) = address(token).staticcall(abi.encodeWithSelector(0x95d89b41));
        return success && data.length > 0 ? abi.decode(data, (string)) : "???";
    }

    function safeName(IERC20 token) internal view returns(string memory) {
        (bool success, bytes memory data) = address(token).staticcall(abi.encodeWithSelector(0x06fdde03));
        return success && data.length > 0 ? abi.decode(data, (string)) : "???";
    }

    function safeDecimals(IERC20 token) internal view returns (uint8) {
        (bool success, bytes memory data) = address(token).staticcall(abi.encodeWithSelector(0x313ce567));
        return success && data.length == 32 ? abi.decode(data, (uint8)) : 18;
    }

    function safeTransfer(IERC20 token, address to, uint256 amount) internal {
        (bool success, bytes memory data) = address(token).call(abi.encodeWithSelector(0xa9059cbb, to, amount));
        require(success && (data.length == 0 || abi.decode(data, (bool))), "BoringERC20: Transfer failed");
    }

    function safeTransferFrom(IERC20 token, address from, address to, uint256 amount) internal {
        (bool success, bytes memory data) = address(token).call(abi.encodeWithSelector(0x23b872dd, from, to, amount));
        require(success && (data.length == 0 || abi.decode(data, (bool))), "BoringERC20: TransferFrom failed");
    }
}


// File @boringcrypto/boring-solidity/contracts/[email protected]

// Audit on 5-Jan-2021 by Keno and BoringCrypto

// P1 - P3: OK
pragma solidity 0.6.12;
// solhint-disable avoid-low-level-calls
// T1 - T4: OK
contract BaseBoringBatchable {
    function _getRevertMsg(bytes memory _returnData) internal pure returns (string memory) {
        // If the _res length is less than 68, then the transaction failed silently (without a revert message)
        if (_returnData.length < 68) return "Transaction reverted silently";

        assembly {
            // Slice the sighash.
            _returnData := add(_returnData, 0x04)
        }
        return abi.decode(_returnData, (string)); // All that remains is the revert string
    }    
    
    // F3 - F9: OK
    // F1: External is ok here because this is the batch function, adding it to a batch makes no sense
    // F2: Calls in the batch may be payable, delegatecall operates in the same context, so each call in the batch has access to msg.value
    // C1 - C21: OK
    // C3: The length of the loop is fully under user control, so can't be exploited
    // C7: Delegatecall is only used on the same contract, so it's safe
    function batch(bytes[] calldata calls, bool revertOnFail) external payable returns(bool[] memory successes, bytes[] memory results) {
        // Interactions
        successes = new bool[](calls.length);
        results = new bytes[](calls.length);
        for (uint256 i = 0; i < calls.length; i++) {
            (bool success, bytes memory result) = address(this).delegatecall(calls[i]);
            require(success || !revertOnFail, _getRevertMsg(result));
            successes[i] = success;
            results[i] = result;
        }
    }
}

// T1 - T4: OK
contract BoringBatchable is BaseBoringBatchable {
    // F1 - F9: OK
    // F6: Parameters can be used front-run the permit and the user's permit will fail (due to nonce or other revert)
    //     if part of a batch this could be used to grief once as the second call would not need the permit
    // C1 - C21: OK
    function permitToken(IERC20 token, address from, address to, uint256 amount, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {
        // Interactions
        // X1 - X5
        token.permit(from, to, amount, deadline, v, r, s);
    }
}


// File @boringcrypto/boring-solidity/contracts/[email protected]

// Audit on 5-Jan-2021 by Keno and BoringCrypto

// P1 - P3: OK
pragma solidity 0.6.12;

// Source: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/access/Ownable.sol + Claimable.sol
// Edited by BoringCrypto

// T1 - T4: OK
contract BoringOwnableData {
    // V1 - V5: OK
    address public owner;
    // V1 - V5: OK
    address public pendingOwner;
}

// T1 - T4: OK
contract BoringOwnable is BoringOwnableData {
    // E1: OK
    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    constructor () public {
        owner = msg.sender;
        emit OwnershipTransferred(address(0), msg.sender);
    }

    // F1 - F9: OK
    // C1 - C21: OK
    function transferOwnership(address newOwner, bool direct, bool renounce) public onlyOwner {
        if (direct) {
            // Checks
            require(newOwner != address(0) || renounce, "Ownable: zero address");

            // Effects
            emit OwnershipTransferred(owner, newOwner);
            owner = newOwner;
            pendingOwner = address(0);
        } else {
            // Effects
            pendingOwner = newOwner;
        }
    }

    // F1 - F9: OK
    // C1 - C21: OK
    function claimOwnership() public {
        address _pendingOwner = pendingOwner;
        
        // Checks
        require(msg.sender == _pendingOwner, "Ownable: caller != pending owner");

        // Effects
        emit OwnershipTransferred(owner, _pendingOwner);
        owner = _pendingOwner;
        pendingOwner = address(0);
    }

    // M1 - M5: OK
    // C1 - C21: OK
    modifier onlyOwner() {
        require(msg.sender == owner, "Ownable: caller is not the owner");
        _;
    }
}


// File contracts/libraries/SignedSafeMath.sol

pragma solidity 0.6.12;

library SignedSafeMath {
    int256 constant private _INT256_MIN = -2**255;

    /**
     * @dev Returns the multiplication of two signed integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `*` operator.
     *
     * Requirements:
     *
     * - Multiplication cannot overflow.
     */
    function mul(int256 a, int256 b) internal pure returns (int256) {
        // 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 0;
        }

        require(!(a == -1 && b == _INT256_MIN), "SignedSafeMath: multiplication overflow");

        int256 c = a * b;
        require(c / a == b, "SignedSafeMath: multiplication overflow");

        return c;
    }

    /**
     * @dev Returns the integer division of two signed integers. Reverts 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(int256 a, int256 b) internal pure returns (int256) {
        require(b != 0, "SignedSafeMath: division by zero");
        require(!(b == -1 && a == _INT256_MIN), "SignedSafeMath: division overflow");

        int256 c = a / b;

        return c;
    }

    /**
     * @dev Returns the subtraction of two signed integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(int256 a, int256 b) internal pure returns (int256) {
        int256 c = a - b;
        require((b >= 0 && c <= a) || (b < 0 && c > a), "SignedSafeMath: subtraction overflow");

        return c;
    }

    /**
     * @dev Returns the addition of two signed integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `+` operator.
     *
     * Requirements:
     *
     * - Addition cannot overflow.
     */
    function add(int256 a, int256 b) internal pure returns (int256) {
        int256 c = a + b;
        require((b >= 0 && c >= a) || (b < 0 && c < a), "SignedSafeMath: addition overflow");

        return c;
    }

    function toUInt256(int256 a) internal pure returns (uint256) {
        require(a >= 0, "Integer < 0");
        return uint256(a);
    }
}


// File contracts/interfaces/IRewarder.sol

pragma solidity 0.6.12;

interface IRewarder {
    using BoringERC20 for IERC20;
    function onSushiReward(uint256 pid, address user, address recipient, uint256 sushiAmount, uint256 newLpAmount) external;
    function pendingTokens(uint256 pid, address user, uint256 sushiAmount) external view returns (IERC20[] memory, uint256[] memory);
}


// File contracts/interfaces/IMasterChef.sol

pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;

interface IMasterChef {
    using BoringERC20 for IERC20;
    struct UserInfo {
        uint256 amount;     // How many LP tokens the user has provided.
        uint256 rewardDebt; // Reward debt. See explanation below.
    }

    struct PoolInfo {
        IERC20 lpToken;           // Address of LP token contract.
        uint256 allocPoint;       // How many allocation points assigned to this pool. SUSHI to distribute per block.
        uint256 lastRewardBlock;  // Last block number that SUSHI distribution occurs.
        uint256 accSushiPerShare; // Accumulated SUSHI per share, times 1e12. See below.
    }

    function poolInfo(uint256 pid) external view returns (IMasterChef.PoolInfo memory);
    function totalAllocPoint() external view returns (uint256);
    function deposit(uint256 _pid, uint256 _amount) external;
}


// File contracts/MiniChefV2.sol

pragma solidity 0.6.12;

interface IMigratorChef {
    // Take the current LP token address and return the new LP token address.
    // Migrator should have full access to the caller's LP token.
    function migrate(IERC20 token) external returns (IERC20);
}

/// @notice The (older) MasterChef contract gives out a constant number of SUSHI tokens per block.
/// It is the only address with minting rights for SUSHI.
/// The idea for this MasterChef V2 (MCV2) contract is therefore to be the owner of a dummy token
/// that is deposited into the MasterChef V1 (MCV1) contract.
/// The allocation point for this pool on MCV1 is the total allocation point for all pools that receive double incentives.
contract MiniChefV2 is BoringOwnable, BoringBatchable {
    using BoringMath for uint256;
    using BoringMath128 for uint128;
    using BoringERC20 for IERC20;
    using SignedSafeMath for int256;

    /// @notice Info of each MCV2 user.
    /// `amount` LP token amount the user has provided.
    /// `rewardDebt` The amount of SUSHI entitled to the user.
    struct UserInfo {
        uint256 amount;
        int256 rewardDebt;
    }

    /// @notice Info of each MCV2 pool.
    /// `allocPoint` The amount of allocation points assigned to the pool.
    /// Also known as the amount of SUSHI to distribute per block.
    struct PoolInfo {
        uint128 accSushiPerShare;
        uint64 lastRewardTime;
        uint64 allocPoint;
    }

    /// @notice Address of SUSHI contract.
    IERC20 public immutable SUSHI;
    // @notice The migrator contract. It has a lot of power. Can only be set through governance (owner).
    IMigratorChef public migrator;

    /// @notice Info of each MCV2 pool.
    PoolInfo[] public poolInfo;
    /// @notice Address of the LP token for each MCV2 pool.
    IERC20[] public lpToken;
    /// @notice Address of each `IRewarder` contract in MCV2.
    IRewarder[] public rewarder;

    /// @notice Info of each user that stakes LP tokens.
    mapping (uint256 => mapping (address => UserInfo)) public userInfo;
    /// @dev Total allocation points. Must be the sum of all allocation points in all pools.
    uint256 public totalAllocPoint;

    uint256 public sushiPerSecond;
    uint256 private constant ACC_SUSHI_PRECISION = 1e12;

    event Deposit(address indexed user, uint256 indexed pid, uint256 amount, address indexed to);
    event Withdraw(address indexed user, uint256 indexed pid, uint256 amount, address indexed to);
    event EmergencyWithdraw(address indexed user, uint256 indexed pid, uint256 amount, address indexed to);
    event Harvest(address indexed user, uint256 indexed pid, uint256 amount);
    event LogPoolAddition(uint256 indexed pid, uint256 allocPoint, IERC20 indexed lpToken, IRewarder indexed rewarder);
    event LogSetPool(uint256 indexed pid, uint256 allocPoint, IRewarder indexed rewarder, bool overwrite);
    event LogUpdatePool(uint256 indexed pid, uint64 lastRewardTime, uint256 lpSupply, uint256 accSushiPerShare);
    event LogSushiPerSecond(uint256 sushiPerSecond);

    /// @param _sushi The SUSHI token contract address.
    constructor(IERC20 _sushi) public {
        SUSHI = _sushi;
    }

    /// @notice Returns the number of MCV2 pools.
    function poolLength() public view returns (uint256 pools) {
        pools = poolInfo.length;
    }

    /// @notice Add a new LP to the pool. Can only be called by the owner.
    /// DO NOT add the same LP token more than once. Rewards will be messed up if you do.
    /// @param allocPoint AP of the new pool.
    /// @param _lpToken Address of the LP ERC-20 token.
    /// @param _rewarder Address of the rewarder delegate.
    function add(uint256 allocPoint, IERC20 _lpToken, IRewarder _rewarder) public onlyOwner {
        totalAllocPoint = totalAllocPoint.add(allocPoint);
        lpToken.push(_lpToken);
        rewarder.push(_rewarder);

        poolInfo.push(PoolInfo({
            allocPoint: allocPoint.to64(),
            lastRewardTime: block.timestamp.to64(),
            accSushiPerShare: 0
        }));
        emit LogPoolAddition(lpToken.length.sub(1), allocPoint, _lpToken, _rewarder);
    }

    /// @notice Update the given pool's SUSHI allocation point and `IRewarder` contract. Can only be called by the owner.
    /// @param _pid The index of the pool. See `poolInfo`.
    /// @param _allocPoint New AP of the pool.
    /// @param _rewarder Address of the rewarder delegate.
    /// @param overwrite True if _rewarder should be `set`. Otherwise `_rewarder` is ignored.
    function set(uint256 _pid, uint256 _allocPoint, IRewarder _rewarder, bool overwrite) public onlyOwner {
        totalAllocPoint = totalAllocPoint.sub(poolInfo[_pid].allocPoint).add(_allocPoint);
        poolInfo[_pid].allocPoint = _allocPoint.to64();
        if (overwrite) { rewarder[_pid] = _rewarder; }
        emit LogSetPool(_pid, _allocPoint, overwrite ? _rewarder : rewarder[_pid], overwrite);
    }

    /// @notice Sets the sushi per second to be distributed. Can only be called by the owner.
    /// @param _sushiPerSecond The amount of Sushi to be distributed per second.
    function setSushiPerSecond(uint256 _sushiPerSecond) public onlyOwner {
        sushiPerSecond = _sushiPerSecond;
        emit LogSushiPerSecond(_sushiPerSecond);
    }

    /// @notice Set the `migrator` contract. Can only be called by the owner.
    /// @param _migrator The contract address to set.
    function setMigrator(IMigratorChef _migrator) public onlyOwner {
        migrator = _migrator;
    }

    /// @notice Migrate LP token to another LP contract through the `migrator` contract.
    /// @param _pid The index of the pool. See `poolInfo`.
    function migrate(uint256 _pid) public {
        require(address(migrator) != address(0), "MasterChefV2: no migrator set");
        IERC20 _lpToken = lpToken[_pid];
        uint256 bal = _lpToken.balanceOf(address(this));
        _lpToken.approve(address(migrator), bal);
        IERC20 newLpToken = migrator.migrate(_lpToken);
        require(bal == newLpToken.balanceOf(address(this)), "MasterChefV2: migrated balance must match");
        lpToken[_pid] = newLpToken;
    }

    /// @notice View function to see pending SUSHI on frontend.
    /// @param _pid The index of the pool. See `poolInfo`.
    /// @param _user Address of user.
    /// @return pending SUSHI reward for a given user.
    function pendingSushi(uint256 _pid, address _user) external view returns (uint256 pending) {
        PoolInfo memory pool = poolInfo[_pid];
        UserInfo storage user = userInfo[_pid][_user];
        uint256 accSushiPerShare = pool.accSushiPerShare;
        uint256 lpSupply = lpToken[_pid].balanceOf(address(this));
        if (block.timestamp > pool.lastRewardTime && lpSupply != 0) {
            uint256 time = block.timestamp.sub(pool.lastRewardTime);
            uint256 sushiReward = time.mul(sushiPerSecond).mul(pool.allocPoint) / totalAllocPoint;
            accSushiPerShare = accSushiPerShare.add(sushiReward.mul(ACC_SUSHI_PRECISION) / lpSupply);
        }
        pending = int256(user.amount.mul(accSushiPerShare) / ACC_SUSHI_PRECISION).sub(user.rewardDebt).toUInt256();
    }

    /// @notice Update reward variables for all pools. Be careful of gas spending!
    /// @param pids Pool IDs of all to be updated. Make sure to update all active pools.
    function massUpdatePools(uint256[] calldata pids) external {
        uint256 len = pids.length;
        for (uint256 i = 0; i < len; ++i) {
            updatePool(pids[i]);
        }
    }

    /// @notice Update reward variables of the given pool.
    /// @param pid The index of the pool. See `poolInfo`.
    /// @return pool Returns the pool that was updated.
    function updatePool(uint256 pid) public returns (PoolInfo memory pool) {
        pool = poolInfo[pid];
        if (block.timestamp > pool.lastRewardTime) {
            uint256 lpSupply = lpToken[pid].balanceOf(address(this));
            if (lpSupply > 0) {
                uint256 time = block.timestamp.sub(pool.lastRewardTime);
                uint256 sushiReward = time.mul(sushiPerSecond).mul(pool.allocPoint) / totalAllocPoint;
                pool.accSushiPerShare = pool.accSushiPerShare.add((sushiReward.mul(ACC_SUSHI_PRECISION) / lpSupply).to128());
            }
            pool.lastRewardTime = block.timestamp.to64();
            poolInfo[pid] = pool;
            emit LogUpdatePool(pid, pool.lastRewardTime, lpSupply, pool.accSushiPerShare);
        }
    }

    /// @notice Deposit LP tokens to MCV2 for SUSHI allocation.
    /// @param pid The index of the pool. See `poolInfo`.
    /// @param amount LP token amount to deposit.
    /// @param to The receiver of `amount` deposit benefit.
    function deposit(uint256 pid, uint256 amount, address to) public {
        PoolInfo memory pool = updatePool(pid);
        UserInfo storage user = userInfo[pid][to];

        // Effects
        user.amount = user.amount.add(amount);
        user.rewardDebt = user.rewardDebt.add(int256(amount.mul(pool.accSushiPerShare) / ACC_SUSHI_PRECISION));

        // Interactions
        IRewarder _rewarder = rewarder[pid];
        if (address(_rewarder) != address(0)) {
            _rewarder.onSushiReward(pid, to, to, 0, user.amount);
        }

        lpToken[pid].safeTransferFrom(msg.sender, address(this), amount);

        emit Deposit(msg.sender, pid, amount, to);
    }

    /// @notice Withdraw LP tokens from MCV2.
    /// @param pid The index of the pool. See `poolInfo`.
    /// @param amount LP token amount to withdraw.
    /// @param to Receiver of the LP tokens.
    function withdraw(uint256 pid, uint256 amount, address to) public {
        PoolInfo memory pool = updatePool(pid);
        UserInfo storage user = userInfo[pid][msg.sender];

        // Effects
        user.rewardDebt = user.rewardDebt.sub(int256(amount.mul(pool.accSushiPerShare) / ACC_SUSHI_PRECISION));
        user.amount = user.amount.sub(amount);

        // Interactions
        IRewarder _rewarder = rewarder[pid];
        if (address(_rewarder) != address(0)) {
            _rewarder.onSushiReward(pid, msg.sender, to, 0, user.amount);
        }
        
        lpToken[pid].safeTransfer(to, amount);

        emit Withdraw(msg.sender, pid, amount, to);
    }

    /// @notice Harvest proceeds for transaction sender to `to`.
    /// @param pid The index of the pool. See `poolInfo`.
    /// @param to Receiver of SUSHI rewards.
    function harvest(uint256 pid, address to) public {
        PoolInfo memory pool = updatePool(pid);
        UserInfo storage user = userInfo[pid][msg.sender];
        int256 accumulatedSushi = int256(user.amount.mul(pool.accSushiPerShare) / ACC_SUSHI_PRECISION);
        uint256 _pendingSushi = accumulatedSushi.sub(user.rewardDebt).toUInt256();

        // Effects
        user.rewardDebt = accumulatedSushi;

        // Interactions
        if (_pendingSushi != 0) {
            SUSHI.safeTransfer(to, _pendingSushi);
        }
        
        IRewarder _rewarder = rewarder[pid];
        if (address(_rewarder) != address(0)) {
            _rewarder.onSushiReward( pid, msg.sender, to, _pendingSushi, user.amount);
        }

        emit Harvest(msg.sender, pid, _pendingSushi);
    }
    
    /// @notice Withdraw LP tokens from MCV2 and harvest proceeds for transaction sender to `to`.
    /// @param pid The index of the pool. See `poolInfo`.
    /// @param amount LP token amount to withdraw.
    /// @param to Receiver of the LP tokens and SUSHI rewards.
    function withdrawAndHarvest(uint256 pid, uint256 amount, address to) public {
        PoolInfo memory pool = updatePool(pid);
        UserInfo storage user = userInfo[pid][msg.sender];
        int256 accumulatedSushi = int256(user.amount.mul(pool.accSushiPerShare) / ACC_SUSHI_PRECISION);
        uint256 _pendingSushi = accumulatedSushi.sub(user.rewardDebt).toUInt256();

        // Effects
        user.rewardDebt = accumulatedSushi.sub(int256(amount.mul(pool.accSushiPerShare) / ACC_SUSHI_PRECISION));
        user.amount = user.amount.sub(amount);
        
        // Interactions
        SUSHI.safeTransfer(to, _pendingSushi);

        IRewarder _rewarder = rewarder[pid];
        if (address(_rewarder) != address(0)) {
            _rewarder.onSushiReward(pid, msg.sender, to, _pendingSushi, user.amount);
        }

        lpToken[pid].safeTransfer(to, amount);

        emit Withdraw(msg.sender, pid, amount, to);
        emit Harvest(msg.sender, pid, _pendingSushi);
    }

    /// @notice Withdraw without caring about rewards. EMERGENCY ONLY.
    /// @param pid The index of the pool. See `poolInfo`.
    /// @param to Receiver of the LP tokens.
    function emergencyWithdraw(uint256 pid, address to) public {
        UserInfo storage user = userInfo[pid][msg.sender];
        uint256 amount = user.amount;
        user.amount = 0;
        user.rewardDebt = 0;

        IRewarder _rewarder = rewarder[pid];
        if (address(_rewarder) != address(0)) {
            _rewarder.onSushiReward(pid, msg.sender, to, 0, 0);
        }

        // Note: transfer can fail or succeed if `amount` is zero.
        lpToken[pid].safeTransfer(to, amount);
        emit EmergencyWithdraw(msg.sender, pid, amount, to);
    }
}
        

Contract ABI

[{"type":"constructor","stateMutability":"nonpayable","inputs":[{"type":"address","name":"_sushi","internalType":"contract IERC20"}]},{"type":"event","name":"Deposit","inputs":[{"type":"address","name":"user","internalType":"address","indexed":true},{"type":"uint256","name":"pid","internalType":"uint256","indexed":true},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false},{"type":"address","name":"to","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"EmergencyWithdraw","inputs":[{"type":"address","name":"user","internalType":"address","indexed":true},{"type":"uint256","name":"pid","internalType":"uint256","indexed":true},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false},{"type":"address","name":"to","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"Harvest","inputs":[{"type":"address","name":"user","internalType":"address","indexed":true},{"type":"uint256","name":"pid","internalType":"uint256","indexed":true},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"LogPoolAddition","inputs":[{"type":"uint256","name":"pid","internalType":"uint256","indexed":true},{"type":"uint256","name":"allocPoint","internalType":"uint256","indexed":false},{"type":"address","name":"lpToken","internalType":"contract IERC20","indexed":true},{"type":"address","name":"rewarder","internalType":"contract IRewarder","indexed":true}],"anonymous":false},{"type":"event","name":"LogSetPool","inputs":[{"type":"uint256","name":"pid","internalType":"uint256","indexed":true},{"type":"uint256","name":"allocPoint","internalType":"uint256","indexed":false},{"type":"address","name":"rewarder","internalType":"contract IRewarder","indexed":true},{"type":"bool","name":"overwrite","internalType":"bool","indexed":false}],"anonymous":false},{"type":"event","name":"LogSushiPerSecond","inputs":[{"type":"uint256","name":"sushiPerSecond","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"LogUpdatePool","inputs":[{"type":"uint256","name":"pid","internalType":"uint256","indexed":true},{"type":"uint64","name":"lastRewardTime","internalType":"uint64","indexed":false},{"type":"uint256","name":"lpSupply","internalType":"uint256","indexed":false},{"type":"uint256","name":"accSushiPerShare","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"OwnershipTransferred","inputs":[{"type":"address","name":"previousOwner","internalType":"address","indexed":true},{"type":"address","name":"newOwner","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"Withdraw","inputs":[{"type":"address","name":"user","internalType":"address","indexed":true},{"type":"uint256","name":"pid","internalType":"uint256","indexed":true},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false},{"type":"address","name":"to","internalType":"address","indexed":true}],"anonymous":false},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract IERC20"}],"name":"SUSHI","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"add","inputs":[{"type":"uint256","name":"allocPoint","internalType":"uint256"},{"type":"address","name":"_lpToken","internalType":"contract IERC20"},{"type":"address","name":"_rewarder","internalType":"contract IRewarder"}]},{"type":"function","stateMutability":"payable","outputs":[{"type":"bool[]","name":"successes","internalType":"bool[]"},{"type":"bytes[]","name":"results","internalType":"bytes[]"}],"name":"batch","inputs":[{"type":"bytes[]","name":"calls","internalType":"bytes[]"},{"type":"bool","name":"revertOnFail","internalType":"bool"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"claimOwnership","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"deposit","inputs":[{"type":"uint256","name":"pid","internalType":"uint256"},{"type":"uint256","name":"amount","internalType":"uint256"},{"type":"address","name":"to","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"emergencyWithdraw","inputs":[{"type":"uint256","name":"pid","internalType":"uint256"},{"type":"address","name":"to","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"harvest","inputs":[{"type":"uint256","name":"pid","internalType":"uint256"},{"type":"address","name":"to","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract IERC20"}],"name":"lpToken","inputs":[{"type":"uint256","name":"","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"massUpdatePools","inputs":[{"type":"uint256[]","name":"pids","internalType":"uint256[]"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"migrate","inputs":[{"type":"uint256","name":"_pid","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract IMigratorChef"}],"name":"migrator","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"owner","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"pendingOwner","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"pending","internalType":"uint256"}],"name":"pendingSushi","inputs":[{"type":"uint256","name":"_pid","internalType":"uint256"},{"type":"address","name":"_user","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"permitToken","inputs":[{"type":"address","name":"token","internalType":"contract IERC20"},{"type":"address","name":"from","internalType":"address"},{"type":"address","name":"to","internalType":"address"},{"type":"uint256","name":"amount","internalType":"uint256"},{"type":"uint256","name":"deadline","internalType":"uint256"},{"type":"uint8","name":"v","internalType":"uint8"},{"type":"bytes32","name":"r","internalType":"bytes32"},{"type":"bytes32","name":"s","internalType":"bytes32"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint128","name":"accSushiPerShare","internalType":"uint128"},{"type":"uint64","name":"lastRewardTime","internalType":"uint64"},{"type":"uint64","name":"allocPoint","internalType":"uint64"}],"name":"poolInfo","inputs":[{"type":"uint256","name":"","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"pools","internalType":"uint256"}],"name":"poolLength","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract IRewarder"}],"name":"rewarder","inputs":[{"type":"uint256","name":"","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"set","inputs":[{"type":"uint256","name":"_pid","internalType":"uint256"},{"type":"uint256","name":"_allocPoint","internalType":"uint256"},{"type":"address","name":"_rewarder","internalType":"contract IRewarder"},{"type":"bool","name":"overwrite","internalType":"bool"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setMigrator","inputs":[{"type":"address","name":"_migrator","internalType":"contract IMigratorChef"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setSushiPerSecond","inputs":[{"type":"uint256","name":"_sushiPerSecond","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"sushiPerSecond","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"totalAllocPoint","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferOwnership","inputs":[{"type":"address","name":"newOwner","internalType":"address"},{"type":"bool","name":"direct","internalType":"bool"},{"type":"bool","name":"renounce","internalType":"bool"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"tuple","name":"pool","internalType":"struct MiniChefV2.PoolInfo","components":[{"type":"uint128","name":"accSushiPerShare","internalType":"uint128"},{"type":"uint64","name":"lastRewardTime","internalType":"uint64"},{"type":"uint64","name":"allocPoint","internalType":"uint64"}]}],"name":"updatePool","inputs":[{"type":"uint256","name":"pid","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"amount","internalType":"uint256"},{"type":"int256","name":"rewardDebt","internalType":"int256"}],"name":"userInfo","inputs":[{"type":"uint256","name":"","internalType":"uint256"},{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"withdraw","inputs":[{"type":"uint256","name":"pid","internalType":"uint256"},{"type":"uint256","name":"amount","internalType":"uint256"},{"type":"address","name":"to","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"withdrawAndHarvest","inputs":[{"type":"uint256","name":"pid","internalType":"uint256"},{"type":"uint256","name":"amount","internalType":"uint256"},{"type":"address","name":"to","internalType":"address"}]}]
            

Deployed ByteCode

0x6080604052600436106101b75760003560e01c80637c516e94116100ec578063a06e408b1161008a578063c346253d11610064578063c346253d146104be578063d1abb907146104de578063d2423b51146104fe578063e30c39781461051f576101b7565b8063a06e408b14610474578063ab560e1014610489578063ab7de0981461049e576101b7565b80638da5cb5b116100c65780638da5cb5b146103f15780638dbdbe6d1461040657806393f1a40b146104265780639baf58c314610454576101b7565b80637c516e941461039c5780637cd07e47146103bc57806388bba42f146103d1576101b7565b806323cf3118116101595780634e71e0c8116101335780634e71e0c81461030d57806351eb05a61461032257806357a5b58c1461034f57806378ed5d1f1461036f576101b7565b806323cf3118146102ad5780632f940c70146102cd578063454b0608146102ed576101b7565b80631526fe27116101955780631526fe271461022957806317caf6f11461025857806318fccc761461026d578063195426ec1461028d576101b7565b8063078dfbe7146101bc578063081e3eda146101de5780630ad58d2f14610209575b600080fd5b3480156101c857600080fd5b506101dc6101d736600461217d565b610534565b005b3480156101ea57600080fd5b506101f3610623565b6040516102009190612a03565b60405180910390f35b34801561021557600080fd5b506101dc610224366004612459565b610629565b34801561023557600080fd5b506102496102443660046123c4565b6107b9565b604051610200939291906129d9565b34801561026457600080fd5b506101f36107fb565b34801561027957600080fd5b506101dc6102883660046123f4565b610801565b34801561029957600080fd5b506101f36102a83660046123f4565b61099b565b3480156102b957600080fd5b506101dc6102c836600461230e565b610b9b565b3480156102d957600080fd5b506101dc6102e83660046123f4565b610be7565b3480156102f957600080fd5b506101dc6103083660046123c4565b610d08565b34801561031957600080fd5b506101dc610fb4565b34801561032e57600080fd5b5061034261033d3660046123c4565b611041565b60405161020091906129a0565b34801561035b57600080fd5b506101dc61036a366004612210565b6112c5565b34801561037b57600080fd5b5061038f61038a3660046123c4565b6112fb565b6040516102009190612527565b3480156103a857600080fd5b506101dc6103b7366004612287565b611322565b3480156103c857600080fd5b5061038f611396565b3480156103dd57600080fd5b506101dc6103ec366004612486565b6113a5565b3480156103fd57600080fd5b5061038f611512565b34801561041257600080fd5b506101dc610421366004612459565b611521565b34801561043257600080fd5b506104466104413660046123f4565b6116ac565b604051610200929190612a4b565b34801561046057600080fd5b506101dc61046f3660046123c4565b6116d0565b34801561048057600080fd5b506101f361173a565b34801561049557600080fd5b5061038f611740565b3480156104aa57600080fd5b506101dc6104b9366004612423565b611764565b3480156104ca57600080fd5b5061038f6104d93660046123c4565b61193a565b3480156104ea57600080fd5b506101dc6104f9366004612459565b611947565b61051161050c3660046121c7565b611b7a565b6040516102009291906125b9565b34801561052b57600080fd5b5061038f611d0a565b6000546001600160a01b031633146105675760405162461bcd60e51b815260040161055e90612818565b60405180910390fd5b8115610602576001600160a01b0383161515806105815750805b61059d5760405162461bcd60e51b815260040161055e90612732565b600080546040516001600160a01b03808716939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0385166001600160a01b03199182161790915560018054909116905561061e565b600180546001600160a01b0319166001600160a01b0385161790555b505050565b60035490565b610631612115565b61063a84611041565b6000858152600660209081526040808320338452909152902081519192509061068c9064e8d4a51000906106789087906001600160801b0316611d19565b8161067f57fe5b6001840154919004611d56565b6001820155805461069d9085611da3565b81556005805460009190879081106106b157fe5b6000918252602090912001546001600160a01b0316905080156107375781546040516345fb1ba160e11b81526001600160a01b03831691638bf6374291610704918a9133918a9160009190600401612a0c565b600060405180830381600087803b15801561071e57600080fd5b505af1158015610732573d6000803e3d6000fd5b505050505b61076584866004898154811061074957fe5b6000918252602090912001546001600160a01b03169190611dc6565b836001600160a01b031686336001600160a01b03167f8166bf25f8a2b7ed3c85049207da4358d16edbed977d23fa2ee6f0dde3ec2132886040516107a99190612a03565b60405180910390a4505050505050565b600381815481106107c657fe5b6000918252602090912001546001600160801b03811691506001600160401b03600160801b8204811691600160c01b90041683565b60075481565b610809612115565b61081283611041565b6000848152600660209081526040808320338452909152812082518154939450909264e8d4a510009161084e91906001600160801b0316611d19565b8161085557fe5b0490506000610879610874846001015484611d5690919063ffffffff16565b611eb4565b60018401839055905080156108bc576108bc6001600160a01b037f0000000000000000000000002995d1317dcd4f0ab89f4ae60f3f020a4f17c7ce168683611dc6565b6000600587815481106108cb57fe5b6000918252602090912001546001600160a01b0316905080156109505783546040516345fb1ba160e11b81526001600160a01b03831691638bf637429161091d918b9133918c91899190600401612a0c565b600060405180830381600087803b15801561093757600080fd5b505af115801561094b573d6000803e3d6000fd5b505050505b86336001600160a01b03167f71bab65ced2e5750775a0613be067df48ef06cf92a496ebf7663ae06609249548460405161098a9190612a03565b60405180910390a350505050505050565b60006109a5612115565b600384815481106109b257fe5b600091825260208083206040805160608101825291909301546001600160801b0380821683526001600160401b03600160801b8304811684860152600160c01b90920490911682850152888552600683528385206001600160a01b0389168652909252918320825160048054949650919492169288908110610a3057fe5b6000918252602090912001546040516370a0823160e01b81526001600160a01b03909116906370a0823190610a69903090600401612527565b60206040518083038186803b158015610a8157600080fd5b505afa158015610a95573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ab991906123dc565b905083602001516001600160401b031642118015610ad657508015155b15610b62576000610afd85602001516001600160401b031642611da390919063ffffffff16565b90506000600754610b3087604001516001600160401b0316610b2a60085486611d1990919063ffffffff16565b90611d19565b81610b3757fe5b049050610b5d83610b4d8364e8d4a51000611d19565b81610b5457fe5b86919004611eda565b935050505b60018301548354610b90916108749164e8d4a5100090610b829087611d19565b81610b8957fe5b0490611d56565b979650505050505050565b6000546001600160a01b03163314610bc55760405162461bcd60e51b815260040161055e90612818565b600280546001600160a01b0319166001600160a01b0392909216919091179055565b60008281526006602090815260408083203384529091528120805482825560018201839055600580549293919286908110610c1e57fe5b6000918252602090912001546001600160a01b031690508015610ca3576040516345fb1ba160e11b81526001600160a01b03821690638bf6374290610c70908890339089906000908190600401612a0c565b600060405180830381600087803b158015610c8a57600080fd5b505af1158015610c9e573d6000803e3d6000fd5b505050505b610cb584836004888154811061074957fe5b836001600160a01b031685336001600160a01b03167f2cac5e20e1541d836381527a43f651851e302817b71dc8e810284e69210c1c6b85604051610cf99190612a03565b60405180910390a45050505050565b6002546001600160a01b0316610d305760405162461bcd60e51b815260040161055e906128b9565b600060048281548110610d3f57fe5b60009182526020822001546040516370a0823160e01b81526001600160a01b03909116925082906370a0823190610d7a903090600401612527565b60206040518083038186803b158015610d9257600080fd5b505afa158015610da6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dca91906123dc565b60025460405163095ea7b360e01b81529192506001600160a01b038085169263095ea7b392610dff92169085906004016125a0565b602060405180830381600087803b158015610e1957600080fd5b505af1158015610e2d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e51919061224f565b5060025460405163ce5494bb60e01b81526000916001600160a01b03169063ce5494bb90610e83908690600401612527565b602060405180830381600087803b158015610e9d57600080fd5b505af1158015610eb1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ed5919061226b565b6040516370a0823160e01b81529091506001600160a01b038216906370a0823190610f04903090600401612527565b60206040518083038186803b158015610f1c57600080fd5b505afa158015610f30573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f5491906123dc565b8214610f725760405162461bcd60e51b815260040161055e90612761565b8060048581548110610f8057fe5b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555050505050565b6001546001600160a01b0316338114610fdf5760405162461bcd60e51b815260040161055e9061284d565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b039092166001600160a01b0319928316179055600180549091169055565b611049612115565b6003828154811061105657fe5b60009182526020918290206040805160608101825292909101546001600160801b03811683526001600160401b03600160801b82048116948401859052600160c01b909104169082015291504211156112c0576000600483815481106110b857fe5b6000918252602090912001546040516370a0823160e01b81526001600160a01b03909116906370a08231906110f1903090600401612527565b60206040518083038186803b15801561110957600080fd5b505afa15801561111d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061114191906123dc565b905080156111e457600061116b83602001516001600160401b031642611da390919063ffffffff16565b9050600060075461119885604001516001600160401b0316610b2a60085486611d1990919063ffffffff16565b8161119f57fe5b0490506111d66111c5846111b88464e8d4a51000611d19565b816111bf57fe5b04611efd565b85516001600160801b031690611f26565b6001600160801b0316845250505b6111ed42611f55565b6001600160401b03166020830152600380548391908590811061120c57fe5b6000918252602091829020835191018054848401516040958601516001600160801b03199092166001600160801b039094169390931767ffffffffffffffff60801b1916600160801b6001600160401b0394851602176001600160c01b0316600160c01b93909116929092029190911790558301518351915185927f0fc9545022a542541ad085d091fb09a2ab36fee366a4576ab63714ea907ad353926112b69290918691612a59565b60405180910390a2505b919050565b8060005b818110156112f5576112ec8484838181106112e057fe5b90506020020135611041565b506001016112c9565b50505050565b6004818154811061130857fe5b6000918252602090912001546001600160a01b0316905081565b60405163d505accf60e01b81526001600160a01b0389169063d505accf9061135a908a908a908a908a908a908a908a9060040161255f565b600060405180830381600087803b15801561137457600080fd5b505af1158015611388573d6000803e3d6000fd5b505050505050505050505050565b6002546001600160a01b031681565b6000546001600160a01b031633146113cf5760405162461bcd60e51b815260040161055e90612818565b61140e83611408600387815481106113e357fe5b60009182526020909120015460075490600160c01b90046001600160401b0316611da3565b90611eda565b60075561141a83611f55565b6003858154811061142757fe5b9060005260206000200160000160186101000a8154816001600160401b0302191690836001600160401b03160217905550801561149b57816005858154811061146c57fe5b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055505b806114c757600584815481106114ad57fe5b6000918252602090912001546001600160a01b03166114c9565b815b6001600160a01b0316847f95895a6ab1df54420d241b55243258a33e61b2194db66c1179ec521aae8e18658584604051611504929190612a3b565b60405180910390a350505050565b6000546001600160a01b031681565b611529612115565b61153284611041565b60008581526006602090815260408083206001600160a01b038716845290915290208054919250906115649085611eda565b8155815161159b9064e8d4a51000906115879087906001600160801b0316611d19565b8161158e57fe5b6001840154919004611f7e565b81600101819055506000600586815481106115b257fe5b6000918252602090912001546001600160a01b0316905080156116385781546040516345fb1ba160e11b81526001600160a01b03831691638bf6374291611605918a918991829160009190600401612a0c565b600060405180830381600087803b15801561161f57600080fd5b505af1158015611633573d6000803e3d6000fd5b505050505b61166833308760048a8154811061164b57fe5b6000918252602090912001546001600160a01b0316929190611fc4565b836001600160a01b031686336001600160a01b03167f02d7e648dd130fc184d383e55bb126ac4c9c60e8f94bf05acdf557ba2d540b47886040516107a99190612a03565b60066020908152600092835260408084209091529082529020805460019091015482565b6000546001600160a01b031633146116fa5760405162461bcd60e51b815260040161055e90612818565b60088190556040517fc6ce5eff3291fb2c1517b943daa5067ea76c83816bbf674307fbc7fea3b311d09061172f908390612a03565b60405180910390a150565b60085481565b7f0000000000000000000000002995d1317dcd4f0ab89f4ae60f3f020a4f17c7ce81565b6000546001600160a01b0316331461178e5760405162461bcd60e51b815260040161055e90612818565b60075461179b9084611eda565b6007556004805460018181019092557f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b0180546001600160a01b038086166001600160a01b03199283161790925560058054938401815560009081527f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db090930180549285169290911691909117905560408051606081019091529081526003906020810161184842611f55565b6001600160401b0316815260200161185f86611f55565b6001600160401b039081169091528254600181810185556000948552602094859020845192018054958501516040909501518416600160c01b026001600160c01b0395909416600160801b0267ffffffffffffffff60801b196001600160801b039094166001600160801b0319909716969096179290921694909417929092161790556004546001600160a01b0380841692908516916118fe91611da3565b7f81ee0f8c5c46e2cb41984886f77a84181724abb86c32a5f6de539b07509d45e58660405161192d9190612a03565b60405180910390a4505050565b6005818154811061130857fe5b61194f612115565b61195884611041565b6000858152600660209081526040808320338452909152812082518154939450909264e8d4a510009161199491906001600160801b0316611d19565b8161199b57fe5b04905060006119ba610874846001015484611d5690919063ffffffff16565b90506119f564e8d4a510006119e586600001516001600160801b031689611d1990919063ffffffff16565b816119ec57fe5b84919004611d56565b60018401558254611a069087611da3565b8355611a3c6001600160a01b037f0000000000000000000000002995d1317dcd4f0ab89f4ae60f3f020a4f17c7ce168683611dc6565b600060058881548110611a4b57fe5b6000918252602090912001546001600160a01b031690508015611ad05783546040516345fb1ba160e11b81526001600160a01b03831691638bf6374291611a9d918c9133918c91899190600401612a0c565b600060405180830381600087803b158015611ab757600080fd5b505af1158015611acb573d6000803e3d6000fd5b505050505b611ae2868860048b8154811061074957fe5b856001600160a01b031688336001600160a01b03167f8166bf25f8a2b7ed3c85049207da4358d16edbed977d23fa2ee6f0dde3ec21328a604051611b269190612a03565b60405180910390a487336001600160a01b03167f71bab65ced2e5750775a0613be067df48ef06cf92a496ebf7663ae066092495484604051611b689190612a03565b60405180910390a35050505050505050565b606080836001600160401b0381118015611b9357600080fd5b50604051908082528060200260200182016040528015611bbd578160200160208202803683370190505b509150836001600160401b0381118015611bd657600080fd5b50604051908082528060200260200182016040528015611c0a57816020015b6060815260200190600190039081611bf55790505b50905060005b84811015611d01576000606030888885818110611c2957fe5b9050602002810190611c3b9190612a83565b604051611c499291906124fb565b600060405180830381855af49150503d8060008114611c84576040519150601f19603f3d011682016040523d82523d6000602084013e611c89565b606091505b50915091508180611c98575085155b611ca1826120b5565b90611cbf5760405162461bcd60e51b815260040161055e9190612653565b5081858481518110611ccd57fe5b60200260200101901515908115158152505080848481518110611cec57fe5b60209081029190910101525050600101611c10565b50935093915050565b6001546001600160a01b031681565b6000811580611d3457505080820282828281611d3157fe5b04145b611d505760405162461bcd60e51b815260040161055e90612969565b92915050565b6000818303818312801590611d6b5750838113155b80611d805750600083128015611d8057508381135b611d9c5760405162461bcd60e51b815260040161055e906128f0565b9392505050565b80820382811115611d505760405162461bcd60e51b815260040161055e90612666565b60006060846001600160a01b031663a9059cbb8585604051602401611dec9291906125a0565b6040516020818303038152906040529060e01b6020820180516001600160e01b038381831617835250505050604051611e25919061250b565b6000604051808303816000865af19150503d8060008114611e62576040519150601f19603f3d011682016040523d82523d6000602084013e611e67565b606091505b5091509150818015611e91575080511580611e91575080806020019051810190611e91919061224f565b611ead5760405162461bcd60e51b815260040161055e906126ba565b5050505050565b600080821215611ed65760405162461bcd60e51b815260040161055e90612695565b5090565b81810181811015611d505760405162461bcd60e51b815260040161055e906127e1565b60006001600160801b03821115611ed65760405162461bcd60e51b815260040161055e906127aa565b8181016001600160801b038083169082161015611d505760405162461bcd60e51b815260040161055e906127e1565b60006001600160401b03821115611ed65760405162461bcd60e51b815260040161055e90612882565b6000828201818312801590611f935750838112155b80611fa85750600083128015611fa857508381125b611d9c5760405162461bcd60e51b815260040161055e906126f1565b60006060856001600160a01b03166323b872dd868686604051602401611fec9392919061253b565b6040516020818303038152906040529060e01b6020820180516001600160e01b038381831617835250505050604051612025919061250b565b6000604051808303816000865af19150503d8060008114612062576040519150601f19603f3d011682016040523d82523d6000602084013e612067565b606091505b5091509150818015612091575080511580612091575080806020019051810190612091919061224f565b6120ad5760405162461bcd60e51b815260040161055e90612934565b505050505050565b60606044825110156120fb575060408051808201909152601d81527f5472616e73616374696f6e2072657665727465642073696c656e746c7900000060208201526112c0565b60048201915081806020019051810190611d50919061232a565b604080516060810182526000808252602082018190529181019190915290565b60008083601f840112612146578182fd5b5081356001600160401b0381111561215c578182fd5b602083019150836020808302850101111561217657600080fd5b9250929050565b600080600060608486031215612191578283fd5b833561219c81612af3565b925060208401356121ac81612b0b565b915060408401356121bc81612b0b565b809150509250925092565b6000806000604084860312156121db578283fd5b83356001600160401b038111156121f0578384fd5b6121fc86828701612135565b90945092505060208401356121bc81612b0b565b60008060208385031215612222578182fd5b82356001600160401b03811115612237578283fd5b61224385828601612135565b90969095509350505050565b600060208284031215612260578081fd5b8151611d9c81612b0b565b60006020828403121561227c578081fd5b8151611d9c81612af3565b600080600080600080600080610100898b0312156122a3578384fd5b88356122ae81612af3565b975060208901356122be81612af3565b965060408901356122ce81612af3565b9550606089013594506080890135935060a089013560ff811681146122f1578384fd5b979a969950949793969295929450505060c08201359160e0013590565b60006020828403121561231f578081fd5b8135611d9c81612af3565b60006020828403121561233b578081fd5b81516001600160401b0380821115612351578283fd5b818401915084601f830112612364578283fd5b815181811115612372578384fd5b604051601f8201601f191681016020018381118282101715612392578586fd5b6040528181528382016020018710156123a9578485fd5b6123ba826020830160208701612ac7565b9695505050505050565b6000602082840312156123d5578081fd5b5035919050565b6000602082840312156123ed578081fd5b5051919050565b60008060408385031215612406578182fd5b82359150602083013561241881612af3565b809150509250929050565b600080600060608486031215612437578081fd5b83359250602084013561244981612af3565b915060408401356121bc81612af3565b60008060006060848603121561246d578081fd5b833592506020840135915060408401356121bc81612af3565b6000806000806080858703121561249b578182fd5b843593506020850135925060408501356124b481612af3565b915060608501356124c481612b0b565b939692955090935050565b600081518084526124e7816020860160208601612ac7565b601f01601f19169290920160200192915050565b6000828483379101908152919050565b6000825161251d818460208701612ac7565b9190910192915050565b6001600160a01b0391909116815260200190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b0397881681529590961660208601526040850193909352606084019190915260ff16608083015260a082015260c081019190915260e00190565b6001600160a01b03929092168252602082015260400190565b604080825283519082018190526000906020906060840190828701845b828110156125f45781511515845292840192908401906001016125d6565b5050508381038285015280855161260b8184612a03565b91508192508381028201848801865b838110156126445785830385526126328383516124cf565b9487019492509086019060010161261a565b50909998505050505050505050565b600060208252611d9c60208301846124cf565b602080825260159082015274426f72696e674d6174683a20556e646572666c6f7760581b604082015260600190565b6020808252600b908201526a0496e7465676572203c20360ac1b604082015260600190565b6020808252601c908201527f426f72696e6745524332303a205472616e73666572206661696c656400000000604082015260600190565b60208082526021908201527f5369676e6564536166654d6174683a206164646974696f6e206f766572666c6f6040820152607760f81b606082015260800190565b6020808252601590820152744f776e61626c653a207a65726f206164647265737360581b604082015260600190565b60208082526029908201527f4d61737465724368656656323a206d696772617465642062616c616e6365206d6040820152680eae6e840dac2e8c6d60bb1b606082015260800190565b6020808252601c908201527f426f72696e674d6174683a2075696e74313238204f766572666c6f7700000000604082015260600190565b60208082526018908201527f426f72696e674d6174683a20416464204f766572666c6f770000000000000000604082015260600190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252818101527f4f776e61626c653a2063616c6c657220213d2070656e64696e67206f776e6572604082015260600190565b6020808252601b908201527f426f72696e674d6174683a2075696e743634204f766572666c6f770000000000604082015260600190565b6020808252601d908201527f4d61737465724368656656323a206e6f206d69677261746f7220736574000000604082015260600190565b60208082526024908201527f5369676e6564536166654d6174683a207375627472616374696f6e206f766572604082015263666c6f7760e01b606082015260800190565b6020808252818101527f426f72696e6745524332303a205472616e7366657246726f6d206661696c6564604082015260600190565b60208082526018908201527f426f72696e674d6174683a204d756c204f766572666c6f770000000000000000604082015260600190565b81516001600160801b031681526020808301516001600160401b0390811691830191909152604092830151169181019190915260600190565b6001600160801b039390931683526001600160401b03918216602084015216604082015260600190565b90815260200190565b9485526001600160a01b0393841660208601529190921660408401526060830191909152608082015260a00190565b9182521515602082015260400190565b918252602082015260400190565b6001600160401b0393909316835260208301919091526001600160801b0316604082015260600190565b6000808335601e19843603018112612a99578283fd5b8301803591506001600160401b03821115612ab2578283fd5b60200191503681900382131561217657600080fd5b60005b83811015612ae2578181015183820152602001612aca565b838111156112f55750506000910152565b6001600160a01b0381168114612b0857600080fd5b50565b8015158114612b0857600080fdfea264697066735822122060f148b828b8c3abf6edb8f9067ddaed729c9cc77570f31ab0c92a4646ab5ca064736f6c634300060c0033