# 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.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.aftermath.finance/farms/architecture/stake-position.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
