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

uint256 totalShares

lastHarvestedTime

uint256 lastHarvestedTime

totalLockedShares

uint256 totalLockedShares

accXWINperLockedShare

uint256 accXWINperLockedShare

treasury

address treasury

lockedRewardsVault

uint256 lockedRewardsVault

performanceFee

uint256 performanceFee

callFee

uint256 callFee

blocksPerDay

uint256 blocksPerDay

xwinpid

uint256 xwinpid

lockpid

uint256 lockpid

Deposit

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) external

masterChefDeposit

function masterChefDeposit() external

deposit

function deposit(uint256 _amount, uint8 _duration) external

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

function harvest() public

Re-invest rewards for compounding rewards

_harvest

function _harvest() internal

harvestLockBonus

function harvestLockBonus() internal

Collect locking bonus

withdraw

function withdraw() external

Withdraws everything from user

_earn

function _earn() internal

Reinvest reward tokens into MasterChef to compound staking rewards

setTreasury

function setTreasury(address _treasury) external

Sets treasury address

Only callable by the contract owner.

setFees

function setFees(uint256 _callFee, uint256 _performanceFee) external

Sets call fee and performance fee

Only callable by the contract admin.

setBlocksPerDay

function setBlocksPerDay(uint256 _blocksPerDay) external

migrateMasterChef

function migrateMasterChef(address _newMasterChef, uint256 _xwinpid, uint256 _lockpid) external

calculateHarvestCakeRewards

function calculateHarvestCakeRewards() external view returns (uint256)

Calculates the expected harvest reward from third party

Return Values

Name
Type
Description

[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

Name
Type
Description

[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

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

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

Name
Type
Description

_amount

uint256

Amount to be deposited

_duration

uint8

Duration to be locked

Last updated