Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance Non-Rowan Yield Reward Functionality with Optional Duration Feature #3442

Open
creightontaylor opened this issue Jan 26, 2024 · 1 comment

Comments

@creightontaylor
Copy link

Currently, the Sifchain codebase includes a feature for non-Rowan yield rewards, where users can add non-Rowan liquidity to a reward bucket. The system then automatically distributes the entire liquidity in the bucket to the corresponding liquidity pool. This is a valuable functionality, but it could be further enhanced for better flexibility and utility.

Feature Request:
I propose adding an optional duration parameter to this existing functionality. When this duration is set, any new liquidity added to the reward bucket should not be distributed immediately in its entirety. Instead, it would be more beneficial if the distribution of this new liquidity is spread out over the specified duration. This means the liquidity would be distributed in smaller, incremental portions throughout the duration period, rather than all at once.

Benefits:

Controlled Distribution: This enhancement would allow for a more controlled and gradual distribution of liquidity, which could be beneficial for managing market impact and providing a more steady support to the liquidity pool.
Flexibility for Users: Users who contribute liquidity can have more options in terms of how their assets are utilized over time.
Enhanced Strategic Options: This feature could open up new strategic possibilities for liquidity management within the Sifchain ecosystem.
I believe this enhancement will add significant value to the Sifchain platform, offering greater control and flexibility to users in the management of non-Rowan liquidity rewards.

@Sifchain Sifchain deleted a comment from Haste171 Jan 27, 2024
@sif-taskforce
Copy link

sif-taskforce commented Feb 28, 2024

1. 📝 Indexing

I'm indexing the files within your repository.

2. 🔎 Searching

I'm searching for relevant snippets in your repository.

I found the following snippets in your repository.

View Snippets

https://github.com/Sifchain/sifnode/blob/main/x/dispensation/claims.md#L0-L30

https://github.com/Sifchain/sifnode/blob/main/x/dispensation/claims.md#L15-L30

https://github.com/Sifchain/sifnode/blob/main/ui/README.md#L0-L133

https://github.com/Sifchain/sifnode/blob/main/docs/clp/clp-adr.md#L0-L201

https://github.com/Sifchain/sifnode/blob/main/smart-contracts/Deployment.md#L0-L105

3. 🌐 Planning

I'm creating a plan for the discussion and coding steps.

I have created the following workflow as a basis for how the discussion and coding will be derived.

💡 Steps

Modify Claims Documentation

Action: modify
File: x/dispensation/claims.md
Lines: [1, 31]
Dependencies: []
Instructions: In the 'x/dispensation/claims.md' file, update the documentation to include a section on the optional duration parameter for liquidity distribution. This section should explain how the distribution method changes with the duration parameter, allowing liquidity to be spread out incrementally over the set duration instead of being released all at once. Reference the 'General use case' section for context on how claims are currently processed and highlight the benefits of having a controlled distribution method.

Add Duration Parameter to Liquidity Rewards Distribution Function

Action: modify
File: x/clp/keeper/add_liquidity_to_rewards_bucket.go
Lines: [1, 50]
Dependencies: ['Step 1']
Instructions: In the 'x/clp/keeper/add_liquidity_to_rewards_bucket.go' file, modify the 'AddLiquidityToRewardsBucket' function to accept an additional parameter 'duration'. This parameter should specify the time over which the added liquidity is to be distributed. Update the function's logic to ensure that the distribution of rewards is spread out over the specified duration. This involves adjusting the calculation of rewards per block or per epoch to account for the total distribution period.

Update MsgAddLiquidityToRewardsBucket Message

Action: modify
File: x/clp/types/message_add_liquidity_to_rewards_bucket.go
Lines: [10, 30]
Dependencies: ['Step 2']
Instructions: Modify the 'MsgAddLiquidityToRewardsBucket' message in 'x/clp/types/message_add_liquidity_to_rewards_bucket.go' to include a new field 'Duration' of type 'int64'. This field represents the duration over which the liquidity is to be distributed. Ensure that the message validation logic is updated to check for a valid duration value (e.g., non-negative).

Update Handler to Process Duration Parameter

Action: modify
File: x/clp/handler.go
Lines: [50, 100]
Dependencies: ['Step 3']
Instructions: In the 'x/clp/handler.go' file, update the handler for 'MsgAddLiquidityToRewardsBucket' to extract the 'Duration' parameter from the message and pass it to the 'AddLiquidityToRewardsBucket' function. Ensure that the handler correctly processes the duration parameter and that any necessary validation is performed before calling the function.

Update CLI Command for Adding Liquidity to Rewards Bucket

Action: modify
File: x/clp/client/cli/tx_add_liquidity_to_rewards_bucket.go
Lines: [1, 50]
Dependencies: ['Step 4']
Instructions: Modify the CLI command for adding liquidity to the rewards bucket in 'x/clp/client/cli/tx_add_liquidity_to_rewards_bucket.go' to accept a new flag '--duration' that specifies the distribution duration. Update the command logic to include the duration in the 'MsgAddLiquidityToRewardsBucket' message. Provide clear instructions in the command's help text explaining the purpose of the duration parameter and how to use it.

I have created the following workflow as a basis for how the discussion and coding will be derived.

💡 Steps

Modify Claims Documentation

Action: modify
File: x/dispensation/claims.md
Lines: [1, 31]
Dependencies: []
Instructions: In the 'x/dispensation/claims.md' file, update the documentation to include a section on the optional duration parameter for liquidity distribution. This section should explain how the distribution method changes with the duration parameter, allowing liquidity to be spread out incrementally over the set duration instead of being released all at once. Reference the 'General use case' section for context on how claims are currently processed and highlight the benefits of having a controlled distribution method.

Add Duration Parameter to Liquidity Rewards Distribution Function

Action: modify
File: x/clp/keeper/add_liquidity_to_rewards_bucket.go
Lines: [1, 50]
Dependencies: ['Step 1']
Instructions: In the 'x/clp/keeper/add_liquidity_to_rewards_bucket.go' file, modify the 'AddLiquidityToRewardsBucket' function to accept an additional parameter 'duration'. This parameter should specify the time over which the added liquidity is to be distributed. Update the function's logic to ensure that the distribution of rewards is spread out over the specified duration. This involves adjusting the calculation of rewards per block or per epoch to account for the total distribution period.

Update MsgAddLiquidityToRewardsBucket Message

Action: modify
File: x/clp/types/message_add_liquidity_to_rewards_bucket.go
Lines: [10, 30]
Dependencies: ['Step 2']
Instructions: Modify the 'MsgAddLiquidityToRewardsBucket' message in 'x/clp/types/message_add_liquidity_to_rewards_bucket.go' to include a new field 'Duration' of type 'int64'. This field represents the duration over which the liquidity is to be distributed. Ensure that the message validation logic is updated to check for a valid duration value (e.g., non-negative).

Update Handler to Process Duration Parameter

Action: modify
File: x/clp/handler.go
Lines: [50, 100]
Dependencies: ['Step 3']
Instructions: In the 'x/clp/handler.go' file, update the handler for 'MsgAddLiquidityToRewardsBucket' to extract the 'Duration' parameter from the message and pass it to the 'AddLiquidityToRewardsBucket' function. Ensure that the handler correctly processes the duration parameter and that any necessary validation is performed before calling the function.

Update CLI Command for Adding Liquidity to Rewards Bucket

Action: modify
File: x/clp/client/cli/tx_add_liquidity_to_rewards_bucket.go
Lines: [1, 50]
Dependencies: ['Step 4']
Instructions: Modify the CLI command for adding liquidity to the rewards bucket in 'x/clp/client/cli/tx_add_liquidity_to_rewards_bucket.go' to accept a new flag '--duration' that specifies the distribution duration. Update the command logic to include the duration in the 'MsgAddLiquidityToRewardsBucket' message. Provide clear instructions in the command's help text explaining the purpose of the duration parameter and how to use it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants