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

multi currency incentive rewards #1396

Merged
merged 15 commits into from
Sep 15, 2021
628 changes: 366 additions & 262 deletions modules/incentives/src/lib.rs

Large diffs are not rendered by default.

504 changes: 504 additions & 0 deletions modules/incentives/src/migrations.rs

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions modules/incentives/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ use frame_support::{
construct_runtime,
dispatch::{DispatchError, DispatchResult},
ord_parameter_types, parameter_types,
weights::constants::RocksDbWeight,
};
use frame_system::EnsureSignedBy;
use orml_traits::parameter_type_with_key;
Expand Down Expand Up @@ -55,8 +56,7 @@ ord_parameter_types! {
pub const ALICE: AccountId = AccountId::from([1u8; 32]);
pub const BOB: AccountId = AccountId::from([2u8; 32]);
pub const VAULT: AccountId = IncentivesModule::account_id();
pub const UNRELEASED: AccountId = AccountId::from([3u8; 32]);
pub const VALIDATOR: AccountId = AccountId::from([4u8; 32]);
pub const RewardsSource: AccountId = AccountId::from([3u8; 32]);
pub const ROOT: AccountId = AccountId32::new([255u8; 32]);
}

Expand All @@ -83,7 +83,7 @@ impl frame_system::Config for Runtime {
type AccountData = pallet_balances::AccountData<Balance>;
type OnNewAccount = ();
type OnKilledAccount = ();
type DbWeight = ();
type DbWeight = RocksDbWeight;
type BaseCallFilter = ();
type SystemWeightInfo = ();
type SS58Prefix = ();
Expand Down Expand Up @@ -243,12 +243,14 @@ impl EmergencyShutdown for MockEmergencyShutdown {
impl orml_rewards::Config for Runtime {
type Share = Balance;
type Balance = Balance;
type PoolId = PoolId<AccountId>;
type PoolIdV0 = PoolIdV0<AccountId>;
type PoolIdConvertor = PoolIdConvertor<Runtime>;
type PoolId = PoolId;
type CurrencyId = CurrencyId;
type Handler = IncentivesModule;
}

parameter_types! {
pub NativeRewardsSource: AccountId = UNRELEASED::get();
pub const AccumulatePeriod: BlockNumber = 10;
pub const NativeCurrencyId: CurrencyId = ACA;
pub const StableCurrencyId: CurrencyId = AUSD;
Expand All @@ -263,12 +265,12 @@ ord_parameter_types! {
impl Config for Runtime {
type Event = Event;
type RelaychainAccountId = AccountId;
type NativeRewardsSource = NativeRewardsSource;
type RewardsSource = RewardsSource;
type AccumulatePeriod = AccumulatePeriod;
type NativeCurrencyId = NativeCurrencyId;
type StableCurrencyId = StableCurrencyId;
type LiquidCurrencyId = LiquidCurrencyId;
type UpdateOrigin = EnsureSignedBy<Root, AccountId>;
type UpdateOrigin = EnsureSignedBy<ROOT, AccountId>;
type CDPTreasury = MockCDPTreasury;
type Currency = TokensModule;
type DEX = MockDEX;
Expand Down Expand Up @@ -299,9 +301,7 @@ pub struct ExtBuilder {

impl Default for ExtBuilder {
fn default() -> Self {
Self {
balances: vec![(UNRELEASED::get(), ACA, 10_000)],
}
Self { balances: vec![] }
}
}

Expand Down
Loading