编译器
0.8.11+commit.d7f03943
文件 1 的 11:Address.sol
pragma solidity ^0.8.0;
library Address {
function isContract(address account) internal view returns (bool) {
uint256 size;
assembly {
size := extcodesize(account)
}
return size > 0;
}
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");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
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");
}
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResult(success, returndata, errorMessage);
}
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResult(success, returndata, errorMessage);
}
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResult(success, returndata, errorMessage);
}
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
if (returndata.length > 0) {
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
文件 2 的 11:AuraMath.sol
pragma solidity 0.8.11;
library AuraMath {
function min(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a - b;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a * b;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return a / b;
}
function average(uint256 a, uint256 b) internal pure returns (uint256) {
return (a / 2) + (b / 2) + (((a % 2) + (b % 2)) / 2);
}
function to224(uint256 a) internal pure returns (uint224 c) {
require(a <= type(uint224).max, "AuraMath: uint224 Overflow");
c = uint224(a);
}
function to128(uint256 a) internal pure returns (uint128 c) {
require(a <= type(uint128).max, "AuraMath: uint128 Overflow");
c = uint128(a);
}
function to112(uint256 a) internal pure returns (uint112 c) {
require(a <= type(uint112).max, "AuraMath: uint112 Overflow");
c = uint112(a);
}
function to96(uint256 a) internal pure returns (uint96 c) {
require(a <= type(uint96).max, "AuraMath: uint96 Overflow");
c = uint96(a);
}
function to32(uint256 a) internal pure returns (uint32 c) {
require(a <= type(uint32).max, "AuraMath: uint32 Overflow");
c = uint32(a);
}
}
library AuraMath32 {
function sub(uint32 a, uint32 b) internal pure returns (uint32 c) {
c = a - b;
}
}
library AuraMath112 {
function add(uint112 a, uint112 b) internal pure returns (uint112 c) {
c = a + b;
}
function sub(uint112 a, uint112 b) internal pure returns (uint112 c) {
c = a - b;
}
}
library AuraMath224 {
function add(uint224 a, uint224 b) internal pure returns (uint224 c) {
c = a + b;
}
}
文件 3 的 11: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;
}
}
文件 4 的 11: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);
}
文件 5 的 11:ILiqLocker.sol
pragma solidity 0.8.11;
interface ILiqLocker {
function lock(address _account, uint256 _amount) external;
function checkpointEpoch() external;
function epochCount() external view returns (uint256);
function balanceAtEpochOf(uint256 _epoch, address _user) external view returns (uint256 amount);
function totalSupplyAtEpoch(uint256 _epoch) external view returns (uint256 supply);
function queueNewRewards(address _rewardsToken, uint256 reward) external;
function getReward(address _account, bool _stake) external;
function getReward(address _account) external;
function getRewardFor(address _account) external returns (uint256 rewardAmount);
function earned(address _account, address token) external view returns (uint256 userRewards);
}
文件 6 的 11:IRewardStaking.sol
pragma solidity 0.8.11;
interface IRewardStaking {
function getReward(address _account, bool _claimExtras) external;
function getReward(address _account) external;
function getReward(address _account, address _token) external;
function stakeFor(address, uint256) external;
function processIdleRewards() external;
}
文件 7 的 11:LiqLocker.sol
pragma solidity 0.8.11;
import { IERC20 } from "@openzeppelin/contracts-0.8/token/ERC20/IERC20.sol";
import { SafeERC20 } from "@openzeppelin/contracts-0.8/token/ERC20/utils/SafeERC20.sol";
import { Ownable } from "@openzeppelin/contracts-0.8/access/Ownable.sol";
import { ReentrancyGuard } from "@openzeppelin/contracts-0.8/security/ReentrancyGuard.sol";
import { AuraMath, AuraMath32, AuraMath112, AuraMath224 } from "../utils/AuraMath.sol";
import { ILiqLocker } from "../interfaces/ILiqLocker.sol";
import { IRewardStaking } from "../interfaces/IRewardStaking.sol";
import { Permission } from "../utils/Permission.sol";
contract LiqLocker is ReentrancyGuard, Ownable, Permission, ILiqLocker {
using AuraMath for uint256;
using AuraMath224 for uint224;
using AuraMath112 for uint112;
using AuraMath32 for uint32;
using SafeERC20 for IERC20;
struct RewardData {
uint32 periodFinish;
uint32 lastUpdateTime;
uint96 rewardRate;
uint96 rewardPerTokenStored;
}
struct UserData {
uint128 rewardPerTokenPaid;
uint128 rewards;
}
struct EarnedData {
address token;
uint256 amount;
}
struct Balances {
uint112 locked;
uint32 nextUnlockIndex;
}
struct LockedBalance {
uint112 amount;
uint32 unlockTime;
}
struct Epoch {
uint224 supply;
uint32 date;
}
struct DelegateeCheckpoint {
uint224 votes;
uint32 epochStart;
}
address[] public rewardTokens;
mapping(address => uint256) public queuedRewards;
uint256 public constant newRewardRatio = 830;
mapping(address => RewardData) public rewardData;
mapping(address => mapping(address => bool)) public rewardDistributors;
mapping(address => mapping(address => UserData)) public userData;
uint256 public constant rewardsDuration = 86400 * 7;
uint256 public constant lockDuration = rewardsDuration * 17;
uint256 public lockedSupply;
Epoch[] public epochs;
mapping(address => Balances) public balances;
mapping(address => LockedBalance[]) public userLocks;
mapping(address => address) private _delegates;
mapping(address => DelegateeCheckpoint[]) private _checkpointedVotes;
mapping(address => mapping(uint256 => uint256)) public delegateeUnlocks;
mapping(address => bool) public blacklist;
IERC20 public immutable stakingToken;
address public immutable cvxCrv;
uint256 public constant denominator = 10000;
address public immutable cvxcrvStaking;
address public immutable olit;
uint256 public kickRewardPerEpoch = 100;
uint256 public kickRewardEpochDelay = 3;
bool public isShutdown = false;
string private _name;
string private _symbol;
uint8 private immutable _decimals;
event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate);
event DelegateCheckpointed(address indexed delegate);
event Recovered(address _token, uint256 _amount);
event RewardPaid(address indexed _user, address indexed _rewardsToken, uint256 _reward);
event Staked(address indexed _user, uint256 _lockedAmount, uint256 _unlockTime);
event Withdrawn(address indexed _user, uint256 _amount, uint256 _expiryTime, bool _relocked);
event KickReward(address indexed _user, address indexed _kicked, uint256 _reward);
event RewardAdded(address indexed _token, uint256 _reward);
event BlacklistModified(address account, bool blacklisted);
event KickIncentiveSet(uint256 rate, uint256 delay);
event Shutdown();
constructor(
string memory _nameArg,
string memory _symbolArg,
address _stakingToken,
address _cvxCrv,
address _cvxCrvStaking,
address _olit
) Ownable() {
_name = _nameArg;
_symbol = _symbolArg;
_decimals = 18;
stakingToken = IERC20(_stakingToken);
cvxCrv = _cvxCrv;
cvxcrvStaking = _cvxCrvStaking;
olit = _olit;
uint256 currentEpoch = block.timestamp.div(rewardsDuration).mul(rewardsDuration);
epochs.push(Epoch({ supply: 0, date: uint32(currentEpoch) }));
}
modifier updateReward(address _account) {
{
Balances storage userBalance = balances[_account];
uint256 rewardTokensLength = rewardTokens.length;
for (uint256 i = 0; i < rewardTokensLength; i++) {
address token = rewardTokens[i];
uint256 newRewardPerToken = _rewardPerToken(token);
rewardData[token].rewardPerTokenStored = newRewardPerToken.to96();
rewardData[token].lastUpdateTime = _lastTimeRewardApplicable(rewardData[token].periodFinish).to32();
if (_account != address(0)) {
userData[_account][token] = UserData({
rewardPerTokenPaid: newRewardPerToken.to128(),
rewards: _earned(_account, token, userBalance.locked).to128()
});
}
}
}
_;
}
modifier notBlacklisted(address _sender, address _receiver) {
require(!blacklist[_sender], "blacklisted");
if (_sender != _receiver) {
require(!blacklist[_receiver], "blacklisted");
}
_;
}
function modifyBlacklist(address _account, bool _blacklisted) external onlyOwner {
uint256 cs;
assembly {
cs := extcodesize(_account)
}
require(cs != 0, "Must be contract");
blacklist[_account] = _blacklisted;
emit BlacklistModified(_account, _blacklisted);
}
function addReward(address _rewardsToken, address _distributor) external onlyOwner {
require(rewardData[_rewardsToken].lastUpdateTime == 0, "Reward already exists");
require(_rewardsToken != address(stakingToken), "Cannot add StakingToken as reward");
require(rewardTokens.length < 5, "Max rewards length");
rewardTokens.push(_rewardsToken);
rewardData[_rewardsToken].lastUpdateTime = uint32(block.timestamp);
rewardData[_rewardsToken].periodFinish = uint32(block.timestamp);
rewardDistributors[_rewardsToken][_distributor] = true;
}
function approveRewardDistributor(
address _rewardsToken,
address _distributor,
bool _approved
) external onlyOwner {
require(rewardData[_rewardsToken].lastUpdateTime > 0, "Reward does not exist");
rewardDistributors[_rewardsToken][_distributor] = _approved;
}
function setKickIncentive(uint256 _rate, uint256 _delay) external onlyOwner {
require(_rate <= 500, "over max rate");
require(_delay >= 2, "min delay");
kickRewardPerEpoch = _rate;
kickRewardEpochDelay = _delay;
emit KickIncentiveSet(_rate, _delay);
}
function shutdown() external onlyOwner {
isShutdown = true;
emit Shutdown();
}
function recoverERC20(address _tokenAddress, uint256 _tokenAmount) external onlyOwner {
require(_tokenAddress != address(stakingToken), "Cannot withdraw staking token");
require(rewardData[_tokenAddress].lastUpdateTime == 0, "Cannot withdraw reward token");
IERC20(_tokenAddress).safeTransfer(owner(), _tokenAmount);
emit Recovered(_tokenAddress, _tokenAmount);
}
function setApprovals() external {
IERC20(cvxCrv).safeApprove(cvxcrvStaking, 0);
IERC20(cvxCrv).safeApprove(cvxcrvStaking, type(uint256).max);
}
function lock(address _account, uint256 _amount) external nonReentrant updateReward(_account) {
stakingToken.safeTransferFrom(msg.sender, address(this), _amount);
_lock(_account, _amount);
}
function _lock(address _account, uint256 _amount) internal notBlacklisted(msg.sender, _account) {
require(_amount > 0, "Cannot stake 0");
require(!isShutdown, "shutdown");
Balances storage bal = balances[_account];
_checkpointEpoch();
uint112 lockAmount = _amount.to112();
bal.locked = bal.locked.add(lockAmount);
lockedSupply = lockedSupply.add(_amount);
uint256 currentEpoch = block.timestamp.div(rewardsDuration).mul(rewardsDuration);
uint256 unlockTime = currentEpoch.add(lockDuration);
uint256 idx = userLocks[_account].length;
if (idx == 0 || userLocks[_account][idx - 1].unlockTime < unlockTime) {
userLocks[_account].push(LockedBalance({ amount: lockAmount, unlockTime: uint32(unlockTime) }));
} else {
LockedBalance storage userL = userLocks[_account][idx - 1];
userL.amount = userL.amount.add(lockAmount);
}
address delegatee = delegates(_account);
if (delegatee != address(0)) {
delegateeUnlocks[delegatee][unlockTime] += lockAmount;
_checkpointDelegate(delegatee, lockAmount, 0);
}
Epoch storage e = epochs[epochs.length - 1];
e.supply = e.supply.add(lockAmount);
emit Staked(_account, lockAmount, unlockTime);
}
function getReward(address _account) external {
getReward(_account, false);
}
function getReward(address _account, bool _stake) public nonReentrant updateReward(_account) {
uint256 rewardTokensLength = rewardTokens.length;
for (uint256 i; i < rewardTokensLength; i++) {
address _rewardsToken = rewardTokens[i];
uint256 reward = userData[_account][_rewardsToken].rewards;
if (reward > 0) {
userData[_account][_rewardsToken].rewards = 0;
if (_rewardsToken == cvxCrv && _stake && _account == msg.sender) {
IRewardStaking(cvxcrvStaking).stakeFor(_account, reward);
} else {
IERC20(_rewardsToken).safeTransfer(_account, reward);
}
emit RewardPaid(_account, _rewardsToken, reward);
}
}
}
function getReward(address _account, bool[] calldata _skipIdx) external nonReentrant updateReward(_account) {
uint256 rewardTokensLength = rewardTokens.length;
require(_skipIdx.length == rewardTokensLength, "!arr");
for (uint256 i; i < rewardTokensLength; i++) {
if (_skipIdx[i]) continue;
address _rewardsToken = rewardTokens[i];
uint256 reward = userData[_account][_rewardsToken].rewards;
if (reward > 0) {
userData[_account][_rewardsToken].rewards = 0;
IERC20(_rewardsToken).safeTransfer(_account, reward);
emit RewardPaid(_account, _rewardsToken, reward);
}
}
}
function getRewardFor(address _account)
external
nonReentrant
updateReward(_account)
returns (uint256 rewardAmount)
{
require(hasPermission(_account, msg.sender), "permission not granted");
uint256 rewardTokensLength = rewardTokens.length;
for (uint256 i; i < rewardTokensLength; i++) {
address _rewardsToken = rewardTokens[i];
uint256 reward = userData[_account][_rewardsToken].rewards;
if (reward > 0) {
userData[_account][_rewardsToken].rewards = 0;
if (_rewardsToken == olit) {
IERC20(_rewardsToken).safeTransfer(msg.sender, reward);
rewardAmount = reward;
} else {
IERC20(_rewardsToken).safeTransfer(_account, reward);
}
emit RewardPaid(_account, _rewardsToken, reward);
}
}
}
function checkpointEpoch() external {
_checkpointEpoch();
}
function _checkpointEpoch() internal {
uint256 currentEpoch = block.timestamp.div(rewardsDuration).mul(rewardsDuration);
uint256 nextEpochDate = uint256(epochs[epochs.length - 1].date);
if (nextEpochDate < currentEpoch) {
while (nextEpochDate != currentEpoch) {
nextEpochDate = nextEpochDate.add(rewardsDuration);
epochs.push(Epoch({ supply: 0, date: uint32(nextEpochDate) }));
}
}
}
function processExpiredLocks(bool _relock) external nonReentrant {
_processExpiredLocks(msg.sender, _relock, msg.sender, 0);
}
function kickExpiredLocks(address _account) external nonReentrant {
_processExpiredLocks(_account, false, msg.sender, rewardsDuration.mul(kickRewardEpochDelay));
}
function emergencyWithdraw() external nonReentrant {
require(isShutdown, "Must be shutdown");
LockedBalance[] memory locks = userLocks[msg.sender];
Balances storage userBalance = balances[msg.sender];
uint256 amt = userBalance.locked;
require(amt > 0, "Nothing locked");
userBalance.locked = 0;
userBalance.nextUnlockIndex = locks.length.to32();
lockedSupply -= amt;
emit Withdrawn(msg.sender, amt, type(uint256).max, false);
stakingToken.safeTransfer(msg.sender, amt);
}
function _processExpiredLocks(
address _account,
bool _relock,
address _rewardAddress,
uint256 _checkDelay
) internal updateReward(_account) {
LockedBalance[] storage locks = userLocks[_account];
Balances storage userBalance = balances[_account];
uint112 locked;
uint256 length = locks.length;
uint256 reward = 0;
uint256 expiryTime = _checkDelay == 0 && _relock
? block.timestamp.add(rewardsDuration)
: block.timestamp.sub(_checkDelay);
require(length > 0, "no locks");
if (isShutdown || locks[length - 1].unlockTime <= expiryTime) {
locked = userBalance.locked;
userBalance.nextUnlockIndex = length.to32();
if (_checkDelay > 0) {
uint256 currentEpoch = block.timestamp.sub(_checkDelay).div(rewardsDuration).mul(rewardsDuration);
uint256 epochsover = currentEpoch.sub(uint256(locks[length - 1].unlockTime)).div(rewardsDuration);
uint256 rRate = AuraMath.min(kickRewardPerEpoch.mul(epochsover + 1), denominator);
reward = uint256(locked).mul(rRate).div(denominator);
}
} else {
uint32 nextUnlockIndex = userBalance.nextUnlockIndex;
for (uint256 i = nextUnlockIndex; i < length; i++) {
if (locks[i].unlockTime > expiryTime) break;
locked = locked.add(locks[i].amount);
if (_checkDelay > 0) {
uint256 currentEpoch = block.timestamp.sub(_checkDelay).div(rewardsDuration).mul(rewardsDuration);
uint256 epochsover = currentEpoch.sub(uint256(locks[i].unlockTime)).div(rewardsDuration);
uint256 rRate = AuraMath.min(kickRewardPerEpoch.mul(epochsover + 1), denominator);
reward = reward.add(uint256(locks[i].amount).mul(rRate).div(denominator));
}
nextUnlockIndex++;
}
userBalance.nextUnlockIndex = nextUnlockIndex;
}
require(locked > 0, "no exp locks");
userBalance.locked = userBalance.locked.sub(locked);
lockedSupply = lockedSupply.sub(locked);
_checkpointDelegate(delegates(_account), 0, 0);
emit Withdrawn(_account, locked, expiryTime, _relock);
if (reward > 0) {
locked = locked.sub(reward.to112());
stakingToken.safeTransfer(_rewardAddress, reward);
emit KickReward(_rewardAddress, _account, reward);
}
if (_relock) {
_lock(_account, locked);
} else {
stakingToken.safeTransfer(_account, locked);
}
}
function delegate(address newDelegatee) external virtual nonReentrant {
LockedBalance[] storage locks = userLocks[msg.sender];
uint256 len = locks.length;
require(len > 0, "Nothing to delegate");
require(newDelegatee != address(0), "Must delegate to someone");
address oldDelegatee = delegates(msg.sender);
require(newDelegatee != oldDelegatee, "Must choose new delegatee");
_delegates[msg.sender] = newDelegatee;
emit DelegateChanged(msg.sender, oldDelegatee, newDelegatee);
uint256 upcomingEpoch = block.timestamp.add(rewardsDuration).div(rewardsDuration).mul(rewardsDuration);
uint256 i = len - 1;
uint256 futureUnlocksSum = 0;
LockedBalance memory currentLock = locks[i];
while (currentLock.unlockTime > upcomingEpoch) {
futureUnlocksSum += currentLock.amount;
if (oldDelegatee != address(0)) {
delegateeUnlocks[oldDelegatee][currentLock.unlockTime] -= currentLock.amount;
}
delegateeUnlocks[newDelegatee][currentLock.unlockTime] += currentLock.amount;
if (i > 0) {
i--;
currentLock = locks[i];
} else {
break;
}
}
_checkpointDelegate(oldDelegatee, 0, futureUnlocksSum);
_checkpointDelegate(newDelegatee, futureUnlocksSum, 0);
}
function _checkpointDelegate(
address _account,
uint256 _upcomingAddition,
uint256 _upcomingDeduction
) internal {
if (_account != address(0)) {
uint256 upcomingEpoch = block.timestamp.add(rewardsDuration).div(rewardsDuration).mul(rewardsDuration);
DelegateeCheckpoint[] storage ckpts = _checkpointedVotes[_account];
if (ckpts.length > 0) {
DelegateeCheckpoint memory prevCkpt = ckpts[ckpts.length - 1];
if (prevCkpt.epochStart == upcomingEpoch) {
ckpts[ckpts.length - 1] = DelegateeCheckpoint({
votes: (prevCkpt.votes + _upcomingAddition - _upcomingDeduction).to224(),
epochStart: upcomingEpoch.to32()
});
}
else if (prevCkpt.epochStart + lockDuration <= upcomingEpoch) {
ckpts.push(
DelegateeCheckpoint({
votes: (_upcomingAddition - _upcomingDeduction).to224(),
epochStart: upcomingEpoch.to32()
})
);
} else {
uint256 nextEpoch = upcomingEpoch;
uint256 unlocksSinceLatestCkpt = 0;
while (nextEpoch > prevCkpt.epochStart) {
unlocksSinceLatestCkpt += delegateeUnlocks[_account][nextEpoch];
nextEpoch -= rewardsDuration;
}
ckpts.push(
DelegateeCheckpoint({
votes: (prevCkpt.votes - unlocksSinceLatestCkpt + _upcomingAddition - _upcomingDeduction)
.to224(),
epochStart: upcomingEpoch.to32()
})
);
}
} else {
ckpts.push(
DelegateeCheckpoint({
votes: (_upcomingAddition - _upcomingDeduction).to224(),
epochStart: upcomingEpoch.to32()
})
);
}
emit DelegateCheckpointed(_account);
}
}
function delegates(address account) public view virtual returns (address) {
return _delegates[account];
}
function getVotes(address account) external view returns (uint256) {
return getPastVotes(account, block.timestamp);
}
function checkpoints(address account, uint32 pos) external view virtual returns (DelegateeCheckpoint memory) {
return _checkpointedVotes[account][pos];
}
function numCheckpoints(address account) external view virtual returns (uint32) {
return _checkpointedVotes[account].length.to32();
}
function getPastVotes(address account, uint256 timestamp) public view returns (uint256 votes) {
require(timestamp <= block.timestamp, "ERC20Votes: block not yet mined");
uint256 epoch = timestamp.div(rewardsDuration).mul(rewardsDuration);
DelegateeCheckpoint memory ckpt = _checkpointsLookup(_checkpointedVotes[account], epoch);
votes = ckpt.votes;
if (votes == 0 || ckpt.epochStart + lockDuration <= epoch) {
return 0;
}
while (epoch > ckpt.epochStart) {
votes -= delegateeUnlocks[account][epoch];
epoch -= rewardsDuration;
}
}
function getPastTotalSupply(uint256 timestamp) external view returns (uint256) {
require(timestamp < block.timestamp, "ERC20Votes: block not yet mined");
return totalSupplyAtEpoch(findEpochId(timestamp));
}
function _checkpointsLookup(DelegateeCheckpoint[] storage ckpts, uint256 epochStart)
private
view
returns (DelegateeCheckpoint memory)
{
uint256 high = ckpts.length;
uint256 low = 0;
while (low < high) {
uint256 mid = AuraMath.average(low, high);
if (ckpts[mid].epochStart > epochStart) {
high = mid;
} else {
low = mid + 1;
}
}
return high == 0 ? DelegateeCheckpoint(0, 0) : ckpts[high - 1];
}
function balanceOf(address _user) external view returns (uint256 amount) {
return balanceAtEpochOf(findEpochId(block.timestamp), _user);
}
function balanceAtEpochOf(uint256 _epoch, address _user) public view returns (uint256 amount) {
uint256 epochStart = uint256(epochs[0].date).add(uint256(_epoch).mul(rewardsDuration));
require(epochStart < block.timestamp, "Epoch is in the future");
uint256 cutoffEpoch = epochStart.sub(lockDuration);
LockedBalance[] storage locks = userLocks[_user];
uint256 locksLength = locks.length;
for (uint256 i = locksLength; i > 0; i--) {
uint256 lockEpoch = uint256(locks[i - 1].unlockTime).sub(lockDuration);
if (lockEpoch < epochStart) {
if (lockEpoch > cutoffEpoch) {
amount = amount.add(locks[i - 1].amount);
} else {
break;
}
}
}
return amount;
}
function lockedBalances(address _user)
external
view
returns (
uint256 total,
uint256 unlockable,
uint256 locked,
LockedBalance[] memory lockData
)
{
LockedBalance[] storage locks = userLocks[_user];
Balances storage userBalance = balances[_user];
uint256 nextUnlockIndex = userBalance.nextUnlockIndex;
uint256 idx;
for (uint256 i = nextUnlockIndex; i < locks.length; i++) {
if (locks[i].unlockTime > block.timestamp) {
if (idx == 0) {
lockData = new LockedBalance[](locks.length - i);
}
lockData[idx] = locks[i];
idx++;
locked = locked.add(locks[i].amount);
} else {
unlockable = unlockable.add(locks[i].amount);
}
}
return (userBalance.locked, unlockable, locked, lockData);
}
function totalSupply() external view returns (uint256 supply) {
return totalSupplyAtEpoch(findEpochId(block.timestamp));
}
function totalSupplyAtEpoch(uint256 _epoch) public view returns (uint256 supply) {
uint256 epochStart = uint256(epochs[0].date).add(uint256(_epoch).mul(rewardsDuration));
require(epochStart < block.timestamp, "Epoch is in the future");
uint256 cutoffEpoch = epochStart.sub(lockDuration);
uint256 lastIndex = epochs.length - 1;
uint256 epochIndex = _epoch > lastIndex ? lastIndex : _epoch;
for (uint256 i = epochIndex + 1; i > 0; i--) {
Epoch memory e = epochs[i - 1];
if (e.date == epochStart) {
continue;
} else if (e.date <= cutoffEpoch) {
break;
} else {
supply += e.supply;
}
}
}
function findEpochId(uint256 _time) public view returns (uint256 epoch) {
return _time.sub(epochs[0].date).div(rewardsDuration);
}
function epochCount() external view returns (uint256) {
return epochs.length;
}
function decimals() external view returns (uint8) {
return _decimals;
}
function name() external view returns (string memory) {
return _name;
}
function symbol() external view returns (string memory) {
return _symbol;
}
function claimableRewards(address _account) external view returns (EarnedData[] memory userRewards) {
userRewards = new EarnedData[](rewardTokens.length);
Balances storage userBalance = balances[_account];
uint256 userRewardsLength = userRewards.length;
for (uint256 i = 0; i < userRewardsLength; i++) {
address token = rewardTokens[i];
userRewards[i].token = token;
userRewards[i].amount = _earned(_account, token, userBalance.locked);
}
return userRewards;
}
function lastTimeRewardApplicable(address _rewardsToken) external view returns (uint256) {
return _lastTimeRewardApplicable(rewardData[_rewardsToken].periodFinish);
}
function rewardPerToken(address _rewardsToken) external view returns (uint256) {
return _rewardPerToken(_rewardsToken);
}
function earned(address _account, address token) external view returns (uint256 userRewards) {
Balances storage userBalance = balances[_account];
userRewards = _earned(_account, token, userBalance.locked);
}
function _earned(
address _user,
address _rewardsToken,
uint256 _balance
) internal view returns (uint256) {
UserData memory data = userData[_user][_rewardsToken];
return _balance.mul(_rewardPerToken(_rewardsToken).sub(data.rewardPerTokenPaid)).div(1e18).add(data.rewards);
}
function _lastTimeRewardApplicable(uint256 _finishTime) internal view returns (uint256) {
return AuraMath.min(block.timestamp, _finishTime);
}
function _rewardPerToken(address _rewardsToken) internal view returns (uint256) {
if (lockedSupply == 0) {
return rewardData[_rewardsToken].rewardPerTokenStored;
}
return
uint256(rewardData[_rewardsToken].rewardPerTokenStored).add(
_lastTimeRewardApplicable(rewardData[_rewardsToken].periodFinish)
.sub(rewardData[_rewardsToken].lastUpdateTime)
.mul(rewardData[_rewardsToken].rewardRate)
.mul(1e18)
.div(lockedSupply)
);
}
function queueNewRewards(address _rewardsToken, uint256 _rewards) external nonReentrant {
require(rewardDistributors[_rewardsToken][msg.sender], "!authorized");
require(_rewards > 0, "No reward");
RewardData storage rdata = rewardData[_rewardsToken];
_rewards = _rewards.add(queuedRewards[_rewardsToken]);
require(_rewards < 1e25, "!rewards");
if (block.timestamp >= rdata.periodFinish) {
_notifyReward(_rewardsToken, _rewards);
queuedRewards[_rewardsToken] = 0;
return;
}
uint256 elapsedTime = block.timestamp.sub(rdata.periodFinish.sub(rewardsDuration.to32()));
uint256 currentAtNow = rdata.rewardRate * elapsedTime;
uint256 queuedRatio = currentAtNow.mul(1000).div(_rewards);
if (queuedRatio < newRewardRatio) {
_notifyReward(_rewardsToken, _rewards);
queuedRewards[_rewardsToken] = 0;
} else {
queuedRewards[_rewardsToken] = _rewards;
}
}
function _notifyReward(address _rewardsToken, uint256 _reward) internal updateReward(address(0)) {
RewardData storage rdata = rewardData[_rewardsToken];
if (block.timestamp >= rdata.periodFinish) {
rdata.rewardRate = _reward.div(rewardsDuration).to96();
} else {
uint256 remaining = uint256(rdata.periodFinish).sub(block.timestamp);
uint256 leftover = remaining.mul(rdata.rewardRate);
rdata.rewardRate = _reward.add(leftover).div(rewardsDuration).to96();
}
require(rdata.rewardRate < 1e20, "!rewardRate");
require(lockedSupply >= 1e20, "!balance");
rdata.lastUpdateTime = block.timestamp.to32();
rdata.periodFinish = block.timestamp.add(rewardsDuration).to32();
emit RewardAdded(_rewardsToken, _reward);
}
}
文件 8 的 11: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);
}
}
文件 9 的 11:Permission.sol
pragma solidity 0.8.11;
abstract contract Permission {
event ModifyPermission(address owner, address caller, bool grant);
mapping(address => mapping(address => bool)) private _permitted;
function modifyPermission(address caller, bool permitted) external {
_permitted[msg.sender][caller] = permitted;
emit ModifyPermission(msg.sender, caller, permitted);
}
function hasPermission(address owner, address caller) public view returns (bool) {
return owner == caller || _permitted[owner][caller];
}
}
文件 10 的 11: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;
}
}
文件 11 的 11:SafeERC20.sol
pragma solidity ^0.8.0;
import "../IERC20.sol";
import "../../../utils/Address.sol";
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));
}
function safeApprove(
IERC20 token,
address spender,
uint256 value
) internal {
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 _callOptionalReturn(IERC20 token, bytes memory data) private {
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
if (returndata.length > 0) {
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
{
"compilationTarget": {
"contracts/core/LiqLocker.sol": "LiqLocker"
},
"evmVersion": "london",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs",
"useLiteralContent": true
},
"optimizer": {
"enabled": true,
"runs": 1000
},
"remappings": []
}
[{"inputs":[{"internalType":"string","name":"_nameArg","type":"string"},{"internalType":"string","name":"_symbolArg","type":"string"},{"internalType":"address","name":"_stakingToken","type":"address"},{"internalType":"address","name":"_cvxCrv","type":"address"},{"internalType":"address","name":"_cvxCrvStaking","type":"address"},{"internalType":"address","name":"_olit","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"bool","name":"blacklisted","type":"bool"}],"name":"BlacklistModified","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"delegator","type":"address"},{"indexed":true,"internalType":"address","name":"fromDelegate","type":"address"},{"indexed":true,"internalType":"address","name":"toDelegate","type":"address"}],"name":"DelegateChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"delegate","type":"address"}],"name":"DelegateCheckpointed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"rate","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"delay","type":"uint256"}],"name":"KickIncentiveSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_user","type":"address"},{"indexed":true,"internalType":"address","name":"_kicked","type":"address"},{"indexed":false,"internalType":"uint256","name":"_reward","type":"uint256"}],"name":"KickReward","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"address","name":"caller","type":"address"},{"indexed":false,"internalType":"bool","name":"grant","type":"bool"}],"name":"ModifyPermission","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":false,"internalType":"address","name":"_token","type":"address"},{"indexed":false,"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"Recovered","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_token","type":"address"},{"indexed":false,"internalType":"uint256","name":"_reward","type":"uint256"}],"name":"RewardAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_user","type":"address"},{"indexed":true,"internalType":"address","name":"_rewardsToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"_reward","type":"uint256"}],"name":"RewardPaid","type":"event"},{"anonymous":false,"inputs":[],"name":"Shutdown","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_user","type":"address"},{"indexed":false,"internalType":"uint256","name":"_lockedAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_unlockTime","type":"uint256"}],"name":"Staked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_user","type":"address"},{"indexed":false,"internalType":"uint256","name":"_amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_expiryTime","type":"uint256"},{"indexed":false,"internalType":"bool","name":"_relocked","type":"bool"}],"name":"Withdrawn","type":"event"},{"inputs":[{"internalType":"address","name":"_rewardsToken","type":"address"},{"internalType":"address","name":"_distributor","type":"address"}],"name":"addReward","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_rewardsToken","type":"address"},{"internalType":"address","name":"_distributor","type":"address"},{"internalType":"bool","name":"_approved","type":"bool"}],"name":"approveRewardDistributor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_epoch","type":"uint256"},{"internalType":"address","name":"_user","type":"address"}],"name":"balanceAtEpochOf","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"balances","outputs":[{"internalType":"uint112","name":"locked","type":"uint112"},{"internalType":"uint32","name":"nextUnlockIndex","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"blacklist","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"checkpointEpoch","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint32","name":"pos","type":"uint32"}],"name":"checkpoints","outputs":[{"components":[{"internalType":"uint224","name":"votes","type":"uint224"},{"internalType":"uint32","name":"epochStart","type":"uint32"}],"internalType":"struct LiqLocker.DelegateeCheckpoint","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"}],"name":"claimableRewards","outputs":[{"components":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"internalType":"struct LiqLocker.EarnedData[]","name":"userRewards","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"cvxCrv","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"cvxcrvStaking","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newDelegatee","type":"address"}],"name":"delegate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"delegateeUnlocks","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"delegates","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"denominator","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"},{"internalType":"address","name":"token","type":"address"}],"name":"earned","outputs":[{"internalType":"uint256","name":"userRewards","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"emergencyWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"epochCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"epochs","outputs":[{"internalType":"uint224","name":"supply","type":"uint224"},{"internalType":"uint32","name":"date","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_time","type":"uint256"}],"name":"findEpochId","outputs":[{"internalType":"uint256","name":"epoch","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"getPastTotalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"getPastVotes","outputs":[{"internalType":"uint256","name":"votes","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"},{"internalType":"bool","name":"_stake","type":"bool"}],"name":"getReward","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"}],"name":"getReward","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"},{"internalType":"bool[]","name":"_skipIdx","type":"bool[]"}],"name":"getReward","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"}],"name":"getRewardFor","outputs":[{"internalType":"uint256","name":"rewardAmount","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"getVotes","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"caller","type":"address"}],"name":"hasPermission","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isShutdown","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"}],"name":"kickExpiredLocks","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"kickRewardEpochDelay","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"kickRewardPerEpoch","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_rewardsToken","type":"address"}],"name":"lastTimeRewardApplicable","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"lock","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"lockDuration","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"lockedBalances","outputs":[{"internalType":"uint256","name":"total","type":"uint256"},{"internalType":"uint256","name":"unlockable","type":"uint256"},{"internalType":"uint256","name":"locked","type":"uint256"},{"components":[{"internalType":"uint112","name":"amount","type":"uint112"},{"internalType":"uint32","name":"unlockTime","type":"uint32"}],"internalType":"struct LiqLocker.LockedBalance[]","name":"lockData","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lockedSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"},{"internalType":"bool","name":"_blacklisted","type":"bool"}],"name":"modifyBlacklist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"caller","type":"address"},{"internalType":"bool","name":"permitted","type":"bool"}],"name":"modifyPermission","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"newRewardRatio","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"numCheckpoints","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"olit","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bool","name":"_relock","type":"bool"}],"name":"processExpiredLocks","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_rewardsToken","type":"address"},{"internalType":"uint256","name":"_rewards","type":"uint256"}],"name":"queueNewRewards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"queuedRewards","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_tokenAddress","type":"address"},{"internalType":"uint256","name":"_tokenAmount","type":"uint256"}],"name":"recoverERC20","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"rewardData","outputs":[{"internalType":"uint32","name":"periodFinish","type":"uint32"},{"internalType":"uint32","name":"lastUpdateTime","type":"uint32"},{"internalType":"uint96","name":"rewardRate","type":"uint96"},{"internalType":"uint96","name":"rewardPerTokenStored","type":"uint96"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"rewardDistributors","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_rewardsToken","type":"address"}],"name":"rewardPerToken","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"rewardTokens","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardsDuration","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"setApprovals","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_rate","type":"uint256"},{"internalType":"uint256","name":"_delay","type":"uint256"}],"name":"setKickIncentive","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"shutdown","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"stakingToken","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"supply","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_epoch","type":"uint256"}],"name":"totalSupplyAtEpoch","outputs":[{"internalType":"uint256","name":"supply","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"userData","outputs":[{"internalType":"uint128","name":"rewardPerTokenPaid","type":"uint128"},{"internalType":"uint128","name":"rewards","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"userLocks","outputs":[{"internalType":"uint112","name":"amount","type":"uint112"},{"internalType":"uint32","name":"unlockTime","type":"uint32"}],"stateMutability":"view","type":"function"}]