编译器
0.8.19+commit.7dd6d404
文件 1 的 10: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 的 10:CakePool.sol
pragma solidity 0.8.19;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/security/Pausable.sol";
import "../farm/interfaces/IMasterChefV2.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
contract CakePool is Ownable, Pausable, ReentrancyGuard {
using SafeERC20 for IERC20;
struct UserInfo {
uint256 shares;
uint256 lastDepositedTime;
uint256 lastUserActionAmount;
uint256 lastUserActionTime;
uint256 lockStartTime;
uint256 lockEndTime;
uint256 userBoostedShare;
bool locked;
uint256 lockedAmount;
}
IERC20 public immutable token;
IERC20 public immutable bbc;
IMasterChefV2 public immutable masterchefV2;
mapping(address => UserInfo) public userInfo;
mapping(address => bool) public freePerformanceFeeUsers;
mapping(address => bool) public freeWithdrawFeeUsers;
mapping(address => bool) public freeOverdueFeeUsers;
uint256 public totalShares;
address public admin;
address public treasury;
address public operator;
uint256 public bbcPoolPID;
uint256 public totalBoostDebt;
uint256 public totalLockedAmount;
uint256 public constant MAX_PERFORMANCE_FEE = 2000;
uint256 public constant MAX_WITHDRAW_FEE = 500;
uint256 public constant MAX_OVERDUE_FEE = 100 * 1e10;
uint256 public constant MAX_WITHDRAW_FEE_PERIOD = 1 weeks;
uint256 public constant MIN_LOCK_DURATION = 1 weeks;
uint256 public constant MAX_LOCK_DURATION_LIMIT = 1000 days;
uint256 public constant BOOST_WEIGHT_LIMIT = 5000 * 1e10;
uint256 public constant PRECISION_FACTOR = 1e12;
uint256 public constant PRECISION_FACTOR_SHARE = 1e28;
uint256 public constant MIN_DEPOSIT_AMOUNT = 0.00001 ether;
uint256 public constant MIN_WITHDRAW_AMOUNT = 0.00001 ether;
uint256 public UNLOCK_FREE_DURATION = 2 weeks;
uint256 public MAX_LOCK_DURATION = 365 days;
uint256 public DURATION_FACTOR = 365 days;
uint256 public DURATION_FACTOR_OVERDUE = 90 days;
uint256 public BOOST_WEIGHT = 2000 * 1e10;
uint256 public constant FEE_RATE_SCALE = 10000;
uint256 public performanceFee = 200;
uint256 public withdrawFee = 400;
uint256 public overdueFee = 100 * 1e10;
uint256 public withdrawFeePeriod = 72 hours;
event Deposit(
address indexed sender,
uint256 amount,
uint256 shares,
uint256 duration,
uint256 lastDepositedTime
);
event Withdraw(address indexed sender, uint256 amount, uint256 shares);
event Harvest(address indexed sender, uint256 amount);
event Pause();
event Unpause();
event Init();
event Lock(
address indexed sender,
uint256 lockedAmount,
uint256 shares,
uint256 lockedDuration,
uint256 blockTimestamp
);
event Unlock(
address indexed sender,
uint256 amount,
uint256 blockTimestamp
);
event NewAdmin(address admin);
event NewTreasury(address treasury);
event NewOperator(address operator);
event FreeFeeUser(address indexed user, bool indexed free);
event NewPerformanceFee(uint256 performanceFee);
event NewWithdrawFee(uint256 withdrawFee);
event NewOverdueFee(uint256 overdueFee);
event NewWithdrawFeePeriod(uint256 withdrawFeePeriod);
event NewMaxLockDuration(uint256 maxLockDuration);
event NewDurationFactor(uint256 durationFactor);
event NewDurationFactorOverdue(uint256 durationFactorOverdue);
event NewUnlockFreeDuration(uint256 unlockFreeDuration);
event NewBoostWeight(uint256 boostWeight);
constructor(
IERC20 _token,
IMasterChefV2 _masterchefV2,
address _admin,
address _treasury,
address _operator,
uint256 _pid
) {
require(address(_token) != address(0), "Invalid token");
require(address(_masterchefV2) != address(0), "Invalid masterchefV2");
require(_admin != address(0), "Invalid admin");
require(_treasury != address(0), "Invalid treasury");
require(_operator != address(0), "Invalid operator");
token = _token;
bbc = IERC20(_masterchefV2.BBC());
masterchefV2 = _masterchefV2;
admin = _admin;
treasury = _treasury;
operator = _operator;
bbcPoolPID = _pid;
}
function init(IERC20 dummyToken, uint256 amount) public onlyOwner {
uint256 balance = dummyToken.balanceOf(msg.sender);
require(balance != 0, "Balance must exceed 0");
if (amount == 0 || amount > balance) amount = balance;
dummyToken.safeTransferFrom(msg.sender, address(this), amount);
dummyToken.approve(address(masterchefV2), amount);
masterchefV2.deposit(bbcPoolPID, amount);
emit Init();
}
function close() public onlyOwner {
masterchefV2.emergencyWithdraw(bbcPoolPID);
}
modifier onlyAdmin() {
require(msg.sender == admin, "admin: wut?");
_;
}
modifier onlyOperatorOrBBCOwner(address _user) {
require(
msg.sender == _user || msg.sender == operator,
"Not operator or bbc owner"
);
_;
}
function updateUserShare(address _user) internal virtual {
UserInfo storage user = userInfo[_user];
if (user.shares > 0) {
if (user.locked) {
uint256 currentAmount = (balanceOf() * (user.shares)) /
totalShares -
user.userBoostedShare;
totalBoostDebt -= user.userBoostedShare;
user.userBoostedShare = 0;
totalShares -= user.shares;
if (
!freeOverdueFeeUsers[_user] &&
((user.lockEndTime + UNLOCK_FREE_DURATION) <
block.timestamp)
) {
uint256 earnAmount = currentAmount - user.lockedAmount;
uint256 overdueDuration = block.timestamp -
user.lockEndTime -
UNLOCK_FREE_DURATION;
if (overdueDuration > DURATION_FACTOR_OVERDUE) {
overdueDuration = DURATION_FACTOR_OVERDUE;
}
uint256 overdueWeight = (overdueDuration * overdueFee) /
DURATION_FACTOR_OVERDUE;
uint256 currentOverdueFee = (earnAmount * overdueWeight) /
PRECISION_FACTOR;
uint256 feeHalf = currentOverdueFee / 2;
bbc.safeTransfer(treasury, feeHalf);
bbc.safeTransfer(
address(0xdead),
currentOverdueFee - feeHalf
);
currentAmount -= currentOverdueFee;
}
uint256 pool = balanceOf();
uint256 currentShares;
if (totalShares != 0) {
currentShares =
(currentAmount * totalShares) /
(pool - currentAmount);
} else {
currentShares = currentAmount;
}
user.shares = currentShares;
totalShares += currentShares;
if (user.lockEndTime < block.timestamp) {
user.locked = false;
user.lockStartTime = 0;
user.lockEndTime = 0;
totalLockedAmount -= user.lockedAmount;
user.lockedAmount = 0;
emit Unlock(_user, currentAmount, block.timestamp);
}
} else if (!freePerformanceFeeUsers[_user]) {
uint256 totalAmount = (user.shares * balanceOf()) / totalShares;
totalShares -= user.shares;
user.shares = 0;
uint256 earnAmount = totalAmount -
user.lastUserActionAmount;
uint256 currentPerformanceFee = (earnAmount *
performanceFee) / FEE_RATE_SCALE;
if (currentPerformanceFee > 0) {
bbc.safeTransfer(treasury, currentPerformanceFee);
totalAmount -= currentPerformanceFee;
}
uint256 pool = balanceOf();
uint256 newShares;
if (totalShares != 0) {
newShares =
(totalAmount * totalShares) /
(pool - totalAmount);
} else {
newShares = totalAmount;
}
user.shares = newShares;
totalShares += newShares;
}
}
}
function unlock(
address _user
) public onlyOperatorOrBBCOwner(_user) whenNotPaused nonReentrant {
UserInfo storage user = userInfo[_user];
require(
user.locked && user.lockEndTime < block.timestamp,
"Cannot unlock yet"
);
depositOperation(0, 0, _user);
}
function deposit(
uint256 _amount,
uint256 _lockDuration
) public whenNotPaused nonReentrant {
require(_amount > 0 || _lockDuration > 0, "Nothing to deposit");
depositOperation(_amount, _lockDuration, msg.sender);
}
function depositOperation(
uint256 _amount,
uint256 _lockDuration,
address _user
) internal virtual {
UserInfo storage user = userInfo[_user];
if (user.shares == 0 || _amount > 0) {
require(_amount > MIN_DEPOSIT_AMOUNT, "Deposit amount must be greater than MIN_DEPOSIT_AMOUNT");
}
uint256 totalLockDuration = _lockDuration;
uint256 userLockEndTime = user.lockEndTime;
if (userLockEndTime >= block.timestamp) {
if (_amount > 0) {
user.lockStartTime = block.timestamp;
totalLockedAmount -= user.lockedAmount;
user.lockedAmount = 0;
}
totalLockDuration += userLockEndTime - user.lockStartTime;
}
require(
_lockDuration == 0 || totalLockDuration >= MIN_LOCK_DURATION,
"Minimum lock period is one week"
);
require(
totalLockDuration <= MAX_LOCK_DURATION,
"Maximum lock period exceeded"
);
harvest();
if (totalShares == 0) {
uint256 stockAmount = bbc.balanceOf(address(this));
bbc.safeTransfer(treasury, stockAmount);
}
updateUserShare(_user);
if (_lockDuration > 0) {
if (userLockEndTime < block.timestamp) {
user.lockStartTime = block.timestamp;
userLockEndTime = block.timestamp + _lockDuration;
} else {
userLockEndTime += _lockDuration;
}
user.locked = true;
user.lockEndTime = userLockEndTime;
}
uint256 currentShares;
uint256 currentAmount;
uint256 userCurrentLockedBalance;
uint256 pool = balanceOf();
if (_amount > 0) {
token.safeTransferFrom(_user, address(this), _amount);
currentAmount = _amount;
}
if (user.shares > 0 && user.locked) {
userCurrentLockedBalance = (pool * user.shares) / totalShares;
currentAmount += userCurrentLockedBalance;
totalShares -= user.shares;
user.shares = 0;
if (user.lockStartTime == block.timestamp) {
user.lockedAmount = userCurrentLockedBalance;
totalLockedAmount += userCurrentLockedBalance;
}
}
if (totalShares != 0) {
currentShares =
(currentAmount * totalShares) /
(pool - userCurrentLockedBalance);
} else {
currentShares = currentAmount;
}
if (userLockEndTime > user.lockStartTime) {
uint256 boostWeight = ((userLockEndTime - user.lockStartTime) *
BOOST_WEIGHT) / DURATION_FACTOR;
uint256 boostShares = (boostWeight * currentShares) /
PRECISION_FACTOR;
currentShares += boostShares;
user.shares += currentShares;
uint256 userBoostedShare = (boostWeight * currentAmount) /
PRECISION_FACTOR;
user.userBoostedShare += userBoostedShare;
totalBoostDebt += userBoostedShare;
user.lockedAmount += _amount;
totalLockedAmount += _amount;
emit Lock(
_user,
user.lockedAmount,
user.shares,
(userLockEndTime - user.lockStartTime),
block.timestamp
);
} else {
user.shares += currentShares;
}
if (_amount > 0 || _lockDuration > 0) {
user.lastDepositedTime = block.timestamp;
}
totalShares += currentShares;
user.lastUserActionAmount =
(user.shares * balanceOf()) /
totalShares -
user.userBoostedShare;
user.lastUserActionTime = block.timestamp;
emit Deposit(
_user,
_amount,
currentShares,
_lockDuration,
block.timestamp
);
}
function withdrawByAmount(
uint256 _amount
) public whenNotPaused nonReentrant {
withdrawOperation(0, _amount);
}
function withdraw(uint256 _shares) public whenNotPaused nonReentrant {
require(_shares > 0, "Nothing to withdraw");
withdrawOperation(_shares, 0);
}
function withdrawOperation(uint256 _shares, uint256 _amount) internal virtual {
UserInfo storage user = userInfo[msg.sender];
if(_shares==0 && _amount > 0)
require(_amount > MIN_WITHDRAW_AMOUNT, "Withdraw amount must be greater than MIN_WITHDRAW_AMOUNT");
else
require(_shares <= user.shares, "Withdraw amount exceeds balance");
require(user.lockEndTime < block.timestamp, "Still in lock");
uint256 currentShare = _shares;
uint256 sharesPercent = (_shares * PRECISION_FACTOR_SHARE) /
user.shares;
harvest();
updateUserShare(msg.sender);
if (_shares == 0 && _amount > 0) {
uint256 pool = balanceOf();
currentShare = (_amount * totalShares) / pool;
if (currentShare > user.shares) {
currentShare = user.shares;
}
} else {
currentShare =
(sharesPercent * user.shares) /
PRECISION_FACTOR_SHARE;
}
uint256 currentAmount = (balanceOf() * currentShare) / totalShares;
user.shares -= currentShare;
totalShares -= currentShare;
if (
!freeWithdrawFeeUsers[msg.sender] &&
(block.timestamp < user.lastDepositedTime + withdrawFeePeriod)
) {
uint256 currentWithdrawFee = (currentAmount * withdrawFee) /
FEE_RATE_SCALE;
token.safeTransfer(treasury, currentWithdrawFee);
currentAmount -= currentWithdrawFee;
}
token.safeTransfer(msg.sender, currentAmount);
if (user.shares > 0) {
user.lastUserActionAmount =
(user.shares * balanceOf()) /
totalShares;
} else {
user.lastUserActionAmount = 0;
}
user.lastUserActionTime = block.timestamp;
emit Withdraw(msg.sender, currentAmount, currentShare);
}
function withdrawAll() public {
withdraw(userInfo[msg.sender].shares);
}
function harvest() internal returns (uint256) {
uint256 pendingBBC = masterchefV2.pendingBBC(bbcPoolPID, address(this));
if (pendingBBC > 0) {
uint256 balBefore = bbc.balanceOf(address(this));
masterchefV2.withdraw(bbcPoolPID, 0);
uint256 balAfter = bbc.balanceOf(address(this));
uint256 balInc = balAfter - balBefore;
emit Harvest(msg.sender, balInc);
return balInc;
}
return 0;
}
function setAdmin(address _admin) public onlyOwner {
require(_admin != address(0), "Cannot be zero address");
admin = _admin;
emit NewAdmin(admin);
}
function setTreasury(address _treasury) public onlyOwner {
require(_treasury != address(0), "Cannot be zero address");
treasury = _treasury;
emit NewTreasury(treasury);
}
function setOperator(address _operator) public onlyOwner {
require(_operator != address(0), "Cannot be zero address");
operator = _operator;
emit NewOperator(operator);
}
function setFreePerformanceFeeUser(
address _user,
bool _free
) public onlyAdmin {
require(_user != address(0), "Cannot be zero address");
freePerformanceFeeUsers[_user] = _free;
emit FreeFeeUser(_user, _free);
}
function setFreeOverdueFeeUser(address _user, bool _free) public onlyAdmin {
require(_user != address(0), "Cannot be zero address");
freeOverdueFeeUsers[_user] = _free;
emit FreeFeeUser(_user, _free);
}
function setFreeWithdrawFeeUser(address _user, bool _free) public onlyAdmin {
require(_user != address(0), "Cannot be zero address");
freeWithdrawFeeUsers[_user] = _free;
emit FreeFeeUser(_user, _free);
}
function setPerformanceFee(uint256 _performanceFee) public onlyAdmin {
require(
_performanceFee <= MAX_PERFORMANCE_FEE,
"performanceFee cannot be more than MAX_PERFORMANCE_FEE"
);
performanceFee = _performanceFee;
emit NewPerformanceFee(performanceFee);
}
function setWithdrawFee(uint256 _withdrawFee) public onlyAdmin {
require(
_withdrawFee <= MAX_WITHDRAW_FEE,
"withdrawFee cannot be more than MAX_WITHDRAW_FEE"
);
withdrawFee = _withdrawFee;
emit NewWithdrawFee(withdrawFee);
}
function setOverdueFee(uint256 _overdueFee) public onlyAdmin {
require(
_overdueFee <= MAX_OVERDUE_FEE,
"overdueFee cannot be more than MAX_OVERDUE_FEE"
);
overdueFee = _overdueFee;
emit NewOverdueFee(_overdueFee);
}
function setWithdrawFeePeriod(uint256 _withdrawFeePeriod) public onlyAdmin {
require(
_withdrawFeePeriod <= MAX_WITHDRAW_FEE_PERIOD,
"withdrawFeePeriod cannot be more than MAX_WITHDRAW_FEE_PERIOD"
);
withdrawFeePeriod = _withdrawFeePeriod;
emit NewWithdrawFeePeriod(withdrawFeePeriod);
}
function setMaxLockDuration(uint256 _maxLockDuration) public onlyAdmin {
require(
_maxLockDuration <= MAX_LOCK_DURATION_LIMIT,
"MAX_LOCK_DURATION cannot be more than MAX_LOCK_DURATION_LIMIT"
);
MAX_LOCK_DURATION = _maxLockDuration;
emit NewMaxLockDuration(_maxLockDuration);
}
function setDurationFactor(uint256 _durationFactor) public onlyAdmin {
require(_durationFactor > 0, "DURATION_FACTOR cannot be zero");
DURATION_FACTOR = _durationFactor;
emit NewDurationFactor(_durationFactor);
}
function setDurationFactorOverdue(
uint256 _durationFactorOverdue
) public onlyAdmin {
require(
_durationFactorOverdue > 0,
"DURATION_FACTOR_OVERDUE cannot be zero"
);
DURATION_FACTOR_OVERDUE = _durationFactorOverdue;
emit NewDurationFactorOverdue(_durationFactorOverdue);
}
function setUnlockFreeDuration(
uint256 _unlockFreeDuration
) public onlyAdmin {
require(_unlockFreeDuration > 0, "UNLOCK_FREE_DURATION cannot be zero");
UNLOCK_FREE_DURATION = _unlockFreeDuration;
emit NewUnlockFreeDuration(_unlockFreeDuration);
}
function setBoostWeight(uint256 _boostWeight) public onlyAdmin {
require(
_boostWeight <= BOOST_WEIGHT_LIMIT,
"BOOST_WEIGHT cannot be more than BOOST_WEIGHT_LIMIT"
);
BOOST_WEIGHT = _boostWeight;
emit NewBoostWeight(_boostWeight);
}
function inCaseTokensGetStuck(address _token) public onlyAdmin {
require(
_token != address(token),
"Token cannot be same as deposit token"
);
uint256 amount = IERC20(_token).balanceOf(address(this));
IERC20(_token).safeTransfer(msg.sender, amount);
}
function pause() public onlyAdmin whenNotPaused {
_pause();
emit Pause();
}
function unpause() public onlyAdmin whenPaused {
_unpause();
emit Unpause();
}
function calculatePerformanceFee(
address _user
) public view returns (uint256) {
UserInfo storage user = userInfo[_user];
if (
user.shares > 0 && !user.locked && !freePerformanceFeeUsers[_user]
) {
uint256 earnAmount = getProfit(_user);
uint256 currentPerformanceFee = (earnAmount * performanceFee) /
FEE_RATE_SCALE;
return currentPerformanceFee;
}
return 0;
}
function calculateOverdueFee(address _user) public view returns (uint256) {
UserInfo storage user = userInfo[_user];
if (
user.shares > 0 &&
user.locked &&
!freeOverdueFeeUsers[_user] &&
((user.lockEndTime + UNLOCK_FREE_DURATION) < block.timestamp)
) {
uint256 earnAmount = getProfit(_user);
uint256 overdueDuration = block.timestamp -
user.lockEndTime -
UNLOCK_FREE_DURATION;
if (overdueDuration > DURATION_FACTOR_OVERDUE) {
overdueDuration = DURATION_FACTOR_OVERDUE;
}
uint256 overdueWeight = (overdueDuration * overdueFee) /
DURATION_FACTOR_OVERDUE;
uint256 currentOverdueFee = (earnAmount * overdueWeight) /
PRECISION_FACTOR;
return currentOverdueFee;
}
return 0;
}
function calculatePerformanceFeeOrOverdueFee(
address _user
) internal view returns (uint256) {
return calculatePerformanceFee(_user) + calculateOverdueFee(_user);
}
function calculateWithdrawFee(
address _user,
uint256 _shares
) public view returns (uint256) {
UserInfo storage user = userInfo[_user];
if (user.shares < _shares) {
_shares = user.shares;
}
if (!freeWithdrawFeeUsers[msg.sender] && !user.locked && (block.timestamp < user.lastDepositedTime + withdrawFeePeriod)) {
uint256 pool = balanceOf() + calculateTotalPendingBBCRewards();
uint256 sharesPercent = (_shares * PRECISION_FACTOR) / user.shares;
uint256 currentTotalAmount = (pool * (user.shares)) /
totalShares -
user.userBoostedShare -
calculatePerformanceFeeOrOverdueFee(_user);
uint256 currentAmount = (currentTotalAmount * sharesPercent) / PRECISION_FACTOR;
uint256 currentWithdrawFee = (currentAmount * withdrawFee) / FEE_RATE_SCALE;
return currentWithdrawFee;
}
return 0;
}
function calculateTotalPendingBBCRewards() public view returns (uint256) {
uint256 amount = masterchefV2.pendingBBC(bbcPoolPID, address(this));
return amount;
}
function getPricePerFullShare() public virtual view returns (uint256) {
return
totalShares == 0
? 1e18
: ((balanceOf() + calculateTotalPendingBBCRewards()) * 1e18 / totalShares);
}
function getProfit(address _user) public virtual view returns (uint256) {
UserInfo storage user = userInfo[_user];
if (user.shares == 0) return 0;
uint256 pool = balanceOf() + calculateTotalPendingBBCRewards();
if (user.locked) {
uint256 currentAmount = (pool * user.shares) /
totalShares -
user.userBoostedShare;
return currentAmount - user.lockedAmount;
}
return
(user.shares * pool) / totalShares - user.lastUserActionAmount;
}
function available() public view returns (uint256) {
return token.balanceOf(address(this));
}
function balanceOf() public view returns (uint256) {
return token.balanceOf(address(this)) + totalBoostDebt;
}
}
文件 3 的 10: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 的 10: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);
}
文件 5 的 10: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);
}
文件 6 的 10:IMasterChefV2.sol
pragma solidity 0.8.19;
interface IMasterChefV2 {
function BBC() external view returns (address);
function deposit(uint256 _pid, uint256 _amount) external;
function withdraw(uint256 _pid, uint256 _amount) external;
function pendingBBC(
uint256 _pid,
address _user
) external view returns (uint256);
function userInfo(
uint256 _pid,
address _user
) external view returns (uint256, uint256, uint256);
function emergencyWithdraw(uint256 _pid) external;
function lpToken(uint256 _pid) external view returns (address);
function poolLength() external view returns (uint256 pools);
function getBoostMultiplier(
address _user,
uint256 _pid
) external view returns (uint256);
function updateBoostMultiplier(
address _user,
uint256 _pid,
uint256 _newMultiplier
) external;
}
文件 7 的 10: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());
}
modifier onlyOwner() {
_checkOwner();
_;
}
function owner() public view virtual returns (address) {
return _owner;
}
function _checkOwner() internal view virtual {
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);
}
}
文件 8 的 10:Pausable.sol
pragma solidity ^0.8.0;
import "../utils/Context.sol";
abstract contract Pausable is Context {
event Paused(address account);
event Unpaused(address account);
bool private _paused;
constructor() {
_paused = false;
}
modifier whenNotPaused() {
_requireNotPaused();
_;
}
modifier whenPaused() {
_requirePaused();
_;
}
function paused() public view virtual returns (bool) {
return _paused;
}
function _requireNotPaused() internal view virtual {
require(!paused(), "Pausable: paused");
}
function _requirePaused() internal view virtual {
require(paused(), "Pausable: not paused");
}
function _pause() internal virtual whenNotPaused {
_paused = true;
emit Paused(_msgSender());
}
function _unpause() internal virtual whenPaused {
_paused = false;
emit Unpaused(_msgSender());
}
}
文件 9 的 10: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() {
_nonReentrantBefore();
_;
_nonReentrantAfter();
}
function _nonReentrantBefore() private {
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
_status = _ENTERED;
}
function _nonReentrantAfter() private {
_status = _NOT_ENTERED;
}
function _reentrancyGuardEntered() internal view returns (bool) {
return _status == _ENTERED;
}
}
文件 10 的 10:SafeERC20.sol
pragma solidity ^0.8.0;
import "../IERC20.sol";
import "../extensions/IERC20Permit.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 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));
}
}
{
"compilationTarget": {
"contracts/pool/CakePool.sol": "CakePool"
},
"evmVersion": "paris",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs"
},
"optimizer": {
"enabled": true,
"runs": 999999
},
"remappings": []
}
[{"inputs":[{"internalType":"contract IERC20","name":"_token","type":"address"},{"internalType":"contract IMasterChefV2","name":"_masterchefV2","type":"address"},{"internalType":"address","name":"_admin","type":"address"},{"internalType":"address","name":"_treasury","type":"address"},{"internalType":"address","name":"_operator","type":"address"},{"internalType":"uint256","name":"_pid","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"shares","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"duration","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"lastDepositedTime","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"bool","name":"free","type":"bool"}],"name":"FreeFeeUser","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Harvest","type":"event"},{"anonymous":false,"inputs":[],"name":"Init","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"lockedAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"shares","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"lockedDuration","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"blockTimestamp","type":"uint256"}],"name":"Lock","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"admin","type":"address"}],"name":"NewAdmin","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"boostWeight","type":"uint256"}],"name":"NewBoostWeight","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"durationFactor","type":"uint256"}],"name":"NewDurationFactor","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"durationFactorOverdue","type":"uint256"}],"name":"NewDurationFactorOverdue","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"maxLockDuration","type":"uint256"}],"name":"NewMaxLockDuration","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"operator","type":"address"}],"name":"NewOperator","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"overdueFee","type":"uint256"}],"name":"NewOverdueFee","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"performanceFee","type":"uint256"}],"name":"NewPerformanceFee","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"treasury","type":"address"}],"name":"NewTreasury","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"unlockFreeDuration","type":"uint256"}],"name":"NewUnlockFreeDuration","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"withdrawFee","type":"uint256"}],"name":"NewWithdrawFee","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"withdrawFeePeriod","type":"uint256"}],"name":"NewWithdrawFeePeriod","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":[],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"blockTimestamp","type":"uint256"}],"name":"Unlock","type":"event"},{"anonymous":false,"inputs":[],"name":"Unpause","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"shares","type":"uint256"}],"name":"Withdraw","type":"event"},{"inputs":[],"name":"BOOST_WEIGHT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"BOOST_WEIGHT_LIMIT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DURATION_FACTOR","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DURATION_FACTOR_OVERDUE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"FEE_RATE_SCALE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_LOCK_DURATION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_LOCK_DURATION_LIMIT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_OVERDUE_FEE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_PERFORMANCE_FEE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_WITHDRAW_FEE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_WITHDRAW_FEE_PERIOD","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MIN_DEPOSIT_AMOUNT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MIN_LOCK_DURATION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MIN_WITHDRAW_AMOUNT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PRECISION_FACTOR","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PRECISION_FACTOR_SHARE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"UNLOCK_FREE_DURATION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"admin","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"available","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"bbc","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"bbcPoolPID","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"calculateOverdueFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"calculatePerformanceFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"calculateTotalPendingBBCRewards","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"},{"internalType":"uint256","name":"_shares","type":"uint256"}],"name":"calculateWithdrawFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"close","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"uint256","name":"_lockDuration","type":"uint256"}],"name":"deposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"freeOverdueFeeUsers","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"freePerformanceFeeUsers","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"freeWithdrawFeeUsers","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getPricePerFullShare","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"getProfit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"}],"name":"inCaseTokensGetStuck","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"dummyToken","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"init","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"masterchefV2","outputs":[{"internalType":"contract IMasterChefV2","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"operator","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"overdueFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"performanceFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_admin","type":"address"}],"name":"setAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_boostWeight","type":"uint256"}],"name":"setBoostWeight","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_durationFactor","type":"uint256"}],"name":"setDurationFactor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_durationFactorOverdue","type":"uint256"}],"name":"setDurationFactorOverdue","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"},{"internalType":"bool","name":"_free","type":"bool"}],"name":"setFreeOverdueFeeUser","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"},{"internalType":"bool","name":"_free","type":"bool"}],"name":"setFreePerformanceFeeUser","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"},{"internalType":"bool","name":"_free","type":"bool"}],"name":"setFreeWithdrawFeeUser","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_maxLockDuration","type":"uint256"}],"name":"setMaxLockDuration","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_operator","type":"address"}],"name":"setOperator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_overdueFee","type":"uint256"}],"name":"setOverdueFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_performanceFee","type":"uint256"}],"name":"setPerformanceFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_treasury","type":"address"}],"name":"setTreasury","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_unlockFreeDuration","type":"uint256"}],"name":"setUnlockFreeDuration","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_withdrawFee","type":"uint256"}],"name":"setWithdrawFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_withdrawFeePeriod","type":"uint256"}],"name":"setWithdrawFeePeriod","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"token","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalBoostDebt","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalLockedAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalShares","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"treasury","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"unlock","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"userInfo","outputs":[{"internalType":"uint256","name":"shares","type":"uint256"},{"internalType":"uint256","name":"lastDepositedTime","type":"uint256"},{"internalType":"uint256","name":"lastUserActionAmount","type":"uint256"},{"internalType":"uint256","name":"lastUserActionTime","type":"uint256"},{"internalType":"uint256","name":"lockStartTime","type":"uint256"},{"internalType":"uint256","name":"lockEndTime","type":"uint256"},{"internalType":"uint256","name":"userBoostedShare","type":"uint256"},{"internalType":"bool","name":"locked","type":"bool"},{"internalType":"uint256","name":"lockedAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_shares","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdrawAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"withdrawByAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdrawFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"withdrawFeePeriod","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]