Skip to content

Commit

Permalink
Merge branch 'master' into apopiak/oracle-integration
Browse files Browse the repository at this point in the history
# Conflicts:
#	runtime/basilisk/src/lib.rs
#	runtime/testing-basilisk/src/lib.rs
  • Loading branch information
mrq1911 committed May 31, 2023
2 parents b5c5c68 + df4de2c commit d72a5d2
Show file tree
Hide file tree
Showing 7 changed files with 78 additions and 10 deletions.
23 changes: 22 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pallets/xyk/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = 'pallet-xyk'
version = "6.2.5"
version = "6.2.6"
description = 'XYK automated market maker'
authors = ['GalacticCouncil']
edition = '2021'
Expand Down
4 changes: 2 additions & 2 deletions pallets/xyk/src/tests/spot_price.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ fn spot_price_provider_should_return_correct_price_when_pool_exists() {

let price = XYKSpotPrice::<Test>::spot_price(asset_a, asset_b);

assert_eq!(price, Some(Price::from_float(0.4)));
assert_eq!(price, Some(Price::from_float(2.5))); // 99_000 / 39_600 = 2.5
});
}

Expand Down Expand Up @@ -72,7 +72,7 @@ fn spot_price_provider_should_return_none_when_asset_reserve_is_zero() {
assert_ok!(Currency::set_balance(
RawOrigin::Root.into(),
pool_account,
asset_a,
asset_b,
0u128,
0u128
));
Expand Down
4 changes: 3 additions & 1 deletion runtime/basilisk/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ pallet-route-executor = { git = "https://github.com/galacticcouncil/warehouse",
warehouse-liquidity-mining = { package="pallet-liquidity-mining", git = "https://github.com/galacticcouncil/warehouse", rev = "d6a78b5d51bc8af525d2b8f856efcfce2159e334", default-features = false }
pallet-ema-oracle = { git = "https://github.com/galacticcouncil/warehouse", rev = "d6a78b5d51bc8af525d2b8f856efcfce2159e334", default-features = false }
pallet-duster = { git = "https://github.com/galacticcouncil/warehouse", rev = "d6a78b5d51bc8af525d2b8f856efcfce2159e334", default-features = false }
pallet-collator-rewards = { git = "https://github.com/galacticcouncil/warehouse",rev = "f64f50255965a1177d28bbc969a371013584bbdd", default-features = false}

# collator support
pallet-collator-selection = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.38", default-features = false }
Expand Down Expand Up @@ -282,5 +283,6 @@ try-runtime= [
"pallet-route-executor/try-runtime",
"pallet-xyk-liquidity-mining/try-runtime",
"warehouse-liquidity-mining/try-runtime",
"pallet-ema-oracle/try-runtime"
"pallet-ema-oracle/try-runtime",
"pallet-collator-rewards/try-runtime",
]
27 changes: 24 additions & 3 deletions runtime/basilisk/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -741,7 +741,7 @@ impl pallet_session::Config for Runtime {
type ValidatorIdOf = pallet_collator_selection::IdentityCollator;
type ShouldEndSession = pallet_session::PeriodicSessions<Period, Offset>;
type NextSessionRotation = pallet_session::PeriodicSessions<Period, Offset>;
type SessionManager = CollatorSelection;
type SessionManager = CollatorRewards;
// Essentially just Aura, but lets be pedantic.
type SessionHandler = <opaque::SessionKeys as sp_runtime::traits::OpaqueKeys>::KeyTypeIdProviders;
type Keys = opaque::SessionKeys;
Expand Down Expand Up @@ -942,6 +942,28 @@ impl pallet_route_executor::Config for Runtime {
type WeightInfo = weights::route_executor::BasiliskWeight<Runtime>;
}

parameter_types! {
pub const RewardPerCollator: Balance = 15_216_000_000_000_000; // 12.68[BSX/block] * 1200[block]
//GalacticCouncil collators
pub ExcludedCollators: Vec<AccountId> = vec![
// bXn5CfJB2qHvqnuMqTpXn6un9Fjch8mwkb9i3JUsGVD4ChLoe
hex_literal::hex!["f25e5d7b43266a5b4cca762c9be917f18852d7a5db85e734776206eeb539dd4f"].into(),
];
}

impl pallet_collator_rewards::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type Balance = Balance;
type CurrencyId = AssetId;
type Currency = Currencies;
type RewardPerCollator = RewardPerCollator;
type ExcludedCollators = ExcludedCollators;
type RewardCurrencyId = NativeAssetId;
// We wrap the ` SessionManager` implementation of `CollatorSelection` to get the collatrs that
// we hand out rewards to.
type SessionManager = CollatorSelection;
}

// constants need to be in scope to be used in generics
use pallet_ema_oracle::MAX_PERIODS;

Expand Down Expand Up @@ -1014,15 +1036,14 @@ construct_runtime!(
Duster: pallet_duster = 102,
LBP: pallet_lbp = 104,
NFT: pallet_nft = 105,

MultiTransactionPayment: pallet_transaction_multi_payment = 106,
RelayChainInfo: pallet_relaychain_info = 108,
Marketplace: pallet_marketplace = 109,
TransactionPause: pallet_transaction_pause = 110,
Router: pallet_route_executor = 111,

XYKLiquidityMining: pallet_xyk_liquidity_mining = 112,
XYKWarehouseLM: warehouse_liquidity_mining::<Instance1> = 113,
CollatorRewards: pallet_collator_rewards = 114,

EmaOracle: pallet_ema_oracle = 120,

Expand Down
1 change: 1 addition & 0 deletions runtime/testing-basilisk/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ pallet-route-executor = { git = "https://github.com/galacticcouncil/warehouse",
warehouse-liquidity-mining = { package="pallet-liquidity-mining", git = "https://github.com/galacticcouncil/warehouse", rev = "d6a78b5d51bc8af525d2b8f856efcfce2159e334", default-features = false }
pallet-ema-oracle = { git = "https://github.com/galacticcouncil/warehouse", rev = "d6a78b5d51bc8af525d2b8f856efcfce2159e334", default-features = false }
pallet-duster = { git = "https://github.com/galacticcouncil/warehouse", rev = "d6a78b5d51bc8af525d2b8f856efcfce2159e334", default-features = false }
pallet-collator-rewards = { git = "https://github.com/galacticcouncil/warehouse",rev = "f64f50255965a1177d28bbc969a371013584bbdd", default-features = false}

# collator support
pallet-collator-selection = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.38", default-features = false }
Expand Down
27 changes: 25 additions & 2 deletions runtime/testing-basilisk/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -913,6 +913,30 @@ impl pallet_route_executor::Config for Runtime {
type WeightInfo = common_runtime::weights::route_executor::BasiliskWeight<Runtime>;
}

parameter_types! {
pub const RewardPerCollator: Balance = 10_000 * UNITS;
//GalacticCouncil collators
pub ExcludedCollators: Vec<AccountId> = vec![
// Alice
// hex_literal::hex!["d43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d"].into(),
// Bob
// hex!["8eaf04151687736326c9fea17e25fc5287613693c912909cb226aa4794f26a48"].into(),
];
}

impl pallet_collator_rewards::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type Balance = Balance;
type CurrencyId = AssetId;
type Currency = Currencies;
type RewardPerCollator = RewardPerCollator;
type ExcludedCollators = ExcludedCollators;
type RewardCurrencyId = NativeAssetId;
// We wrap the ` SessionManager` implementation of `CollatorSelection` to get the collatrs that
// we hand out rewards to.
type SessionManager = CollatorSelection;
}

// constants need to be in scope to be used in generics
use pallet_ema_oracle::MAX_PERIODS;

Expand Down Expand Up @@ -985,15 +1009,14 @@ construct_runtime!(
Duster: pallet_duster = 102,
LBP: pallet_lbp = 104,
NFT: pallet_nft = 105,

MultiTransactionPayment: pallet_transaction_multi_payment = 106,
RelayChainInfo: pallet_relaychain_info = 108,
Marketplace: pallet_marketplace = 109,
TransactionPause: pallet_transaction_pause = 110,
Router: pallet_route_executor = 111,

XYKLiquidityMining: pallet_xyk_liquidity_mining = 112,
XYKWarehouseLM: warehouse_liquidity_mining::<Instance1> = 113,
CollatorRewards: pallet_collator_rewards = 114,

EmaOracle: pallet_ema_oracle = 120,

Expand Down

0 comments on commit d72a5d2

Please sign in to comment.