ETH Price: $3,275.48 (-3.96%)
Gas: 14 Gwei

Contract

0xc5C54da87A56e4310C7efB4dfF4E411fb63f8EE7
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Value
Withdraw199458092024-05-25 8:50:2339 days ago1716627023IN
0xc5C54da8...fb63f8EE7
0 ETH0.000296944.25393723
Withdraw198852612024-05-16 21:36:3547 days ago1715895395IN
0xc5C54da8...fb63f8EE7
0 ETH0.000311774.01096132
Withdraw198167482024-05-07 7:38:3557 days ago1715067515IN
0xc5C54da8...fb63f8EE7
0 ETH0.000544647.80116535
Withdraw198132442024-05-06 19:51:4758 days ago1715025107IN
0xc5C54da8...fb63f8EE7
0 ETH0.000432385.64186511
Withdraw198127322024-05-06 18:08:5958 days ago1715018939IN
0xc5C54da8...fb63f8EE7
0 ETH0.00043996.30088087
Withdraw197810112024-05-02 7:41:3562 days ago1714635695IN
0xc5C54da8...fb63f8EE7
0 ETH0.000325526.17652717
Withdraw197805692024-05-02 6:11:4762 days ago1714630307IN
0xc5C54da8...fb63f8EE7
0 ETH0.00035215.65357836
Withdraw197804652024-05-02 5:50:4762 days ago1714629047IN
0xc5C54da8...fb63f8EE7
0 ETH0.000383124.92889035
Withdraw197765062024-05-01 16:34:3563 days ago1714581275IN
0xc5C54da8...fb63f8EE7
0 ETH0.0008901212.74740709
Withdraw197761152024-05-01 15:16:2363 days ago1714576583IN
0xc5C54da8...fb63f8EE7
0 ETH0.0008847511.38229
Withdraw197756612024-05-01 13:44:5963 days ago1714571099IN
0xc5C54da8...fb63f8EE7
0 ETH0.0009980910.52503849
Withdraw197737422024-05-01 7:18:5963 days ago1714547939IN
0xc5C54da8...fb63f8EE7
0 ETH0.0014847913.65400441
Withdraw197670272024-04-30 8:46:5964 days ago1714466819IN
0xc5C54da8...fb63f8EE7
0 ETH0.0009780410.81414301
Deposit197642352024-04-29 23:26:4764 days ago1714433207IN
0xc5C54da8...fb63f8EE7
0 ETH0.00097918.63749197
Deposit197642012024-04-29 23:19:4764 days ago1714432787IN
0xc5C54da8...fb63f8EE7
0 ETH0.000917878.6554929
Withdraw197602612024-04-29 10:05:4765 days ago1714385147IN
0xc5C54da8...fb63f8EE7
0 ETH0.000981749.03730155
Deposit197554562024-04-28 17:58:3566 days ago1714327115IN
0xc5C54da8...fb63f8EE7
0 ETH0.000786126.79913156
Deposit197477272024-04-27 16:01:5967 days ago1714233719IN
0xc5C54da8...fb63f8EE7
0 ETH0.000938918.1197969
Withdraw197453642024-04-27 8:04:3567 days ago1714205075IN
0xc5C54da8...fb63f8EE7
0 ETH0.000497165.43158218
Withdraw197448252024-04-27 6:15:5967 days ago1714198559IN
0xc5C54da8...fb63f8EE7
0 ETH0.000610085.6159956
Withdraw197342352024-04-25 18:40:5969 days ago1714070459IN
0xc5C54da8...fb63f8EE7
0 ETH0.002044518.820324
Withdraw197228182024-04-24 4:20:2370 days ago1713932423IN
0xc5C54da8...fb63f8EE7
0 ETH0.0009968510.89067631
Withdraw196985382024-04-20 18:53:2374 days ago1713639203IN
0xc5C54da8...fb63f8EE7
0 ETH0.000855577.87578427
Deposit196878742024-04-19 7:03:2375 days ago1713510203IN
0xc5C54da8...fb63f8EE7
0 ETH0.0016129416.7570273
Withdraw196877742024-04-19 6:42:5975 days ago1713508979IN
0xc5C54da8...fb63f8EE7
0 ETH0.0012951911.9226273
View all transactions

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Farming

Compiler Version
v0.8.18+commit.87f61d96

Optimization Enabled:
Yes with 1000 runs

Other Settings:
default evmVersion
File 1 of 8 : Farming.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.18;

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "./interfaces/IFarming.sol";

contract Farming is Ownable, IFarming {
  using SafeERC20 for IERC20;

  // Info of each user.
  struct UserInfo {
    uint256 amount;     // How many LP tokens the user has provided.
    uint256 rewardDebt; // Reward debt. See explanation below.
    //
    // We do some fancy math here. Basically, any point in time, the amount of ERC20s
    // entitled to a user but is pending to be distributed is:
    //
    //   pending reward = (user.amount * pool.accERC20PerShare) - user.rewardDebt
    //
    // Whenever a user deposits or withdraws LP tokens to a pool. Here's what happens:
    //   1. The pool's `accERC20PerShare` (and `lastRewardBlock`) gets updated.
    //   2. User receives the pending reward sent to his/her address.
    //   3. User's `amount` gets updated.
    //   4. User's `rewardDebt` gets updated.
  }

  // Info of each pool.
  struct PoolInfo {
    IERC20 lpToken;             // Address of LP token contract.
    uint256 allocPoint;         // How many allocation points assigned to this pool. ERC20s to distribute per block.
    uint256 lastRewardBlock;    // Last block number that ERC20s distribution occurs.
    uint256 accERC20PerShare;   // Accumulated ERC20s per share, times 1e36.
  }

  // Minimum number of blocks that needs to pass, from the deploy, in order to start distributing rewards
  // uint constant MINIMUM_BLOCKS_BEFORE_DISTRIBUTION = 216_000; // 30 days divided by 12 seconds (average Ethereum block time)
  uint constant MINIMUM_BLOCKS_BEFORE_DISTRIBUTION = 0; // Removed due to time constraints

  // Maximum number of blocks that needs to pass, from the deploy, in order to start distributing rewards
  uint constant MAXIMUM_BLOCKS_BEFORE_DISTRIBUTION = 1_296_000; // 180 days divided by 12 seconds (average Ethereum block time)

  // Address of the ERC20 Token contract.
  IERC20 public erc20;
  // The total amount of ERC20 that's paid out as reward.
  uint256 public paidOut;
  // ERC20 tokens rewarded per block.
  uint256 public rewardPerBlock;

  // 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;

  // The block number when farming starts.
  uint256 public startBlock;
  // The block number when farming ends.
  uint256 public endBlock;

  /**
    * @notice Constructor
    * @param _erc20 Address of the reward token
    * @param _rewardPerBlock Distributed rewards per block
    * @param _startBlock Block number from which users can farm
    */
  constructor(
    IERC20 _erc20, 
    uint256 _rewardPerBlock, 
    uint256 _startBlock
  ) {
    require(_startBlock >= block.number + MINIMUM_BLOCKS_BEFORE_DISTRIBUTION && 
      _startBlock <= block.number + MAXIMUM_BLOCKS_BEFORE_DISTRIBUTION, "constructor: invalid start block");

    erc20 = _erc20;
    rewardPerBlock = _rewardPerBlock;
    startBlock = _startBlock;
    endBlock = _startBlock;
  }

  /**
    * @notice Returns the number of farming pools
    * @return pools Number of farming pools
    */
  function poolLength() external view returns (uint256) {
    return poolInfo.length;
  }

  /**
    * @notice Fund the farming and extends the end block
    * @param _amount Amount of token to fund
    * @dev Caller must approve the transfer of token from its wallet
          to this contract before calling this function
    */
  function fund(
    uint256 _amount
  ) public {
    require(block.number < endBlock, "fund: too late, the farm is closed");
    require(_amount % rewardPerBlock == 0, "fund: invalid amount");

    erc20.safeTransferFrom(address(msg.sender), address(this), _amount);
    endBlock += _amount / rewardPerBlock;
  }

  /**
    * @notice Create a farming pool
    * @param _allocPoint Allocation points of the pool. This pool will receive
              _allocPoint / totalAllocPoint of the reward per block
    * @param _lpToken Address of the LP token
    * @param _withUpdate If true, updates other farmimg pools
    * @dev Owner should withdraw before endBlock in order to not lose rewards
    * @dev DO NOT add the same LP token more than once. Rewards will be messed
                up if you do.
    */
  function add(
    uint256 _allocPoint, 
    IERC20 _lpToken, 
    bool _withUpdate
  ) public onlyOwner {
    if (_withUpdate) {
      massUpdatePools();
    }
    uint256 lastRewardBlock = block.number > startBlock ? block.number : startBlock;
    totalAllocPoint = totalAllocPoint + _allocPoint;
    poolInfo.push(PoolInfo({
      lpToken: _lpToken,
      allocPoint: _allocPoint,
      lastRewardBlock: lastRewardBlock,
      accERC20PerShare: 0
    }));

    // Deposit 1 wei in order to not lose rewards 
    deposit(poolInfo.length - 1, 1 wei);
  }

  /**
    * @notice Update allocation points of a farming pool
    * @param _pid Pool id
    * @param _allocPoint Allocation points of the pool
    * @param _withUpdate If true, updates other farmimg pools
    */
  function set(
    uint256 _pid, 
    uint256 _allocPoint, 
    bool _withUpdate
  ) public onlyOwner {
    if (_withUpdate) {
      massUpdatePools();
    }
    totalAllocPoint = totalAllocPoint - poolInfo[_pid].allocPoint + _allocPoint;
    poolInfo[_pid].allocPoint = _allocPoint;
  }

  /**
    * @notice Returns the amount of deposited LPs for a user
    * @param _pid Pool id
    * @param _user Address of the user
    * @return deposited Deposited tokens of the user
    */
  function deposited(
    uint256 _pid, 
    address _user
  ) external view returns (uint256) {
    UserInfo storage user = userInfo[_pid][_user];
    return user.amount;
  }

  /**
    * @notice Returns the pending rewards for a user
    * @param _pid Pool id
    * @param _user Address of the user
    * @return rewards Rewards of the user in the farming pool
    */
  function pending(
    uint256 _pid, 
    address _user
  ) external view returns (uint256) {
    PoolInfo storage pool = poolInfo[_pid];
    UserInfo storage user = userInfo[_pid][_user];
    uint256 accERC20PerShare = pool.accERC20PerShare;
    uint256 lpSupply = pool.lpToken.balanceOf(address(this));
    uint256 lastBlock = block.number < endBlock ? block.number : endBlock;

    if (lastBlock > pool.lastRewardBlock && lpSupply != 0) {
      uint256 nrOfBlocks = lastBlock - pool.lastRewardBlock;
      uint256 erc20Reward = nrOfBlocks * rewardPerBlock * pool.allocPoint / totalAllocPoint;
      accERC20PerShare = accERC20PerShare + erc20Reward * 1e36 / lpSupply;
    }

    return user.amount * accERC20PerShare / 1e36 - user.rewardDebt;
  }

  /**
    * @notice Returns the total amount of pending rewards
    * @return totalRewards Total amount of pending rewards
    */
  function totalPending() external view returns (uint256) {
    if (block.number <= startBlock) {
      return 0;
    }

    uint256 lastBlock = block.number < endBlock ? block.number : endBlock;
    return rewardPerBlock * (lastBlock - startBlock) - paidOut;
  }

  /**
    * @notice Updates reward variables for every farming pool
    * @dev Can be really expensive in gas
    */
  function massUpdatePools() public {
    uint256 length = poolInfo.length;
    for (uint256 pid = 0; pid < length; ++pid) {
      updatePool(pid);
    }
  }

  /**
    * @notice Updates reward variables for a single farming pool
    * @param _pid Pool id
    */
  function updatePool(
    uint256 _pid
  ) public {
    PoolInfo storage pool = poolInfo[_pid];
    uint256 lastBlock = block.number < endBlock ? block.number : endBlock;

    if (lastBlock <= pool.lastRewardBlock) {
      return;
    }
    uint256 lpSupply = pool.lpToken.balanceOf(address(this));
    if (lpSupply == 0) {
      pool.lastRewardBlock = lastBlock;
      return;
    }

    uint256 nrOfBlocks = lastBlock - pool.lastRewardBlock;
    uint256 erc20Reward = nrOfBlocks * rewardPerBlock * pool.allocPoint / totalAllocPoint;

    pool.accERC20PerShare = pool.accERC20PerShare + erc20Reward * 1e36 / lpSupply;
    pool.lastRewardBlock = block.number;
  }

  /**
    * @notice Deposit LP tokens in a farming pool
    * @param _pid Pool id
    * @param _amount Amount of LP tokens to deposit
    */
  function deposit(
    uint256 _pid, 
    uint256 _amount
  ) public {
    require(block.number <= endBlock, "deposit: cannot deposit after end block");

    PoolInfo storage pool = poolInfo[_pid];
    UserInfo storage user = userInfo[_pid][msg.sender];
    updatePool(_pid);
    if (user.amount > 0) {
      uint256 pendingAmount = user.amount * pool.accERC20PerShare / 1e36 - user.rewardDebt;
      if (pendingAmount > 0) {
        erc20Transfer(msg.sender, pendingAmount);
      }
    }
    pool.lpToken.safeTransferFrom(address(msg.sender), address(this), _amount);
    user.amount = user.amount + _amount;
    user.rewardDebt = user.amount * pool.accERC20PerShare / 1e36;
    emit Deposit(msg.sender, _pid, _amount);
  }

  /**
    * @notice Withdraw tokens from a farming pool
    * @param _pid Pool id
    * @param _amount Amount of LP tokens to withdraw
    */
  function withdraw(
    uint256 _pid, 
    uint256 _amount
  ) public {
    PoolInfo storage pool = poolInfo[_pid];
    UserInfo storage user = userInfo[_pid][msg.sender];
    require(user.amount >= _amount, "withdraw: can't withdraw more than deposit");
    updatePool(_pid);

    uint256 pendingAmount = user.amount * pool.accERC20PerShare / 1e36 - user.rewardDebt;
    if (pendingAmount > 0) {
      erc20Transfer(msg.sender, pendingAmount);
    }
    
    user.amount = user.amount - _amount;
    user.rewardDebt = user.amount * pool.accERC20PerShare / 1e36;
    pool.lpToken.safeTransfer(address(msg.sender), _amount);
    emit Withdraw(msg.sender, _pid, _amount);
  }

  /**
    * @notice Withdraw LP tokens from a farming pool ignoring rewards
    * @param _pid Pool id
    * @dev Emergency only
    */
  function emergencyWithdraw(
    uint256 _pid
  ) public {
    PoolInfo storage pool = poolInfo[_pid];
    UserInfo storage user = userInfo[_pid][msg.sender];
    pool.lpToken.safeTransfer(address(msg.sender), user.amount);
    emit EmergencyWithdraw(msg.sender, _pid, user.amount);
    user.amount = 0;
    user.rewardDebt = 0;
  }

  // Transfer ERC20 and update the required ERC20 to payout all rewards
  function erc20Transfer(
    address _to, 
    uint256 _amount
  ) internal {
    SafeERC20.safeTransfer(erc20, _to, _amount);
    paidOut += _amount;
  }
}

File 2 of 8 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)

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() {
        _transferOwnership(_msgSender());
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        _checkOwner();
        _;
    }

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

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        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 {
        _transferOwnership(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");
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}

File 3 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);
}

File 4 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 5 of 8 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.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 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.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 functionCallWithValue(target, data, 0, "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");
        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResultFromTarget(target, 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) {
        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResultFromTarget(target, 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) {
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
     * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
     *
     * _Available since v4.8._
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        if (success) {
            if (returndata.length == 0) {
                // only check isContract if the call was successful and the return data is empty
                // otherwise we already know that it was a contract
                require(isContract(target), "Address: call to non-contract");
            }
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    /**
     * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason or 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 {
            _revert(returndata, errorMessage);
        }
    }

    function _revert(bytes memory returndata, string memory errorMessage) private pure {
        // 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 7 of 8 : Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

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 8 of 8 : IFarming.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.18;

interface IFarming {
    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);
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"contract IERC20","name":"_erc20","type":"address"},{"internalType":"uint256","name":"_rewardPerBlock","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":"_user","type":"address"},{"indexed":true,"internalType":"uint256","name":"_pid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"Withdraw","type":"event"},{"inputs":[{"internalType":"uint256","name":"_allocPoint","type":"uint256"},{"internalType":"contract IERC20","name":"_lpToken","type":"address"},{"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"},{"internalType":"address","name":"_user","type":"address"}],"name":"deposited","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"}],"name":"emergencyWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"endBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"erc20","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"fund","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"massUpdatePools","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"paidOut","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"address","name":"_user","type":"address"}],"name":"pending","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"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":"accERC20PerShare","type":"uint256"}],"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":"rewardPerBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"uint256","name":"_allocPoint","type":"uint256"},{"internalType":"bool","name":"_withUpdate","type":"bool"}],"name":"set","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":"totalPending","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":[{"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"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60806040523480156200001157600080fd5b50604051620017c3380380620017c383398101604081905262000034916200013d565b6200003f33620000ed565b6200004c60004362000182565b81101580156200006a5750620000666213c6804362000182565b8111155b620000bb5760405162461bcd60e51b815260206004820181905260248201527f636f6e7374727563746f723a20696e76616c696420737461727420626c6f636b604482015260640160405180910390fd5b600180546001600160a01b0319166001600160a01b0394909416939093179092556003556007819055600855620001aa565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000806000606084860312156200015357600080fd5b83516001600160a01b03811681146200016b57600080fd5b602085015160409095015190969495509392505050565b80820180821115620001a457634e487b7160e01b600052601160045260246000fd5b92915050565b61160980620001ba6000396000f3fe608060405234801561001057600080fd5b506004361061018d5760003560e01c8063630b5ba1116100e357806393f1a40b1161008c578063e2bbb15811610066578063e2bbb15814610335578063e4c75c2714610348578063f2fde38b1461035b57600080fd5b806393f1a40b146102c8578063a23831061461030f578063ca1d209d1461032257600080fd5b8063785e9e86116100bd578063785e9e86146102835780638ae39cac146102ae5780638da5cb5b146102b757600080fd5b8063630b5ba11461026057806364482f7914610268578063715018a61461027b57600080fd5b80633f90916a1161014557806351eb05a61161011f57806351eb05a6146102315780635312ea8e146102445780635c76ca2d1461025757600080fd5b80633f90916a1461020d578063441a3e701461021557806348cd4cb11461022857600080fd5b80631526fe27116101765780631526fe27146101b257806317caf6f1146101ef5780631eaaa045146101f857600080fd5b8063081e3eda14610192578063083c6323146101a9575b600080fd5b6004545b6040519081526020015b60405180910390f35b61019660085481565b6101c56101c0366004611348565b61036e565b604080516001600160a01b03909516855260208501939093529183015260608201526080016101a0565b61019660065481565b61020b610206366004611384565b6103b2565b005b610196610507565b61020b6102233660046113c6565b61055d565b61019660075481565b61020b61023f366004611348565b610703565b61020b610252366004611348565b61085a565b61019660025481565b61020b6108fc565b61020b6102763660046113e8565b610927565b61020b6109ae565b600154610296906001600160a01b031681565b6040516001600160a01b0390911681526020016101a0565b61019660035481565b6000546001600160a01b0316610296565b6102fa6102d6366004611416565b60056020908152600092835260408084209091529082529020805460019091015482565b604080519283526020830191909152016101a0565b61019661031d366004611416565b6109c2565b61020b610330366004611348565b6109ec565b61020b6103433660046113c6565b610afb565b610196610356366004611416565b610ca6565b61020b610369366004611446565b610e44565b6004818154811061037e57600080fd5b600091825260209091206004909102018054600182015460028301546003909301546001600160a01b039092169350919084565b6103ba610ed4565b80156103c8576103c86108fc565b600060075443116103db576007546103dd565b435b9050836006546103ed9190611480565b600655604080516080810182526001600160a01b0385811682526020820187815292820184815260006060840181815260048054600180820183559382905295517f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b968202968701805473ffffffffffffffffffffffffffffffffffffffff1916919096161790945594517f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19c85015590517f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19d84015592517f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19e9092019190915554610501916104fa91611493565b6001610afb565b50505050565b600060075443116105185750600090565b6000600854431061052b5760085461052d565b435b9050600254600754826105409190611493565b60035461054d91906114a6565b6105579190611493565b91505090565b600060048381548110610572576105726114bd565b6000918252602080832086845260058252604080852033865290925292208054600490920290920192508311156106165760405162461bcd60e51b815260206004820152602a60248201527f77697468647261773a2063616e2774207769746864726177206d6f726520746860448201527f616e206465706f7369740000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b61061f84610703565b600081600101546ec097ce7bc90715b34b9f10000000008460030154846000015461064a91906114a6565b61065491906114e9565b61065e9190611493565b90508015610670576106703382610f2e565b815461067d908590611493565b80835560038401546ec097ce7bc90715b34b9f1000000000916106a091906114a6565b6106aa91906114e9565b600183015582546106c5906001600160a01b03163386610f60565b604051848152859033907ff279e6a1f5e320cca91135676d9cb6e44ca8a08c0b88342bcdb1144f6511b5689060200160405180910390a35050505050565b600060048281548110610718576107186114bd565b906000526020600020906004020190506000600854431061073b5760085461073d565b435b90508160020154811161074f57505050565b81546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa158015610797573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107bb91906114fd565b9050806000036107cf575060029091015550565b60008360020154836107e19190611493565b905060006006548560010154600354846107fb91906114a6565b61080591906114a6565b61080f91906114e9565b90508261082b826ec097ce7bc90715b34b9f10000000006114a6565b61083591906114e9565b85600301546108449190611480565b6003860155505043600290930192909255505050565b60006004828154811061086f5761086f6114bd565b600091825260208083208584526005825260408085203380875293529093208054600490930290930180549094506108b4926001600160a01b03919091169190610f60565b8054604051908152839033907fbb757047c2b5f3974fe26b7c10f732e7bce710b0952a71082702781e62ae05959060200160405180910390a360008082556001909101555050565b60045460005b818110156109235761091381610703565b61091c81611516565b9050610902565b5050565b61092f610ed4565b801561093d5761093d6108fc565b8160048481548110610951576109516114bd565b9060005260206000209060040201600101546006546109709190611493565b61097a9190611480565b6006819055508160048481548110610994576109946114bd565b906000526020600020906004020160010181905550505050565b6109b6610ed4565b6109c0600061100e565b565b60008281526005602090815260408083206001600160a01b03851684529091529020545b92915050565b6008544310610a635760405162461bcd60e51b815260206004820152602260248201527f66756e643a20746f6f206c6174652c20746865206661726d20697320636c6f7360448201527f6564000000000000000000000000000000000000000000000000000000000000606482015260840161060d565b600354610a70908261152f565b15610abd5760405162461bcd60e51b815260206004820152601460248201527f66756e643a20696e76616c696420616d6f756e74000000000000000000000000604482015260640161060d565b600154610ad5906001600160a01b031633308461106b565b600354610ae290826114e9565b60086000828254610af39190611480565b909155505050565b600854431115610b735760405162461bcd60e51b815260206004820152602760248201527f6465706f7369743a2063616e6e6f74206465706f73697420616674657220656e60448201527f6420626c6f636b00000000000000000000000000000000000000000000000000606482015260840161060d565b600060048381548110610b8857610b886114bd565b60009182526020808320868452600582526040808520338652909252922060049091029091019150610bb984610703565b805415610c1357600081600101546ec097ce7bc90715b34b9f100000000084600301548460000154610beb91906114a6565b610bf591906114e9565b610bff9190611493565b90508015610c1157610c113382610f2e565b505b8154610c2a906001600160a01b031633308661106b565b8054610c37908490611480565b80825560038301546ec097ce7bc90715b34b9f100000000091610c5a91906114a6565b610c6491906114e9565b6001820155604051838152849033907f90890809c654f11d6e72a28fa60149770a0d11ec6c92319d6ceb2bb0a4ea1a159060200160405180910390a350505050565b60008060048481548110610cbc57610cbc6114bd565b600091825260208083208784526005825260408085206001600160a01b038981168752935280852060049485029092016003810154815492516370a0823160e01b8152309681019690965290965091949193919216906370a0823190602401602060405180830381865afa158015610d38573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d5c91906114fd565b905060006008544310610d7157600854610d73565b435b9050846002015481118015610d8757508115155b15610e01576000856002015482610d9e9190611493565b90506000600654876001015460035484610db891906114a6565b610dc291906114a6565b610dcc91906114e9565b905083610de8826ec097ce7bc90715b34b9f10000000006114a6565b610df291906114e9565b610dfc9086611480565b945050505b600184015484546ec097ce7bc90715b34b9f100000000090610e249086906114a6565b610e2e91906114e9565b610e389190611493565b98975050505050505050565b610e4c610ed4565b6001600160a01b038116610ec85760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161060d565b610ed18161100e565b50565b6000546001600160a01b031633146109c05760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161060d565b600154610f45906001600160a01b03168383610f60565b8060026000828254610f579190611480565b90915550505050565b6040516001600160a01b0383166024820152604481018290526110099084907fa9059cbb00000000000000000000000000000000000000000000000000000000906064015b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091526110bc565b505050565b600080546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6040516001600160a01b03808516602483015283166044820152606481018290526105019085907f23b872dd0000000000000000000000000000000000000000000000000000000090608401610fa5565b6000611111826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166111a19092919063ffffffff16565b805190915015611009578080602001905181019061112f9190611543565b6110095760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f74207375636365656400000000000000000000000000000000000000000000606482015260840161060d565b60606111b084846000856111b8565b949350505050565b6060824710156112305760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c0000000000000000000000000000000000000000000000000000606482015260840161060d565b600080866001600160a01b0316858760405161124c9190611584565b60006040518083038185875af1925050503d8060008114611289576040519150601f19603f3d011682016040523d82523d6000602084013e61128e565b606091505b509150915061129f878383876112aa565b979650505050505050565b60608315611319578251600003611312576001600160a01b0385163b6113125760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161060d565b50816111b0565b6111b0838381511561132e5781518083602001fd5b8060405162461bcd60e51b815260040161060d91906115a0565b60006020828403121561135a57600080fd5b5035919050565b6001600160a01b0381168114610ed157600080fd5b8015158114610ed157600080fd5b60008060006060848603121561139957600080fd5b8335925060208401356113ab81611361565b915060408401356113bb81611376565b809150509250925092565b600080604083850312156113d957600080fd5b50508035926020909101359150565b6000806000606084860312156113fd57600080fd5b833592506020840135915060408401356113bb81611376565b6000806040838503121561142957600080fd5b82359150602083013561143b81611361565b809150509250929050565b60006020828403121561145857600080fd5b813561146381611361565b9392505050565b634e487b7160e01b600052601160045260246000fd5b808201808211156109e6576109e661146a565b818103818111156109e6576109e661146a565b80820281158282048414176109e6576109e661146a565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601260045260246000fd5b6000826114f8576114f86114d3565b500490565b60006020828403121561150f57600080fd5b5051919050565b6000600182016115285761152861146a565b5060010190565b60008261153e5761153e6114d3565b500690565b60006020828403121561155557600080fd5b815161146381611376565b60005b8381101561157b578181015183820152602001611563565b50506000910152565b60008251611596818460208701611560565b9190910192915050565b60208152600082518060208401526115bf816040850160208701611560565b601f01601f1916919091016040019291505056fea264697066735822122043c4facadb26d635e88899ac0e25ded1c31bb21f3aa959a73c4fd15311d9d06b64736f6c63430008120033000000000000000000000000f97e2a78f1f3d1fd438ff7cc3bb7de01e5945b830000000000000000000000000000000000000000000000007ce66c50e284000000000000000000000000000000000000000000000000000000000000011a2fa0

Deployed Bytecode

0x608060405234801561001057600080fd5b506004361061018d5760003560e01c8063630b5ba1116100e357806393f1a40b1161008c578063e2bbb15811610066578063e2bbb15814610335578063e4c75c2714610348578063f2fde38b1461035b57600080fd5b806393f1a40b146102c8578063a23831061461030f578063ca1d209d1461032257600080fd5b8063785e9e86116100bd578063785e9e86146102835780638ae39cac146102ae5780638da5cb5b146102b757600080fd5b8063630b5ba11461026057806364482f7914610268578063715018a61461027b57600080fd5b80633f90916a1161014557806351eb05a61161011f57806351eb05a6146102315780635312ea8e146102445780635c76ca2d1461025757600080fd5b80633f90916a1461020d578063441a3e701461021557806348cd4cb11461022857600080fd5b80631526fe27116101765780631526fe27146101b257806317caf6f1146101ef5780631eaaa045146101f857600080fd5b8063081e3eda14610192578063083c6323146101a9575b600080fd5b6004545b6040519081526020015b60405180910390f35b61019660085481565b6101c56101c0366004611348565b61036e565b604080516001600160a01b03909516855260208501939093529183015260608201526080016101a0565b61019660065481565b61020b610206366004611384565b6103b2565b005b610196610507565b61020b6102233660046113c6565b61055d565b61019660075481565b61020b61023f366004611348565b610703565b61020b610252366004611348565b61085a565b61019660025481565b61020b6108fc565b61020b6102763660046113e8565b610927565b61020b6109ae565b600154610296906001600160a01b031681565b6040516001600160a01b0390911681526020016101a0565b61019660035481565b6000546001600160a01b0316610296565b6102fa6102d6366004611416565b60056020908152600092835260408084209091529082529020805460019091015482565b604080519283526020830191909152016101a0565b61019661031d366004611416565b6109c2565b61020b610330366004611348565b6109ec565b61020b6103433660046113c6565b610afb565b610196610356366004611416565b610ca6565b61020b610369366004611446565b610e44565b6004818154811061037e57600080fd5b600091825260209091206004909102018054600182015460028301546003909301546001600160a01b039092169350919084565b6103ba610ed4565b80156103c8576103c86108fc565b600060075443116103db576007546103dd565b435b9050836006546103ed9190611480565b600655604080516080810182526001600160a01b0385811682526020820187815292820184815260006060840181815260048054600180820183559382905295517f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b968202968701805473ffffffffffffffffffffffffffffffffffffffff1916919096161790945594517f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19c85015590517f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19d84015592517f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19e9092019190915554610501916104fa91611493565b6001610afb565b50505050565b600060075443116105185750600090565b6000600854431061052b5760085461052d565b435b9050600254600754826105409190611493565b60035461054d91906114a6565b6105579190611493565b91505090565b600060048381548110610572576105726114bd565b6000918252602080832086845260058252604080852033865290925292208054600490920290920192508311156106165760405162461bcd60e51b815260206004820152602a60248201527f77697468647261773a2063616e2774207769746864726177206d6f726520746860448201527f616e206465706f7369740000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b61061f84610703565b600081600101546ec097ce7bc90715b34b9f10000000008460030154846000015461064a91906114a6565b61065491906114e9565b61065e9190611493565b90508015610670576106703382610f2e565b815461067d908590611493565b80835560038401546ec097ce7bc90715b34b9f1000000000916106a091906114a6565b6106aa91906114e9565b600183015582546106c5906001600160a01b03163386610f60565b604051848152859033907ff279e6a1f5e320cca91135676d9cb6e44ca8a08c0b88342bcdb1144f6511b5689060200160405180910390a35050505050565b600060048281548110610718576107186114bd565b906000526020600020906004020190506000600854431061073b5760085461073d565b435b90508160020154811161074f57505050565b81546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa158015610797573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107bb91906114fd565b9050806000036107cf575060029091015550565b60008360020154836107e19190611493565b905060006006548560010154600354846107fb91906114a6565b61080591906114a6565b61080f91906114e9565b90508261082b826ec097ce7bc90715b34b9f10000000006114a6565b61083591906114e9565b85600301546108449190611480565b6003860155505043600290930192909255505050565b60006004828154811061086f5761086f6114bd565b600091825260208083208584526005825260408085203380875293529093208054600490930290930180549094506108b4926001600160a01b03919091169190610f60565b8054604051908152839033907fbb757047c2b5f3974fe26b7c10f732e7bce710b0952a71082702781e62ae05959060200160405180910390a360008082556001909101555050565b60045460005b818110156109235761091381610703565b61091c81611516565b9050610902565b5050565b61092f610ed4565b801561093d5761093d6108fc565b8160048481548110610951576109516114bd565b9060005260206000209060040201600101546006546109709190611493565b61097a9190611480565b6006819055508160048481548110610994576109946114bd565b906000526020600020906004020160010181905550505050565b6109b6610ed4565b6109c0600061100e565b565b60008281526005602090815260408083206001600160a01b03851684529091529020545b92915050565b6008544310610a635760405162461bcd60e51b815260206004820152602260248201527f66756e643a20746f6f206c6174652c20746865206661726d20697320636c6f7360448201527f6564000000000000000000000000000000000000000000000000000000000000606482015260840161060d565b600354610a70908261152f565b15610abd5760405162461bcd60e51b815260206004820152601460248201527f66756e643a20696e76616c696420616d6f756e74000000000000000000000000604482015260640161060d565b600154610ad5906001600160a01b031633308461106b565b600354610ae290826114e9565b60086000828254610af39190611480565b909155505050565b600854431115610b735760405162461bcd60e51b815260206004820152602760248201527f6465706f7369743a2063616e6e6f74206465706f73697420616674657220656e60448201527f6420626c6f636b00000000000000000000000000000000000000000000000000606482015260840161060d565b600060048381548110610b8857610b886114bd565b60009182526020808320868452600582526040808520338652909252922060049091029091019150610bb984610703565b805415610c1357600081600101546ec097ce7bc90715b34b9f100000000084600301548460000154610beb91906114a6565b610bf591906114e9565b610bff9190611493565b90508015610c1157610c113382610f2e565b505b8154610c2a906001600160a01b031633308661106b565b8054610c37908490611480565b80825560038301546ec097ce7bc90715b34b9f100000000091610c5a91906114a6565b610c6491906114e9565b6001820155604051838152849033907f90890809c654f11d6e72a28fa60149770a0d11ec6c92319d6ceb2bb0a4ea1a159060200160405180910390a350505050565b60008060048481548110610cbc57610cbc6114bd565b600091825260208083208784526005825260408085206001600160a01b038981168752935280852060049485029092016003810154815492516370a0823160e01b8152309681019690965290965091949193919216906370a0823190602401602060405180830381865afa158015610d38573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d5c91906114fd565b905060006008544310610d7157600854610d73565b435b9050846002015481118015610d8757508115155b15610e01576000856002015482610d9e9190611493565b90506000600654876001015460035484610db891906114a6565b610dc291906114a6565b610dcc91906114e9565b905083610de8826ec097ce7bc90715b34b9f10000000006114a6565b610df291906114e9565b610dfc9086611480565b945050505b600184015484546ec097ce7bc90715b34b9f100000000090610e249086906114a6565b610e2e91906114e9565b610e389190611493565b98975050505050505050565b610e4c610ed4565b6001600160a01b038116610ec85760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161060d565b610ed18161100e565b50565b6000546001600160a01b031633146109c05760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161060d565b600154610f45906001600160a01b03168383610f60565b8060026000828254610f579190611480565b90915550505050565b6040516001600160a01b0383166024820152604481018290526110099084907fa9059cbb00000000000000000000000000000000000000000000000000000000906064015b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091526110bc565b505050565b600080546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6040516001600160a01b03808516602483015283166044820152606481018290526105019085907f23b872dd0000000000000000000000000000000000000000000000000000000090608401610fa5565b6000611111826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166111a19092919063ffffffff16565b805190915015611009578080602001905181019061112f9190611543565b6110095760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f74207375636365656400000000000000000000000000000000000000000000606482015260840161060d565b60606111b084846000856111b8565b949350505050565b6060824710156112305760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c0000000000000000000000000000000000000000000000000000606482015260840161060d565b600080866001600160a01b0316858760405161124c9190611584565b60006040518083038185875af1925050503d8060008114611289576040519150601f19603f3d011682016040523d82523d6000602084013e61128e565b606091505b509150915061129f878383876112aa565b979650505050505050565b60608315611319578251600003611312576001600160a01b0385163b6113125760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161060d565b50816111b0565b6111b0838381511561132e5781518083602001fd5b8060405162461bcd60e51b815260040161060d91906115a0565b60006020828403121561135a57600080fd5b5035919050565b6001600160a01b0381168114610ed157600080fd5b8015158114610ed157600080fd5b60008060006060848603121561139957600080fd5b8335925060208401356113ab81611361565b915060408401356113bb81611376565b809150509250925092565b600080604083850312156113d957600080fd5b50508035926020909101359150565b6000806000606084860312156113fd57600080fd5b833592506020840135915060408401356113bb81611376565b6000806040838503121561142957600080fd5b82359150602083013561143b81611361565b809150509250929050565b60006020828403121561145857600080fd5b813561146381611361565b9392505050565b634e487b7160e01b600052601160045260246000fd5b808201808211156109e6576109e661146a565b818103818111156109e6576109e661146a565b80820281158282048414176109e6576109e661146a565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601260045260246000fd5b6000826114f8576114f86114d3565b500490565b60006020828403121561150f57600080fd5b5051919050565b6000600182016115285761152861146a565b5060010190565b60008261153e5761153e6114d3565b500690565b60006020828403121561155557600080fd5b815161146381611376565b60005b8381101561157b578181015183820152602001611563565b50506000910152565b60008251611596818460208701611560565b9190910192915050565b60208152600082518060208401526115bf816040850160208701611560565b601f01601f1916919091016040019291505056fea264697066735822122043c4facadb26d635e88899ac0e25ded1c31bb21f3aa959a73c4fd15311d9d06b64736f6c63430008120033

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

000000000000000000000000f97e2a78f1f3d1fd438ff7cc3bb7de01e5945b830000000000000000000000000000000000000000000000007ce66c50e284000000000000000000000000000000000000000000000000000000000000011a2fa0

-----Decoded View---------------
Arg [0] : _erc20 (address): 0xf97e2A78f1f3D1fD438ff7cC3BB7De01E5945B83
Arg [1] : _rewardPerBlock (uint256): 9000000000000000000
Arg [2] : _startBlock (uint256): 18493344

-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 000000000000000000000000f97e2a78f1f3d1fd438ff7cc3bb7de01e5945b83
Arg [1] : 0000000000000000000000000000000000000000000000007ce66c50e2840000
Arg [2] : 00000000000000000000000000000000000000000000000000000000011a2fa0


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading
[ Download: CSV Export  ]

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.