forked from solana-labs/solana-program-library
-
Notifications
You must be signed in to change notification settings - Fork 78
Closed
Description
Instructions
New Instructions
AddLiquidityMiningRewards
arguments
- reserve: Pubkey
- RewardType: Deposit | Borrow
- token address: Pubkey
- token amount: u64
- duration_in_slots: u64
behavior
- transfer rewards to a token account owned by program
ClaimRewards
arguments
- reserve: Pubkey
- reward_id: u64
Modifying existing instructions
Deposit, Repay, Borrow, WIthdraw, Liquidate now all affect rewards calculations, so reward variables have to be "refreshed" at the start of each instruction now.
I think easiest way is to modify _refresh_reserve_interest to also refresh the rewards
State
RewardInfo
struct ReserveRewardInfo {
id: u8,
token_account: Pubkey,
mint: Pubkey,
accumulated_reward_rate: Decimal,
last_updated_slot: u64,
rewards_attributed: Decimal,
total_rewards: u64
}
struct ObligationRewardInfo {
id: u8,
old_accumulator: Decimal,
claimed_rewards: Decimal,
unclaimed_rewards: Decimal
}Other considerations:
- how to handle cases when the lm reward duration is finished? rewards can't accumulate forever. maybe best to have a cancelRewards function so the owner can withdraw
- should we have a way to permissionlessly crank LM rewards? in case reward refreshing causes compute issues. Compute issues are scary because they can break liquidations.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels