Skip to content

Commit

Permalink
Update Runtime and mocks with EFE
Browse files Browse the repository at this point in the history
  • Loading branch information
balqaasem committed Sep 2, 2021
1 parent 2033baf commit f283b53
Show file tree
Hide file tree
Showing 9 changed files with 147 additions and 130 deletions.
45 changes: 24 additions & 21 deletions lib-serml/serp/serp-treasury/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,30 @@ impl orml_currencies::Config for Runtime {
type WeightInfo = ();
}

parameter_types! {
pub StableCurrencyIds: Vec<CurrencyId> = vec![
SETR,
SETCHF,
SETEUR,
SETGBP,
SETSAR,
SETUSD,
];
pub const SetterCurrencyId: CurrencyId = SETR; // Setter currency ticker is SETR/
pub const GetSetUSDCurrencyId: CurrencyId = SETUSD; // Setter currency ticker is SETUSD/
pub const DirhamCurrencyId: CurrencyId = DRAM; // SettinDEX currency ticker is DRAM/

pub const SerpTreasuryPalletId: PalletId = PalletId(*b"set/serp");
pub const CharityFundAccountId: AccountId = CHARITY_FUND;
pub const SettPayTreasuryAccountId: AccountId = SETRPAY;
pub const CashDropVaultAccountId: AccountId = VAULT;

pub CashDropPeriod: BlockNumber = 120;
}

parameter_types! {
pub const GetExchangeFee: (u32, u32) = (1, 100);
pub const GetStableCurrencyExchangeFee: (u32, u32) = (1, 200); // 0.5%
pub const DexPalletId: PalletId = PalletId(*b"set/sdex");
pub const TradingPathLimit: u32 = 3;
pub EnabledTradingPairs: Vec<TradingPair> = vec![
Expand All @@ -158,7 +180,9 @@ parameter_types! {
impl setheum_dex::Config for Runtime {
type Event = Event;
type Currency = Currencies;
type StableCurrencyIds = StableCurrencyIds;
type GetExchangeFee = GetExchangeFee;
type GetStableCurrencyExchangeFee = GetStableCurrencyExchangeFee;
type TradingPathLimit = TradingPathLimit;
type PalletId = DexPalletId;
type CurrencyIdMapping = ();
Expand Down Expand Up @@ -195,27 +219,6 @@ ord_parameter_types! {
pub const One: AccountId = 1;
}

parameter_types! {
pub StableCurrencyIds: Vec<CurrencyId> = vec![
SETR,
SETCHF,
SETEUR,
SETGBP,
SETSAR,
SETUSD,
];
pub const SetterCurrencyId: CurrencyId = SETR; // Setter currency ticker is SETR/
pub const GetSetUSDCurrencyId: CurrencyId = SETUSD; // Setter currency ticker is SETUSD/
pub const DirhamCurrencyId: CurrencyId = DRAM; // SettinDEX currency ticker is DRAM/

pub const SerpTreasuryPalletId: PalletId = PalletId(*b"set/serp");
pub const CharityFundAccountId: AccountId = CHARITY_FUND;
pub const SettPayTreasuryAccountId: AccountId = SETRPAY;
pub const CashDropVaultAccountId: AccountId = VAULT;

pub CashDropPeriod: BlockNumber = 120;
}

parameter_type_with_key! {
pub MinimumClaimableTransferAmounts: |currency_id: CurrencyId| -> Balance {
match currency_id {
Expand Down
47 changes: 25 additions & 22 deletions lib-serml/setmint/setmint-engine/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,32 @@ impl PriceProvider<CurrencyId> for MockPriceSource {
fn unlock_price(_currency_id: CurrencyId) {}
}

parameter_types! {
pub StableCurrencyIds: Vec<CurrencyId> = vec![
SETR,
SETCHF,
SETEUR,
SETGBP,
SETSAR,
SETUSD,
];
pub const SetterCurrencyId: CurrencyId = SETR; // Setter currency ticker is SETR/
pub const GetSetUSDCurrencyId: CurrencyId = SETUSD; // Setter currency ticker is SETUSD/
pub const DirhamCurrencyId: CurrencyId = DRAM; // SettinDEX currency ticker is DRAM/

pub const SerpTreasuryPalletId: PalletId = PalletId(*b"set/serp");
pub const CharityFundAccountId: AccountId = CHARITY_FUND;
pub const SettPayTreasuryAccountId: AccountId = SETRPAY;
pub const CashDropVaultAccountId: AccountId = VAULT;

pub CashDropPeriod: BlockNumber = 120; // Triggers SERP-TES for serping after Every 60 blocks
pub MaxSlippageSwapWithDEX: Ratio = Ratio::one();
}

parameter_types! {
pub const DexPalletId: PalletId = PalletId(*b"set/sdex");
pub const GetExchangeFee: (u32, u32) = (1, 1000); // 0.1%
pub const GetStableCurrencyExchangeFee: (u32, u32) = (1, 2000); // 0.05%
pub const TradingPathLimit: u32 = 3;
pub EnabledTradingPairs: Vec<TradingPair> = vec![
TradingPair::from_currency_ids(DNAR, SETR).unwrap(),
Expand All @@ -202,36 +225,16 @@ parameter_types! {
impl setheum_dex::Config for Runtime {
type Event = Event;
type Currency = Currencies;
type StableCurrencyIds = StableCurrencyIds;
type GetExchangeFee = GetExchangeFee;
type GetStableCurrencyExchangeFee = GetStableCurrencyExchangeFee;
type TradingPathLimit = TradingPathLimit;
type PalletId = DexPalletId;
type CurrencyIdMapping = ();
type WeightInfo = ();
type ListingOrigin = EnsureSignedBy<One, AccountId>;
}

parameter_types! {
pub StableCurrencyIds: Vec<CurrencyId> = vec![
SETR,
SETCHF,
SETEUR,
SETGBP,
SETSAR,
SETUSD,
];
pub const SetterCurrencyId: CurrencyId = SETR; // Setter currency ticker is SETR/
pub const GetSetUSDCurrencyId: CurrencyId = SETUSD; // Setter currency ticker is SETUSD/
pub const DirhamCurrencyId: CurrencyId = DRAM; // SettinDEX currency ticker is DRAM/

pub const SerpTreasuryPalletId: PalletId = PalletId(*b"set/serp");
pub const CharityFundAccountId: AccountId = CHARITY_FUND;
pub const SettPayTreasuryAccountId: AccountId = SETRPAY;
pub const CashDropVaultAccountId: AccountId = VAULT;

pub CashDropPeriod: BlockNumber = 120; // Triggers SERP-TES for serping after Every 60 blocks
pub MaxSlippageSwapWithDEX: Ratio = Ratio::one();
}

parameter_type_with_key! {
pub MinimumClaimableTransferAmounts: |currency_id: CurrencyId| -> Balance {
match currency_id {
Expand Down
47 changes: 25 additions & 22 deletions lib-serml/setmint/setmint-gateway/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,32 @@ ord_parameter_types! {
pub const One: AccountId = 1;
}

parameter_types! {
pub StableCurrencyIds: Vec<CurrencyId> = vec![
SETR,
SETCHF,
SETEUR,
SETGBP,
SETSAR,
SETUSD,
];
pub const SetterCurrencyId: CurrencyId = SETR; // Setter currency ticker is SETR/
pub const GetSetUSDCurrencyId: CurrencyId = SETUSD; // Setter currency ticker is SETUSD/
pub const DirhamCurrencyId: CurrencyId = DRAM; // SettinDEX currency ticker is DRAM/

pub const SerpTreasuryPalletId: PalletId = PalletId(*b"set/serp");
pub const CharityFundAccountId: AccountId = CHARITY_FUND;
pub const SettPayTreasuryAccountId: AccountId = SETRPAY;
pub const CashDropVaultAccountId: AccountId = VAULT;

pub CashDropPeriod: BlockNumber = 120; // Triggers SERP-TES for serping after Every 60 blocks
pub MaxSlippageSwapWithDEX: Ratio = Ratio::one();
}

parameter_types! {
pub const DexPalletId: PalletId = PalletId(*b"set/sdex");
pub const GetExchangeFee: (u32, u32) = (1, 1000); // 0.1%
pub const GetStableCurrencyExchangeFee: (u32, u32) = (1, 2000); // 0.05%
pub const TradingPathLimit: u32 = 3;
pub EnabledTradingPairs: Vec<TradingPair> = vec![
TradingPair::from_currency_ids(DNAR, SETR).unwrap(),
Expand All @@ -177,36 +200,16 @@ parameter_types! {
impl setheum_dex::Config for Runtime {
type Event = Event;
type Currency = Currencies;
type StableCurrencyIds = StableCurrencyIds;
type GetExchangeFee = GetExchangeFee;
type GetStableCurrencyExchangeFee = GetStableCurrencyExchangeFee;
type TradingPathLimit = TradingPathLimit;
type PalletId = DexPalletId;
type CurrencyIdMapping = ();
type WeightInfo = ();
type ListingOrigin = EnsureSignedBy<One, AccountId>;
}

parameter_types! {
pub StableCurrencyIds: Vec<CurrencyId> = vec![
SETR,
SETCHF,
SETEUR,
SETGBP,
SETSAR,
SETUSD,
];
pub const SetterCurrencyId: CurrencyId = SETR; // Setter currency ticker is SETR/
pub const GetSetUSDCurrencyId: CurrencyId = SETUSD; // Setter currency ticker is SETUSD/
pub const DirhamCurrencyId: CurrencyId = DRAM; // SettinDEX currency ticker is DRAM/

pub const SerpTreasuryPalletId: PalletId = PalletId(*b"set/serp");
pub const CharityFundAccountId: AccountId = CHARITY_FUND;
pub const SettPayTreasuryAccountId: AccountId = SETRPAY;
pub const CashDropVaultAccountId: AccountId = VAULT;

pub CashDropPeriod: BlockNumber = 120; // Triggers SERP-TES for serping after Every 60 blocks
pub MaxSlippageSwapWithDEX: Ratio = Ratio::one();
}

parameter_type_with_key! {
pub MinimumClaimableTransferAmounts: |currency_id: CurrencyId| -> Balance {
match currency_id {
Expand Down
47 changes: 25 additions & 22 deletions lib-serml/setmint/setmint-manager/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,31 @@ impl orml_currencies::Config for Runtime {
}
pub type AdaptedBasicCurrency = orml_currencies::BasicCurrencyAdapter<Runtime, PalletBalances, Amount, BlockNumber>;

parameter_types! {
pub StableCurrencyIds: Vec<CurrencyId> = vec![
SETR,
SETCHF,
SETEUR,
SETGBP,
SETSAR,
SETUSD,
];
pub const SetterCurrencyId: CurrencyId = SETR; // Setter currency ticker is SETR/
pub const GetSetUSDCurrencyId: CurrencyId = SETUSD; // Setter currency ticker is SETUSD/
pub const DirhamCurrencyId: CurrencyId = DRAM; // SettinDEX currency ticker is DRAM/

pub const SerpTreasuryPalletId: PalletId = PalletId(*b"set/serp");
pub const CharityFundAccountId: AccountId = CHARITY_FUND;
pub const SettPayTreasuryAccountId: AccountId = SETRPAY;
pub const CashDropVaultAccountId: AccountId = VAULT;

pub CashDropPeriod: BlockNumber = 120; // Triggers SERP-TES for serping after Every 60 blocks
pub MaxSlippageSwapWithDEX: Ratio = Ratio::one();
}

parameter_types! {
pub const GetExchangeFee: (u32, u32) = (1, 100);
pub const GetStableCurrencyExchangeFee: (u32, u32) = (1, 200);
pub const DexPalletId: PalletId = PalletId(*b"set/sdex");
pub const TradingPathLimit: u32 = 3;
pub EnabledTradingPairs: Vec<TradingPair> = vec![
Expand All @@ -158,7 +181,9 @@ parameter_types! {
impl setheum_dex::Config for Runtime {
type Event = Event;
type Currency = Currencies;
type StableCurrencyIds = StableCurrencyIds;
type GetExchangeFee = GetExchangeFee;
type GetStableCurrencyExchangeFee = GetStableCurrencyExchangeFee;
type TradingPathLimit = TradingPathLimit;
type PalletId = DexPalletId;
type CurrencyIdMapping = ();
Expand Down Expand Up @@ -195,28 +220,6 @@ ord_parameter_types! {
pub const One: AccountId = 1;
}

parameter_types! {
pub StableCurrencyIds: Vec<CurrencyId> = vec![
SETR,
SETCHF,
SETEUR,
SETGBP,
SETSAR,
SETUSD,
];
pub const SetterCurrencyId: CurrencyId = SETR; // Setter currency ticker is SETR/
pub const GetSetUSDCurrencyId: CurrencyId = SETUSD; // Setter currency ticker is SETUSD/
pub const DirhamCurrencyId: CurrencyId = DRAM; // SettinDEX currency ticker is DRAM/

pub const SerpTreasuryPalletId: PalletId = PalletId(*b"set/serp");
pub const CharityFundAccountId: AccountId = CHARITY_FUND;
pub const SettPayTreasuryAccountId: AccountId = SETRPAY;
pub const CashDropVaultAccountId: AccountId = VAULT;

pub CashDropPeriod: BlockNumber = 120; // Triggers SERP-TES for serping after Every 60 blocks
pub MaxSlippageSwapWithDEX: Ratio = Ratio::one();
}

parameter_type_with_key! {
pub MinimumClaimableTransferAmounts: |currency_id: CurrencyId| -> Balance {
match currency_id {
Expand Down
60 changes: 21 additions & 39 deletions lib-serml/tokens/currencies/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,27 @@ impl orml_currencies::Config for Runtime {
type WeightInfo = ();
}

parameter_types! {
pub StableCurrencyIds: Vec<CurrencyId> = vec![
SETR,
SETCHF,
SETEUR,
SETGBP,
SETSAR,
SETUSD,
];
pub const SetterCurrencyId: CurrencyId = SETR; // Setter currency ticker is SETR/
pub const GetSetUSDCurrencyId: CurrencyId = SETUSD; // Setter currency ticker is SETUSD/
pub const DirhamCurrencyId: CurrencyId = DRAM; // SettinDEX currency ticker is DRAM/

pub const SerpTreasuryPalletId: PalletId = PalletId(*b"set/serp");

pub CashDropPeriod: BlockNumber = 120; // Triggers SERP-TES for serping after Every 60 blocks
}

parameter_types! {
pub const GetExchangeFee: (u32, u32) = (1, 100);
pub const GetStableCurrencyExchangeFee: (u32, u32) = (1, 200);
pub const DexPalletId: PalletId = PalletId(*b"set/sdex");
pub const TradingPathLimit: u32 = 3;
pub EnabledTradingPairs: Vec<TradingPair> = vec![
Expand All @@ -225,7 +244,9 @@ parameter_types! {
impl setheum_dex::Config for Runtime {
type Event = Event;
type Currency = OrmlCurrencies;
type StableCurrencyIds = StableCurrencyIds;
type GetExchangeFee = GetExchangeFee;
type GetStableCurrencyExchangeFee = GetStableCurrencyExchangeFee;
type TradingPathLimit = TradingPathLimit;
type PalletId = DexPalletId;
type CurrencyIdMapping = ();
Expand Down Expand Up @@ -262,45 +283,6 @@ ord_parameter_types! {
pub const One: AccountId32 = AccountId32::from([11u8; 32]);
}

parameter_types! {
pub StableCurrencyIds: Vec<CurrencyId> = vec![
SETR,
SETCHF,
SETEUR,
SETGBP,
SETSAR,
SETUSD,
];
pub const SetterCurrencyId: CurrencyId = SETR; // Setter currency ticker is SETR/
pub const GetSetUSDCurrencyId: CurrencyId = SETUSD; // Setter currency ticker is SETUSD/
pub const DirhamCurrencyId: CurrencyId = DRAM; // SettinDEX currency ticker is DRAM/

pub const SerpTreasuryPalletId: PalletId = PalletId(*b"set/serp");

pub SerpTesSchedule: BlockNumber = 60; // Triggers SERP-TES for serping after Every 60 blocks
pub CashDropPeriod: BlockNumber = 120; // Triggers SERP-TES for serping after Every 60 blocks
pub MaxSlippageSwapWithDEX: Ratio = Ratio::one();

pub RewardableCurrencyIds: Vec<CurrencyId> = vec![
DNAR,
DRAM,
SETR,
SETCHF,
SETEUR,
SETGBP,
SETSAR,
SETUSD,
];
pub NonStableDropCurrencyIds: Vec<CurrencyId> = vec![DNAR, DRAM];
pub SetCurrencyDropCurrencyIds: Vec<CurrencyId> = vec![
SETCHF,
SETEUR,
SETGBP,
SETSAR,
SETUSD,
];
}

parameter_type_with_key! {
pub MinimumClaimableTransferAmounts: |currency_id: CurrencyId| -> Balance {
match currency_id {
Expand Down
6 changes: 6 additions & 0 deletions lib-serml/transaction-payment/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -262,17 +262,23 @@ ord_parameter_types! {
parameter_types! {
pub const DEXPalletId: PalletId = PalletId(*b"set/sdex");
pub const GetExchangeFee: (u32, u32) = (0, 100);
pub const GetStableCurrencyExchangeFee: (u32, u32) = (0, 100);
pub const TradingPathLimit: u32 = 3;
pub EnabledTradingPairs: Vec<TradingPair> = vec![
TradingPair::from_currency_ids(SETR, DNAR).unwrap(),
TradingPair::from_currency_ids(SETR, DRAM).unwrap(),
];
pub StableCurrencyIds: Vec<CurrencyId> = vec![
SETR,
];
}

impl setheum_dex::Config for Runtime {
type Event = Event;
type Currency = Currencies;
type StableCurrencyIds = StableCurrencyIds;
type GetExchangeFee = GetExchangeFee;
type GetStableCurrencyExchangeFee = GetStableCurrencyExchangeFee;
type TradingPathLimit = TradingPathLimit;
type PalletId = DEXPalletId;
type CurrencyIdMapping = ();
Expand Down
Loading

0 comments on commit f283b53

Please sign in to comment.