Contract 0xB7ad2952810b010deeD7d4d35956BCDd93769aBD

Txn Hash Method
Block
From
To
Value [Txn Fee]
0x857d023219dbbd3602f99cf3613c45a6c3de56c7731f1b9bc1b687ff180aa0a5Withdraw280334122022-01-15 11:57:5911 days 9 hrs ago0x6d9518bd44fce1ee2ef8d7e3090fba60304a4cea IN  0xb7ad2952810b010deed7d4d35956bcdd93769abd0 FTM0.025286782557
0x5c95bf135d4a9d2f8603950a3a293ad6526e687c7bd77ed25a4456a078c00d40Deposit280333312022-01-15 11:56:5811 days 9 hrs ago0x6d9518bd44fce1ee2ef8d7e3090fba60304a4cea IN  0xb7ad2952810b010deed7d4d35956bcdd93769abd0 FTM0.057405908719
0x80d84cb599c7eb2f92f9d4ed95d864edd05922dd06df59f28f4acf3f8d42309fDeposit280332682022-01-15 11:56:0911 days 9 hrs ago0x6d9518bd44fce1ee2ef8d7e3090fba60304a4cea IN  0xb7ad2952810b010deed7d4d35956bcdd93769abd0 FTM0.058017650513
0x52b9cb73781bc086a48de584478a7cc8382e5362f31bd391764f4ba8b4958644Deposit280328792022-01-15 11:50:5411 days 9 hrs ago0x6d9518bd44fce1ee2ef8d7e3090fba60304a4cea IN  0xb7ad2952810b010deed7d4d35956bcdd93769abd0 FTM0.058127346804
0x5cdcc02576c011957fb0153181aaaa25aea00a37b2d9f5dc56fca5003fd47fd6Deposit280327832022-01-15 11:49:4011 days 9 hrs ago0x6d9518bd44fce1ee2ef8d7e3090fba60304a4cea IN  0xb7ad2952810b010deed7d4d35956bcdd93769abd0 FTM0.076807516446
0xbfb75363027c90c1555cd4e93faf35eebc4b5aae439460ffaf3b9c80d1ebc697Deposit280327642022-01-15 11:49:2511 days 9 hrs ago0x6d9518bd44fce1ee2ef8d7e3090fba60304a4cea IN  0xb7ad2952810b010deed7d4d35956bcdd93769abd0 FTM0.054385763779
0xa40259ddc0c2fab4d318c7b10484f69d92677f0454df3355d910c736b0b84659Add280321592022-01-15 11:41:2011 days 9 hrs ago0x6d9518bd44fce1ee2ef8d7e3090fba60304a4cea IN  0xb7ad2952810b010deed7d4d35956bcdd93769abd0 FTM0.057291
0x9d9390a42c2e148c1b87f335cf9a187ce486407947c6b084bae123b3fd2c66bfAdd280321322022-01-15 11:40:5611 days 9 hrs ago0x6d9518bd44fce1ee2ef8d7e3090fba60304a4cea IN  0xb7ad2952810b010deed7d4d35956bcdd93769abd0 FTM0.0549468
0x476ff58d15fd22acf37709f711e2f273291f9f868df61fbc7a9bd084ddebbf89Add280321272022-01-15 11:40:5211 days 9 hrs ago0x6d9518bd44fce1ee2ef8d7e3090fba60304a4cea IN  0xb7ad2952810b010deed7d4d35956bcdd93769abd0 FTM0.0583362
0xd382ac24ecaa568ac0e68292cf75c0555342a45c628ba92b3c45378417b12f6bAdd280320592022-01-15 11:39:5911 days 9 hrs ago0x6d9518bd44fce1ee2ef8d7e3090fba60304a4cea IN  0xb7ad2952810b010deed7d4d35956bcdd93769abd0 FTM0.0445977
0x421bd608cb05cabc2752ab20663586956e195d1d957de7c98fd60417081ce7c8Add280320512022-01-15 11:39:5411 days 9 hrs ago0x6d9518bd44fce1ee2ef8d7e3090fba60304a4cea IN  0xb7ad2952810b010deed7d4d35956bcdd93769abd0 FTM0.0478806
0xe322b3b535620c7672c44b962a08a1935b89512a2dedb61fc2c33711adbd372eAdd280320402022-01-15 11:39:4611 days 9 hrs ago0x6d9518bd44fce1ee2ef8d7e3090fba60304a4cea IN  0xb7ad2952810b010deed7d4d35956bcdd93769abd0 FTM0.0545364
0x20fd6557a35e8f4ddb7bbe63f1e9fab4217677dde6bfa7fa45c55a93e3733c620x60c06040280313692022-01-15 11:31:1111 days 9 hrs ago0x6d9518bd44fce1ee2ef8d7e3090fba60304a4cea IN  Create: MasterChef0 FTM1.1298603
[ Download CSV Export 
Latest 1 internal transaction
Parent Txn Hash Block From To Value
0x20fd6557a35e8f4ddb7bbe63f1e9fab4217677dde6bfa7fa45c55a93e3733c62280313692022-01-15 11:31:1111 days 9 hrs ago 0x6d9518bd44fce1ee2ef8d7e3090fba60304a4cea  Contract Creation0 FTM
[ Download CSV Export 
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
MasterChef

Compiler Version
v0.8.6+commit.11564f7e

Optimization Enabled:
No with 200 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 18 : MasterChef.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.6;

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";

import "./SandManTokenV3.sol";
import "./Treasury.sol";

// MasterChef is the master of SandMan. He can make SandMan and he is a fair guy.
//
// Note that it's ownable and the owner wields tremendous power. The ownership
// will be transferred to a governance smart contract once SANDMAN is sufficiently
// distributed and the community can show to govern itself.
//
// Have fun reading it. Hopefully it's bug-free. God bless.
contract MasterChef is Ownable, ReentrancyGuard {
    using SafeERC20 for IERC20;

    // Info of each user.
    struct UserInfo {
        uint256 amount;         // How many LP tokens the user has provided.
        uint256 rewardDebt;     // Reward debt.
        uint256 usdRewardDebt;  // Usd debt.
    }

    // Info of each pool.
    struct PoolInfo {
        IERC20 lpToken;           // Address of LP token contract.
        uint256 allocPoint;       // How many allocation points assigned to this pool. SANDMANs to distribute per block.
        uint256 lastRewardBlock;  // Last block number that SANDMANs distribution occurs.
        uint256 accSandManPerShare;   // Accumulated SANDMANs per share, times 1e18. See below.
        uint16 depositFeeBP;      // Deposit fee in basis points
        uint256 lpSupply;
        uint8 tokenType;          // 0=Token, 1=LP Token
    }

    uint256 public constant sandManMaximumSupply = 500 * (10 ** 3) * (10 ** 18); // 500,000 sandMan
    uint256 public constant MAX_EMISSION_RATE = 10 * (10 ** 18); // 10
    // The SANDMAN TOKEN!
    SandManTokenV3 public immutable sandMan;
    
    Treasury public immutable treasury;
    
    // SANDMAN tokens created per block.
    uint256 public sandManPerBlock;
    // Deposit Fee address
    address public feeAddress;

    // Info of each pool.
    PoolInfo[] public poolInfo;
    // Info of each user that stakes LP tokens.
    mapping(uint256 => mapping(address => UserInfo)) public userInfo;
    // Total allocation points. Must be the sum of all allocation points in all pools.
    uint256 public totalAllocPoint = 0;
    // The block number when SANDMAN mining starts.
    uint256 public startBlock;
    // The block number when SANDMAN mining ends.
    uint256 public emmissionEndBlock = type(uint256).max;

    //new code 
    uint256 public totalUSDCollected = 0;
    uint256 public accDepositUSDRewardPerShare = 0;
    uint256 usdRewardBalance = 0;
    uint256 public totalSupply = 0;

    event addPool(uint256 indexed pid, address lpToken, uint256 allocPoint, uint256 depositFeeBP);
    event setPool(uint256 indexed pid, address lpToken, uint256 allocPoint, uint256 depositFeeBP);
    event Deposit(address indexed user, uint256 indexed pid, uint256 amount);
    event Withdraw(address indexed user, uint256 indexed pid, uint256 amount);
    event EmergencyWithdraw(address indexed user, uint256 indexed pid, uint256 amount);
    event SetEmissionRate(address indexed caller, uint256 previousAmount, uint256 newAmount);
    event SetFeeAddress(address indexed user, address indexed newAddress);
    event SetStartBlock(uint256 newStartBlock);
    
    constructor(
        SandManTokenV3 _sandMan,
        Treasury _treasuryAddress,
        address _feeAddress,
        uint256 _sandManPerBlock,
        uint256 _startBlock
    ) {
        require(_feeAddress != address(0), "!nonzero");

        sandMan = _sandMan;
        treasury = _treasuryAddress;
        feeAddress = _feeAddress;
        sandManPerBlock = _sandManPerBlock;
        startBlock = _startBlock;
    }

    function poolLength() external view returns (uint256) {
        return poolInfo.length;
    }

    mapping(IERC20 => bool) public poolExistence;
    modifier nonDuplicated(IERC20 _lpToken) {
        require(!poolExistence[_lpToken], "nonDuplicated: duplicated");
        _;
    }

        // Add a new lp to the pool. Can only be called by the owner.
    function add(uint8 _tokenType, uint256 _allocPoint, IERC20 _lpToken, uint16 _depositFeeBP, bool _withUpdate) external onlyOwner nonDuplicated(_lpToken) {
        // Make sure the provided token is ERC20
        _lpToken.balanceOf(address(this));

        require(_depositFeeBP <= 401, "add: invalid deposit fee basis points");
        require(_tokenType == 0 || _tokenType == 1, "invalid token type");
        if (_withUpdate) {
            massUpdatePools();
        }
        uint256 lastRewardBlock = block.number > startBlock ? block.number : startBlock;
        totalAllocPoint = totalAllocPoint + _allocPoint;
        poolExistence[_lpToken] = true;

        poolInfo.push(PoolInfo({
        lpToken : _lpToken,
        allocPoint : _allocPoint,
        lastRewardBlock : lastRewardBlock,
        accSandManPerShare : 0,
        depositFeeBP : _depositFeeBP,
        tokenType: _tokenType,
        lpSupply: 0
        }));

        emit addPool(poolInfo.length - 1, address(_lpToken), _allocPoint, _depositFeeBP);
    }

    // Update the given pool's SANDMAN allocation point and deposit fee. Can only be called by the owner.
    function set(uint256 _pid, uint8 _tokenType, uint256 _allocPoint, uint16 _depositFeeBP, bool _withUpdate) external onlyOwner {
        require(_depositFeeBP <= 401, "set: invalid deposit fee basis points");
        require(_tokenType == 0 || _tokenType == 1, "invalid token type");

        if (_withUpdate) {
            massUpdatePools();
        }
        totalAllocPoint = totalAllocPoint - poolInfo[_pid].allocPoint + _allocPoint;
        poolInfo[_pid].allocPoint = _allocPoint;
        poolInfo[_pid].depositFeeBP = _depositFeeBP;
        poolInfo[_pid].tokenType = _tokenType;

        emit setPool(_pid, address(poolInfo[_pid].lpToken), _allocPoint, _depositFeeBP);
    }

    // Return reward multiplier over the given _from to _to block.
    function getMultiplier(uint256 _from, uint256 _to) public view returns (uint256) {
        // As we set the multiplier to 0 here after emmissionEndBlock
        // deposits aren't blocked after farming ends.
        if (_from > emmissionEndBlock)
            return 0;
        if (_to > emmissionEndBlock)
            return emmissionEndBlock - _from;
        else
            return _to - _from;
    }

    // View function to see pending SANDMANs on frontend.
    function pendingSandMan(uint256 _pid, address _user) external view returns (uint256) {
        PoolInfo storage pool = poolInfo[_pid];
        UserInfo storage user = userInfo[_pid][_user];
        uint256 accSandManPerShare = pool.accSandManPerShare;
        if (block.number > pool.lastRewardBlock && pool.lpSupply != 0 && totalAllocPoint > 0) {
            uint256 multiplier = getMultiplier(pool.lastRewardBlock, block.number);
            uint256 sandManReward = (multiplier * sandManPerBlock * pool.allocPoint) / totalAllocPoint;
            accSandManPerShare = accSandManPerShare + ((sandManReward * 1e18) / pool.lpSupply);
        }

        return ((user.amount * accSandManPerShare) /  1e18) - user.rewardDebt;
    }


    // Update reward variables for all pools. Be careful of gas spending!
    function massUpdatePools() public {
        uint256 length = poolInfo.length;
        for (uint256 pid = 0; pid < length; ++pid) {
            updatePool(pid);
        }
    }

    // Update reward variables of the given pool to be up-to-date.
    function updatePool(uint256 _pid) public {
        PoolInfo storage pool = poolInfo[_pid];
        if (block.number <= pool.lastRewardBlock) {
            return;
        }

        if (pool.lpSupply == 0 || pool.allocPoint == 0) {
            pool.lastRewardBlock = block.number;
            return;
        }

        uint256 multiplier = getMultiplier(pool.lastRewardBlock, block.number);
        uint256 sandManReward = (multiplier * sandManPerBlock * pool.allocPoint) / totalAllocPoint;

        // This shouldn't happen, but just in case we stop rewards.
        if (sandMan.totalSupply() > sandManMaximumSupply)
            sandManReward = 0;
        else if ((sandMan.totalSupply() + sandManReward) > sandManMaximumSupply)
            sandManReward = sandManMaximumSupply - sandMan.totalSupply();

        if (sandManReward > 0)
            sandMan.mint(address(this), sandManReward);

        // The first time we reach SandMan max supply we solidify the end of farming.
        if (sandMan.totalSupply() >= sandManMaximumSupply && emmissionEndBlock == type(uint256).max)
            emmissionEndBlock = block.number;

        pool.accSandManPerShare = pool.accSandManPerShare + ((sandManReward * 1e18) / pool.lpSupply);
        pool.lastRewardBlock = block.number;
    }

    // Deposit LP tokens to MasterChef for SANDMAN allocation.
    function deposit(uint256 _pid, uint256 _amount) external nonReentrant {
        PoolInfo storage pool = poolInfo[_pid];
        UserInfo storage user = userInfo[_pid][msg.sender];
        updatePool(_pid);
        if (user.amount > 0) {
            uint256 pending = ((user.amount * pool.accSandManPerShare) / 1e18) - user.rewardDebt;
            if (pending > 0) {
                safeSandManTransfer(msg.sender, pending);
            }

            payPendingUSDCReward(_pid, msg.sender);

        }
        

        if (_amount > 0) {
            uint256 balanceBefore = pool.lpToken.balanceOf(address(this));
            pool.lpToken.safeTransferFrom(address(msg.sender), address(this), _amount);
            _amount = pool.lpToken.balanceOf(address(this)) - balanceBefore;
            require(_amount > 0, "we dont accept deposits of 0 size");

            if (pool.depositFeeBP > 0) {
                uint256 depositFee = (_amount * pool.depositFeeBP - 100) / 10000; // 3%
                pool.lpToken.safeTransfer(feeAddress, depositFee);
                user.amount = user.amount + _amount - depositFee;
                pool.lpSupply = pool.lpSupply + _amount - depositFee;

                //transfer 1% to distribution
                uint256 feeForDistribution = (_amount * 100) / 10000; //1% for distribution
                
                pool.lpToken.safeTransfer(address(treasury), feeForDistribution);
                
                uint256 usdcReceived = 0;
                usdcReceived  = treasury.convertDepositFeesToUSD(address(pool.lpToken), pool.tokenType);
                
                if (usdcReceived > 0 && totalSupply != 0){
                    accDepositUSDRewardPerShare = accDepositUSDRewardPerShare + ((usdcReceived * 1e18) / totalSupply); // div en el total supply del mc
                    totalUSDCollected = totalUSDCollected + usdcReceived;
                }


            } else {
                user.amount = user.amount + _amount;
                pool.lpSupply = pool.lpSupply + _amount;
            }
        }
        user.rewardDebt = (user.amount * pool.accSandManPerShare) / 1e18;
        user.usdRewardDebt = ((user.amount * accDepositUSDRewardPerShare) / 1e18);

        totalSupply = totalSupply + _amount;

        emit Deposit(msg.sender, _pid, _amount);
    }

    // Withdraw LP tokens from MasterChef.
    function withdraw(uint256 _pid, uint256 _amount) external nonReentrant {
        PoolInfo storage pool = poolInfo[_pid];
        UserInfo storage user = userInfo[_pid][msg.sender];
        require(user.amount >= _amount, "withdraw: not good");
        updatePool(_pid);
        uint256 pending = ((user.amount * pool.accSandManPerShare) / 1e18) - user.rewardDebt;
        if (pending > 0) {
            safeSandManTransfer(msg.sender, pending);
        }
        if (_amount > 0) {
            user.amount = user.amount - _amount;
            pool.lpToken.safeTransfer(address(msg.sender), _amount);
            pool.lpSupply = pool.lpSupply - _amount;
        }
        user.rewardDebt = (user.amount * pool.accSandManPerShare) / 1e18;
        emit Withdraw(msg.sender, _pid, _amount);
    }

    // Withdraw without caring about rewards. EMERGENCY ONLY.
    function emergencyWithdraw(uint256 _pid) external nonReentrant {
        PoolInfo storage pool = poolInfo[_pid];
        UserInfo storage user = userInfo[_pid][msg.sender];
        uint256 amount = user.amount;
        user.amount = 0;
        user.rewardDebt = 0;
        pool.lpToken.safeTransfer(address(msg.sender), amount);

        // In the case of an accounting error, we choose to let the user emergency withdraw anyway
        if (pool.lpSupply >=  amount)
            pool.lpSupply = pool.lpSupply - amount;
        else
            pool.lpSupply = 0;

        emit EmergencyWithdraw(msg.sender, _pid, amount);
    }

    // Safe sandMan transfer function, just in case if rounding error causes pool to not have enough SANDMANs.
    function safeSandManTransfer(address _to, uint256 _amount) internal {
        uint256 sandManBal = sandMan.balanceOf(address(this));
        bool transferSuccess = false;
        if (_amount > sandManBal) {
            transferSuccess = sandMan.transfer(_to, sandManBal);
        } else {
            transferSuccess = sandMan.transfer(_to, _amount);
        }
        require(transferSuccess, "safeSandManTransfer: transfer failed");
    }

    function setFeeAddress(address _feeAddress) external onlyOwner {
        require(_feeAddress != address(0), "!nonzero");
        feeAddress = _feeAddress;
        emit SetFeeAddress(msg.sender, _feeAddress);
    }

    // Update lastRewardBlock variables for all pools.
    function _massUpdateLastRewardBlockPools() internal {
        uint256 length = poolInfo.length;
        for (uint256 _pid = 0; _pid < length; ++_pid) {
            poolInfo[_pid].lastRewardBlock = startBlock;
        }
    }

    function setStartBlock(uint256 _newStartBlock) external onlyOwner {
        require(block.number < startBlock, "cannot change start block if sale has already commenced");
        require(block.number < _newStartBlock, "cannot set start block in the past");
                
        startBlock = _newStartBlock;
        _massUpdateLastRewardBlockPools();

        emit SetStartBlock(startBlock);
    }

    function setEmissionRate(uint256 _sandManPerBlock) external onlyOwner {
        require(_sandManPerBlock > 0);
        require(_sandManPerBlock < MAX_EMISSION_RATE);

        massUpdatePools();
        sandManPerBlock = _sandManPerBlock;
        
        emit SetEmissionRate(msg.sender, sandManPerBlock, _sandManPerBlock);
    }

    function pendingUSDC(uint256 _pid, address _user) external view returns (uint256) {
        UserInfo storage user = userInfo[_pid][_user];

        return ((user.amount * accDepositUSDRewardPerShare) / (1e18)) - user.usdRewardDebt;
    }

    function payPendingUSDCReward(uint256 _pid, address userAddress) public {

        UserInfo storage user = userInfo[_pid][userAddress];

        uint256 usdcPending = ((user.amount * accDepositUSDRewardPerShare) / 1e18) - user.usdRewardDebt;

        if (usdcPending > 0) {
            treasury.transferUSDToUser(userAddress, usdcPending);
        }
    }

}

File 2 of 18 : 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 3 of 18 : 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 4 of 18 : 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 5 of 18 : SandManTokenV3.sol
/*

      %%% %%%%%%%            |#|
    %%%% %%%%%%%%%%%        |#|####
  %%%%% %         %%%       |#|=#####
 %%%%% %   @    @   %%      | | ==####
%%%%%% % (_  ()  )  %%     | |    ===##
%%  %%% %  \_    | %%      | |       =##
%    %%%% %  u^uuu %%     | |         ==#
      %%%% %%%%%%%%%      | |           V
                                                                                          
                                                                                by sandman.finance                                     
 */
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.6;

import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "./libs/IWETH.sol";

import "@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol";
import "@uniswap/v2-core/contracts/interfaces/IUniswapV2Pair.sol";
import "@uniswap/v2-core/contracts/interfaces/IUniswapV2Factory.sol";
import "./ToolBox.sol";

/*
  TABLE ERROR REFERENCE:
  ERR1: The sender is on the blacklist. Please contact to support.
  ERR2: The recipient is on the blacklist. Please contact to support.
  ERR3: User cannot send more than allowed.
  ERR4: User is not operator.
  ERR5: User is excluded from antibot system.
  ERR6: Bot address is already on the blacklist.
  ERR7: The expiration time has to be greater than 0.
  ERR8: Bot address is not found on the blacklist.
  ERR9: Address cant be 0.
*/

// SandManToken
contract SandManTokenV3 is ERC20("DEATH TOKEN", "DEATH"), Ownable {

    event OperatorTransferred(address indexed previousOperator, address indexed newOperator);
    event TransferTaxRateUpdated(address indexed operator, uint256 previousRate, uint256 newRate);
    event HoldingAmountRateUpdated(address indexed operator, uint256 previousRate, uint256 newRate);
    event AntiBotWorkingStatus(address indexed operator, bool previousStatus, bool newStatus);
    event AddBotAddress(address indexed botAddress);
    event RemoveBotAddress(address indexed botAddress);
    event ExcludedOperatorsUpdated(address indexed operatorAddress, bool previousStatus, bool newStatus);
    event ExcludedHoldersUpdated(address indexed holderAddress, bool previousStatus, bool newStatus);
    event SetSwapAndLiquifyEnabled(bool swapAndLiquifyEnabled);
    event TransferFeeChanged(uint256 txnFee, uint256 extraTxnFee);
    event SetSandManRouter(address sandManSwapRouter, address sandManSwapPair);

    using SafeMath for uint256;

    // Transfer tax rate in basis points. (default 6.66%)
    uint16 public transferTaxRate = 666;
    
    // Extra transfer tax rate in basis points. (default 2.00%)
    uint16 public extraTransferTaxRate = 200;
    
    // Burn rate % of transfer tax. (default 54.95% x 6.66% = 3.660336% of total amount).
    uint32 public constant burnRate = 549549549;
    
    // Max transfer tax rate: 10.01%.
    uint16 public constant MAXIMUM_TRANSFER_TAX_RATE = 1001;

    // Max transfer amount rate. (default is 3% of total supply)
    uint16 public maxUserTransferAmountRate = 300;
    
    // Max holding rate. (default is 9% of total supply)
    uint16 public maxUserHoldAmountRate = 900;

    // Length of blacklist addressess
    uint256 public blacklistLength;
 
    // Enable|Disable antiBot
    bool public antiBotWorking;
    
    // Exclude operators from antiBot system
    mapping(address => bool) private _excludedOperatorsFromAntiBot;

    // Exclude holders from antiBot system
    mapping(address => bool) private _excludedHoldersFromAntiBot;

    // Penalized users
    mapping(address => bool) public extraForPenalizedUsers;

    // mapping store blacklist. address=>ExpirationTime 
    mapping(address => uint256) private _blacklist;
    
    // burn address
    address public constant BURN_ADDRESS = 0x000000000000000000000000000000000000dEaD;
    
    // operator role
    address internal _operator;
    
    // Automatic swap and liquify enabled
    bool public swapAndLiquifyEnabled = true;
    // Min amount to liquify. (default 40 SANDMANs)
    uint256 public constant minSandManAmountToLiquify = 40 * (10 ** 18);
    // Min amount to liquify. (default 100 MATIC)
    uint256 public constant minMaticAmountToLiquify = 100 *  (10 ** 18);

    IUniswapV2Router02 public sandManSwapRouter;
    // The trading pair
    address public sandManSwapPair;
    // In swap and liquify
    bool private _inSwapAndLiquify;

    ToolBox public immutable toolBox;

    // MODIFIERS
    modifier antiBot(address _sender, address _recipient, uint256 _amount) { 
        //check blacklist
        require(!_blacklistCheck(_sender), "ERR1");
        require(!_blacklistCheck(_recipient), "ERR2");

        // This code will be disabled after launch and before farming
        if (antiBotWorking){
            // check  if sender|recipient has a tx amount is within the allowed limits
            if (_isNotOperatorExcludedFromAntiBot(_sender)){
                if(_isNotOperatorExcludedFromAntiBot(_recipient))
                    require(_amount <= _maxUserTransferAmount(), "ERR3");
            }
        }
        _;
    }

    modifier transferTaxFree {
        uint16 _transferTaxRate = transferTaxRate;
        uint16 _extraTransferTaxRate = extraTransferTaxRate;
        transferTaxRate = 0;
        extraTransferTaxRate = 0;
        _;
        transferTaxRate = _transferTaxRate;
        extraTransferTaxRate = _extraTransferTaxRate;
    }

    modifier onlyOperator() {
        require(_operator == _msgSender(), "ERR4");
        _;
    }

    modifier lockTheSwap {
        _inSwapAndLiquify = true;
        _;
        _inSwapAndLiquify = false;
    }
    
    
    constructor(ToolBox _toolBoxAddress)
    {
        toolBox = _toolBoxAddress;
      // Exclude operator addresses, lps, etc from antibot system
        _excludedOperatorsFromAntiBot[msg.sender] = true;
        _excludedOperatorsFromAntiBot[address(0)] = true;
        _excludedOperatorsFromAntiBot[address(this)] = true;
        _excludedOperatorsFromAntiBot[BURN_ADDRESS] = true;

        _operator = _msgSender();
    }
    

    function mint(address _to, uint256 _amount) public onlyOwner {
        _mint(_to, _amount);
    }
    
    //INTERNALS
    
    /// @dev overrides transfer function to use antibot system
    function _transfer(address _sender, address _recipient, uint256 _amount) internal virtual override antiBot(_sender, _recipient, _amount) {
        // Autodetect is sender is a BOT
        // This code will be disabled after launch and before farming
        if (antiBotWorking){
            // check  if sender|recipient has a tx amount is within the allowed limits
            if (_isNotHolderExcludedFromAntiBot(_sender)){
                if(_isNotOperatorExcludedFromAntiBot(_sender)){
                    if (balanceOf(_sender) > _maxUserHoldAmount()) {
                        _addBotAddressToBlackList(_sender, type(uint256).max);
                        return;
                    }
                }
            }
        }
        
        // swap and liquify
        bool toFromToolBox = (_sender == address(toolBox) || _recipient == address(toolBox));
        if (
            swapAndLiquifyEnabled == true
            && _inSwapAndLiquify == false
            && address(sandManSwapRouter) != address(0)
            && !toFromToolBox
            && _sender != sandManSwapPair
            && _sender != owner()
        ) {
            swapAndLiquify();
        }

        if (toFromToolBox ||
            _recipient == BURN_ADDRESS || (transferTaxRate == 0 && extraTransferTaxRate == 0) ||
            _excludedOperatorsFromAntiBot[_sender] || _excludedOperatorsFromAntiBot[_recipient]) {
            
            super._transfer(_sender, _recipient, _amount);

        } else {
            // default tax is 6.66% of every transfer, but extra 2% for dumping tax
            uint256 taxAmount = (_amount * (transferTaxRate +
                ((extraForPenalizedUsers[_sender] || extraForPenalizedUsers[_recipient]) ? extraTransferTaxRate : 0))) / 10000;

            uint256 burnAmount = (taxAmount * burnRate) / 1000000000;
            uint256 liquidityAmount = taxAmount - burnAmount;

            // default 93.34% of transfer sent to _recipient
            uint256 sendAmount = _amount - taxAmount;

            require(_amount == sendAmount + taxAmount &&
                        taxAmount == burnAmount + liquidityAmount, "sum error");

            super._transfer(_sender, BURN_ADDRESS, burnAmount);
            super._transfer(_sender, address(this), liquidityAmount);
            super._transfer(_sender, _recipient, sendAmount);

            _amount = sendAmount;
        }
    }

    /// @dev internal function to add address to blacklist.
    function _addBotAddressToBlackList(address _botAddress, uint256 _expirationTime) internal {
        require(_isNotHolderExcludedFromAntiBot(_botAddress), "ERR5");
        require(_isNotOperatorExcludedFromAntiBot(_botAddress), "ERR5");
        require(_blacklist[_botAddress] == 0, "ERR6");
        require(_expirationTime > 0, "ERR7");

        _blacklist[_botAddress] = _expirationTime;
        blacklistLength = blacklistLength.add(1);

        emit AddBotAddress(_botAddress);
    }
    
    ///@dev internal function to remove address from blacklist.
    function _removeBotAddressToBlackList(address _botAddress) internal {
        require(_blacklist[_botAddress] > 0, "ERR8");

        delete _blacklist[_botAddress];
        blacklistLength = blacklistLength.sub(1);

        emit RemoveBotAddress(_botAddress);
    }

    ///@dev Check if the address is excluded from antibot system.
    function _isNotHolderExcludedFromAntiBot(address _userAddress) internal view returns(bool) {
        return(!_excludedHoldersFromAntiBot[_userAddress]);
    }

    ///@dev Check if the address is excluded from antibot system.
    function _isNotOperatorExcludedFromAntiBot(address _userAddress) internal view returns(bool) {
        return(!_excludedOperatorsFromAntiBot[_userAddress]);
    }

    ///@dev Max user transfer allowed
    function _maxUserTransferAmount() internal view returns (uint256) {
        return totalSupply().mul(maxUserTransferAmountRate).div(10000);
    }

    ///@dev Max user Holding allowed
    function _maxUserHoldAmount() internal view returns (uint256) {
        return totalSupply().mul(maxUserHoldAmountRate).div(10000);
    }

    ///@dev check if the address is in the blacklist or expired
    function _blacklistCheck(address _botAddress) internal view returns(bool) {
        if(_blacklist[_botAddress] > 0)
            return _blacklist[_botAddress] > block.timestamp;
        else 
            return false;
    }

    // PUBLICS
 
    ///@dev Max user transfer allowed
    function maxUserTransferAmount() external view returns (uint256) {
        return _maxUserTransferAmount();
    }

    ///@dev Max user Holding allowed
    function maxUserHoldAmount() external view returns (uint256) {
        return _maxUserHoldAmount();
    }

     ///@dev check if the address is in the blacklist or expired
    function blacklistCheck(address _botAddress) external view returns(bool) {
        return _blacklistCheck(_botAddress);     
    }
    
    ///@dev check if the address is in the blacklist or not
    function blacklistCheckExpirationTime(address _botAddress) external view returns(uint256){
        return _blacklist[_botAddress];
    }


    // EXTERNALS

    ///@dev Update operator address status
    function updateOperatorsFromAntiBot(address _operatorAddress, bool _status) external onlyOwner {
        require(_operatorAddress != address(0), "ERR9");

        emit ExcludedOperatorsUpdated(_operatorAddress, _excludedOperatorsFromAntiBot[_operatorAddress], _status);

        _excludedOperatorsFromAntiBot[_operatorAddress] = _status;
    }

    ///@dev Update operator address status
    function updateHoldersFromAntiBot(address _holderAddress, bool _status) external onlyOwner {
        require(_holderAddress != address(0), "ERR9");

        emit ExcludedHoldersUpdated(_holderAddress, _excludedHoldersFromAntiBot[_holderAddress], _status);

        _excludedHoldersFromAntiBot[_holderAddress] = _status;
    }


    ///@dev Update operator address
    function transferOperator(address newOperator) external onlyOperator {
        require(newOperator != address(0), "ERR9");
        
        emit OperatorTransferred(_operator, newOperator);

        _operator = newOperator;
    }

    function operator() external view returns (address) {
        return _operator;
    }

     ///@dev Updates the max holding amount. 
    function updateMaxUserHoldAmountRate(uint16 _maxUserHoldAmountRate) external onlyOwner {
        require(_maxUserHoldAmountRate >= 500);
        require(_maxUserHoldAmountRate <= 10000);
        
        emit TransferTaxRateUpdated(_msgSender(), maxUserHoldAmountRate, _maxUserHoldAmountRate);

        maxUserHoldAmountRate = _maxUserHoldAmountRate;
    }

    ///@dev Updates the max user transfer amount. 
    function updateMaxUserTransferAmountRate(uint16 _maxUserTransferAmountRate) external onlyOwner {
        require(_maxUserTransferAmountRate >= 50);
        require(_maxUserTransferAmountRate <= 10000);
        
        emit HoldingAmountRateUpdated(_msgSender(), maxUserHoldAmountRate, _maxUserTransferAmountRate);

        maxUserTransferAmountRate = _maxUserTransferAmountRate;
    }

    
    ///@dev Update the antiBotWorking status: ENABLE|DISABLE.
    function updateStatusAntiBotWorking(bool _status) external onlyOwner {
        emit AntiBotWorkingStatus(_msgSender(), antiBotWorking, _status);

        antiBotWorking = _status;
    }

     ///@dev Add an address to the blacklist. Only the owner can add. Owner is the address of the Governance contract.
    function addBotAddress(address _botAddress, uint256 _expirationTime) external onlyOwner {
        _addBotAddressToBlackList(_botAddress, _expirationTime);
    }
    
    ///@dev Remove an address from the blacklist. Only the owner can remove. Owner is the address of the Governance contract.
    function removeBotAddress(address botAddress) external onlyOperator {
        _removeBotAddressToBlackList(botAddress);
    }
    
    ///@dev Add multi address to the blacklist. Only the owner can add. Owner is the address of the Governance contract.
    function addBotAddressBatch(address[] memory _addresses, uint256 _expirationTime) external onlyOwner {
        require(_addresses.length > 0);

        for(uint i=0;i<_addresses.length;i++){
            _addBotAddressToBlackList(_addresses[i], _expirationTime);
        }
    }
    
    ///@dev Remove multi address from the blacklist. Only the owner can remove. Owner is the address of the Governance contract.
    function removeBotAddressBatch(address[] memory _addresses) external onlyOperator {
        require(_addresses.length > 0);

        for(uint i=0;i<_addresses.length;i++){
            _removeBotAddressToBlackList(_addresses[i]);
        }
    }

    ///@dev Check if the address is excluded from antibot system.
    function isExcludedOperatorFromAntiBot(address _userAddress) external view returns(bool) {
        return(_excludedOperatorsFromAntiBot[_userAddress]);
    }

    ///@dev Check if the address is excluded from antibot system.
    function isExcludedHolderFromAntiBot(address _userAddress) external view returns(bool) {
        return(_excludedHoldersFromAntiBot[_userAddress]);
    }

    //new code
    function swapAndLiquify() private lockTheSwap transferTaxFree {
        uint256 contractTokenBalance = ERC20(address(this)).balanceOf(address(this));

        uint256 WETHbalance = IERC20(sandManSwapRouter.WETH()).balanceOf(address(this));

        IWETH(sandManSwapRouter.WETH()).withdraw(WETHbalance);

        if (address(this).balance >= minMaticAmountToLiquify || contractTokenBalance >= minSandManAmountToLiquify) {

            ERC20(address(this)).transfer(address(toolBox), ERC20(address(this)).balanceOf(address(this)));
            // send all tokens to add liquidity with, we are refunded any that aren't used.
            toolBox.sandManETHLiquidityWithBuyBack{value: address(this).balance}(BURN_ADDRESS);
        }
    }

    receive() external payable {}

    function updateSwapAndLiquifyEnabled(bool _enabled) external onlyOperator {
        swapAndLiquifyEnabled = _enabled;

        // emit SetSwapAndLiquifyEnabled(swapAndLiquifyEnabled);
    }

    function updateTransferTaxRate(uint16 _transferTaxRate, uint16 _extraTransferTaxRate) external onlyOperator {
        require(_transferTaxRate + _extraTransferTaxRate  <= MAXIMUM_TRANSFER_TAX_RATE,
            "!valid");
        transferTaxRate = _transferTaxRate;
        extraTransferTaxRate = _extraTransferTaxRate;

        emit TransferFeeChanged(transferTaxRate, extraTransferTaxRate);
    }

    function updateSandManSwapRouter(address _router) external onlyOperator {
        require(_router != address(0), "!!0");
        require(address(sandManSwapRouter) == address(0), "!unset");

        sandManSwapRouter = IUniswapV2Router02(_router);
        sandManSwapPair = IUniswapV2Factory(sandManSwapRouter.factory()).getPair(address(this), sandManSwapRouter.WETH());

        require(address(sandManSwapPair) != address(0), "matic pair !exist");

        emit SetSandManRouter(address(sandManSwapRouter), sandManSwapPair);
    }


}

File 6 of 18 : Treasury.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.6;

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol";
import "@uniswap/v2-core/contracts/interfaces/IUniswapV2Pair.sol";

contract Treasury {

    IUniswapV2Router02 public tokenSwapRouter;
    IERC20 public immutable usdRewardCurrency;

    uint256 public usdRewardBalance = 0;

    constructor(address _usdCurrencyAddress, IUniswapV2Router02 _routerAddress) {
        tokenSwapRouter = _routerAddress;
        usdRewardCurrency = IERC20(_usdCurrencyAddress);
    }

    
    function _removeLpToken(address _lpToken) internal {
        uint256 amount = IERC20(_lpToken).balanceOf(address(this));

        require(IERC20(_lpToken).approve(address(tokenSwapRouter), amount), '!approved');

        IUniswapV2Pair lpToken = IUniswapV2Pair(_lpToken);
        // make the swap
        tokenSwapRouter.removeLiquidity(
            lpToken.token0(),
            lpToken.token1(),
            amount,
            0,
            0,
            address(this),
            block.timestamp
        );
    }

    function convertDepositFeesToUSD(address _token, uint8 _tokenType) public returns (uint256){
        if (_tokenType == 1) {
            _removeLpToken(_token);
            return convertDepositFeesToUSD(IUniswapV2Pair(_token).token0(), 0) +
                   convertDepositFeesToUSD(IUniswapV2Pair(_token).token1(), 0);
        }

        uint256 totalTokenBalance = IERC20(_token).balanceOf(address(this));

        if (_token == address(usdRewardCurrency)) {
            return totalTokenBalance;
        }

        if (totalTokenBalance == 0){
            return 0;
        }

        address[] memory path = new address[](2);
        path[0] = _token;
        path[1] = address(usdRewardCurrency);

        uint256 usdPriorBalance = usdRewardCurrency.balanceOf(address(this));

        require(IERC20(_token).approve(address(tokenSwapRouter), totalTokenBalance), 'approval failed');

        // make the swap
        tokenSwapRouter.swapExactTokensForTokens(
            totalTokenBalance,
            0, 
            path,
            address(this),
            block.timestamp
        );

        uint256 usdProfit = usdRewardCurrency.balanceOf(address(this)) - usdPriorBalance;

        usdRewardBalance = usdRewardBalance + usdProfit;

        // emit DepositFeeConvertedToUSDC(token, totalTokenBalance, usdProfit);

        return usdProfit;
 
    }

    function transferUSDToUser(address recipient, uint256 amount) external {
        require(usdRewardCurrency.balanceOf(address(this)) >= amount, "accounting error, transfering more usdc out than available");
        require(usdRewardCurrency.transfer(recipient, amount), "transfer failed!");

        usdRewardBalance = usdRewardBalance - amount;

        // emit USDCTransferredToUser(recipient, amount);
    }

    function updateTokenSwapRouter(address _router) external {
        require(_router != address(0), "updateTokenSwapRouter: new _router is the zero address");
        require(address(tokenSwapRouter) == address(0), "router already set!");

        tokenSwapRouter = IUniswapV2Router02(_router);
        // emit SandManSwapRouterUpdated(msg.sender, address(tokenSwapRouter));
    }

    receive() external payable {}

}

File 7 of 18 : 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);
    }

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

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

File 8 of 18 : Ownable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../utils/Context.sol";

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

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

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor() {
        _setOwner(_msgSender());
    }

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

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

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

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

    function _setOwner(address newOwner) private {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}

File 9 of 18 : 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 18 : ERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "./IERC20.sol";
import "./extensions/IERC20Metadata.sol";
import "../../utils/Context.sol";

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

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

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;

    /**
     * @dev Sets the values for {name} and {symbol}.
     *
     * The default value of {decimals} is 18. To select a different value for
     * {decimals} you should overload it.
     *
     * All two of these values are immutable: they can only be set once during
     * construction.
     */
    constructor(string memory name_, string memory symbol_) {
        _name = name_;
        _symbol = symbol_;
    }

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

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

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

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

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

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

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

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

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

        uint256 currentAllowance = _allowances[sender][_msgSender()];
        require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
        unchecked {
            _approve(sender, _msgSender(), currentAllowance - amount);
        }

        return true;
    }

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

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

        return true;
    }

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

        _beforeTokenTransfer(sender, recipient, amount);

        uint256 senderBalance = _balances[sender];
        require(senderBalance >= amount, "ERC20: transfer amount exceeds balance");
        unchecked {
            _balances[sender] = senderBalance - amount;
        }
        _balances[recipient] += amount;

        emit Transfer(sender, recipient, amount);

        _afterTokenTransfer(sender, recipient, amount);
    }

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

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

        _totalSupply += amount;
        _balances[account] += amount;
        emit Transfer(address(0), account, amount);

        _afterTokenTransfer(address(0), account, amount);
    }

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

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

        uint256 accountBalance = _balances[account];
        require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
        unchecked {
            _balances[account] = accountBalance - amount;
        }
        _totalSupply -= amount;

        emit Transfer(account, address(0), amount);

        _afterTokenTransfer(account, address(0), amount);
    }

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

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

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

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

File 11 of 18 : IWETH.sol
pragma solidity >=0.5.0;

interface IWETH {
    function deposit() external payable;
    function transfer(address to, uint value) external returns (bool);
    function withdraw(uint) external;
}

File 12 of 18 : 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 13 of 18 : 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 14 of 18 : IUniswapV2Factory.sol
pragma solidity >=0.5.0;

interface IUniswapV2Factory {
    event PairCreated(address indexed token0, address indexed token1, address pair, uint);

    function feeTo() external view returns (address);
    function feeToSetter() external view returns (address);

    function getPair(address tokenA, address tokenB) external view returns (address pair);
    function allPairs(uint) external view returns (address pair);
    function allPairsLength() external view returns (uint);

    function createPair(address tokenA, address tokenB) external returns (address pair);

    function setFeeTo(address) external;
    function setFeeToSetter(address) external;
}

File 15 of 18 : ToolBox.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.6;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";

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

import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";


contract ToolBox is ReentrancyGuard, Ownable {
    using SafeERC20 for ERC20;

    address public sandManAddress;

    IUniswapV2Router02 public immutable sandManSwapRouter;
    // The trading pair
    address public sandManSwapPair;

    // To receive ETH when swapping
    receive() external payable {}

    event SetSandManAddresses(address sandManAddress, address sandManSwapPair);

    /**
     * @notice Constructs the AddLiquidityHelper contract.
     */
    constructor(address _router)  {
        require(_router != address(0), "_router is the zero address");
        sandManSwapRouter = IUniswapV2Router02(_router);
    }

    function sandManETHLiquidityWithBuyBack(address lpHolder) external payable nonReentrant {
        require(msg.sender == sandManAddress, "can only be used by the sandMan token!");

        (uint256 res0, uint256 res1, ) = IUniswapV2Pair(sandManSwapPair).getReserves();

        if (res0 != 0 && res1 != 0) {
            // making weth res0
            if (IUniswapV2Pair(sandManSwapPair).token0() == sandManAddress)
                (res1, res0) = (res0, res1);

            uint256 contractTokenBalance = ERC20(sandManAddress).balanceOf(address(this));

            // calculate how much eth is needed to use all of contractTokenBalance
            // also boost precision a tad.
            uint256 totalETHNeeded = (res0 * contractTokenBalance) / res1;

            uint256 existingETH = address(this).balance;

            uint256 unmatchedSandMan = 0;

            if (existingETH < totalETHNeeded) {
                // calculate how much sandMan will match up with our existing eth.
                uint256 matchedSandMan = (res1 * existingETH) / res0;
                if (contractTokenBalance >= matchedSandMan)
                    unmatchedSandMan = contractTokenBalance - matchedSandMan;
            } else if (existingETH > totalETHNeeded) {
                // use excess eth for sandMan buy back
                uint256 excessETH = existingETH - totalETHNeeded;

                if (excessETH / 2 > 0) {
                    // swap half of the excess eth for lp to be balanced
                    swapETHForTokens(excessETH / 2, sandManAddress);
                }
            }

            uint256 unmatchedSandManToSwap = unmatchedSandMan / 2;

            // swap tokens for ETH
            if (unmatchedSandManToSwap > 0)
                swapTokensForEth(sandManAddress, unmatchedSandManToSwap);

            uint256 sandManBalance = ERC20(sandManAddress).balanceOf(address(this));

            // approve token transfer to cover all possible scenarios
            ERC20(sandManAddress).approve(address(sandManSwapRouter), sandManBalance);

            // add the liquidity
            sandManSwapRouter.addLiquidityETH{value: address(this).balance}(
                sandManAddress,
                sandManBalance,
                0, // slippage is unavoidable
                0, // slippage is unavoidable
                lpHolder,
                block.timestamp
            );

        }

        if (address(this).balance > 0) {
            // not going to require/check return value of this transfer as reverting behaviour is undesirable.
            payable(address(msg.sender)).call{value: address(this).balance}("");
        }

        if (ERC20(sandManAddress).balanceOf(address(this)) > 0) {
            ERC20(sandManAddress).transfer(msg.sender, ERC20(sandManAddress).balanceOf(address(this)));
        }
            
    }

    function addSandManETHLiquidity(uint256 nativeAmount) external payable nonReentrant {
        require(msg.value > 0, "!sufficient funds");

        ERC20(sandManAddress).safeTransferFrom(msg.sender, address(this), nativeAmount);

        // approve token transfer to cover all possible scenarios
        ERC20(sandManAddress).approve(address(sandManSwapRouter), nativeAmount);

        // add the liquidity
        sandManSwapRouter.addLiquidityETH{value: msg.value}(
            sandManAddress,
            nativeAmount,
            0, // slippage is unavoidable
            0, // slippage is unavoidable
            address(this),
            block.timestamp
        );

        if (address(this).balance > 0) {
            // not going to require/check return value of this transfer as reverting behaviour is undesirable.
            payable(address(msg.sender)).call{value: address(this).balance}("");
        }

        if (ERC20(sandManAddress).balanceOf(address(this)) > 0)
            ERC20(sandManAddress).transfer(msg.sender, ERC20(sandManAddress).balanceOf(address(this)));
    }

    function addSandManLiquidity(address baseTokenAddress, uint256 baseAmount, uint256 nativeAmount) external nonReentrant {
        ERC20(baseTokenAddress).safeTransferFrom(msg.sender, address(this), baseAmount);
        ERC20(sandManAddress).safeTransferFrom(msg.sender, address(this), nativeAmount);

        // approve token transfer to cover all possible scenarios
        ERC20(baseTokenAddress).approve(address(sandManSwapRouter), baseAmount);
        ERC20(sandManAddress).approve(address(sandManSwapRouter), nativeAmount);

        // add the liquidity
        sandManSwapRouter.addLiquidity(
            baseTokenAddress,
            sandManAddress,
            baseAmount,
            nativeAmount ,
            0, // slippage is unavoidable
            0, // slippage is unavoidable
            msg.sender,
            block.timestamp
        );

        if (ERC20(baseTokenAddress).balanceOf(address(this)) > 0)
            ERC20(baseTokenAddress).safeTransfer(msg.sender, ERC20(baseTokenAddress).balanceOf(address(this)));

        if (ERC20(sandManAddress).balanceOf(address(this)) > 0)
            ERC20(sandManAddress).transfer(msg.sender, ERC20(sandManAddress).balanceOf(address(this)));
    }

    function removeSandManLiquidity(address baseTokenAddress, uint256 liquidity) external nonReentrant {
        address lpTokenAddress = IUniswapV2Factory(sandManSwapRouter.factory()).getPair(baseTokenAddress, sandManAddress);
        require(lpTokenAddress != address(0), "pair hasn't been created yet, so can't remove liquidity!");

        ERC20(lpTokenAddress).safeTransferFrom(msg.sender, address(this), liquidity);
        // approve token transfer to cover all possible scenarios
        ERC20(lpTokenAddress).approve(address(sandManSwapRouter), liquidity);

        // add the liquidity
        sandManSwapRouter.removeLiquidity(
            baseTokenAddress,
            sandManAddress,
            liquidity,
            0, // slippage is unavoidable
            0, // slippage is unavoidable
            msg.sender,
            block.timestamp
        );
    }

    /// @dev Swap tokens for eth
    function swapTokensForEth(address saleTokenAddress, uint256 tokenAmount) internal {
        // generate the sandManSwap pair path of token -> weth
        address[] memory path = new address[](2);
        path[0] = saleTokenAddress;
        path[1] = sandManSwapRouter.WETH();

        ERC20(saleTokenAddress).approve(address(sandManSwapRouter), tokenAmount);

        // make the swap
        sandManSwapRouter.swapExactTokensForETHSupportingFeeOnTransferTokens(
            tokenAmount,
            0, // accept any amount of ETH
            path,
            address(this),
            block.timestamp
        );
    }


    function swapETHForTokens(uint256 ethAmount, address wantedTokenAddress) internal {
        require(address(this).balance >= ethAmount, "insufficient matic provided!");
        require(wantedTokenAddress != address(0), "wanted token address can't be the zero address!");

        // generate the sandManSwap pair path of token -> weth
        address[] memory path = new address[](2);
        path[0] = sandManSwapRouter.WETH();
        path[1] = wantedTokenAddress;

        // make the swap
        sandManSwapRouter.swapExactETHForTokensSupportingFeeOnTransferTokens{value: ethAmount}(
            0,
            path,
            // cannot send tokens to the token contract of the same type as the output token
            address(this),
            block.timestamp
        );
    }

    /**
     * @dev set the sandMan address.
     * Can only be called by the current owner.
     */
    function setSandManAddress(address _sandManAddress) external onlyOwner {
        require(_sandManAddress != address(0), "_sandManAddress is the zero address");
        require(sandManAddress == address(0), "sandManAddress already set!");

        sandManAddress = _sandManAddress;

        sandManSwapPair = IUniswapV2Factory(sandManSwapRouter.factory()).getPair(sandManAddress, sandManSwapRouter.WETH());

        require(address(sandManSwapPair) != address(0), "matic pair !exist");

        emit SetSandManAddresses(sandManAddress, sandManSwapPair);
    }
}

File 16 of 18 : 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 17 of 18 : IERC20Metadata.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../IERC20.sol";

/**
 * @dev Interface for the optional metadata functions from the ERC20 standard.
 *
 * _Available since v4.1._
 */
interface IERC20Metadata is IERC20 {
    /**
     * @dev Returns the name of the token.
     */
    function name() external view returns (string memory);

    /**
     * @dev Returns the symbol of the token.
     */
    function symbol() external view returns (string memory);

    /**
     * @dev Returns the decimals places of the token.
     */
    function decimals() external view returns (uint8);
}

File 18 of 18 : 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);
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"contract SandManTokenV3","name":"_sandMan","type":"address"},{"internalType":"contract Treasury","name":"_treasuryAddress","type":"address"},{"internalType":"address","name":"_feeAddress","type":"address"},{"internalType":"uint256","name":"_sandManPerBlock","type":"uint256"},{"internalType":"uint256","name":"_startBlock","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"EmergencyWithdraw","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"caller","type":"address"},{"indexed":false,"internalType":"uint256","name":"previousAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newAmount","type":"uint256"}],"name":"SetEmissionRate","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"address","name":"newAddress","type":"address"}],"name":"SetFeeAddress","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newStartBlock","type":"uint256"}],"name":"SetStartBlock","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Withdraw","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":false,"internalType":"address","name":"lpToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"allocPoint","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"depositFeeBP","type":"uint256"}],"name":"addPool","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":false,"internalType":"address","name":"lpToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"allocPoint","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"depositFeeBP","type":"uint256"}],"name":"setPool","type":"event"},{"inputs":[],"name":"MAX_EMISSION_RATE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"accDepositUSDRewardPerShare","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint8","name":"_tokenType","type":"uint8"},{"internalType":"uint256","name":"_allocPoint","type":"uint256"},{"internalType":"contract IERC20","name":"_lpToken","type":"address"},{"internalType":"uint16","name":"_depositFeeBP","type":"uint16"},{"internalType":"bool","name":"_withUpdate","type":"bool"}],"name":"add","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"deposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"}],"name":"emergencyWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"emmissionEndBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"feeAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_from","type":"uint256"},{"internalType":"uint256","name":"_to","type":"uint256"}],"name":"getMultiplier","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"massUpdatePools","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"address","name":"userAddress","type":"address"}],"name":"payPendingUSDCReward","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"address","name":"_user","type":"address"}],"name":"pendingSandMan","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"address","name":"_user","type":"address"}],"name":"pendingUSDC","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"name":"poolExistence","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"poolInfo","outputs":[{"internalType":"contract IERC20","name":"lpToken","type":"address"},{"internalType":"uint256","name":"allocPoint","type":"uint256"},{"internalType":"uint256","name":"lastRewardBlock","type":"uint256"},{"internalType":"uint256","name":"accSandManPerShare","type":"uint256"},{"internalType":"uint16","name":"depositFeeBP","type":"uint16"},{"internalType":"uint256","name":"lpSupply","type":"uint256"},{"internalType":"uint8","name":"tokenType","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"poolLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"sandMan","outputs":[{"internalType":"contract SandManTokenV3","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"sandManMaximumSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"sandManPerBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"uint8","name":"_tokenType","type":"uint8"},{"internalType":"uint256","name":"_allocPoint","type":"uint256"},{"internalType":"uint16","name":"_depositFeeBP","type":"uint16"},{"internalType":"bool","name":"_withUpdate","type":"bool"}],"name":"set","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_sandManPerBlock","type":"uint256"}],"name":"setEmissionRate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_feeAddress","type":"address"}],"name":"setFeeAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_newStartBlock","type":"uint256"}],"name":"setStartBlock","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"startBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalAllocPoint","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalUSDCollected","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"treasury","outputs":[{"internalType":"contract Treasury","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"}],"name":"updatePool","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"","type":"address"}],"name":"userInfo","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"rewardDebt","type":"uint256"},{"internalType":"uint256","name":"usdRewardDebt","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60c060405260006006557fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60085560006009556000600a556000600b556000600c553480156200004e57600080fd5b506040516200468a3803806200468a8339818101604052810190620000749190620002fe565b6200009462000088620001d660201b60201c565b620001de60201b60201c565b60018081905550600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156200010e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016200010590620003ad565b60405180910390fd5b8473ffffffffffffffffffffffffffffffffffffffff1660808173ffffffffffffffffffffffffffffffffffffffff1660601b815250508373ffffffffffffffffffffffffffffffffffffffff1660a08173ffffffffffffffffffffffffffffffffffffffff1660601b8152505082600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555081600281905550806007819055505050505050620004f0565b600033905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b600081519050620002b38162000488565b92915050565b600081519050620002ca81620004a2565b92915050565b600081519050620002e181620004bc565b92915050565b600081519050620002f881620004d6565b92915050565b600080600080600060a086880312156200031d576200031c6200045a565b5b60006200032d88828901620002b9565b95505060206200034088828901620002d0565b94505060406200035388828901620002a2565b93505060606200036688828901620002e7565b92505060806200037988828901620002e7565b9150509295509295909350565b600062000395600883620003cf565b9150620003a2826200045f565b602082019050919050565b60006020820190508181036000830152620003c88162000386565b9050919050565b600082825260208201905092915050565b6000620003ed8262000430565b9050919050565b6000620004018262000430565b9050919050565b60006200041582620003f4565b9050919050565b60006200042982620003f4565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600080fd5b7f216e6f6e7a65726f000000000000000000000000000000000000000000000000600082015250565b6200049381620003e0565b81146200049f57600080fd5b50565b620004ad8162000408565b8114620004b957600080fd5b50565b620004c7816200041c565b8114620004d357600080fd5b50565b620004e18162000450565b8114620004ed57600080fd5b50565b60805160601c60a05160601c6141216200056960003960008181610fd50152818161156f01528181611e660152611ed4015260008181610a2e01528181610ae701528181610b9501528181610c5501528181610cee015281816119cc015281816127b80152818161286d015261292101526141216000f3fe608060405234801561001057600080fd5b50600436106101fb5760003560e01c8063715018a61161011a578063bdfbe74f116100ad578063e2bbb1581161007c578063e2bbb15814610586578063e4c4cf01146105a2578063edab16a6146105c0578063f2fde38b146105dc578063f35e4a6e146105f8576101fb565b8063bdfbe74f146104ea578063c0f0936d1461051a578063cbd258b514610538578063ce8fa0ba14610568576101fb565b80638dbb1e3a116100e95780638dbb1e3a1461043c57806393f1a40b1461046c57806394c4a78c1461049e578063a1bdb15e146104ce576101fb565b8063715018a6146103dc5780638705fcd4146103e657806389b06f9f146104025780638da5cb5b1461041e576101fb565b806343cab1e8116101925780635312ea8e116101615780635312ea8e1461037c57806361d027b314610398578063630b5ba1146103b65780636abc1ef5146103c0576101fb565b806343cab1e814610308578063441a3e701461032657806348cd4cb11461034257806351eb05a614610360576101fb565b80632a4f9d43116101ce5780632a4f9d431461029057806338a2c581146102ae57806341275358146102cc578063436cc3d6146102ea576101fb565b8063081e3eda146102005780631526fe271461021e57806317caf6f11461025457806318160ddd14610272575b600080fd5b610208610614565b60405161021591906138a7565b60405180910390f35b61023860048036038101906102339190612fe2565b610621565b60405161024b97969594939291906135e0565b60405180910390f35b61025c6106ae565b60405161026991906138a7565b60405180910390f35b61027a6106b4565b60405161028791906138a7565b60405180910390f35b6102986106ba565b6040516102a591906138a7565b60405180910390f35b6102b66106c0565b6040516102c391906138a7565b60405180910390f35b6102d46106c6565b6040516102e191906134ea565b60405180910390f35b6102f26106ec565b6040516102ff91906138a7565b60405180910390f35b6103106106f8565b60405161031d91906138a7565b60405180910390f35b610340600480360381019061033b919061307c565b6106fe565b005b61034a610979565b60405161035791906138a7565b60405180910390f35b61037a60048036038101906103759190612fe2565b61097f565b005b61039660048036038101906103919190612fe2565b610e10565b005b6103a0610fd3565b6040516103ad919061366a565b60405180910390f35b6103be610ff7565b005b6103da60048036038101906103d591906130bc565b61102a565b005b6103e46112c6565b005b61040060048036038101906103fb9190612f5b565b61134e565b005b61041c6004803603810190610417919061303c565b6114d8565b005b610426611601565b60405161043391906134ea565b60405180910390f35b6104566004803603810190610451919061307c565b61162a565b60405161046391906138a7565b60405180910390f35b6104866004803603810190610481919061303c565b611673565b604051610495939291906138eb565b60405180910390f35b6104b860048036038101906104b3919061303c565b6116aa565b6040516104c591906138a7565b60405180910390f35b6104e860048036038101906104e39190612fe2565b611809565b005b61050460048036038101906104ff919061303c565b61190a565b60405161051191906138a7565b60405180910390f35b61052261199c565b60405161052f91906138a7565b60405180910390f35b610552600480360381019061054d9190612fb5565b6119aa565b60405161055f91906135c5565b60405180910390f35b6105706119ca565b60405161057d919061364f565b60405180910390f35b6105a0600480360381019061059b919061307c565b6119ee565b005b6105aa61211e565b6040516105b791906138a7565b60405180910390f35b6105da60048036038101906105d59190613137565b612124565b005b6105f660048036038101906105f19190612f5b565b61256f565b005b610612600480360381019061060d9190612fe2565b612667565b005b6000600480549050905090565b6004818154811061063157600080fd5b90600052602060002090600702016000915090508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060010154908060020154908060030154908060040160009054906101000a900461ffff16908060050154908060060160009054906101000a900460ff16905087565b60065481565b600c5481565b60025481565b60085481565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b678ac7230489e8000081565b60095481565b60026001541415610744576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161073b90613887565b60405180910390fd5b600260018190555060006004838154811061076257610761613c36565b5b9060005260206000209060070201905060006005600085815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209050828160000154101561080d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161080490613827565b60405180910390fd5b6108168461097f565b60008160010154670de0b6b3a76400008460030154846000015461083a91906139db565b61084491906139aa565b61084e9190613a35565b905060008111156108645761086333826127b4565b5b60008411156108ed5783826000015461087d9190613a35565b82600001819055506108d433858560000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16612a159092919063ffffffff16565b8383600501546108e49190613a35565b83600501819055505b670de0b6b3a76400008360030154836000015461090a91906139db565b61091491906139aa565b8260010181905550843373ffffffffffffffffffffffffffffffffffffffff167ff279e6a1f5e320cca91135676d9cb6e44ca8a08c0b88342bcdb1144f6511b5688660405161096391906138a7565b60405180910390a3505050600180819055505050565b60075481565b60006004828154811061099557610994613c36565b5b90600052602060002090600702019050806002015443116109b65750610e0d565b6000816005015414806109cd575060008160010154145b156109e15743816002018190555050610e0d565b60006109f182600201544361162a565b90506000600654836001015460025484610a0b91906139db565b610a1591906139db565b610a1f91906139aa565b90506969e10de76676d08000007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b158015610a9257600080fd5b505afa158015610aa6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610aca919061300f565b1115610ad95760009050610c4a565b6969e10de76676d0800000817f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b158015610b4b57600080fd5b505afa158015610b5f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b83919061300f565b610b8d9190613954565b1115610c49577f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b158015610bf957600080fd5b505afa158015610c0d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c31919061300f565b6969e10de76676d0800000610c469190613a35565b90505b5b6000811115610ce1577f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166340c10f1930836040518363ffffffff1660e01b8152600401610cae92919061353c565b600060405180830381600087803b158015610cc857600080fd5b505af1158015610cdc573d6000803e3d6000fd5b505050505b6969e10de76676d08000007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b158015610d5257600080fd5b505afa158015610d66573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d8a919061300f565b10158015610db957507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600854145b15610dc657436008819055505b8260050154670de0b6b3a764000082610ddf91906139db565b610de991906139aa565b8360030154610df89190613954565b83600301819055504383600201819055505050505b50565b60026001541415610e56576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e4d90613887565b60405180910390fd5b6002600181905550600060048281548110610e7457610e73613c36565b5b9060005260206000209060070201905060006005600084815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002090506000816000015490506000826000018190555060008260010181905550610f4433828560000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16612a159092919063ffffffff16565b80836005015410610f6c57808360050154610f5f9190613a35565b8360050181905550610f77565b600083600501819055505b833373ffffffffffffffffffffffffffffffffffffffff167fbb757047c2b5f3974fe26b7c10f732e7bce710b0952a71082702781e62ae059583604051610fbe91906138a7565b60405180910390a35050506001808190555050565b7f000000000000000000000000000000000000000000000000000000000000000081565b6000600480549050905060005b81811015611026576110158161097f565b8061101f90613b8f565b9050611004565b5050565b611032612a9b565b73ffffffffffffffffffffffffffffffffffffffff16611050611601565b73ffffffffffffffffffffffffffffffffffffffff16146110a6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161109d906137e7565b60405180910390fd5b6101918261ffff1611156110ef576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110e6906137c7565b60405180910390fd5b60008460ff161480611104575060018460ff16145b611143576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161113a90613707565b60405180910390fd5b801561115257611151610ff7565b5b826004868154811061116757611166613c36565b5b9060005260206000209060070201600101546006546111869190613a35565b6111909190613954565b60068190555082600486815481106111ab576111aa613c36565b5b90600052602060002090600702016001018190555081600486815481106111d5576111d4613c36565b5b906000526020600020906007020160040160006101000a81548161ffff021916908361ffff160217905550836004868154811061121557611214613c36565b5b906000526020600020906007020160060160006101000a81548160ff021916908360ff160217905550847f39f0c3d078af018954b4fa56832a05a2b511afaa999b133ea3f1c487c21ed2876004878154811061127457611273613c36565b5b906000526020600020906007020160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1685856040516112b793929190613565565b60405180910390a25050505050565b6112ce612a9b565b73ffffffffffffffffffffffffffffffffffffffff166112ec611601565b73ffffffffffffffffffffffffffffffffffffffff1614611342576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611339906137e7565b60405180910390fd5b61134c6000612aa3565b565b611356612a9b565b73ffffffffffffffffffffffffffffffffffffffff16611374611601565b73ffffffffffffffffffffffffffffffffffffffff16146113ca576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113c1906137e7565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561143a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611431906137a7565b60405180910390fd5b80600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fd44190acf9d04bdb5d3a1aafff7e6dee8b40b93dfb8c5d3f0eea4b9f4539c3f760405160405180910390a350565b60006005600084815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020905060008160020154670de0b6b3a7640000600a54846000015461154e91906139db565b61155891906139aa565b6115629190613a35565b905060008111156115fb577f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663fe2f871384836040518363ffffffff1660e01b81526004016115c892919061353c565b600060405180830381600087803b1580156115e257600080fd5b505af11580156115f6573d6000803e3d6000fd5b505050505b50505050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b600060085483111561163f576000905061166d565b60085482111561165e57826008546116579190613a35565b905061166d565b828261166a9190613a35565b90505b92915050565b6005602052816000526040600020602052806000526040600020600091509150508060000154908060010154908060020154905083565b600080600484815481106116c1576116c0613c36565b5b9060005260206000209060070201905060006005600086815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020905060008260030154905082600201544311801561174657506000836005015414155b801561175457506000600654115b156117cc57600061176984600201544361162a565b9050600060065485600101546002548461178391906139db565b61178d91906139db565b61179791906139aa565b90508460050154670de0b6b3a7640000826117b291906139db565b6117bc91906139aa565b836117c79190613954565b925050505b8160010154670de0b6b3a76400008284600001546117ea91906139db565b6117f491906139aa565b6117fe9190613a35565b935050505092915050565b611811612a9b565b73ffffffffffffffffffffffffffffffffffffffff1661182f611601565b73ffffffffffffffffffffffffffffffffffffffff1614611885576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161187c906137e7565b60405180910390fd5b6000811161189257600080fd5b678ac7230489e8000081106118a657600080fd5b6118ae610ff7565b806002819055503373ffffffffffffffffffffffffffffffffffffffff167f1d6d701a35096c20378cd75889e191ea7805a050284fffba3bc572d9d354644f600254836040516118ff9291906138c2565b60405180910390a250565b6000806005600085815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002090508060020154670de0b6b3a7640000600a54836000015461197f91906139db565b61198991906139aa565b6119939190613a35565b91505092915050565b6969e10de76676d080000081565b600d6020528060005260406000206000915054906101000a900460ff1681565b7f000000000000000000000000000000000000000000000000000000000000000081565b60026001541415611a34576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a2b90613887565b60405180910390fd5b6002600181905550600060048381548110611a5257611a51613c36565b5b9060005260206000209060070201905060006005600085815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209050611abf8461097f565b600081600001541115611b265760008160010154670de0b6b3a764000084600301548460000154611af091906139db565b611afa91906139aa565b611b049190613a35565b90506000811115611b1a57611b1933826127b4565b5b611b2485336114d8565b505b60008311156120525760008260000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401611b8e91906134ea565b60206040518083038186803b158015611ba657600080fd5b505afa158015611bba573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bde919061300f565b9050611c313330868660000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16612b67909392919063ffffffff16565b808360000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401611c8f91906134ea565b60206040518083038186803b158015611ca757600080fd5b505afa158015611cbb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cdf919061300f565b611ce99190613a35565b935060008411611d2e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d2590613767565b60405180910390fd5b60008360040160009054906101000a900461ffff1661ffff16111561201f57600061271060648560040160009054906101000a900461ffff1661ffff1687611d7691906139db565b611d809190613a35565b611d8a91906139aa565b9050611dfd600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16828660000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16612a159092919063ffffffff16565b80858460000154611e0e9190613954565b611e189190613a35565b836000018190555080858560050154611e319190613954565b611e3b9190613a35565b84600501819055506000612710606487611e5591906139db565b611e5f91906139aa565b9050611ed07f0000000000000000000000000000000000000000000000000000000000000000828760000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16612a159092919063ffffffff16565b60007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663403d5ec78760000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168860060160009054906101000a900460ff166040518363ffffffff1660e01b8152600401611f6292919061359c565b602060405180830381600087803b158015611f7c57600080fd5b505af1158015611f90573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fb4919061300f565b9050600081118015611fc957506000600c5414155b1561201757600c54670de0b6b3a764000082611fe591906139db565b611fef91906139aa565b600a54611ffc9190613954565b600a81905550806009546120109190613954565b6009819055505b505050612050565b83826000015461202f9190613954565b82600001819055508383600501546120479190613954565b83600501819055505b505b670de0b6b3a76400008260030154826000015461206f91906139db565b61207991906139aa565b8160010181905550670de0b6b3a7640000600a54826000015461209c91906139db565b6120a691906139aa565b816002018190555082600c546120bc9190613954565b600c81905550833373ffffffffffffffffffffffffffffffffffffffff167f90890809c654f11d6e72a28fa60149770a0d11ec6c92319d6ceb2bb0a4ea1a158560405161210991906138a7565b60405180910390a35050600180819055505050565b600a5481565b61212c612a9b565b73ffffffffffffffffffffffffffffffffffffffff1661214a611601565b73ffffffffffffffffffffffffffffffffffffffff16146121a0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612197906137e7565b60405180910390fd5b82600d60008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561222e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161222590613847565b60405180910390fd5b8373ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b815260040161226791906134ea565b60206040518083038186803b15801561227f57600080fd5b505afa158015612293573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122b7919061300f565b506101918361ffff161115612301576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122f8906136c7565b60405180910390fd5b60008660ff161480612316575060018660ff16145b612355576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161234c90613707565b60405180910390fd5b811561236457612363610ff7565b5b6000600754431161237757600754612379565b435b9050856006546123899190613954565b6006819055506001600d60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060046040518060e001604052808773ffffffffffffffffffffffffffffffffffffffff168152602001888152602001838152602001600081526020018661ffff168152602001600081526020018960ff16815250908060018154018082558091505060019003906000526020600020906007020160009091909190915060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060208201518160010155604082015181600201556060820151816003015560808201518160040160006101000a81548161ffff021916908361ffff16021790555060a0820151816005015560c08201518160060160006101000a81548160ff021916908360ff1602179055505050600160048054905061252b9190613a35565b7faa6642278d4bbef86d8990c37355d5d4dfe365c194106bdf7a65162268606f0786888760405161255e93929190613565565b60405180910390a250505050505050565b612577612a9b565b73ffffffffffffffffffffffffffffffffffffffff16612595611601565b73ffffffffffffffffffffffffffffffffffffffff16146125eb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125e2906137e7565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561265b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612652906136e7565b60405180910390fd5b61266481612aa3565b50565b61266f612a9b565b73ffffffffffffffffffffffffffffffffffffffff1661268d611601565b73ffffffffffffffffffffffffffffffffffffffff16146126e3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016126da906137e7565b60405180910390fd5b6007544310612727576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161271e90613787565b60405180910390fd5b804310612769576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612760906136a7565b60405180910390fd5b80600781905550612778612bf0565b7f63b90b79f11a0f132bcb2c4a4ddd44abda45c1308a83b2919318df7f5f8b7be46007546040516127a991906138a7565b60405180910390a150565b60007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b815260040161280f91906134ea565b60206040518083038186803b15801561282757600080fd5b505afa15801561283b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061285f919061300f565b905060008183111561291f577f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663a9059cbb85846040518363ffffffff1660e01b81526004016128c692919061353c565b602060405180830381600087803b1580156128e057600080fd5b505af11580156128f4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129189190612f88565b90506129cf565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663a9059cbb85856040518363ffffffff1660e01b815260040161297a92919061353c565b602060405180830381600087803b15801561299457600080fd5b505af11580156129a8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129cc9190612f88565b90505b80612a0f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612a0690613727565b60405180910390fd5b50505050565b612a968363a9059cbb60e01b8484604051602401612a3492919061353c565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050612c46565b505050565b600033905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b612bea846323b872dd60e01b858585604051602401612b8893929190613505565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050612c46565b50505050565b6000600480549050905060005b81811015612c425760075460048281548110612c1c57612c1b613c36565b5b90600052602060002090600702016002018190555080612c3b90613b8f565b9050612bfd565b5050565b6000612ca8826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16612d0d9092919063ffffffff16565b9050600081511115612d085780806020019051810190612cc89190612f88565b612d07576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612cfe90613867565b60405180910390fd5b5b505050565b6060612d1c8484600085612d25565b90509392505050565b606082471015612d6a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612d6190613747565b60405180910390fd5b612d7385612e39565b612db2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612da990613807565b60405180910390fd5b6000808673ffffffffffffffffffffffffffffffffffffffff168587604051612ddb91906134d3565b60006040518083038185875af1925050503d8060008114612e18576040519150601f19603f3d011682016040523d82523d6000602084013e612e1d565b606091505b5091509150612e2d828286612e4c565b92505050949350505050565b600080823b905060008111915050919050565b60608315612e5c57829050612eac565b600083511115612e6f5782518084602001fd5b816040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612ea39190613685565b60405180910390fd5b9392505050565b600081359050612ec281614061565b92915050565b600081359050612ed781614078565b92915050565b600081519050612eec81614078565b92915050565b600081359050612f018161408f565b92915050565b600081359050612f16816140a6565b92915050565b600081359050612f2b816140bd565b92915050565b600081519050612f40816140bd565b92915050565b600081359050612f55816140d4565b92915050565b600060208284031215612f7157612f70613c65565b5b6000612f7f84828501612eb3565b91505092915050565b600060208284031215612f9e57612f9d613c65565b5b6000612fac84828501612edd565b91505092915050565b600060208284031215612fcb57612fca613c65565b5b6000612fd984828501612ef2565b91505092915050565b600060208284031215612ff857612ff7613c65565b5b600061300684828501612f1c565b91505092915050565b60006020828403121561302557613024613c65565b5b600061303384828501612f31565b91505092915050565b6000806040838503121561305357613052613c65565b5b600061306185828601612f1c565b925050602061307285828601612eb3565b9150509250929050565b6000806040838503121561309357613092613c65565b5b60006130a185828601612f1c565b92505060206130b285828601612f1c565b9150509250929050565b600080600080600060a086880312156130d8576130d7613c65565b5b60006130e688828901612f1c565b95505060206130f788828901612f46565b945050604061310888828901612f1c565b935050606061311988828901612f07565b925050608061312a88828901612ec8565b9150509295509295909350565b600080600080600060a0868803121561315357613152613c65565b5b600061316188828901612f46565b955050602061317288828901612f1c565b945050604061318388828901612ef2565b935050606061319488828901612f07565b92505060806131a588828901612ec8565b9150509295509295909350565b6131bb81613a69565b82525050565b6131ca81613a7b565b82525050565b60006131db82613922565b6131e58185613938565b93506131f5818560208601613b5c565b80840191505092915050565b61320a81613ade565b82525050565b61321981613b02565b82525050565b61322881613b26565b82525050565b60006132398261392d565b6132438185613943565b9350613253818560208601613b5c565b61325c81613c6a565b840191505092915050565b6000613274602283613943565b915061327f82613c7b565b604082019050919050565b6000613297602583613943565b91506132a282613cca565b604082019050919050565b60006132ba602683613943565b91506132c582613d19565b604082019050919050565b60006132dd601283613943565b91506132e882613d68565b602082019050919050565b6000613300602483613943565b915061330b82613d91565b604082019050919050565b6000613323602683613943565b915061332e82613de0565b604082019050919050565b6000613346602183613943565b915061335182613e2f565b604082019050919050565b6000613369603783613943565b915061337482613e7e565b604082019050919050565b600061338c600883613943565b915061339782613ecd565b602082019050919050565b60006133af602583613943565b91506133ba82613ef6565b604082019050919050565b60006133d2602083613943565b91506133dd82613f45565b602082019050919050565b60006133f5601d83613943565b915061340082613f6e565b602082019050919050565b6000613418601283613943565b915061342382613f97565b602082019050919050565b600061343b601983613943565b915061344682613fc0565b602082019050919050565b600061345e602a83613943565b915061346982613fe9565b604082019050919050565b6000613481601f83613943565b915061348c82614038565b602082019050919050565b6134a081613a99565b82525050565b6134af81613b4a565b82525050565b6134be81613ac7565b82525050565b6134cd81613ad1565b82525050565b60006134df82846131d0565b915081905092915050565b60006020820190506134ff60008301846131b2565b92915050565b600060608201905061351a60008301866131b2565b61352760208301856131b2565b61353460408301846134b5565b949350505050565b600060408201905061355160008301856131b2565b61355e60208301846134b5565b9392505050565b600060608201905061357a60008301866131b2565b61358760208301856134b5565b61359460408301846134a6565b949350505050565b60006040820190506135b160008301856131b2565b6135be60208301846134c4565b9392505050565b60006020820190506135da60008301846131c1565b92915050565b600060e0820190506135f5600083018a613201565b61360260208301896134b5565b61360f60408301886134b5565b61361c60608301876134b5565b6136296080830186613497565b61363660a08301856134b5565b61364360c08301846134c4565b98975050505050505050565b60006020820190506136646000830184613210565b92915050565b600060208201905061367f600083018461321f565b92915050565b6000602082019050818103600083015261369f818461322e565b905092915050565b600060208201905081810360008301526136c081613267565b9050919050565b600060208201905081810360008301526136e08161328a565b9050919050565b60006020820190508181036000830152613700816132ad565b9050919050565b60006020820190508181036000830152613720816132d0565b9050919050565b60006020820190508181036000830152613740816132f3565b9050919050565b6000602082019050818103600083015261376081613316565b9050919050565b6000602082019050818103600083015261378081613339565b9050919050565b600060208201905081810360008301526137a08161335c565b9050919050565b600060208201905081810360008301526137c08161337f565b9050919050565b600060208201905081810360008301526137e0816133a2565b9050919050565b60006020820190508181036000830152613800816133c5565b9050919050565b60006020820190508181036000830152613820816133e8565b9050919050565b600060208201905081810360008301526138408161340b565b9050919050565b600060208201905081810360008301526138608161342e565b9050919050565b6000602082019050818103600083015261388081613451565b9050919050565b600060208201905081810360008301526138a081613474565b9050919050565b60006020820190506138bc60008301846134b5565b92915050565b60006040820190506138d760008301856134b5565b6138e460208301846134b5565b9392505050565b600060608201905061390060008301866134b5565b61390d60208301856134b5565b61391a60408301846134b5565b949350505050565b600081519050919050565b600081519050919050565b600081905092915050565b600082825260208201905092915050565b600061395f82613ac7565b915061396a83613ac7565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561399f5761399e613bd8565b5b828201905092915050565b60006139b582613ac7565b91506139c083613ac7565b9250826139d0576139cf613c07565b5b828204905092915050565b60006139e682613ac7565b91506139f183613ac7565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613a2a57613a29613bd8565b5b828202905092915050565b6000613a4082613ac7565b9150613a4b83613ac7565b925082821015613a5e57613a5d613bd8565b5b828203905092915050565b6000613a7482613aa7565b9050919050565b60008115159050919050565b6000613a9282613a69565b9050919050565b600061ffff82169050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b6000613ae982613af0565b9050919050565b6000613afb82613aa7565b9050919050565b6000613b0d82613b14565b9050919050565b6000613b1f82613aa7565b9050919050565b6000613b3182613b38565b9050919050565b6000613b4382613aa7565b9050919050565b6000613b5582613a99565b9050919050565b60005b83811015613b7a578082015181840152602081019050613b5f565b83811115613b89576000848401525b50505050565b6000613b9a82613ac7565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415613bcd57613bcc613bd8565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600080fd5b6000601f19601f8301169050919050565b7f63616e6e6f742073657420737461727420626c6f636b20696e2074686520706160008201527f7374000000000000000000000000000000000000000000000000000000000000602082015250565b7f6164643a20696e76616c6964206465706f73697420666565206261736973207060008201527f6f696e7473000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f696e76616c696420746f6b656e20747970650000000000000000000000000000600082015250565b7f7361666553616e644d616e5472616e736665723a207472616e7366657220666160008201527f696c656400000000000000000000000000000000000000000000000000000000602082015250565b7f416464726573733a20696e73756666696369656e742062616c616e636520666f60008201527f722063616c6c0000000000000000000000000000000000000000000000000000602082015250565b7f776520646f6e7420616363657074206465706f73697473206f6620302073697a60008201527f6500000000000000000000000000000000000000000000000000000000000000602082015250565b7f63616e6e6f74206368616e676520737461727420626c6f636b2069662073616c60008201527f652068617320616c726561647920636f6d6d656e636564000000000000000000602082015250565b7f216e6f6e7a65726f000000000000000000000000000000000000000000000000600082015250565b7f7365743a20696e76616c6964206465706f73697420666565206261736973207060008201527f6f696e7473000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000600082015250565b7f77697468647261773a206e6f7420676f6f640000000000000000000000000000600082015250565b7f6e6f6e4475706c6963617465643a206475706c69636174656400000000000000600082015250565b7f5361666545524332303a204552433230206f7065726174696f6e20646964206e60008201527f6f74207375636365656400000000000000000000000000000000000000000000602082015250565b7f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00600082015250565b61406a81613a69565b811461407557600080fd5b50565b61408181613a7b565b811461408c57600080fd5b50565b61409881613a87565b81146140a357600080fd5b50565b6140af81613a99565b81146140ba57600080fd5b50565b6140c681613ac7565b81146140d157600080fd5b50565b6140dd81613ad1565b81146140e857600080fd5b5056fea26469706673582212202b350f9fb89f761fa7b530f708ef40e4bed2c101950517de3fd037b04a5d0da864736f6c63430008060033000000000000000000000000108a2757d76c027d0eef5a27922483ceeb040c850000000000000000000000004ec35552d05adce782e42acdb0d0cd28673c2e7e0000000000000000000000006d9518bd44fce1ee2ef8d7e3090fba60304a4cea0000000000000000000000000000000000000000000000000c3c1f0a673d9e000000000000000000000000000000000000000000000000000000000000000000

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

000000000000000000000000108a2757d76c027d0eef5a27922483ceeb040c850000000000000000000000004ec35552d05adce782e42acdb0d0cd28673c2e7e0000000000000000000000006d9518bd44fce1ee2ef8d7e3090fba60304a4cea0000000000000000000000000000000000000000000000000c3c1f0a673d9e000000000000000000000000000000000000000000000000000000000000000000

-----Decoded View---------------
Arg [0] : _sandMan (address): 0x108a2757d76c027d0eef5a27922483ceeb040c85
Arg [1] : _treasuryAddress (address): 0x4ec35552d05adce782e42acdb0d0cd28673c2e7e
Arg [2] : _feeAddress (address): 0x6d9518bd44fce1ee2ef8d7e3090fba60304a4cea
Arg [3] : _sandManPerBlock (uint256): 881613756600000000
Arg [4] : _startBlock (uint256): 0

-----Encoded View---------------
5 Constructor Arguments found :
Arg [0] : 000000000000000000000000108a2757d76c027d0eef5a27922483ceeb040c85
Arg [1] : 0000000000000000000000004ec35552d05adce782e42acdb0d0cd28673c2e7e
Arg [2] : 0000000000000000000000006d9518bd44fce1ee2ef8d7e3090fba60304a4cea
Arg [3] : 0000000000000000000000000000000000000000000000000c3c1f0a673d9e00
Arg [4] : 0000000000000000000000000000000000000000000000000000000000000000


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

Amount Staked
0

Amount Delegated
0

Staking Total
0

Staking Start Epoch
0

Staking Start Time
0

Proof of Importance
0

Origination Score
0

Validation Score
0

Active
0

Online
0

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