VStaker

Implements staking of LP Tokens and of VRSW tokens

VStaker allows users to stake their LP Tokens and their VRSW tokens, and calculates rewards that accrue to users according to their stakes.

A single VStaker instance can exist per VirtuSwap deployment on a network.

Events

event StakeVrsw

event StakeVrsw(
    address who, 
    uint256 amount);

Emitted when someone stakes VRSW

event StakeLp

event StakeLp(
    address who, 
    address lpToken,
    uint256 amount);

Emitted when someone stakes an LP token of a VirtuSwap Pool

event RewardsClaimed

event RewardsClaimed(
    address who, 
    address lpToken,
    uint256 amount);

Emitted when rewards on a pool are claimed

event UnstakeVrsw

event UnstakeVrsw(
    address who, 
    uint256 amount);

Emitted when someone unstakes VRSW tokens

event UnstakeLp

event UnstakeLp(
    address who,
    address lpToken, 
    uint256 amount);

Emitted when someone unstakes LP tokens

event LockVrsw

event LockVrsw(
    address who, 
    uint256 amount,
    uint256 lockDuration);

Emitted when someone locks VRSW tokens for lockDuration seconds

event LockStakedVrsw

event LockStakedVrsw(
    address who, 
    uint256 amount,
    uint256 lockDuration);

Emitted when someone locks staked VRSW tokens for lockDuration seconds

event UnlockVrsw

event UnlockVrsw(
    address who, 
    uint256 amount);

Emitted when someone unlocks VRSW tokens

State-Changing Functions

function stakeVrsw

function stakeVrsw(uint256 amount) external;

Stakes VRSW tokens into the Staker. The caller receives the same amount of veVRSW tokens.

Emits StakeVrsw event

Parameters:

Name
Type
Description

amount

uint256

Amount to stake

function stakeLp

function stakeLP(address lpToken, uint256 amount) external;

Stakes LP tokens into the Staker

Emits StakeLp event

Parameters:

Name
Type
Description

lpToken

address

Address of the LP token being staked

amount

uint256

Amount to stake

function unstakeVrsw

function stakeVrsw(uint256 amount) external;

Unstakes VRSW tokens from the Staker, burning the same amount of veVRSW. Caller must have staked at least the amount previously

Parameters:

Name
Type
Description

amount

uint256

Amount to stake

function unstakeLp

function unstakeLP(address lpToken, uint256 amount) external;

Unstakes LP tokens from the staker. Caller must have staked at least the amount previously

Parameters:

Name
Type
Description

lpToken

address

Address of the LP token being unstaked

amount

uint256

Amount to stake

function lockVrsw

function lockVrsw(uint256 amount, uint256 lockDuration) external;

Allows the user to lock VRSW tokens in the contract for a specified duration of time.

Locking Vrsw tokens boosts the protocol rewards for the locker.

Parameters:

Name
Type
Description

amount

uint256

Amount to stake

lockDuration

uint256

lock duration in seconds

function lockStakedVrsw

function lockStakedVrsw(uint256 amount, uint256 lockDuration) external;

Allows the user to lock staked VRSW tokens in the contract for a specified duration of time.

Locking staked VRSW tokens boosts the protocol rewards for the locker.

Parameters:

Name
Type
Description

amount

uint256

Amount to stake

lockDuration

uint256

lock duration in seconds

function claimRewards

function claimRewards(
    address lpToken
) external override

Allows a user to claim their accrued VRSW rewards. The sender's accrued rewards are calculated according to the Tokenomics formulas. The rewards claimed are transferred to the user's address using the transferRewards function of the vMinter contract.

Read-Only Functions

function checkLock

function checkLock(
    address who
) external view returns (uint[] memory unlockedPositions);

Checks for any stake positions of a given users that are currently unlocked

Parameters:

Name
Type
Description

who

address

Address of the wallet to check for

function viewRewards

function viewRewards(
        address who,
        address lpToken) 
external view returns (uint256 rewards);

Returns the amount of VRSW rewards that a user has accrued in a given VirtuSwap pool, but not yet claimed

Parameters:

Name
Type
Description

who

address

Address of the wallet to check for

lpToken

address

Address of the LP Token representing the pool

function viewVrswStakes

function viewVrswStakes() 
    external view 
    returns (VrswStake[] memory stakes);

Returns an array of VrswStake structures containing information about the caller's VRSW stakes

Parameters:

Name
Type
Description

who

address

Address of the wallet to check for

function viewLpStakes

function viewLpStakes() 
    external view 
    returns (LpStake[] memory stakes);

Returns an array of LpStake structures containing information about the caller's LP Token stakes

Parameters:

Name
Type
Description

who

address

Address of the wallet to check for

function isLpTokenValid

function isLpTokenValid(address lpToken) 
    external view returns (bool);

Checks if a given address represents a valid VirtuSwap pool LP token.

Last updated