Skip to content

Commit d31e278

Browse files
committed
Add ema price period pallet type
1 parent 6f3ce2c commit d31e278

File tree

5 files changed

+10
-1
lines changed

5 files changed

+10
-1
lines changed

pallets/admin-utils/src/tests/mock.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ parameter_types! {
134134
pub const InitialColdkeySwapScheduleDuration: u64 = 5 * 24 * 60 * 60 / 12; // 5 days
135135
pub const InitialDissolveNetworkScheduleDuration: u64 = 5 * 24 * 60 * 60 / 12; // 5 days
136136
pub const InitialTaoWeight: u64 = u64::MAX/10; // 10% global weight.
137+
pub const InitialEmaPriceHalvingPeriod: u64 = 201_600_u64; // 4 weeks
137138
}
138139

139140
impl pallet_subtensor::Config for Test {
@@ -197,6 +198,7 @@ impl pallet_subtensor::Config for Test {
197198
type InitialColdkeySwapScheduleDuration = InitialColdkeySwapScheduleDuration;
198199
type InitialDissolveNetworkScheduleDuration = InitialDissolveNetworkScheduleDuration;
199200
type InitialTaoWeight = InitialTaoWeight;
201+
type InitialEmaPriceHalvingPeriod = InitialEmaPriceHalvingPeriod;
200202
}
201203

202204
#[derive_impl(frame_system::config_preludes::TestDefaultConfig)]

pallets/subtensor/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ pub mod pallet {
398398
#[pallet::type_value]
399399
/// Default EMA price halving blocks
400400
pub fn DefaultEMAPriceMovingBlocks<T: Config>() -> u64 {
401-
201_600
401+
T::InitialEmaPriceHalvingPeriod::get()
402402
}
403403
#[pallet::type_value]
404404
/// Default registrations this block.

pallets/subtensor/src/macros/config.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,5 +207,8 @@ mod config {
207207
/// Initial TAO weight.
208208
#[pallet::constant]
209209
type InitialTaoWeight: Get<u64>;
210+
/// Initial EMA price halving period
211+
#[pallet::constant]
212+
type InitialEmaPriceHalvingPeriod: Get<u64>;
210213
}
211214
}

pallets/subtensor/src/tests/mock.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ parameter_types! {
184184
pub const InitialColdkeySwapScheduleDuration: u64 = 5 * 24 * 60 * 60 / 12; // Default as 5 days
185185
pub const InitialDissolveNetworkScheduleDuration: u64 = 5 * 24 * 60 * 60 / 12; // Default as 5 days
186186
pub const InitialTaoWeight: u64 = 0; // 100% global weight.
187+
pub const InitialEmaPriceHalvingPeriod: u64 = 201_600_u64; // 4 weeks
187188
}
188189

189190
// Configure collective pallet for council
@@ -406,6 +407,7 @@ impl crate::Config for Test {
406407
type InitialColdkeySwapScheduleDuration = InitialColdkeySwapScheduleDuration;
407408
type InitialDissolveNetworkScheduleDuration = InitialDissolveNetworkScheduleDuration;
408409
type InitialTaoWeight = InitialTaoWeight;
410+
type InitialEmaPriceHalvingPeriod = InitialEmaPriceHalvingPeriod;
409411
}
410412

411413
pub struct OriginPrivilegeCmp;

runtime/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1017,6 +1017,7 @@ parameter_types! {
10171017
pub const InitialColdkeySwapScheduleDuration: BlockNumber = 5 * 24 * 60 * 60 / 12; // 5 days
10181018
pub const InitialDissolveNetworkScheduleDuration: BlockNumber = 5 * 24 * 60 * 60 / 12; // 5 days
10191019
pub const SubtensorInitialTaoWeight: u64 = 971_718_665_099_567_868; // 0.05267697438728329% tao weight.
1020+
pub const InitialEmaPriceHalvingPeriod: u64 = 201_600_u64; // 4 weeks
10201021
}
10211022

10221023
impl pallet_subtensor::Config for Runtime {
@@ -1080,6 +1081,7 @@ impl pallet_subtensor::Config for Runtime {
10801081
type Preimages = Preimage;
10811082
type InitialColdkeySwapScheduleDuration = InitialColdkeySwapScheduleDuration;
10821083
type InitialDissolveNetworkScheduleDuration = InitialDissolveNetworkScheduleDuration;
1084+
type InitialEmaPriceHalvingPeriod = InitialEmaPriceHalvingPeriod;
10831085
}
10841086

10851087
use sp_runtime::BoundedVec;

0 commit comments

Comments
 (0)