xWin Locked Stake
xWinLockedStake
UserInfo
struct UserInfo {
uint256 shares;
uint256 amount;
uint256 lockedShares;
uint256 rewardDebt;
uint256 startTimestamp;
uint256 endPeriodTimestamp;
uint256 xWinFavor;
}token
contract IERC20Upgradeable tokenmasterChef
contract xWinMasterChef masterChefuserInfo
mapping(address => struct xWinLockedStake.UserInfo) userInfototalShares
uint256 totalShareslastHarvestedTime
uint256 lastHarvestedTimetotalLockedShares
uint256 totalLockedSharesaccXWINperLockedShare
uint256 accXWINperLockedSharetreasury
address treasurylockedRewardsVault
uint256 lockedRewardsVaultperformanceFee
uint256 performanceFeecallFee
uint256 callFeeblocksPerDay
uint256 blocksPerDayxwinpid
uint256 xwinpidlockpid
uint256 lockpidDeposit
event Deposit(address sender, uint256 amount, uint256 shares)Withdraw
event Withdraw(address sender, uint256 amount, uint256 shares)Harvest
event Harvest(address sender, uint256 performanceFee, uint256 callFee)initialize
function initialize(contract IERC20Upgradeable _token, address _masterChef, address _treasury, uint256 _xwinpid, uint256 _lockpid) externalmasterChefDeposit
function masterChefDeposit() externaldeposit
function deposit(uint256 _amount, uint8 _duration) externalDeposit into locked staking farm If locked position already exists, this function acts to deposit more and extend locking period
Parameters
_amount
uint256
Amount of xWin Tokens to deposit
_duration
uint8
Duration to lock
harvest
function harvest() publicRe-invest rewards for compounding rewards
_harvest
function _harvest() internalharvestLockBonus
function harvestLockBonus() internalCollect locking bonus
withdraw
function withdraw() externalWithdraws everything from user
_earn
function _earn() internalReinvest reward tokens into MasterChef to compound staking rewards
setTreasury
function setTreasury(address _treasury) externalSets treasury address
Only callable by the contract owner.
setFees
function setFees(uint256 _callFee, uint256 _performanceFee) externalSets call fee and performance fee
Only callable by the contract admin.
setBlocksPerDay
function setBlocksPerDay(uint256 _blocksPerDay) externalmigrateMasterChef
function migrateMasterChef(address _newMasterChef, uint256 _xwinpid, uint256 _lockpid) externalcalculateHarvestCakeRewards
function calculateHarvestCakeRewards() external view returns (uint256)Calculates the expected harvest reward from third party
Return Values
[0]
uint256
Expected reward to collect in CAKE
calculateTotalPendingCakeRewards
function calculateTotalPendingCakeRewards() external view returns (uint256)Calculates the total pending rewards that can be restaked
Return Values
[0]
uint256
Returns total pending cake rewards
_doWithdraw
function _doWithdraw(struct xWinLockedStake.UserInfo user) internal returns (uint256)withdraws the user's entire position from both lock bonus and staking
getPricePerFullShare
function getPricePerFullShare() external view returns (uint256)Calculates the price per share
available
function available() public view returns (uint256)Custom logic for how much the vault allows to be borrowed
The contract puts all of the tokens except for lockedRewards to work.
getFavor
function getFavor(address _user) external view returns (uint256)totalXWINBalance
function totalXWINBalance() public view returns (uint256)Calculates the total underlying tokens
It includes tokens held by the contract and held in MasterChef
shareMultiplier
function shareMultiplier(uint256 amount, uint8 period) public pure returns (uint256)getUserPosition
function getUserPosition(address _user) public view returns (uint256 rewardAmount, uint256 xwinAmount)Views a user's current position
Parameters
_user
address
Address of user
Return Values
rewardAmount
uint256
xWin Token amount from locking reward
xwinAmount
uint256
xWin Tokens amount from staking
convertWeeksToTimestamp
function convertWeeksToTimestamp(uint256 w) internal pure returns (uint256)getUserCompoundAPYrate
function getUserCompoundAPYrate(address _user) external view returns (uint256 estimatedDailyRate)Returns user's daily reward rate
getUserLockingBonusAPR
function getUserLockingBonusAPR(address _user) external view returns (uint256 apr)Gets the user's rate from lock duration bonus
getEstimatedDepositAPY
function getEstimatedDepositAPY(uint256 _amount, uint8 _duration) external view returns (uint256 estimatedDailyRate, uint256 estimatedBonusApr)Given an amount and duration, return the user's rate and bonus rate
Parameters
_amount
uint256
Amount to be deposited
_duration
uint8
Duration to be locked
Last updated