Skip to content

Commit b711c0b

Browse files
authored
Merge pull request #91 from mangata-finance/feature/xyk-refactor-mat2
[WIP][MGX-391] cleanup rewards traits
2 parents cbe2bfa + 3aafa06 commit b711c0b

File tree

1 file changed

+14
-82
lines changed

1 file changed

+14
-82
lines changed

frame/mangata-support/src/traits.rs

Lines changed: 14 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -211,84 +211,38 @@ pub trait ProofOfStakeRewardsApi<AccountId> {
211211
+ From<TokenId>
212212
+ Into<TokenId>;
213213

214-
fn claim_rewards_v2(
215-
sender: AccountId,
214+
fn enable(liquidity_token_id: Self::CurrencyId, weight: u8);
215+
216+
fn disable(liquidity_token_id: Self::CurrencyId);
217+
218+
fn is_enabled(
216219
liquidity_token_id: Self::CurrencyId,
217-
amount: Self::Balance,
218-
) -> DispatchResult;
220+
) -> bool;
219221

220-
fn claim_rewards_all_v2(
222+
fn claim_rewards_all(
221223
sender: AccountId,
222224
liquidity_token_id: Self::CurrencyId,
223225
) -> Result<Self::Balance, DispatchError>;
224226

225-
fn update_pool_promotion(
226-
liquidity_token_id: TokenId,
227-
liquidity_mining_issuance_weight: Option<u8>,
228-
) -> DispatchResult;
229-
230-
fn activate_liquidity_v2(
227+
// Activation & deactivation should happen in PoS
228+
fn activate_liquidity(
231229
sender: AccountId,
232230
liquidity_token_id: Self::CurrencyId,
233231
amount: Self::Balance,
234232
use_balance_from: Option<ActivateKind>,
235233
) -> DispatchResult;
236234

237-
fn deactivate_liquidity_v2(
235+
// Activation & deactivation should happen in PoS
236+
fn deactivate_liquidity(
238237
sender: AccountId,
239238
liquidity_token_id: Self::CurrencyId,
240239
amount: Self::Balance,
241240
) -> DispatchResult;
242241

243-
fn current_rewards_time() -> Option<u32>;
244-
245-
fn calculate_rewards_amount_v2(
242+
fn calculate_rewards_amount(
246243
user: AccountId,
247244
liquidity_asset_id: Self::CurrencyId,
248245
) -> Result<Balance, DispatchError>;
249-
250-
fn set_liquidity_minting_checkpoint_v2(
251-
user: AccountId,
252-
liquidity_asset_id: Self::CurrencyId,
253-
liquidity_assets_added: Self::Balance,
254-
use_balance_from: Option<ActivateKind>,
255-
) -> DispatchResult;
256-
257-
fn set_liquidity_burning_checkpoint_v2(
258-
user: AccountId,
259-
liquidity_asset_id: Self::CurrencyId,
260-
liquidity_assets_burned: Self::Balance,
261-
) -> DispatchResult;
262-
}
263-
264-
pub trait CumulativeWorkRewardsApi {
265-
type AccountId: Parameter
266-
+ Member
267-
+ MaybeSerializeDeserialize
268-
+ Debug
269-
+ MaybeDisplay
270-
+ Ord
271-
+ MaxEncodedLen;
272-
273-
fn get_pool_rewards_v2(liquidity_asset_id: TokenId) -> Option<U256>;
274-
275-
fn claim_rewards_all_v2(
276-
user: Self::AccountId,
277-
liquidity_asset_id: TokenId,
278-
) -> Result<Balance, DispatchError>;
279-
280-
fn set_liquidity_minting_checkpoint_v2(
281-
user: Self::AccountId,
282-
liquidity_asset_id: TokenId,
283-
liquidity_assets_added: Balance,
284-
use_balance_from: Option<ActivateKind>,
285-
) -> DispatchResult;
286-
287-
fn set_liquidity_burning_checkpoint_v2(
288-
user: Self::AccountId,
289-
liquidity_asset_id: TokenId,
290-
liquidity_assets_burned: Balance,
291-
) -> DispatchResult;
292246
}
293247

294248
pub trait PreValidateSwaps {
@@ -474,30 +428,8 @@ pub trait PoolCreateApi {
474428
) -> Option<(TokenId, Balance)>;
475429
}
476430

477-
pub trait RewardsApi {
478-
type AccountId: Parameter
479-
+ Member
480-
+ MaybeSerializeDeserialize
481-
+ Debug
482-
+ MaybeDisplay
483-
+ Ord
484-
+ MaxEncodedLen;
485-
486-
/// checks whether given pool is promoted and tokens
487-
/// can be activated
488-
fn can_activate(liquidity_asset_id: TokenId) -> bool;
489-
490-
/// Activates liquidity tokens for rewards minting
491-
fn activate_liquidity_tokens(
492-
user: &Self::AccountId,
493-
liquidity_asset_id: TokenId,
494-
amount: Balance,
495-
) -> DispatchResult;
496-
497-
fn update_pool_promotion(
498-
liquidity_token_id: TokenId,
499-
liquidity_mining_issuance_weight: Option<u8>,
500-
);
431+
pub trait LiquidityMiningApi {
432+
fn distribute_rewards(liquidity_mining_rewards: Balance);
501433
}
502434

503435
pub trait AssetRegistryApi {

0 commit comments

Comments
 (0)