Merge branch 'emissions' of https://github.com/akildemir/serai into block-emissions

This commit is contained in:
akildemir
2024-05-03 13:50:52 +03:00
157 changed files with 8806 additions and 2349 deletions

View File

@@ -128,7 +128,7 @@ std = [
"pallet-transaction-payment-rpc-runtime-api/std",
]
fast-epoch = []
fast-epoch = ["genesis-liquidity-pallet/fast-epoch"]
runtime-benchmarks = [
"sp-runtime/runtime-benchmarks",

View File

@@ -11,7 +11,6 @@ use core::marker::PhantomData;
// Re-export all components
pub use serai_primitives as primitives;
pub use primitives::{BlockNumber, Header};
use primitives::{NetworkId, NETWORKS};
pub use frame_system as system;
pub use frame_support as support;
@@ -50,7 +49,7 @@ use sp_runtime::{
BoundedVec, Perbill, ApplyExtrinsicResult,
};
use primitives::{PublicKey, AccountLookup, SubstrateAmount};
use primitives::{NetworkId, PublicKey, AccountLookup, SubstrateAmount, Coin, NETWORKS};
use support::{
traits::{ConstU8, ConstU16, ConstU32, ConstU64, Contains},
@@ -178,6 +177,9 @@ impl Contains<RuntimeCall> for CallFilter {
},
RuntimeCall::Dex(call) => !matches!(call, dex::Call::__Ignore(_, _)),
RuntimeCall::ValidatorSets(call) => !matches!(call, validator_sets::Call::__Ignore(_, _)),
RuntimeCall::GenesisLiquidity(call) => {
!matches!(call, genesis_liquidity::Call::__Ignore(_, _))
}
RuntimeCall::InInstructions(call) => !matches!(call, in_instructions::Call::__Ignore(_, _)),
RuntimeCall::Signals(call) => !matches!(call, signals::Call::__Ignore(_, _)),
@@ -325,7 +327,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<{ HOURS / 2 }>; // 30 minutes
#[cfg(not(feature = "fast-epoch"))]
type EpochDuration = ConstU64<{ 4 * 7 * DAYS }>;
@@ -641,4 +643,28 @@ sp_api::impl_runtime_apis! {
}
}
}
impl dex::DexApi<Block> for Runtime {
fn quote_price_exact_tokens_for_tokens(
asset1: Coin,
asset2: Coin,
amount: SubstrateAmount,
include_fee: bool
) -> Option<SubstrateAmount> {
Dex::quote_price_exact_tokens_for_tokens(asset1, asset2, amount, include_fee)
}
fn quote_price_tokens_for_exact_tokens(
asset1: Coin,
asset2: Coin,
amount: SubstrateAmount,
include_fee: bool
) -> Option<SubstrateAmount> {
Dex::quote_price_tokens_for_exact_tokens(asset1, asset2, amount, include_fee)
}
fn get_reserves(asset1: Coin, asset2: Coin) -> Option<(SubstrateAmount, SubstrateAmount)> {
Dex::get_reserves(&asset1, &asset2).ok()
}
}
}