Cryo Explorer Ethereum Mainnet

Address Contract Verified

Address 0x9af118D9fA1eFEa5b5a792847554960217DEdb04
Balance 0 ETH
Nonce 1
Code Size 3225 bytes
Indexed Transactions 0
External Etherscan · Sourcify

Contract Bytecode

3225 bytes
0x608060405234801561001057600080fd5b50600436106100b45760003560e01c806373eff2fd1161007157806373eff2fd146101285780639c7ec8811461016a578063a1c130d414610172578063a43564eb1461017a578063b97dd9e2146101a0578063f7e251f8146101a8576100b4565b806305917ac0146100b957806315e5a1e5146100d3578063290e4544146100db57806343312451146100e35780634ff0876a14610118578063674247d614610120575b600080fd5b6100c16101ce565b60408051918252519081900360200190f35b6100c16101f2565b6100c16101f8565b6100c1600480360360408110156100f957600080fd5b5080356001600160a01b031690602001356001600160801b03166103dc565b6100c16103f1565b6100c16103f7565b61014e6004803603602081101561013e57600080fd5b50356001600160a01b031661041b565b604080516001600160801b039092168252519081900360200190f35b61014e610436565b6100c1610445565b6100c16004803603602081101561019057600080fd5b50356001600160801b0316610461565b6100c16106cd565b6100c1600480360360208110156101be57600080fd5b50356001600160801b03166106e5565b7f000000000000000000000000000000000000000000000000000000000000001c81565b60065481565b600080600061021f600161020a61080d565b6001600160801b03169063ffffffff6106f016565b336000908152600460205260409020549091506001600160801b03167f000000000000000000000000000000000000000000000000000000000000001c821115610287577f000000000000000000000000000000000000000000000000000000000000001c91505b336000908152600460205260409020546001600160801b03166001015b82816001600160801b0316116102c9576102bd8161085e565b909301926001016102a4565b5060408051828403815260208101859052815133927fb68dafc1da13dc868096d0b87347c831d0bda92d178317eb1dec7f788444485c928290030190a282156103d357604080516323b872dd60e01b81526001600160a01b037f000000000000000000000000bbc3d9331dcaf3d0d5abd81f59d6471d3548e1df811660048301523360248301526044820186905291517f000000000000000000000000f418588522d5dd018b425e472991e52ebbeeeeee909216916323b872dd916064808201926020929091908290030181600087803b1580156103a657600080fd5b505af11580156103ba573d6000803e3d6000fd5b505050506040513d60208110156103d057600080fd5b50505b50909150505b90565b60006103e88383610924565b90505b92915050565b60055481565b7f00000000000000000000000000000000000000000001766e5066dae44720000081565b6004602052600090815260409020546001600160801b031681565b6003546001600160801b031681565b336000908152600460205260409020546001600160801b031690565b6000816001600160801b031661047561080d565b6001600160801b0316116104d0576040805162461bcd60e51b815260206004820152601b60248201527f546869732065706f636820697320696e20746865206675747572650000000000604482015290519081900360640190fd5b7f000000000000000000000000000000000000000000000000000000000000001c826001600160801b031611156105385760405162461bcd60e51b8152600401808060200182810382526021815260200180610c436021913960400191505060405180910390fd5b336000908152600460205260409020546001600160801b03808416916105669116600163ffffffff6109f116565b146105ab576040805162461bcd60e51b815260206004820152601060248201526f2430b93b32b9ba1034b71037b93232b960811b604482015290519081900360640190fd5b60006105b68361085e565b9050801561068557604080516323b872dd60e01b81526001600160a01b037f000000000000000000000000bbc3d9331dcaf3d0d5abd81f59d6471d3548e1df811660048301523360248301526044820184905291517f000000000000000000000000f418588522d5dd018b425e472991e52ebbeeeeee909216916323b872dd916064808201926020929091908290030181600087803b15801561065857600080fd5b505af115801561066c573d6000803e3d6000fd5b505050506040513d602081101561068257600080fd5b50505b6040805182815290516001600160801b0385169133917f04ad45a69eeed9c390c3a678fed2d4b90bde98e742de9936d5e0915bf3d0ea4e9181900360200190a390505b919050565b60006106d761080d565b6001600160801b0316905090565b60006103eb82610a4b565b600082821115610747576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b60008261075c575060006103eb565b8282028284828161076957fe5b04146103e85760405162461bcd60e51b8152600401808060200182810382526021815260200180610c226021913960400191505060405180910390fd5b60008082116107fc576040805162461bcd60e51b815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b81838161080557fe5b049392505050565b6000600654421015610821575060006103d9565b610859600161084d600554610841600654426106f090919063ffffffff16565b9063ffffffff6107a616565b9063ffffffff6109f116565b905090565b6003546000906001600160801b03808416911610156108805761088082610b18565b33600090815260046020526040902080546001600160801b0319166001600160801b0384169081179091556001805490919081106108ba57fe5b9060005260206000200154600014156108d5575060006106c8565b6103eb6001836001600160801b0316815481106108ee57fe5b90600052602060002001546108416109063386610924565b610918866001600160801b0316610bd4565b9063ffffffff61074d16565b600080546001600160a01b0316638c028dd0847f000000000000000000000000af31fd9c3b0350424bf96e551d2d1264d846620561096186610c1b565b604080516001600160e01b031960e087901b1681526001600160a01b0394851660048201529290931660248301526001600160801b0316604482015290516064808301926020929190829003018186803b1580156109be57600080fd5b505afa1580156109d2573d6000803e3d6000fd5b505050506040513d60208110156109e857600080fd5b50519392505050565b6000828201838110156103e8576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b600080546001600160a01b0316632ca32d7e7f000000000000000000000000af31fd9c3b0350424bf96e551d2d1264d8466205610a8785610c1b565b6040518363ffffffff1660e01b815260040180836001600160a01b03166001600160a01b03168152602001826001600160801b03166001600160801b031681526020019250505060206040518083038186803b158015610ae657600080fd5b505afa158015610afa573d6000803e3d6000fd5b505050506040513d6020811015610b1057600080fd5b505192915050565b6003546001600160801b0380831691610b399116600163ffffffff6109f116565b14610b8b576040805162461bcd60e51b815260206004820152601f60248201527f45706f63682063616e20626520696e6974206f6e6c7920696e206f7264657200604482015290519081900360640190fd5b600380546001600160801b0319166001600160801b038316179055610baf81610a4b565b6001826001600160801b031681548110610bc557fe5b60009182526020909120015550565b60006103eb610bee6002548461074d90919063ffffffff16565b7f000000000000000000000000000000000000000000000ff2056c0380621000009063ffffffff6106f016565b6001019056fe536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f774d6178696d756d206e756d626572206f662065706f636873206578636565646564a264697066735822122089053b1300f8b72d6f9a2e361ed59c89c376d5fd2fce379be112281b03f7564f64736f6c634300060b0033

Verified Source Code Full Match

Compiler: v0.6.11+commit.5ef660b1 EVM: istanbul Optimization: Yes (200 runs)
YieldFarm.sol 170 lines
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.6.11;

import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "./interfaces/IStaking.sol";

contract YieldFarm {

    // lib
    using SafeMath for uint;
    using SafeMath for uint128;

    // constants
    uint public immutable TOTAL_DISTRIBUTED_AMOUNT;
    uint public immutable NR_OF_EPOCHS;

    // state variables

    // addreses
    address private immutable _token;
    address private immutable _communityVault;
    // contracts
    IERC20 private immutable _push;
    IStaking private _staking;


    uint[] private epochs;
    uint private immutable _genesisEpochAmount;
    uint private _deprecationPerEpoch;
    uint128 public lastInitializedEpoch;
    mapping(address => uint128) public lastEpochIdHarvested;
    uint public epochDuration; // init from staking contract
    uint public epochStart; // init from staking contract

    // events
    event MassHarvest(address indexed user, uint256 epochsHarvested, uint256 totalValue);
    event Harvest(address indexed user, uint128 indexed epochId, uint256 amount);

    // constructor
    // @param totalDistributedAmount
    constructor(address pushTokenAddress, address token, address stakeContract, address communityVault, uint genesisEpochAmount, uint deprecationPerEpoch, uint nrOfEpochs) public {
        _push = IERC20(pushTokenAddress);
        _token = token;
        _staking = IStaking(stakeContract);
        _communityVault = communityVault;
        epochDuration = _staking.epochDuration();
        epochStart = _staking.epoch1Start() + epochDuration;
        uint n = nrOfEpochs;
        uint difference = (n.mul(n.sub(1))).div(2); //Changed formula, we count first n-1 numbers not n since substraction happens after first epoch uint difference = (n.mul(n.add(1))).div(2);
            TOTAL_DISTRIBUTED_AMOUNT = (genesisEpochAmount.mul(n)).sub(difference.mul(deprecationPerEpoch)); //Changed, formula was not multplying correctly, doesn't hamper contract since used in frontend
        NR_OF_EPOCHS = nrOfEpochs;
        epochs = new uint[](nrOfEpochs + 1);
        _genesisEpochAmount = genesisEpochAmount;
        _deprecationPerEpoch = deprecationPerEpoch;
    }

    // public methods
    // public method to harvest all the unharvested epochs until current epoch - 1
    function massHarvest() external returns (uint){
        uint totalDistributedValue;
        uint epochId = _getEpochId().sub(1); // fails in epoch 0
        uint lastEpochIdHarvestedUser = lastEpochIdHarvested[msg.sender];

        // force max number of epochs
        if (epochId > NR_OF_EPOCHS) {
            epochId = NR_OF_EPOCHS;
        }

        for (uint128 i = lastEpochIdHarvested[msg.sender] + 1; i <= epochId; i++) {
            // i = epochId
            // compute distributed Value and do one single transfer at the end
            totalDistributedValue += _harvest(i);
        }

        emit MassHarvest(msg.sender, epochId - lastEpochIdHarvestedUser, totalDistributedValue);

        if (totalDistributedValue > 0) {
            _push.transferFrom(_communityVault, msg.sender, totalDistributedValue);
        }

        return totalDistributedValue;
    }
    function harvest (uint128 epochId) external returns (uint){
        // checks for requested epoch
        require (_getEpochId() > epochId, "This epoch is in the future");
        require(epochId <= NR_OF_EPOCHS, "Maximum number of epochs exceeded");
        require (lastEpochIdHarvested[msg.sender].add(1) == epochId, "Harvest in order");
        uint userReward = _harvest(epochId);
        if (userReward > 0) {
            _push.transferFrom(_communityVault, msg.sender, userReward);
        }
        emit Harvest(msg.sender, epochId, userReward);
        return userReward;
    }

    // views
    // calls to the staking smart contract to retrieve the epoch total pool size
    function getPoolSize(uint128 epochId) external view returns (uint) {
        return _getPoolSize(epochId);
    }

    function getCurrentEpoch() external view returns (uint) {
        return _getEpochId();
    }

    // calls to the staking smart contract to retrieve user balance for an epoch
    function getEpochStake(address userAddress, uint128 epochId) external view returns (uint) {
        return _getUserBalancePerEpoch(userAddress, epochId);
    }

    function userLastEpochIdHarvested() external view returns (uint){
        return lastEpochIdHarvested[msg.sender];
    }

    // internal methods

    function _initEpoch(uint128 epochId) internal {
        require(lastInitializedEpoch.add(1) == epochId, "Epoch can be init only in order");
        lastInitializedEpoch = epochId;
        // call the staking smart contract to init the epoch
        epochs[epochId] = _getPoolSize(epochId);
    }

    function _harvest (uint128 epochId) internal returns (uint) {
        // try to initialize an epoch. if it can't it fails
        // if it fails either user either a BarnBridge account will init not init epochs
        if (lastInitializedEpoch < epochId) {
            _initEpoch(epochId);
        }
        // Set user state for last harvested
        lastEpochIdHarvested[msg.sender] = epochId;
        // compute and return user total reward. For optimization reasons the transfer have been moved to an upper layer (i.e. massHarvest needs to do a single transfer)

        // exit if there is no stake on the epoch
        if (epochs[epochId] == 0) {
            return 0;
        }
        return _calcTotalAmountPerEpoch(epochId)
        .mul(_getUserBalancePerEpoch(msg.sender, epochId))
        .div(epochs[epochId]);
    }

    function _calcTotalAmountPerEpoch(uint256 epochId) internal view returns (uint) {
      return _genesisEpochAmount.sub(epochId.mul(_deprecationPerEpoch));
    }

    function _getPoolSize(uint128 epochId) internal view returns (uint) {
        // retrieve token token balance
        return _staking.getEpochPoolSize(_token, _stakingEpochId(epochId));
    }

    function _getUserBalancePerEpoch(address userAddress, uint128 epochId) internal view returns (uint){
        // retrieve token token balance per user per epoch
        return _staking.getEpochUserBalance(userAddress, _token, _stakingEpochId(epochId));
    }

    // compute epoch id from blocktimestamp and epochstart date
    function _getEpochId() internal view returns (uint128 epochId) {
        if (block.timestamp < epochStart) {
            return 0;
        }
        epochId = uint128(block.timestamp.sub(epochStart).div(epochDuration).add(1));
    }

    // get the staking epoch which is 1 epoch more
    function _stakingEpochId(uint128 epochId) pure internal returns (uint128) {
        return epochId + 1;
    }
}
SafeMath.sol 214 lines
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

/**
 * @dev Wrappers over Solidity's arithmetic operations with added overflow
 * checks.
 *
 * Arithmetic operations in Solidity wrap on overflow. This can easily result
 * in bugs, because programmers usually assume that an overflow raises an
 * error, which is the standard behavior in high level programming languages.
 * `SafeMath` restores this intuition by reverting the transaction when an
 * operation overflows.
 *
 * Using this library instead of the unchecked operations eliminates an entire
 * class of bugs, so it's recommended to use it always.
 */
library SafeMath {
    /**
     * @dev Returns the addition of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        uint256 c = a + b;
        if (c < a) return (false, 0);
        return (true, c);
    }

    /**
     * @dev Returns the substraction of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        if (b > a) return (false, 0);
        return (true, a - b);
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
        // benefit is lost if 'b' is also tested.
        // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
        if (a == 0) return (true, 0);
        uint256 c = a * b;
        if (c / a != b) return (false, 0);
        return (true, c);
    }

    /**
     * @dev Returns the division of two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        if (b == 0) return (false, 0);
        return (true, a / b);
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        if (b == 0) return (false, 0);
        return (true, a % b);
    }

    /**
     * @dev Returns the addition of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `+` operator.
     *
     * Requirements:
     *
     * - Addition cannot overflow.
     */
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        uint256 c = a + b;
        require(c >= a, "SafeMath: addition overflow");
        return c;
    }

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

    /**
     * @dev Returns the multiplication of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `*` operator.
     *
     * Requirements:
     *
     * - Multiplication cannot overflow.
     */
    function mul(uint256 a, uint256 b) internal pure returns (uint256) {
        if (a == 0) return 0;
        uint256 c = a * b;
        require(c / a == b, "SafeMath: multiplication overflow");
        return c;
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        require(b > 0, "SafeMath: division by zero");
        return a / b;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting when dividing by zero.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b) internal pure returns (uint256) {
        require(b > 0, "SafeMath: modulo by zero");
        return a % b;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on
     * overflow (when the result is negative).
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {trySub}.
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b <= a, errorMessage);
        return a - b;
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting with custom message on
     * division by zero. The result is rounded towards zero.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryDiv}.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b > 0, errorMessage);
        return a / b;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting with custom message when dividing by zero.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryMod}.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b > 0, errorMessage);
        return a % b;
    }
}
Context.sol 24 lines
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <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 GSN 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 payable) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes memory) {
        this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
        return msg.data;
    }
}
IStaking.sol 13 lines
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.6.0;

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

interface IStaking {

    function getEpochId(uint timestamp) external view returns (uint); // get epoch id
    function getEpochUserBalance(address user, address token, uint128 epoch) external view returns(uint);
    function getEpochPoolSize(address token, uint128 epoch) external view returns (uint);
    function epoch1Start() external view returns (uint);
    function epochDuration() external view returns (uint);
}
Ownable.sol 68 lines
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <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 () internal {
        address msgSender = _msgSender();
        _owner = msgSender;
        emit OwnershipTransferred(address(0), msgSender);
    }

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

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

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions anymore. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby removing any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        emit OwnershipTransferred(_owner, address(0));
        _owner = 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");
        emit OwnershipTransferred(_owner, newOwner);
        _owner = newOwner;
    }
}
IERC20.sol 77 lines
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the amount of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves `amount` tokens from the caller's account to `recipient`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address recipient, uint256 amount) external returns (bool);

    /**
     * @dev Returns the remaining number of tokens that `spender` will be
     * allowed to spend on behalf of `owner` through {transferFrom}. This is
     * zero by default.
     *
     * This value changes when {approve} or {transferFrom} are called.
     */
    function allowance(address owner, address spender) external view returns (uint256);

    /**
     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * IMPORTANT: Beware that changing an allowance with this method brings the risk
     * that someone may use both the old and the new allowance by unfortunate
     * transaction ordering. One possible solution to mitigate this race
     * condition is to first reduce the spender's allowance to 0 and set the
     * desired value afterwards:
     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
     *
     * Emits an {Approval} event.
     */
    function approve(address spender, uint256 amount) external returns (bool);

    /**
     * @dev Moves `amount` tokens from `sender` to `recipient` using the
     * allowance mechanism. `amount` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);

    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(address indexed owner, address indexed spender, uint256 value);
}

Read Contract

NR_OF_EPOCHS 0x05917ac0 → uint256
TOTAL_DISTRIBUTED_AMOUNT 0x674247d6 → uint256
epochDuration 0x4ff0876a → uint256
epochStart 0x15e5a1e5 → uint256
getCurrentEpoch 0xb97dd9e2 → uint256
getEpochStake 0x43312451 → uint256
getPoolSize 0xf7e251f8 → uint256
lastEpochIdHarvested 0x73eff2fd → uint128
lastInitializedEpoch 0x9c7ec881 → uint128
userLastEpochIdHarvested 0xa1c130d4 → uint256

Write Contract 2 functions

These functions modify contract state and require a wallet transaction to execute.

harvest 0xa43564eb
uint128 epochId
returns: uint256
massHarvest 0x290e4544
No parameters
returns: uint256

Recent Transactions

No transactions found for this address