mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-08 12:19:24 +00:00
Implement block emissions (#551)
* add genesis liquidity implementation * add missing deposit event * fix CI issues * minor fixes * make math safer * fix fmt * implement block emissions * make remove liquidity an authorized call * implement setting initial values for coins * add genesis liquidity test & misc fixes * updato develop latest * fix rotation test * fix licencing * add fast-epoch feature * only create the pool when adding liquidity first time * add initial reward era test * test whole pre ec security emissions * fix clippy * add swap-to-staked-sri feature * rebase changes * fix tests * Remove accidentally commited ETH ABI files * fix some pr comments * Finish up fixing pr comments * exclude SRI from is_allowed check * Misc changes --------- Co-authored-by: akildemir <aeg_asd@hotmail.com> Co-authored-by: Luke Parker <lukeparker5132@gmail.com>
This commit is contained in:
@@ -89,17 +89,6 @@ impl From<Call> for RuntimeCall {
|
||||
send_to: send_to.into(),
|
||||
}),
|
||||
},
|
||||
Call::GenesisLiquidity(gl) => match gl {
|
||||
serai_abi::genesis_liquidity::Call::remove_coin_liquidity { balance } => {
|
||||
RuntimeCall::GenesisLiquidity(genesis_liquidity::Call::remove_coin_liquidity { balance })
|
||||
}
|
||||
serai_abi::genesis_liquidity::Call::oraclize_values { values, signature } => {
|
||||
RuntimeCall::GenesisLiquidity(genesis_liquidity::Call::oraclize_values {
|
||||
values,
|
||||
signature,
|
||||
})
|
||||
}
|
||||
},
|
||||
Call::ValidatorSets(vs) => match vs {
|
||||
serai_abi::validator_sets::Call::set_keys {
|
||||
network,
|
||||
@@ -138,6 +127,17 @@ impl From<Call> for RuntimeCall {
|
||||
RuntimeCall::ValidatorSets(validator_sets::Call::claim_deallocation { network, session })
|
||||
}
|
||||
},
|
||||
Call::GenesisLiquidity(gl) => match gl {
|
||||
serai_abi::genesis_liquidity::Call::remove_coin_liquidity { balance } => {
|
||||
RuntimeCall::GenesisLiquidity(genesis_liquidity::Call::remove_coin_liquidity { balance })
|
||||
}
|
||||
serai_abi::genesis_liquidity::Call::oraclize_values { values, signature } => {
|
||||
RuntimeCall::GenesisLiquidity(genesis_liquidity::Call::oraclize_values {
|
||||
values,
|
||||
signature,
|
||||
})
|
||||
}
|
||||
},
|
||||
Call::InInstructions(ii) => match ii {
|
||||
serai_abi::in_instructions::Call::execute_batch { batch } => {
|
||||
RuntimeCall::InInstructions(in_instructions::Call::execute_batch { batch })
|
||||
|
||||
@@ -32,6 +32,7 @@ pub use pallet_babe as babe;
|
||||
pub use pallet_grandpa as grandpa;
|
||||
|
||||
pub use genesis_liquidity_pallet as genesis_liquidity;
|
||||
pub use emissions_pallet as emissions;
|
||||
|
||||
// Actually used by the runtime
|
||||
use sp_core::OpaqueMetadata;
|
||||
@@ -51,7 +52,7 @@ use sp_runtime::{
|
||||
#[allow(unused_imports)]
|
||||
use primitives::{
|
||||
NetworkId, PublicKey, AccountLookup, SubstrateAmount, Coin, NETWORKS, MEDIAN_PRICE_WINDOW_LENGTH,
|
||||
HOURS, DAYS, MINUTES, TARGET_BLOCK_TIME, BLOCK_SIZE,
|
||||
HOURS, DAYS, MINUTES, TARGET_BLOCK_TIME, BLOCK_SIZE, FAST_EPOCH_DURATION,
|
||||
};
|
||||
|
||||
use support::{
|
||||
@@ -252,6 +253,10 @@ impl genesis_liquidity::Config for Runtime {
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
}
|
||||
|
||||
impl emissions::Config for Runtime {
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
}
|
||||
|
||||
// for publishing equivocation evidences.
|
||||
impl<C> frame_system::offchain::SendTransactionTypes<C> for Runtime
|
||||
where
|
||||
@@ -278,7 +283,7 @@ pub type ReportLongevity = <Runtime as pallet_babe::Config>::EpochDuration;
|
||||
|
||||
impl babe::Config for Runtime {
|
||||
#[cfg(feature = "fast-epoch")]
|
||||
type EpochDuration = ConstU64<{ MINUTES / 2 }>; // 30 seconds
|
||||
type EpochDuration = ConstU64<{ FAST_EPOCH_DURATION }>;
|
||||
|
||||
#[cfg(not(feature = "fast-epoch"))]
|
||||
type EpochDuration = ConstU64<{ 4 * 7 * DAYS }>;
|
||||
@@ -326,9 +331,10 @@ construct_runtime!(
|
||||
Coins: coins,
|
||||
LiquidityTokens: coins::<Instance1>::{Pallet, Call, Storage, Event<T>},
|
||||
Dex: dex,
|
||||
GenesisLiquidity: genesis_liquidity,
|
||||
|
||||
ValidatorSets: validator_sets,
|
||||
GenesisLiquidity: genesis_liquidity,
|
||||
Emissions: emissions,
|
||||
|
||||
InInstructions: in_instructions,
|
||||
|
||||
|
||||
Reference in New Issue
Block a user