Use an enum for Coin/NetworkId

It originally wasn't an enum so software which had yet to update before an
integration wouldn't error (as now enums are strictly typed). The strict typing
is preferable though.
This commit is contained in:
Luke Parker
2023-04-18 02:01:53 -04:00
parent 6f3b5f4535
commit 9da0eb69c7
15 changed files with 97 additions and 70 deletions

View File

@@ -247,6 +247,21 @@ impl transaction_payment::Config for Runtime {
type FeeMultiplierUpdate = ();
}
#[cfg(feature = "runtime-benchmarks")]
pub struct SeraiAssetBenchmarkHelper;
#[cfg(feature = "runtime-benchmarks")]
impl assets::BenchmarkHelper<Coin> for SeraiAssetBenchmarkHelper {
fn create_asset_id_parameter(id: u32) -> Coin {
match (id % 4) + 1 {
1 => Coin::Bitcoin,
2 => Coin::Ether,
3 => Coin::Dai,
4 => Coin::Monero,
_ => panic!("(id % 4) + 1 wasn't in [1, 4]"),
}
}
}
impl assets::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type Balance = SubstrateAmount;
@@ -275,7 +290,7 @@ impl assets::Config for Runtime {
type WeightInfo = assets::weights::SubstrateWeight<Runtime>;
#[cfg(feature = "runtime-benchmarks")]
type BenchmarkHelper = ();
type BenchmarkHelper = SeraiAssetBenchmarkHelper;
}
impl tokens::Config for Runtime {