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

Feature/3rdparty rewards #98

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions frame/mangata-support/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ std = [
"codec/std",
"sp-core/std"
]
runtime-benchmarks = []
37 changes: 37 additions & 0 deletions frame/mangata-support/src/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
multipurpose_liquidity::{ActivateKind, BondKind},
Balance, TokenId,
};
use sp_core::U256;

Check warning on line 8 in frame/mangata-support/src/traits.rs

View workflow job for this annotation

GitHub Actions / build

unused import: `sp_core::U256`
use sp_runtime::{
traits::{AtLeast32BitUnsigned, MaybeDisplay},
Permill,
Expand Down Expand Up @@ -211,12 +211,44 @@
+ From<TokenId>
+ Into<TokenId>;

#[deprecated(note = "Use `enable_native_rewards` instead.")]
fn enable(liquidity_token_id: Self::CurrencyId, weight: u8);

fn enable_native_rewards(liquidity_token_id: Self::CurrencyId, weight: u8) {
Self::enable(liquidity_token_id, weight)
}

#[deprecated(note = "Use `disable_native_rewards` instead.")]
fn disable(liquidity_token_id: Self::CurrencyId);

fn disable_native_rewards(liquidity_token_id: Self::CurrencyId, weight: u8) {
Self::disable(liquidity_token_id)
}

#[deprecated(note = "Use `native_rewards_enabled` instead.")]
fn is_enabled(liquidity_token_id: Self::CurrencyId) -> bool;

fn native_rewards_enabled(liquidity_token_id: Self::CurrencyId) -> bool {
Self::is_enabled(liquidity_token_id)
}

#[cfg(feature = "runtime-benchmarks")]
fn enable_3rdparty_rewards(
account: AccountId,
pool: (Self::CurrencyId, Self::CurrencyId),
reward_token_id: Self::CurrencyId,
last_block: u32,
amount: Self::Balance,
);

#[cfg(feature = "runtime-benchmarks")]
fn activate_liquidity_for_3rdparty_rewards(
account: AccountId,
liquidity_token: Self::CurrencyId,
amount: Self::Balance,
reward_token_id: Self::CurrencyId,
);

fn claim_rewards_all(
sender: AccountId,
liquidity_token_id: Self::CurrencyId,
Expand Down Expand Up @@ -392,6 +424,11 @@
liquidity_token_amount: Self::Balance,
) -> Self::Balance;

fn valuate_non_liquidity_token(
liquidity_token_id: Self::CurrencyId,
liquidity_token_amount: Self::Balance,
) -> Self::Balance;

fn scale_liquidity_by_mga_valuation(
mga_valuation: Self::Balance,
liquidity_token_amount: Self::Balance,
Expand Down
1 change: 1 addition & 0 deletions primitives/mangata-types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@ std = [
'scale-info/std',
'sp-core/std',
'sp-runtime/std',
'sp-std/std',
]
Loading