文件 1 的 7:Context.sol
pragma solidity ^0.8.0;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
文件 2 的 7:IERC20.sol
pragma solidity ^0.8.0;
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
文件 3 的 7:Ownable.sol
pragma solidity ^0.8.0;
import "../utils/Context.sol";
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() {
_transferOwnership(_msgSender());
}
function owner() public view virtual returns (address) {
return _owner;
}
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
文件 4 的 7:ReentrancyGuard.sol
pragma solidity ^0.8.0;
abstract contract ReentrancyGuard {
uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
uint256 private _status;
constructor() {
_status = _NOT_ENTERED;
}
modifier nonReentrant() {
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
_status = _ENTERED;
_;
_status = _NOT_ENTERED;
}
}
文件 5 的 7:SafeMath.sol
pragma solidity ^0.8.0;
library SafeMath {
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
}
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b > a) return (false, 0);
return (true, a - b);
}
}
function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
}
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a / b);
}
}
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a % b);
}
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
return a + b;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return a - b;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
return a * b;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return a / b;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return a % b;
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b <= a, errorMessage);
return a - b;
}
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a / b;
}
}
function mod(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a % b;
}
}
}
文件 6 的 7:Staking.sol
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
contract Staking is ReentrancyGuard {
using SafeMath for uint256;
uint128 constant private BASE_MULTIPLIER = uint128(1 * 10 ** 18);
uint256 public epoch1Start;
uint256 public epochDuration;
mapping(address => mapping(address => uint256)) private balances;
struct Pool {
uint256 size;
bool set;
}
mapping(address => mapping(uint256 => Pool)) private poolSize;
struct Checkpoint {
uint128 epochId;
uint128 multiplier;
uint256 startBalance;
uint256 newDeposits;
}
mapping(address => mapping(address => Checkpoint[])) private balanceCheckpoints;
mapping(address => uint128) private lastWithdrawEpochId;
event Deposit(address indexed user, address indexed tokenAddress, uint256 amount);
event Withdraw(address indexed user, address indexed tokenAddress, uint256 amount);
event ManualEpochInit(address indexed caller, uint128 indexed epochId, address[] tokens);
event EmergencyWithdraw(address indexed user, address indexed tokenAddress, uint256 amount);
constructor (uint256 _epoch1Start, uint256 _epochDuration) {
epoch1Start = _epoch1Start;
epochDuration = _epochDuration;
}
function deposit(address tokenAddress, uint256 amount) external nonReentrant {
require(amount > 0, "Staking: Amount must be > 0");
IERC20 token = IERC20(tokenAddress);
uint256 allowance = token.allowance(msg.sender, address(this));
require(allowance >= amount, "Staking: Token allowance too small");
balances[msg.sender][tokenAddress] = balances[msg.sender][tokenAddress].add(amount);
bool success = token.transferFrom(msg.sender, address(this), amount);
require(success, "Failed to transfer deposit");
uint128 currentEpoch = getCurrentEpoch();
uint128 currentMultiplier = currentEpochMultiplier();
if (!epochIsInitialized(tokenAddress, currentEpoch)) {
address[] memory tokens = new address[](1);
tokens[0] = tokenAddress;
manualEpochInit(tokens, currentEpoch);
}
Pool storage pNextEpoch = poolSize[tokenAddress][currentEpoch + 1];
pNextEpoch.size = token.balanceOf(address(this));
pNextEpoch.set = true;
Checkpoint[] storage checkpoints = balanceCheckpoints[msg.sender][tokenAddress];
uint256 balanceBefore = getEpochUserBalance(msg.sender, tokenAddress, currentEpoch);
if (checkpoints.length == 0) {
checkpoints.push(Checkpoint(currentEpoch, currentMultiplier, 0, amount));
checkpoints.push(Checkpoint(currentEpoch + 1, BASE_MULTIPLIER, amount, 0));
} else {
uint256 last = checkpoints.length - 1;
if (checkpoints[last].epochId < currentEpoch) {
uint128 multiplier = computeNewMultiplier(
getCheckpointBalance(checkpoints[last]),
BASE_MULTIPLIER,
amount,
currentMultiplier
);
checkpoints.push(Checkpoint(currentEpoch, multiplier, getCheckpointBalance(checkpoints[last]), amount));
uint256 balance = balances[msg.sender][tokenAddress];
checkpoints.push(Checkpoint(currentEpoch + 1, BASE_MULTIPLIER, balance, 0));
}
else if (checkpoints[last].epochId == currentEpoch) {
checkpoints[last].multiplier = computeNewMultiplier(
getCheckpointBalance(checkpoints[last]),
checkpoints[last].multiplier,
amount,
currentMultiplier
);
checkpoints[last].newDeposits = checkpoints[last].newDeposits.add(amount);
checkpoints.push(Checkpoint(currentEpoch + 1, BASE_MULTIPLIER, balances[msg.sender][tokenAddress], 0));
}
else {
if (last >= 1 && checkpoints[last - 1].epochId == currentEpoch) {
checkpoints[last - 1].multiplier = computeNewMultiplier(
getCheckpointBalance(checkpoints[last - 1]),
checkpoints[last - 1].multiplier,
amount,
currentMultiplier
);
checkpoints[last - 1].newDeposits = checkpoints[last - 1].newDeposits.add(amount);
}
checkpoints[last].startBalance = balances[msg.sender][tokenAddress];
}
}
uint256 balanceAfter = getEpochUserBalance(msg.sender, tokenAddress, currentEpoch);
poolSize[tokenAddress][currentEpoch].size = poolSize[tokenAddress][currentEpoch].size.add(balanceAfter.sub(balanceBefore));
emit Deposit(msg.sender, tokenAddress, amount);
}
function withdraw(address tokenAddress, uint256 amount) external nonReentrant {
require(balances[msg.sender][tokenAddress] >= amount, "Staking: balance too small");
balances[msg.sender][tokenAddress] = balances[msg.sender][tokenAddress].sub(amount);
IERC20 token = IERC20(tokenAddress);
bool success = token.transfer(msg.sender, amount);
require(success, "Failed to transfer withdrawl");
uint128 currentEpoch = getCurrentEpoch();
lastWithdrawEpochId[tokenAddress] = currentEpoch;
if (!epochIsInitialized(tokenAddress, currentEpoch)) {
address[] memory tokens = new address[](1);
tokens[0] = tokenAddress;
manualEpochInit(tokens, currentEpoch);
}
Pool storage pNextEpoch = poolSize[tokenAddress][currentEpoch + 1];
pNextEpoch.size = token.balanceOf(address(this));
pNextEpoch.set = true;
Checkpoint[] storage checkpoints = balanceCheckpoints[msg.sender][tokenAddress];
uint256 last = checkpoints.length - 1;
if (checkpoints[last].epochId < currentEpoch) {
checkpoints.push(Checkpoint(currentEpoch, BASE_MULTIPLIER, balances[msg.sender][tokenAddress], 0));
poolSize[tokenAddress][currentEpoch].size = poolSize[tokenAddress][currentEpoch].size.sub(amount);
}
else if (checkpoints[last].epochId == currentEpoch) {
checkpoints[last].startBalance = balances[msg.sender][tokenAddress];
checkpoints[last].newDeposits = 0;
checkpoints[last].multiplier = BASE_MULTIPLIER;
poolSize[tokenAddress][currentEpoch].size = poolSize[tokenAddress][currentEpoch].size.sub(amount);
}
else {
Checkpoint storage currentEpochCheckpoint = checkpoints[last - 1];
uint256 balanceBefore = getCheckpointEffectiveBalance(currentEpochCheckpoint);
if (amount < currentEpochCheckpoint.newDeposits) {
uint128 avgDepositMultiplier = uint128(
balanceBefore.sub(currentEpochCheckpoint.startBalance).mul(BASE_MULTIPLIER).div(currentEpochCheckpoint.newDeposits)
);
currentEpochCheckpoint.newDeposits = currentEpochCheckpoint.newDeposits.sub(amount);
currentEpochCheckpoint.multiplier = computeNewMultiplier(
currentEpochCheckpoint.startBalance,
BASE_MULTIPLIER,
currentEpochCheckpoint.newDeposits,
avgDepositMultiplier
);
} else {
currentEpochCheckpoint.startBalance = currentEpochCheckpoint.startBalance.sub(
amount.sub(currentEpochCheckpoint.newDeposits)
);
currentEpochCheckpoint.newDeposits = 0;
currentEpochCheckpoint.multiplier = BASE_MULTIPLIER;
}
uint256 balanceAfter = getCheckpointEffectiveBalance(currentEpochCheckpoint);
poolSize[tokenAddress][currentEpoch].size = poolSize[tokenAddress][currentEpoch].size.sub(balanceBefore.sub(balanceAfter));
checkpoints[last].startBalance = balances[msg.sender][tokenAddress];
}
emit Withdraw(msg.sender, tokenAddress, amount);
}
function manualEpochInit(address[] memory tokens, uint128 epochId) public {
require(epochId <= getCurrentEpoch(), "can't init a future epoch");
for (uint i = 0; i < tokens.length; i++) {
Pool storage p = poolSize[tokens[i]][epochId];
if (epochId == 0) {
p.size = uint256(0);
p.set = true;
} else {
require(!epochIsInitialized(tokens[i], epochId), "Staking: epoch already initialized");
require(epochIsInitialized(tokens[i], epochId - 1), "Staking: previous epoch not initialized");
p.size = poolSize[tokens[i]][epochId - 1].size;
p.set = true;
}
}
emit ManualEpochInit(msg.sender, epochId, tokens);
}
function emergencyWithdraw(address tokenAddress) external {
require((getCurrentEpoch() - lastWithdrawEpochId[tokenAddress]) >= 10, "At least 10 epochs must pass without success");
uint256 totalUserBalance = balances[msg.sender][tokenAddress];
require(totalUserBalance > 0, "Amount must be > 0");
balances[msg.sender][tokenAddress] = 0;
IERC20 token = IERC20(tokenAddress);
bool success = token.transfer(msg.sender, totalUserBalance);
require(success, "Emergency withdraw transfer failed");
emit EmergencyWithdraw(msg.sender, tokenAddress, totalUserBalance);
}
function getEpochUserBalance(address user, address token, uint128 epochId) public view returns (uint256) {
Checkpoint[] storage checkpoints = balanceCheckpoints[user][token];
if (checkpoints.length == 0 || epochId < checkpoints[0].epochId) {
return 0;
}
uint min = 0;
uint max = checkpoints.length - 1;
if (epochId >= checkpoints[max].epochId) {
return getCheckpointEffectiveBalance(checkpoints[max]);
}
while (max > min) {
uint mid = (max + min + 1) / 2;
if (checkpoints[mid].epochId <= epochId) {
min = mid;
} else {
max = mid - 1;
}
}
return getCheckpointEffectiveBalance(checkpoints[min]);
}
function balanceOf(address user, address token) external view returns (uint256) {
return balances[user][token];
}
function getCurrentEpoch() public view returns (uint128) {
if (block.timestamp < epoch1Start) {
return 0;
}
return uint128((block.timestamp - epoch1Start) / epochDuration + 1);
}
function getEpochPoolSize(address tokenAddress, uint128 epochId) external view returns (uint256) {
if (epochIsInitialized(tokenAddress, epochId)) {
return poolSize[tokenAddress][epochId].size;
}
if (!epochIsInitialized(tokenAddress, 0)) {
return 0;
}
IERC20 token = IERC20(tokenAddress);
return token.balanceOf(address(this));
}
function currentEpochMultiplier() public view returns (uint128) {
uint128 currentEpoch = getCurrentEpoch();
uint256 currentEpochEnd = epoch1Start + currentEpoch * epochDuration;
uint256 timeLeft = currentEpochEnd - block.timestamp;
uint128 multiplier = uint128(timeLeft * BASE_MULTIPLIER / epochDuration);
return multiplier;
}
function computeNewMultiplier(uint256 prevBalance, uint128 prevMultiplier, uint256 amount, uint128 currentMultiplier) public pure returns (uint128) {
uint256 prevAmount = prevBalance.mul(prevMultiplier).div(BASE_MULTIPLIER);
uint256 addAmount = amount.mul(currentMultiplier).div(BASE_MULTIPLIER);
uint128 newMultiplier = uint128(prevAmount.add(addAmount).mul(BASE_MULTIPLIER).div(prevBalance.add(amount)));
return newMultiplier;
}
function epochIsInitialized(address token, uint128 epochId) public view returns (bool) {
return poolSize[token][epochId].set;
}
function getCheckpointBalance(Checkpoint memory c) internal pure returns (uint256) {
return c.startBalance.add(c.newDeposits);
}
function getCheckpointEffectiveBalance(Checkpoint memory c) internal pure returns (uint256) {
return getCheckpointBalance(c).mul(c.multiplier).div(BASE_MULTIPLIER);
}
}
文件 7 的 7:YieldFarmExtendedV3.sol
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "./Staking.sol";
contract YieldFarmExtendedV3 is Ownable {
using SafeMath for uint256;
using SafeMath for uint128;
address private _lpTokenAddress;
address private _communityVault;
IERC20 private _sylo;
Staking private _staking;
struct EpochReward {
uint128 id;
uint256 reward;
}
EpochReward[] public epochRewards;
uint128 public epochsDelayed;
uint256[] private epochs = new uint256[](256);
uint128 public lastInitializedEpoch;
mapping(address => uint128) private lastEpochIdHarvested;
uint256 public epochDuration;
uint256 public epochStart;
uint256 public finalEpoch;
event MassHarvest(
address indexed user,
uint256 epochsHarvested,
uint256 totalValue
);
event Harvest(
address indexed user,
uint128 indexed epochId,
uint256 amount
);
constructor(
address syloTokenAddress,
address lpTokenAddress,
Staking stakeContract,
address communityVault,
uint256 _rewardsPerEpoch,
uint128 _epochsDelayed
) {
require(syloTokenAddress != address(0), "Sylo token address is required");
require(lpTokenAddress != address(0), "LP token address is required");
require(communityVault != address(0), "Community Vault address is required");
require(_rewardsPerEpoch > 0, "Rewards per epoch must be greater than 0");
_sylo = IERC20(syloTokenAddress);
_lpTokenAddress = lpTokenAddress;
_staking = stakeContract;
_communityVault = communityVault;
epochRewards.push(
EpochReward(
0,
_rewardsPerEpoch
)
);
epochsDelayed = _epochsDelayed;
epochDuration = _staking.epochDuration();
epochStart =
_staking.epoch1Start() +
epochDuration.mul(epochsDelayed);
}
function massHarvest() external returns (uint256) {
uint256 totalDistributedValue;
uint256 epochId = _getEpochId().sub(1);
if (finalEpoch != 0 && epochId > finalEpoch) {
epochId = finalEpoch;
}
for (
uint128 i = lastEpochIdHarvested[msg.sender] + 1;
i <= epochId;
i++
) {
totalDistributedValue += _harvest(i);
}
emit MassHarvest(
msg.sender,
epochId - lastEpochIdHarvested[msg.sender],
totalDistributedValue
);
if (totalDistributedValue > 0) {
bool success = _sylo.transferFrom(
_communityVault,
msg.sender,
totalDistributedValue
);
require(success, "Failed to transfer mass harvest reward");
}
return totalDistributedValue;
}
function harvest(uint128 epochId) external returns (uint256) {
require(_getEpochId() > epochId, "This epoch is in the future");
require(finalEpoch == 0 || epochId <= finalEpoch, "Cannot harvest for epochs after the yield farm has ended");
require(
lastEpochIdHarvested[msg.sender].add(1) == epochId,
"Harvest in order"
);
uint256 userReward = _harvest(epochId);
if (userReward > 0) {
bool success = _sylo.transferFrom(_communityVault, msg.sender, userReward);
require(success, "Failed to transfer harvest reward");
}
emit Harvest(msg.sender, epochId, userReward);
return userReward;
}
function setRewardsPerEpoch(uint256 _rewardsPerEpoch) external onlyOwner {
require(_rewardsPerEpoch > 0, "Rewards per epoch must be greater than 0");
epochRewards.push(
EpochReward(
_getEpochId() + 1,
_rewardsPerEpoch
)
);
}
function endYieldFarm() external onlyOwner {
require(finalEpoch == 0, "V2 extended yield farm has already ended");
finalEpoch = _getEpochId();
}
function getEpochId() external view returns (uint256) {
return _getEpochId();
}
function getPoolSize(uint128 epochId) external view returns (uint256) {
return _getPoolSize(epochId);
}
function getCurrentEpoch() external view returns (uint256) {
return _getEpochId();
}
function getEpochStake(address userAddress, uint128 epochId)
external
view
returns (uint256)
{
return _getUserBalancePerEpoch(userAddress, epochId);
}
function userLastEpochIdHarvested() external view returns (uint256) {
return lastEpochIdHarvested[msg.sender];
}
function _initEpoch(uint128 epochId) internal {
require(
lastInitializedEpoch.add(1) == epochId,
"Epoch can be init only in order"
);
lastInitializedEpoch = epochId;
epochs[epochId] = _getPoolSize(epochId);
}
function _harvest(uint128 epochId) internal returns (uint256) {
if (lastInitializedEpoch < epochId) {
_initEpoch(epochId);
}
lastEpochIdHarvested[msg.sender] = epochId;
if (epochs[epochId] == 0) {
return 0;
}
return
_getEpochReward(epochId)
.mul(_getUserBalancePerEpoch(msg.sender, epochId))
.div(epochs[epochId]);
}
function getCurrentEpochReward() external view returns (uint256) {
return _getEpochReward(_getEpochId());
}
function _getEpochReward(uint128 epochId) internal view returns (uint256) {
EpochReward memory epochReward = epochRewards[0];
if (epochRewards.length == 1) {
return epochReward.reward;
}
for (uint256 i = 1; i < epochRewards.length; i++) {
if (epochRewards[i].id > epochId) {
break;
}
epochReward = epochRewards[i];
}
return epochReward.reward;
}
function _getPoolSize(uint128 epochId) internal view returns (uint256) {
return
_staking.getEpochPoolSize(
_lpTokenAddress,
_stakingEpochId(epochId)
);
}
function _getUserBalancePerEpoch(address userAddress, uint128 epochId)
public
view
returns (uint256)
{
return
_staking.getEpochUserBalance(
userAddress,
_lpTokenAddress,
_stakingEpochId(epochId)
);
}
function _getEpochId() internal view returns (uint128 epochId) {
if (block.timestamp < epochStart) {
return 0;
}
epochId = uint128(
block.timestamp.sub(epochStart).div(epochDuration).add(1)
);
}
function _stakingEpochId(uint128 epochId) internal view returns (uint128) {
return epochId + epochsDelayed;
}
}
{
"compilationTarget": {
"contracts/YieldFarmExtendedV3.sol": "YieldFarmExtendedV3"
},
"evmVersion": "istanbul",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs"
},
"optimizer": {
"enabled": false,
"runs": 200
},
"remappings": []
}
[{"inputs":[{"internalType":"address","name":"syloTokenAddress","type":"address"},{"internalType":"address","name":"lpTokenAddress","type":"address"},{"internalType":"contract Staking","name":"stakeContract","type":"address"},{"internalType":"address","name":"communityVault","type":"address"},{"internalType":"uint256","name":"_rewardsPerEpoch","type":"uint256"},{"internalType":"uint128","name":"_epochsDelayed","type":"uint128"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint128","name":"epochId","type":"uint128"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Harvest","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"epochsHarvested","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalValue","type":"uint256"}],"name":"MassHarvest","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"},{"inputs":[{"internalType":"address","name":"userAddress","type":"address"},{"internalType":"uint128","name":"epochId","type":"uint128"}],"name":"_getUserBalancePerEpoch","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"endYieldFarm","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"epochDuration","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"epochRewards","outputs":[{"internalType":"uint128","name":"id","type":"uint128"},{"internalType":"uint256","name":"reward","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"epochStart","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"epochsDelayed","outputs":[{"internalType":"uint128","name":"","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"finalEpoch","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getCurrentEpoch","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getCurrentEpochReward","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getEpochId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"userAddress","type":"address"},{"internalType":"uint128","name":"epochId","type":"uint128"}],"name":"getEpochStake","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint128","name":"epochId","type":"uint128"}],"name":"getPoolSize","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint128","name":"epochId","type":"uint128"}],"name":"harvest","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"lastInitializedEpoch","outputs":[{"internalType":"uint128","name":"","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"massHarvest","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_rewardsPerEpoch","type":"uint256"}],"name":"setRewardsPerEpoch","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"userLastEpochIdHarvested","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]