๐ฐIncentive
The incentive contract is responsible for distributing the flow rewards to the LPs. It is also responsible for managing the liquidity flows and positions. Incentive contracts allow any user to incentivize a pool. External users can then create positions to get rewards from flows by locking their LP tokens. Users will receive rewards for each active flow.
What is a flow?
So every incentive contract is able to have multiple flows. A flow is a stream of rewards that are distributed among users who lock their LP tokens. A flow has a start and end epoch, and a curve that determines how the rewards are distributed. A flow can be open, expanded and closed.
A flow is open when it is created, and users can add to their positions.
The flow can only be closed by the flow creator or the contract admin. When a flow is closed, the unclaimed rewards are returned to the creator.
The flow can be expanded indefinitely, but due to some limitations, the flow gets "reset" after a period of 180 epochs. When a flow gets reset, nothing changes for you as a flow creator in practice, as the flow continues to distribute rewards as usual. If you are a user however, you will need to claim your rewards within those 180 epochs (about 6 months), otherwise you will lose the rewards you were entitled to as they will become claimable by all the LP holders.
Instantiate
Instantiates an instance of the incentive contract
Key | Type | Description |
---|---|---|
| AssetInfo | Information about the LP asset |
| String | Fee distributor contract address |
ExecuteMsg
TakeGlobalWeightSnapshot
Makes a snapshot of the current global weight, at the current epoch. Used to accurately calculate the rewards share.
OpenFlow
Opens a new liquidity flow.
Key | Type | Description |
---|---|---|
| Option<u64> | The epoch at which the flow should start. If unspecified, the flow will start at the current epoch. |
| Option<u64> | The epoch at which the flow should end. If unspecified, the flow will end in 14 epochs, or 2 weeks if the epoch is set to last a day. |
| Option<Curve> | The type of distribution curve. If not set, the default curve will be Linear. |
| Asset | The asset to be distributed in this flow. |
| Option<String> | If set, the label will be used to identify the flow, in addition to the flow_id. |
Expand Flow
Expands an existing flow.
Key | Type | Description |
---|---|---|
| FlowIdentifier | The identifier of the flow to expand, whether an id or a label. |
| Option<u64> | The epoch at which the flow should end. If not set, the flow will be expanded a default value of 14 epochs. |
| Asset | The asset to expand this flow with. |
CloseFlow
Closes an existing liquidity flow. Sender of the message must either be the contract admin or the creator of the flow.
Key | Type | Description |
---|---|---|
| FlowIdentifier | The identifier of the flow to close. |
OpenPosition
Creates a new position to earn flow rewards.
Key | Type | Description |
---|---|---|
| Uint128 | The amount to add to the position. |
| u64 | The amount of time (in seconds) before the LP tokens can be redeemed. |
| Option<String> | The receiver of the new position. This is mostly used for the frontend helper contract. If left empty, defaults to the message sender. |
ExpandPosition
Expands an existing position to earn more flow rewards.
Key | Type | Description |
---|---|---|
| Uint128 | The amount to add to the existing position. |
| u64 | The unbond completion timestamp to identify the position to add to. |
| Option<String> | The receiver of the expanded position. This is mostly used for the frontend helper contract. If left empty, defaults to the message sender. |
ClosePosition
Closes an existing position to stop earning flow rewards.
Key | Type | Description |
---|---|---|
| u64 | The unbonding duration of the position to close. |
Withdraw
Withdraws the LP tokens from a closed position once the unbonding duration has passed.
Claim
Claims the flow rewards.
QueryMsg
Config
Retrieves the current contract configuration.
Flow
Retrieves a specific flow. If start_epoch and end_epoch are set, the asset_history and emitted_tokens will be filtered to only include epochs within the range. The maximum gap between the start_epoch and end_epoch is 100 epochs.
Key | Type | Description |
---|---|---|
| FlowIdentifier | The id of the flow to find. |
| Option<u64> | If set, filters the asset_history and emitted_tokens to only include epochs from start_epoch |
| Option<u64> | If set, filters the asset_history and emitted_tokens to only include epochs until end_epoch |
Flows
Retrieves the current flows. If start_epoch and end_epoch are set, the asset_history and emitted_tokens will be filtered to only include epochs within the range. The maximum gap between the start_epoch and end_epoch is 100 epochs.
Key | Type | Description |
---|---|---|
| Option<u64> | If set, filters the asset_history and emitted_tokens to only include epochs from start_epoch |
| Option<u64> | If set, filters the asset_history and emitted_tokens to only include epochs until end_epoch |
Positions
Retrieves the positions for an address.
Key | Type | Description |
---|---|---|
| String | The address to query. |
Rewards
Retrieves the rewards for an address.
Key | Type | Description |
---|---|---|
| String | The address to query. |
GlobalWeight
Retrieves the global weight for an epoch.
Key | Type | Description |
---|---|---|
| u64 | The epoch to get the global weight for. |
CurrentEpochRewardsShare
Retrieves the rewards share of an address for the current epoch.
Key | Type | Description |
---|---|---|
| String | The address to query. |
Last updated