Stake Position

Staked position package

This package provides an interface to the staked position manipulation. The main entry point is the StakedPosition structure.

Opening a position

A user can open a position by using the stake function. When opening a position, a user has to specify the lock duration period in milliseconds. The lock duration should respect the boundaries set during the Afterburner Vault configuration.

A locked position will receive bonus rewards in respect of the configured Afterburner Vault’s multiplier.

Harvesting rewards

Rewards harvesting is a three-stage process:

  • a user has to call the begin_harvest<STAKE> function;

  • for each reward, a user should call the harvest_rewards<STAKE, REWARD> function. It will allow the user to obtain rewards accrued for the type `Coin<REWARD>`;

  • to finalize the process a user has to call the end_harvest function which emits the corresponding event.

For a Strict implementation, a user can claim their rewards at any moment.

For a Relaxed implementation, a user can claim their rewards only after the position is unlocked.

Adding to a stake

At any given moment a user can increase the position’s staked amount by using the deposit_principal function. After increasing the stake of a locked position, the lock period is recalculated.

Withdrawing a stake

A user may withdraw the staked principal by using the withdraw_principal<STAKE> function. The position must be unlocked in order to withdraw from it.

It is not possible to unlock a position staked in the Strict Afterburner Vault before the end of the lock period.

Prolonging a position's lock

A user may increase a lock period by using the renew_lock function.

Joining positions

A user may merge two positions by using the join function. The resulting position will have the most recent lock start time and the longer lock duration between the two positions.

Splitting positions

A user may split a position into two by using the split function. The accumulated rewards are split between the two positions determined by the pro-rata amount being split over the total staked amount. All other parameters are kept identical to the original position.

Closing a position

A user may delete an inactive position by using the destroy function. The destroyed position must not have any principal or rewards remaining.

Last updated