Contract 0x64005c4bb5a87297f7724d49acae6d42b59f9ec9

Contract Overview

Balance:
0 CRO

CRO Value:
$0.00

Token:
Txn Hash Method
Block
From
To
Value [Txn Fee]
0x6b8e9b78ebd1ce966501749bffc077a69f0b2f1d08d3f63c69afde85ef2a58ffWithdraw68640692023-02-08 4:54:1611 hrs 43 mins ago0x8194ed39b510a07425b49752ce489cbaa972fbf0 IN  0x64005c4bb5a87297f7724d49acae6d42b59f9ec90 CRO1.6569614660030
0xdd4975b3b99708120f2818b50eb93eaafae6cd0de5b6a4b35c24966fb2cba85eDeposit68513002023-02-07 8:53:151 day 7 hrs ago0x8194ed39b510a07425b49752ce489cbaa972fbf0 IN  0x64005c4bb5a87297f7724d49acae6d42b59f9ec90 CRO1.8074108556710
0xd278abd46f6a7d7824049a41abcb83a41316d3c3b8c1602f644f8f0f77698faaWithdraw68492922023-02-07 5:44:391 day 10 hrs ago0x8194ed39b510a07425b49752ce489cbaa972fbf0 IN  0x64005c4bb5a87297f7724d49acae6d42b59f9ec90 CRO1.6475607552740
0x8e198eebb569d3dc6225a053c4e3e68fb89edb323e3a01f6d7a5d0bb0096fc21Deposit68126902023-02-04 20:17:483 days 20 hrs ago0x8194ed39b510a07425b49752ce489cbaa972fbf0 IN  0x64005c4bb5a87297f7724d49acae6d42b59f9ec90 CRO1.8080777090850
0x811713cc23bc3c2d38000778d8f306cf86f153204bb49c8c1ba3fa56bf1c3ab7Withdraw68124902023-02-04 19:58:573 days 20 hrs ago0x8194ed39b510a07425b49752ce489cbaa972fbf0 IN  0x64005c4bb5a87297f7724d49acae6d42b59f9ec90 CRO1.7401763974670
0xa66afb8d34101892f575f7a5c14a20d9753b4cecf3f8a071c53ed49567385826Deposit68048012023-02-04 7:54:244 days 8 hrs ago0x8194ed39b510a07425b49752ce489cbaa972fbf0 IN  0x64005c4bb5a87297f7724d49acae6d42b59f9ec90 CRO1.7785761980090
0x50b92535d4ce3c5a9032101f3e2dba34306454c28c031f4a541e5832303af28cDeposit68047782023-02-04 7:52:144 days 8 hrs ago0x8194ed39b510a07425b49752ce489cbaa972fbf0 IN  0x64005c4bb5a87297f7724d49acae6d42b59f9ec90 CRO1.7785765924070
0xae74862c07bebc09fe162a95fc364b15acaa92f2bc82cc2511f399b83b407dd3Deposit68047702023-02-04 7:51:294 days 8 hrs ago0x8194ed39b510a07425b49752ce489cbaa972fbf0 IN  0x64005c4bb5a87297f7724d49acae6d42b59f9ec90 CRO1.7785189177620
0xe41bdc71ef38176555d5216f5121e7921e8cd902f22ffbef06d1316ab6498192Deposit68047602023-02-04 7:50:324 days 8 hrs ago0x8194ed39b510a07425b49752ce489cbaa972fbf0 IN  0x64005c4bb5a87297f7724d49acae6d42b59f9ec90 CRO1.7785190701880
0x336939dcd98ee525ba42f604e2e78af7adaf7cdfa9f617b48c4c44db7057b21aDeposit68047472023-02-04 7:49:204 days 8 hrs ago0x8194ed39b510a07425b49752ce489cbaa972fbf0 IN  0x64005c4bb5a87297f7724d49acae6d42b59f9ec90 CRO1.7785193121760
0x810a9c0241381f1128c399100daa3a944c4a24ce0d1d74d9bffce08a99d0f190Deposit68047322023-02-04 7:47:554 days 8 hrs ago0x8194ed39b510a07425b49752ce489cbaa972fbf0 IN  0x64005c4bb5a87297f7724d49acae6d42b59f9ec90 CRO1.7688815209980
0xcaacc3441b9c777f90f3f799a84f2f6eefb964dbdf50952438bac2cd9d323024Deposit68046972023-02-04 7:44:374 days 8 hrs ago0x8194ed39b510a07425b49752ce489cbaa972fbf0 IN  0x64005c4bb5a87297f7724d49acae6d42b59f9ec90 CRO1.7119404797750
0x7e29a55c662955ba779b198f36506ab359d3cc77ac00bf12545f18b57fd7fa19Deposit68037152023-02-04 6:12:094 days 10 hrs ago0x8194ed39b510a07425b49752ce489cbaa972fbf0 IN  0x64005c4bb5a87297f7724d49acae6d42b59f9ec90 CRO1.6912443305620
0xce0e55fae36dc765abb1b28185cf2b5f9588a4c23cfd2903df608fe640aaf794Withdraw68031792023-02-04 5:21:434 days 11 hrs ago0x8194ed39b510a07425b49752ce489cbaa972fbf0 IN  0x64005c4bb5a87297f7724d49acae6d42b59f9ec90 CRO1.5787608556830
0xcb73716cab0e198d5ad7521cab4eebeadcfb655312c03680166ccded50247c75Withdraw68031622023-02-04 5:20:074 days 11 hrs ago0x8194ed39b510a07425b49752ce489cbaa972fbf0 IN  0x64005c4bb5a87297f7724d49acae6d42b59f9ec90 CRO1.5788767665440
0x25e95627f54eb1c4f68af13d774e4f65bccb1357ed4482ce24b672be6326c51eWithdraw68031352023-02-04 5:17:344 days 11 hrs ago0x8194ed39b510a07425b49752ce489cbaa972fbf0 IN  0x64005c4bb5a87297f7724d49acae6d42b59f9ec90 CRO1.5885732101090
0xde60e68fe301a3e4e9d7e8eb47c92c3f985050ac241903ff89388ca57669f6eeEmergency Withdr...68031232023-02-04 5:16:264 days 11 hrs ago0x8194ed39b510a07425b49752ce489cbaa972fbf0 IN  0x64005c4bb5a87297f7724d49acae6d42b59f9ec90 CRO0.5767355950160
0x50528903be5fabb678c4f5a6473721c6d1a35ca40983e9a65f3ff1d814ef65f0Emergency Withdr...68030952023-02-04 5:13:494 days 11 hrs ago0x8194ed39b510a07425b49752ce489cbaa972fbf0 IN  0x64005c4bb5a87297f7724d49acae6d42b59f9ec90 CRO0.4481572673420
0x2b635bd02efca52c17259f6b1ae474e17da4f0a72124f7dd9acac50a9f4fafffEmergency Withdr...68030792023-02-04 5:12:194 days 11 hrs ago0x8194ed39b510a07425b49752ce489cbaa972fbf0 IN  0x64005c4bb5a87297f7724d49acae6d42b59f9ec90 CRO0.5767358406570
0x9d8ec6de51b2fdd73cdfc0947e7a28b99fb03450ddf412121b926c4b8372cc88Emergency Withdr...68030482023-02-04 5:09:244 days 11 hrs ago0x8194ed39b510a07425b49752ce489cbaa972fbf0 IN  0x64005c4bb5a87297f7724d49acae6d42b59f9ec90 CRO0.576736020430
0x526957ff4506806a6623428cf746650ea45f4f1272583b1b455c62cccf23b48dWithdraw68029732023-02-04 5:02:214 days 11 hrs ago0x8194ed39b510a07425b49752ce489cbaa972fbf0 IN  0x64005c4bb5a87297f7724d49acae6d42b59f9ec90 CRO1.5789374594040
0x560bf48c6c891bdfe74969c80599405af205781c39ae447686a0df8198e64925Emergency Withdr...68029302023-02-04 4:58:174 days 11 hrs ago0x8194ed39b510a07425b49752ce489cbaa972fbf0 IN  0x64005c4bb5a87297f7724d49acae6d42b59f9ec90 CRO0.7549521796340
0x10957122602346b476c73e9ecfeed469167fef2a2d929a4af72dd9284906fe9dDeposit68028992023-02-04 4:55:234 days 11 hrs ago0x8194ed39b510a07425b49752ce489cbaa972fbf0 IN  0x64005c4bb5a87297f7724d49acae6d42b59f9ec90 CRO1.7786666809230
0x78d7c7c867821f23c1cd1ec222e979ad6dfea4d7d31d7c132efbb0ba246249d5Emergency Withdr...68028622023-02-04 4:51:534 days 11 hrs ago0x8194ed39b510a07425b49752ce489cbaa972fbf0 IN  0x64005c4bb5a87297f7724d49acae6d42b59f9ec90 CRO1.3015124353150
0xea0904e64fb9f8642413ee519a8a5c8023c72671aa15c16f6675ba98e3c63b24Emergency Withdr...68028092023-02-04 4:46:544 days 11 hrs ago0x8194ed39b510a07425b49752ce489cbaa972fbf0 IN  0x64005c4bb5a87297f7724d49acae6d42b59f9ec90 CRO0.5767373417020
[ Download CSV Export 
Latest 1 internal transaction
Parent Txn Hash Block From To Value
0x45c409832bc49fdcaf433ea2a1b167b307bb1ffcb83a107fdf9ee0dcb8da0e0854036352022-11-04 9:51:4696 days 6 hrs ago 0x6cfabd1ff774453bf125a29aa9258d1b18b38ebf  Contract Creation0 CRO
[ Download CSV Export 
Loading

Similar Match Source Code
Note: This contract matches the deployed ByteCode of the Source Code for Contract 0xe7e294C1d219775b04C037309f22306Ee13165d2

Contract Name:
FarmBoosterProxy

Compiler Version
v0.8.4+commit.c7e474f2

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 8 : FarmBoosterProxy.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "../interfaces/IMasterChef.sol";
import "../interfaces/IFarmBooster.sol";

contract FarmBoosterProxy is ReentrancyGuard {
    using SafeERC20 for IERC20;

    // The address of the farm booster proxy factory
    address public immutable FARM_BOOSTER_PROXY_FACTORY;
    IMasterChef public masterchef;
    IERC20 public candyToken;
    IFarmBooster public farmBooster;

    address public admin;
    // Whether it is initialized
    bool public isInitialized;
    // Record whether lp was approved
    mapping(address => bool) public lpApproved;

    event DepositByProxy(
        address indexed user,
        address indexed proxy,
        uint256 indexed pid,
        uint256 amount
    );
    event WithdrawByProxy(
        address indexed user,
        address indexed proxy,
        uint256 indexed pid,
        uint256 amount
    );
    event EmergencyWithdrawByProxy(
        address indexed user,
        address indexed proxy,
        uint256 indexed pid
    );

    /**
     * @notice Constructor
     */
    constructor() {
        FARM_BOOSTER_PROXY_FACTORY = msg.sender;
    }

    /**
     * @notice Checks if the msg.sender is the admin address.
     */
    modifier onlyAdmin() {
        require(msg.sender == admin, "admin: wut?");
        _;
    }

    /**
     * @notice It initializes the contract
     * @dev It can only be called once.
     * @param _admin: the admin address
     * @param _farmBooster: the farm booster address
     * @param _masterchef: the address of the Masterchef V2
     * @param _candyToken: the address of the candy token
     */
    function initialize(
        address _admin,
        address _farmBooster,
        address _masterchef,
        address _candyToken
    ) external {
        require(!isInitialized, "Operations: Already initialized");
        require(
            msg.sender == FARM_BOOSTER_PROXY_FACTORY,
            "Operations: Not factory"
        );

        // Make this contract initialized
        isInitialized = true;
        admin = _admin;
        farmBooster = IFarmBooster(_farmBooster);
        masterchef = IMasterChef(_masterchef);
        candyToken = IERC20(_candyToken);
    }

    /**
     * @notice Deposit LP tokens to pool.
     * @dev It can only be called by admin.
     * @param _pid The id of the pool.
     * @param _amount Amount of LP tokens to deposit.
     * @param _referrer Referrer.
     */
    function deposit(
        uint256 _pid,
        uint256 _amount,
        address _referrer
    ) external nonReentrant onlyAdmin {
        uint256 poolLength = masterchef.poolLength();
        require(_pid < poolLength, "Pool is not exist");
        address lpAddress = masterchef.lpToken(_pid);
        IERC20(lpAddress).safeTransferFrom(msg.sender, address(this), _amount);
        if (!lpApproved[lpAddress]) {
            IERC20(lpAddress).approve(address(masterchef), type(uint256).max);
            lpApproved[lpAddress] = true;
        }
        masterchef.deposit(_pid, _amount, _referrer);
        harvestCandy();
        farmBooster.updatePoolBoostMultiplier(msg.sender, _pid);
        emit DepositByProxy(msg.sender, address(this), _pid, _amount);
    }

    /**
     * @notice Withdraw LP tokens from pool.
     * @dev It can only be called by admin.
     * @param _pid The id of the pool.
     * @param _amount Amount of LP tokens to withdraw.
     */
    function withdraw(uint256 _pid, uint256 _amount)
        external
        nonReentrant
        onlyAdmin
    {
        uint256 poolLength = masterchef.poolLength();
        require(_pid < poolLength, "Pool is not exist");
        masterchef.withdraw(_pid, _amount);
        address lpAddress = masterchef.lpToken(_pid);
        IERC20(lpAddress).safeTransfer(msg.sender, _amount);
        harvestCandy();
        farmBooster.updatePoolBoostMultiplier(msg.sender, _pid);
        emit WithdrawByProxy(msg.sender, address(this), _pid, _amount);
    }

    /**
     * @notice Withdraw without caring about the rewards. EMERGENCY ONLY.
     * @dev It can only be called by admin.
     * @param _pid The id of the pool.
     */
    function emergencyWithdraw(uint256 _pid) external nonReentrant onlyAdmin {
        uint256 poolLength = masterchef.poolLength();
        require(_pid < poolLength, "Pool is not exist");
        masterchef.emergencyWithdraw(_pid);
        address lpAddress = masterchef.lpToken(_pid);
        IERC20(lpAddress).safeTransfer(
            msg.sender,
            IERC20(lpAddress).balanceOf(address(this))
        );
        harvestCandy();
        farmBooster.updatePoolBoostMultiplier(msg.sender, _pid);
        emit EmergencyWithdrawByProxy(msg.sender, address(this), _pid);
    }

    function harvestCandy() internal {
        uint256 candyBalance = candyToken.balanceOf(address(this));
        if (candyBalance > 0) {
            candyToken.safeTransfer(msg.sender, candyBalance);
        }
    }
}

File 2 of 8 : IFarmBooster.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface IFarmBooster {
    function onCandyPoolUpdate(
        address _user,
        uint256 _lockedAmount,
        uint256 _lockedDuration,
        uint256 _totalLockedAmount,
        uint256 _maxLockDuration
    ) external;

    function updatePoolBoostMultiplier(address _user, uint256 _pid) external;

    function setProxy(address _user, address _proxy) external;

    function isBoosterPool(address _user, uint256 _pid)
        external
        view
        returns (bool);
}

File 3 of 8 : IMasterChef.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface IMasterChef {
    function deposit(
        uint256 _pid,
        uint256 _amount,
        address _referrer
    ) external;

    function withdraw(uint256 _pid, uint256 _amount) external;

    function pendingCandy(uint256 _pid, address _user)
        external
        view
        returns (uint256);

    function userInfo(uint256 _pid, address _user)
        external
        view
        returns (
            uint256,
            uint256,
            uint256
        );

    function emergencyWithdraw(uint256 _pid) external;

    function lpToken(uint256 _pid) external view returns (address);

    function poolLength() external view returns (uint256 pools);

    function getBoostMultiplier(address _user, uint256 _pid)
        external
        view
        returns (uint256);

    function updateBoostMultiplier(
        address _user,
        uint256 _pid,
        uint256 _newMultiplier
    ) external;
}

File 4 of 8 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)

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 making 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 8 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

import "../IERC20.sol";
import "../extensions/draft-IERC20Permit.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));
        }
    }

    function safePermit(
        IERC20Permit token,
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal {
        uint256 nonceBefore = token.nonces(owner);
        token.permit(owner, spender, value, deadline, v, r, s);
        uint256 nonceAfter = token.nonces(owner);
        require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
    }

    /**
     * @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 6 of 8 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @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);

    /**
     * @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 `to`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address to, 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 `from` to `to` 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 from,
        address to,
        uint256 amount
    ) external returns (bool);
}

File 7 of 8 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)

pragma solidity ^0.8.1;

/**
 * @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
     * ====
     *
     * [IMPORTANT]
     * ====
     * You shouldn't rely on `isContract` to protect against flash loan attacks!
     *
     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
     * constructor.
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize/address.code.length, which returns 0
        // for contracts in construction, since the code is only stored at the end
        // of the constructor execution.

        return account.code.length > 0;
    }

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

        (bool success, ) = recipient.call{value: amount}("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

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

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

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

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

        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

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

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

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

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

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

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

    /**
     * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly
                /// @solidity memory-safe-assembly
                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

File 8 of 8 : draft-IERC20Permit.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
 * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
 *
 * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
 * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
 * need to send a transaction, and thus is not required to hold Ether at all.
 */
interface IERC20Permit {
    /**
     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
     * given ``owner``'s signed approval.
     *
     * IMPORTANT: The same issues {IERC20-approve} has related to transaction
     * ordering also apply here.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `deadline` must be a timestamp in the future.
     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
     * over the EIP712-formatted function arguments.
     * - the signature must use ``owner``'s current nonce (see {nonces}).
     *
     * For more information on the signature format, see the
     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
     * section].
     */
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

    /**
     * @dev Returns the current nonce for `owner`. This value must be
     * included whenever a signature is generated for {permit}.
     *
     * Every successful call to {permit} increases ``owner``'s nonce by one. This
     * prevents a signature from being used multiple times.
     */
    function nonces(address owner) external view returns (uint256);

    /**
     * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
     */
    // solhint-disable-next-line func-name-mixedcase
    function DOMAIN_SEPARATOR() external view returns (bytes32);
}

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

Contract ABI

[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"address","name":"proxy","type":"address"},{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"DepositByProxy","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"address","name":"proxy","type":"address"},{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"}],"name":"EmergencyWithdrawByProxy","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"address","name":"proxy","type":"address"},{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"WithdrawByProxy","type":"event"},{"inputs":[],"name":"FARM_BOOSTER_PROXY_FACTORY","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"admin","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"candyToken","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"address","name":"_referrer","type":"address"}],"name":"deposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"}],"name":"emergencyWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"farmBooster","outputs":[{"internalType":"contract IFarmBooster","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_admin","type":"address"},{"internalType":"address","name":"_farmBooster","type":"address"},{"internalType":"address","name":"_masterchef","type":"address"},{"internalType":"address","name":"_candyToken","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"isInitialized","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"lpApproved","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"masterchef","outputs":[{"internalType":"contract IMasterChef","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60a060405234801561001057600080fd5b5060016000553360601b60805260805160601c6112356100426000396000818161011c0152610b4c01526112356000f3fe608060405234801561001057600080fd5b50600436106100a95760003560e01c80638dbdbe6d116100715780638dbdbe6d14610151578063a63f5e2a14610164578063f851a44014610177578063f8c8765e1461018a578063fb1db2781461019d578063fbcdbd0e146101b057600080fd5b80630643aae1146100ae578063392e53cd146100de578063441a3e701461010257806351035703146101175780635312ea8e1461013e575b600080fd5b6003546100c1906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b6004546100f290600160a01b900460ff1681565b60405190151581526020016100d5565b61011561011036600461108f565b6101d3565b005b6100c17f000000000000000000000000000000000000000000000000000000000000000081565b61011561014c36600461105f565b610476565b61011561015f3660046110b0565b610779565b6002546100c1906001600160a01b031681565b6004546100c1906001600160a01b031681565b610115610198366004610fe4565b610ae7565b6001546100c1906001600160a01b031681565b6100f26101be366004610fac565b60056020526000908152604090205460ff1681565b600260005414156101ff5760405162461bcd60e51b81526004016101f690611187565b60405180910390fd5b60026000556004546001600160a01b0316331461022e5760405162461bcd60e51b81526004016101f690611137565b6001546040805163040f1f6d60e11b815290516000926001600160a01b03169163081e3eda916004808301926020929190829003018186803b15801561027357600080fd5b505afa158015610287573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102ab9190611077565b90508083106102cc5760405162461bcd60e51b81526004016101f69061115c565b600154604051630441a3e760e41b815260048101859052602481018490526001600160a01b039091169063441a3e7090604401600060405180830381600087803b15801561031957600080fd5b505af115801561032d573d6000803e3d6000fd5b50506001546040516378ed5d1f60e01b815260048101879052600093506001600160a01b0390911691506378ed5d1f9060240160206040518083038186803b15801561037857600080fd5b505afa15801561038c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103b09190610fc8565b90506103c66001600160a01b0382163385610c13565b6103ce610c7b565b600354604051630bd6db7760e11b8152336004820152602481018690526001600160a01b03909116906317adb6ee90604401600060405180830381600087803b15801561041a57600080fd5b505af115801561042e573d6000803e3d6000fd5b505060405185815286925030915033907fa8c1f92a8228d8f30d30e0539f7256c2847eaf35775bdc0a5a9c0a5a066f31d39060200160405180910390a4505060016000555050565b600260005414156104995760405162461bcd60e51b81526004016101f690611187565b60026000556004546001600160a01b031633146104c85760405162461bcd60e51b81526004016101f690611137565b6001546040805163040f1f6d60e11b815290516000926001600160a01b03169163081e3eda916004808301926020929190829003018186803b15801561050d57600080fd5b505afa158015610521573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105459190611077565b90508082106105665760405162461bcd60e51b81526004016101f69061115c565b600154604051632989754760e11b8152600481018490526001600160a01b0390911690635312ea8e90602401600060405180830381600087803b1580156105ac57600080fd5b505af11580156105c0573d6000803e3d6000fd5b50506001546040516378ed5d1f60e01b815260048101869052600093506001600160a01b0390911691506378ed5d1f9060240160206040518083038186803b15801561060b57600080fd5b505afa15801561061f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106439190610fc8565b6040516370a0823160e01b81523060048201529091506106d49033906001600160a01b038416906370a082319060240160206040518083038186803b15801561068b57600080fd5b505afa15801561069f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106c39190611077565b6001600160a01b0384169190610c13565b6106dc610c7b565b600354604051630bd6db7760e11b8152336004820152602481018590526001600160a01b03909116906317adb6ee90604401600060405180830381600087803b15801561072857600080fd5b505af115801561073c573d6000803e3d6000fd5b505060405185925030915033907f238154946c0c149f8f44d71bfa79cf891af27a2567d540447b44c7c532529e3290600090a45050600160005550565b6002600054141561079c5760405162461bcd60e51b81526004016101f690611187565b60026000556004546001600160a01b031633146107cb5760405162461bcd60e51b81526004016101f690611137565b6001546040805163040f1f6d60e11b815290516000926001600160a01b03169163081e3eda916004808301926020929190829003018186803b15801561081057600080fd5b505afa158015610824573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108489190611077565b90508084106108695760405162461bcd60e51b81526004016101f69061115c565b6001546040516378ed5d1f60e01b8152600481018690526000916001600160a01b0316906378ed5d1f9060240160206040518083038186803b1580156108ae57600080fd5b505afa1580156108c2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108e69190610fc8565b90506108fd6001600160a01b038216333087610d19565b6001600160a01b03811660009081526005602052604090205460ff166109c95760015460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529082169063095ea7b390604401602060405180830381600087803b15801561096c57600080fd5b505af1158015610980573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109a4919061103f565b506001600160a01b0381166000908152600560205260409020805460ff191660011790555b600154604051638dbdbe6d60e01b815260048101879052602481018690526001600160a01b03858116604483015290911690638dbdbe6d90606401600060405180830381600087803b158015610a1e57600080fd5b505af1158015610a32573d6000803e3d6000fd5b50505050610a3e610c7b565b600354604051630bd6db7760e11b8152336004820152602481018790526001600160a01b03909116906317adb6ee90604401600060405180830381600087803b158015610a8a57600080fd5b505af1158015610a9e573d6000803e3d6000fd5b505060405186815287925030915033907f138d30356a982952b65b72a90f5ee823874132ec8dd8b2fa5c42499228670fa69060200160405180910390a450506001600055505050565b600454600160a01b900460ff1615610b415760405162461bcd60e51b815260206004820152601f60248201527f4f7065726174696f6e733a20416c726561647920696e697469616c697a65640060448201526064016101f6565b336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614610bb95760405162461bcd60e51b815260206004820152601760248201527f4f7065726174696f6e733a204e6f7420666163746f727900000000000000000060448201526064016101f6565b600480546001600160a01b039586166001600160a81b031990911617600160a01b179055600380549385166001600160a01b0319948516179055600180549285169284169290921790915560028054919093169116179055565b6040516001600160a01b038316602482015260448101829052610c7690849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610d57565b505050565b6002546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a082319060240160206040518083038186803b158015610cbf57600080fd5b505afa158015610cd3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cf79190611077565b90508015610d1657600254610d16906001600160a01b03163383610c13565b50565b6040516001600160a01b0380851660248301528316604482015260648101829052610d519085906323b872dd60e01b90608401610c3f565b50505050565b6000610dac826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316610e299092919063ffffffff16565b805190915015610c765780806020019051810190610dca919061103f565b610c765760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016101f6565b6060610e388484600085610e42565b90505b9392505050565b606082471015610ea35760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016101f6565b6001600160a01b0385163b610efa5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016101f6565b600080866001600160a01b03168587604051610f1691906110e8565b60006040518083038185875af1925050503d8060008114610f53576040519150601f19603f3d011682016040523d82523d6000602084013e610f58565b606091505b5091509150610f68828286610f73565b979650505050505050565b60608315610f82575081610e3b565b825115610f925782518084602001fd5b8160405162461bcd60e51b81526004016101f69190611104565b600060208284031215610fbd578081fd5b8135610e3b816111ea565b600060208284031215610fd9578081fd5b8151610e3b816111ea565b60008060008060808587031215610ff9578283fd5b8435611004816111ea565b93506020850135611014816111ea565b92506040850135611024816111ea565b91506060850135611034816111ea565b939692955090935050565b600060208284031215611050578081fd5b81518015158114610e3b578182fd5b600060208284031215611070578081fd5b5035919050565b600060208284031215611088578081fd5b5051919050565b600080604083850312156110a1578182fd5b50508035926020909101359150565b6000806000606084860312156110c4578283fd5b833592506020840135915060408401356110dd816111ea565b809150509250925092565b600082516110fa8184602087016111be565b9190910192915050565b60208152600082518060208401526111238160408501602087016111be565b601f01601f19169190910160400192915050565b6020808252600b908201526a61646d696e3a207775743f60a81b604082015260600190565b602080825260119082015270141bdbdb081a5cc81b9bdd08195e1a5cdd607a1b604082015260600190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b60005b838110156111d95781810151838201526020016111c1565b83811115610d515750506000910152565b6001600160a01b0381168114610d1657600080fdfea2646970667358221220c85f4802e4eefd7a405fb15ff56d3f5fa3e51899a4b6462cd34daaf442fb741864736f6c63430008040033

Block Transaction Gas Used Reward
Age Block Fee Address BC Fee Address Voting Power Jailed Incoming
Block Uncle Number Difficulty Gas Used Reward
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.