编译器
0.8.25+commit.b61c2a91
文件 1 的 6:Address.sol
pragma solidity ^0.8.1;
library Address {
function isContract(address account) internal view returns (bool) {
return account.code.length > 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 functionCallWithValue(target, data, 0, "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");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, 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) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, 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) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata,
string memory errorMessage
) internal view returns (bytes memory) {
if (success) {
if (returndata.length == 0) {
require(isContract(target), "Address: call to non-contract");
}
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
function _revert(bytes memory returndata, string memory errorMessage) private pure {
if (returndata.length > 0) {
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
文件 2 的 6:IERC20.sol
pragma solidity ^0.8.0;
interface IERC20 {
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address to, 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 from, address to, uint256 amount) external returns (bool);
}
文件 3 的 6:IERC20Metadata.sol
pragma solidity ^0.8.0;
import "./IERC20.sol";
interface IERC20Metadata is IERC20 {
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function decimals() external view returns (uint8);
}
文件 4 的 6:IERC20Permit.sol
pragma solidity ^0.8.0;
interface IERC20Permit {
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
function nonces(address owner) external view returns (uint256);
function DOMAIN_SEPARATOR() external view returns (bytes32);
}
文件 5 的 6:SafeERC20.sol
pragma solidity ^0.8.0;
import "./IERC20.sol";
import "./IERC20Permit.sol";
import "./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 oldAllowance = token.allowance(address(this), spender);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));
}
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");
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));
}
}
function forceApprove(IERC20 token, address spender, uint256 value) internal {
bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);
if (!_callOptionalReturnBool(token, approvalCall)) {
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));
_callOptionalReturn(token, approvalCall);
}
}
function safePermit(
IERC20Permit token,
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) internal {
uint256 nonceBefore = token.nonces(owner);
token.permit(owner, spender, value, deadline, v, r, s);
uint256 nonceAfter = token.nonces(owner);
require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
}
function _callOptionalReturn(IERC20 token, bytes memory data) private {
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
(bool success, bytes memory returndata) = address(token).call(data);
return
success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token));
}
}
文件 6 的 6:YearnBoostedStaker.sol
pragma solidity ^0.8.22;
import {IERC20, SafeERC20} from "./SafeERC20.sol";
import {IERC20Metadata} from "./IERC20Metadata.sol";
contract YearnBoostedStaker {
using SafeERC20 for IERC20;
uint public immutable MAX_STAKE_GROWTH_WEEKS;
uint8 public immutable MAX_WEEK_BIT;
uint public immutable START_TIME;
IERC20 public immutable stakeToken;
mapping(address account => AccountData data) public accountData;
mapping(address account => mapping(uint week => uint weight)) private accountWeeklyWeights;
mapping(address account => mapping(uint week => ToRealize weight)) public accountWeeklyToRealize;
mapping(address account => mapping(uint week => uint amount)) public accountWeeklyMaxStake;
uint112 public globalGrowthRate;
uint16 public globalLastUpdateWeek;
mapping(uint week => uint weight) private globalWeeklyWeights;
mapping(uint week => ToRealize weight) public globalWeeklyToRealize;
mapping(uint week => uint amount) public globalWeeklyMaxStake;
uint public totalSupply;
uint8 public immutable decimals;
address public owner;
address public pendingOwner;
mapping(address account => mapping(address caller => ApprovalStatus approvalStatus)) public approvedCaller;
mapping(address staker => bool approved) public approvedWeightedStaker;
struct ToRealize {
uint128 weightPersistent;
uint128 weight;
}
struct AccountData {
uint112 realizedStake;
uint112 pendingStake;
uint16 lastUpdateWeek;
uint8 updateWeeksBitmap;
}
enum ApprovalStatus {
None,
StakeOnly,
UnstakeOnly,
StakeAndUnstake
}
event Staked(address indexed account, uint indexed week, uint amount, uint newUserWeight, uint weightAdded);
event Unstaked(address indexed account, uint indexed week, uint amount, uint newUserWeight, uint weightRemoved);
event ApprovedCallerSet(address indexed account, address indexed caller, ApprovalStatus status);
event OwnershipTransferred(address indexed newOwner);
event WeightedStakerSet(address indexed staker, bool approved);
constructor(address _token, uint _max_stake_growth_weeks, uint _start_time, address _owner) {
owner = _owner;
emit OwnershipTransferred(_owner);
stakeToken = IERC20(_token);
decimals = IERC20Metadata(_token).decimals();
require(
_max_stake_growth_weeks > 0 &&
_max_stake_growth_weeks <= 7,
"Invalid weeks"
);
MAX_STAKE_GROWTH_WEEKS = _max_stake_growth_weeks;
MAX_WEEK_BIT = uint8(1 << MAX_STAKE_GROWTH_WEEKS);
if (_start_time == 0){
START_TIME = block.timestamp;
}
else {
require(_start_time <= block.timestamp, "!Past");
START_TIME = _start_time;
}
}
function stake(uint _amount) external returns (uint) {
return _stake(msg.sender, _amount);
}
function stakeFor(address _account, uint _amount) external returns (uint) {
if (msg.sender != _account) {
ApprovalStatus status = approvedCaller[_account][msg.sender];
require(
status == ApprovalStatus.StakeAndUnstake ||
status == ApprovalStatus.StakeOnly,
"!Permission"
);
}
return _stake(_account, _amount);
}
function _stake(address _account, uint _amount) internal returns (uint) {
require(_amount > 1 && _amount < type(uint112).max, "invalid amount");
uint systemWeek = getWeek();
(AccountData memory acctData, uint accountWeight) = _checkpointAccount(_account, systemWeek);
uint112 globalWeight = uint112(_checkpointGlobal(systemWeek));
uint weight = _amount >> 1;
_amount = weight << 1;
acctData.pendingStake += uint112(weight);
globalGrowthRate += uint112(weight);
uint realizeWeek = systemWeek + MAX_STAKE_GROWTH_WEEKS;
ToRealize memory toRealize = accountWeeklyToRealize[_account][realizeWeek];
toRealize.weight += uint128(weight);
toRealize.weightPersistent += uint128(weight);
accountWeeklyToRealize[_account][realizeWeek] = toRealize;
toRealize = globalWeeklyToRealize[realizeWeek];
toRealize.weight += uint128(weight);
toRealize.weightPersistent += uint128(weight);
globalWeeklyToRealize[realizeWeek] = toRealize;
accountWeeklyWeights[_account][systemWeek] = accountWeight + weight;
globalWeeklyWeights[systemWeek] = globalWeight + weight;
acctData.updateWeeksBitmap |= 1;
accountData[_account] = acctData;
totalSupply += _amount;
stakeToken.safeTransferFrom(msg.sender, address(this), uint(_amount));
emit Staked(_account, systemWeek, _amount, accountWeight + weight, weight);
return _amount;
}
function stakeAsMaxWeighted(address _account, uint _amount) external returns (uint) {
require(
approvedWeightedStaker[msg.sender],
"!approvedStaker"
);
require(_amount > 1 && _amount < type(uint112).max, "invalid amount");
uint systemWeek = getWeek();
(AccountData memory acctData, uint accountWeight) = _checkpointAccount(_account, systemWeek);
uint112 globalWeight = uint112(_checkpointGlobal(systemWeek));
uint weight = _amount >> 1;
_amount = weight << 1;
acctData.realizedStake += uint112(weight);
weight = weight * (MAX_STAKE_GROWTH_WEEKS + 1);
accountWeeklyMaxStake[_account][systemWeek] += _amount;
globalWeeklyMaxStake[systemWeek] += _amount;
accountWeeklyWeights[_account][systemWeek] = accountWeight + weight;
globalWeeklyWeights[systemWeek] = globalWeight + weight;
accountData[_account] = acctData;
totalSupply += _amount;
stakeToken.safeTransferFrom(msg.sender, address(this), uint(_amount));
emit Staked(_account, systemWeek, _amount, accountWeight + weight, weight);
return _amount;
}
function unstake(uint _amount, address _receiver) external returns (uint) {
return _unstake(msg.sender, _amount, _receiver);
}
function unstakeFor(address _account, uint _amount, address _receiver) external returns (uint) {
if (msg.sender != _account) {
ApprovalStatus status = approvedCaller[_account][msg.sender];
require(
status == ApprovalStatus.StakeAndUnstake ||
status == ApprovalStatus.UnstakeOnly,
"!Permission"
);
}
return _unstake(_account, _amount, _receiver);
}
function _unstake(address _account, uint _amount, address _receiver) internal returns (uint) {
require(_amount > 1 && _amount < type(uint112).max, "invalid amount");
uint systemWeek = getWeek();
(AccountData memory acctData, ) = _checkpointAccount(_account, systemWeek);
_checkpointGlobal(systemWeek);
uint8 bitmap = acctData.updateWeeksBitmap;
uint128 weightToRemove;
uint128 amountNeeded = uint128(_amount >> 1);
_amount = amountNeeded << 1;
if (bitmap > 0) {
for (uint128 weekIndex; weekIndex < MAX_STAKE_GROWTH_WEEKS;) {
uint8 mask = uint8(1 << weekIndex);
if (bitmap & mask == mask) {
uint weekToCheck = systemWeek + MAX_STAKE_GROWTH_WEEKS - weekIndex;
uint128 pending = accountWeeklyToRealize[_account][weekToCheck].weight;
if (amountNeeded > pending){
weightToRemove += pending * (weekIndex + 1);
accountWeeklyToRealize[_account][weekToCheck].weight = 0;
globalWeeklyToRealize[weekToCheck].weight -= pending;
if (weekIndex == 0) {
accountWeeklyToRealize[_account][weekToCheck].weightPersistent = 0;
globalWeeklyToRealize[weekToCheck].weightPersistent -= pending;
}
bitmap = bitmap ^ mask;
amountNeeded -= pending;
}
else {
weightToRemove += amountNeeded * (weekIndex + 1);
accountWeeklyToRealize[_account][weekToCheck].weight -= amountNeeded;
globalWeeklyToRealize[weekToCheck].weight -= amountNeeded;
if (weekIndex == 0) {
accountWeeklyToRealize[_account][weekToCheck].weightPersistent -= amountNeeded;
globalWeeklyToRealize[weekToCheck].weightPersistent -= amountNeeded;
}
if (amountNeeded == pending) bitmap = bitmap ^ mask;
amountNeeded = 0;
break;
}
}
unchecked{weekIndex++;}
}
acctData.updateWeeksBitmap = bitmap;
}
uint pendingRemoved = (_amount >> 1) - amountNeeded;
if (amountNeeded > 0) {
weightToRemove += amountNeeded * uint128(1 + MAX_STAKE_GROWTH_WEEKS);
acctData.realizedStake -= uint112(amountNeeded);
acctData.pendingStake = 0;
}
else{
acctData.pendingStake -= uint112(pendingRemoved);
}
accountData[_account] = acctData;
globalGrowthRate -= uint112(pendingRemoved);
globalWeeklyWeights[systemWeek] -= weightToRemove;
uint newAccountWeight = accountWeeklyWeights[_account][systemWeek] - weightToRemove;
accountWeeklyWeights[_account][systemWeek] = newAccountWeight;
totalSupply -= _amount;
emit Unstaked(_account, systemWeek, _amount, newAccountWeight, weightToRemove);
stakeToken.safeTransfer(_receiver, _amount);
return _amount;
}
function checkpointAccount(address _account) external returns (AccountData memory acctData, uint weight) {
(acctData, weight) = _checkpointAccount(_account, getWeek());
accountData[_account] = acctData;
}
function checkpointAccountWithLimit(address _account, uint _week) external returns (AccountData memory acctData, uint weight) {
uint systemWeek = getWeek();
if (_week >= systemWeek) _week = systemWeek;
(acctData, weight) = _checkpointAccount(_account, _week);
accountData[_account] = acctData;
}
function _checkpointAccount(address _account, uint _systemWeek) internal returns (AccountData memory acctData, uint weight){
acctData = accountData[_account];
uint lastUpdateWeek = acctData.lastUpdateWeek;
if (_systemWeek == lastUpdateWeek) {
return (acctData, accountWeeklyWeights[_account][lastUpdateWeek]);
}
require(_systemWeek > lastUpdateWeek, "specified week is older than last update.");
uint pending = uint(acctData.pendingStake);
uint realized = acctData.realizedStake;
if (pending == 0) {
if (realized != 0) {
weight = accountWeeklyWeights[_account][lastUpdateWeek];
while (lastUpdateWeek < _systemWeek) {
unchecked{lastUpdateWeek++;}
accountWeeklyWeights[_account][lastUpdateWeek] = weight;
}
}
accountData[_account].lastUpdateWeek = uint16(_systemWeek);
acctData.lastUpdateWeek = uint16(_systemWeek);
return (acctData, weight);
}
weight = accountWeeklyWeights[_account][lastUpdateWeek];
uint8 bitmap = acctData.updateWeeksBitmap;
uint targetSyncWeek = min(_systemWeek, lastUpdateWeek + MAX_STAKE_GROWTH_WEEKS);
while (lastUpdateWeek < targetSyncWeek) {
unchecked{ lastUpdateWeek++; }
weight += pending;
accountWeeklyWeights[_account][lastUpdateWeek] = weight;
bitmap = bitmap << 1;
if (bitmap & MAX_WEEK_BIT == MAX_WEEK_BIT){
uint toRealize = accountWeeklyToRealize[_account][lastUpdateWeek].weight;
pending -= toRealize;
realized += toRealize;
if (pending == 0) break;
}
}
while (lastUpdateWeek < _systemWeek){
unchecked{lastUpdateWeek++;}
accountWeeklyWeights[_account][lastUpdateWeek] = weight;
}
acctData = AccountData({
updateWeeksBitmap: bitmap,
pendingStake: uint112(pending),
realizedStake: uint112(realized),
lastUpdateWeek: uint16(_systemWeek)
});
}
function getAccountWeight(address account) external view returns (uint) {
return getAccountWeightAt(account, getWeek());
}
function getAccountWeightAt(address _account, uint _week) public view returns (uint) {
if (_week > getWeek()) return 0;
AccountData memory acctData = accountData[_account];
uint16 lastUpdateWeek = acctData.lastUpdateWeek;
if (lastUpdateWeek >= _week) return accountWeeklyWeights[_account][_week];
uint weight = accountWeeklyWeights[_account][lastUpdateWeek];
uint pending = uint(acctData.pendingStake);
if (pending == 0) return weight;
uint8 bitmap = acctData.updateWeeksBitmap;
while (lastUpdateWeek < _week) {
unchecked{lastUpdateWeek++;}
weight += pending;
bitmap = bitmap << 1;
if (bitmap & MAX_WEEK_BIT == MAX_WEEK_BIT){
pending -= accountWeeklyToRealize[_account][lastUpdateWeek].weight;
if (pending == 0) break;
}
}
return weight;
}
function checkpointGlobal() external returns (uint) {
uint systemWeek = getWeek();
return _checkpointGlobal(systemWeek);
}
function _checkpointGlobal(uint systemWeek) internal returns (uint) {
uint16 lastUpdateWeek = globalLastUpdateWeek;
uint rate = globalGrowthRate;
uint weight = globalWeeklyWeights[lastUpdateWeek];
if (weight == 0) {
globalLastUpdateWeek = uint16(systemWeek);
return 0;
}
if (lastUpdateWeek == systemWeek){
return weight;
}
while (lastUpdateWeek < systemWeek) {
unchecked{lastUpdateWeek++;}
weight += rate;
globalWeeklyWeights[lastUpdateWeek] = weight;
rate -= globalWeeklyToRealize[lastUpdateWeek].weight;
}
globalGrowthRate = uint112(rate);
globalLastUpdateWeek = uint16(systemWeek);
return weight;
}
function getGlobalWeight() external view returns (uint) {
return getGlobalWeightAt(getWeek());
}
function getGlobalWeightAt(uint week) public view returns (uint) {
uint systemWeek = getWeek();
if (week > systemWeek) return 0;
uint16 lastUpdateWeek = globalLastUpdateWeek;
uint rate = globalGrowthRate;
if (week <= lastUpdateWeek) return globalWeeklyWeights[week];
uint weight = globalWeeklyWeights[lastUpdateWeek];
if (rate == 0) {
return weight;
}
while (lastUpdateWeek < week) {
unchecked {lastUpdateWeek++;}
weight += rate;
rate -= globalWeeklyToRealize[lastUpdateWeek].weight;
}
return weight;
}
function balanceOf(address _account) external view returns (uint) {
AccountData memory acctData = accountData[_account];
return 2 * (acctData.pendingStake + acctData.realizedStake);
}
function setApprovedCaller(address _caller, ApprovalStatus _status) external {
approvedCaller[msg.sender][_caller] = _status;
emit ApprovedCallerSet(msg.sender, _caller, _status);
}
function setWeightedStaker(address _staker, bool _approved) external {
require(msg.sender == owner, "!authorized");
approvedWeightedStaker[_staker] = _approved;
emit WeightedStakerSet(_staker, _approved);
}
function transferOwnership(address _pendingOwner) external {
require(msg.sender == owner, "!authorized");
pendingOwner = _pendingOwner;
}
function acceptOwnership() external {
require(msg.sender == pendingOwner, "!authorized");
owner = msg.sender;
pendingOwner = address(0);
emit OwnershipTransferred(msg.sender);
}
function sweep(address _token) external {
require(msg.sender == owner, "!authorized");
uint amount = IERC20(_token).balanceOf(address(this));
if (_token == address(stakeToken)) {
amount = amount - totalSupply;
}
if (amount > 0) IERC20(_token).safeTransfer(owner, amount);
}
function getWeek() public view returns (uint week) {
unchecked{
return (block.timestamp - START_TIME) / 1 weeks;
}
}
function min(uint a, uint b) internal pure returns (uint) {
return a < b ? a : b;
}
}
{
"compilationTarget": {
"YearnBoostedStaker.sol": "YearnBoostedStaker"
},
"evmVersion": "cancun",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs"
},
"optimizer": {
"enabled": true,
"runs": 200
},
"remappings": []
}
[{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_max_stake_growth_weeks","type":"uint256"},{"internalType":"uint256","name":"_start_time","type":"uint256"},{"internalType":"address","name":"_owner","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"caller","type":"address"},{"indexed":false,"internalType":"enum YearnBoostedStaker.ApprovalStatus","name":"status","type":"uint8"}],"name":"ApprovedCallerSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"uint256","name":"week","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newUserWeight","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"weightAdded","type":"uint256"}],"name":"Staked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"uint256","name":"week","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newUserWeight","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"weightRemoved","type":"uint256"}],"name":"Unstaked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"staker","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"WeightedStakerSet","type":"event"},{"inputs":[],"name":"MAX_STAKE_GROWTH_WEEKS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_WEEK_BIT","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"START_TIME","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"acceptOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"accountData","outputs":[{"internalType":"uint112","name":"realizedStake","type":"uint112"},{"internalType":"uint112","name":"pendingStake","type":"uint112"},{"internalType":"uint16","name":"lastUpdateWeek","type":"uint16"},{"internalType":"uint8","name":"updateWeeksBitmap","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"week","type":"uint256"}],"name":"accountWeeklyMaxStake","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"week","type":"uint256"}],"name":"accountWeeklyToRealize","outputs":[{"internalType":"uint128","name":"weightPersistent","type":"uint128"},{"internalType":"uint128","name":"weight","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"address","name":"caller","type":"address"}],"name":"approvedCaller","outputs":[{"internalType":"enum YearnBoostedStaker.ApprovalStatus","name":"approvalStatus","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"staker","type":"address"}],"name":"approvedWeightedStaker","outputs":[{"internalType":"bool","name":"approved","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"}],"name":"checkpointAccount","outputs":[{"components":[{"internalType":"uint112","name":"realizedStake","type":"uint112"},{"internalType":"uint112","name":"pendingStake","type":"uint112"},{"internalType":"uint16","name":"lastUpdateWeek","type":"uint16"},{"internalType":"uint8","name":"updateWeeksBitmap","type":"uint8"}],"internalType":"struct YearnBoostedStaker.AccountData","name":"acctData","type":"tuple"},{"internalType":"uint256","name":"weight","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"},{"internalType":"uint256","name":"_week","type":"uint256"}],"name":"checkpointAccountWithLimit","outputs":[{"components":[{"internalType":"uint112","name":"realizedStake","type":"uint112"},{"internalType":"uint112","name":"pendingStake","type":"uint112"},{"internalType":"uint16","name":"lastUpdateWeek","type":"uint16"},{"internalType":"uint8","name":"updateWeeksBitmap","type":"uint8"}],"internalType":"struct YearnBoostedStaker.AccountData","name":"acctData","type":"tuple"},{"internalType":"uint256","name":"weight","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"checkpointGlobal","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"getAccountWeight","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"},{"internalType":"uint256","name":"_week","type":"uint256"}],"name":"getAccountWeightAt","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getGlobalWeight","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"week","type":"uint256"}],"name":"getGlobalWeightAt","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getWeek","outputs":[{"internalType":"uint256","name":"week","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"globalGrowthRate","outputs":[{"internalType":"uint112","name":"","type":"uint112"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"globalLastUpdateWeek","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"week","type":"uint256"}],"name":"globalWeeklyMaxStake","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"week","type":"uint256"}],"name":"globalWeeklyToRealize","outputs":[{"internalType":"uint128","name":"weightPersistent","type":"uint128"},{"internalType":"uint128","name":"weight","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_caller","type":"address"},{"internalType":"enum YearnBoostedStaker.ApprovalStatus","name":"_status","type":"uint8"}],"name":"setApprovedCaller","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_staker","type":"address"},{"internalType":"bool","name":"_approved","type":"bool"}],"name":"setWeightedStaker","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"stake","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"stakeAsMaxWeighted","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"stakeFor","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"stakeToken","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"}],"name":"sweep","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_pendingOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"address","name":"_receiver","type":"address"}],"name":"unstake","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"address","name":"_receiver","type":"address"}],"name":"unstakeFor","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"}]