xWin Locked Stake

xWinLockedStake

UserInfo

struct UserInfo {
  uint256 shares;
  uint256 amount;
  uint256 lockedShares;
  uint256 rewardDebt;
  uint256 startTimestamp;
  uint256 endPeriodTimestamp;
  uint256 xWinFavor;
}

token

contract IERC20Upgradeable token

masterChef

contract xWinMasterChef masterChef

userInfo

mapping(address => struct xWinLockedStake.UserInfo) userInfo

totalShares

lastHarvestedTime

totalLockedShares

accXWINperLockedShare

treasury

lockedRewardsVault

performanceFee

callFee

blocksPerDay

xwinpid

lockpid

Deposit

Withdraw

Harvest

initialize

masterChefDeposit

deposit

Deposit into locked staking farm If locked position already exists, this function acts to deposit more and extend locking period

Parameters

Name
Type
Description

_amount

uint256

Amount of xWin Tokens to deposit

_duration

uint8

Duration to lock

harvest

Re-invest rewards for compounding rewards

_harvest

harvestLockBonus

Collect locking bonus

withdraw

Withdraws everything from user

_earn

Reinvest reward tokens into MasterChef to compound staking rewards

setTreasury

Sets treasury address

Only callable by the contract owner.

setFees

Sets call fee and performance fee

Only callable by the contract admin.

setBlocksPerDay

migrateMasterChef

calculateHarvestCakeRewards

Calculates the expected harvest reward from third party

Return Values

Name
Type
Description

[0]

uint256

Expected reward to collect in CAKE

calculateTotalPendingCakeRewards

Calculates the total pending rewards that can be restaked

Return Values

Name
Type
Description

[0]

uint256

Returns total pending cake rewards

_doWithdraw

withdraws the user's entire position from both lock bonus and staking

getPricePerFullShare

Calculates the price per share

available

Custom logic for how much the vault allows to be borrowed

The contract puts all of the tokens except for lockedRewards to work.

getFavor

totalXWINBalance

Calculates the total underlying tokens

It includes tokens held by the contract and held in MasterChef

shareMultiplier

getUserPosition

Views a user's current position

Parameters

Name
Type
Description

_user

address

Address of user

Return Values

Name
Type
Description

rewardAmount

uint256

xWin Token amount from locking reward

xwinAmount

uint256

xWin Tokens amount from staking

convertWeeksToTimestamp

getUserCompoundAPYrate

Returns user's daily reward rate

getUserLockingBonusAPR

Gets the user's rate from lock duration bonus

getEstimatedDepositAPY

Given an amount and duration, return the user's rate and bonus rate

Parameters

Name
Type
Description

_amount

uint256

Amount to be deposited

_duration

uint8

Duration to be locked

Last updated