11use crate :: origins:: GeneralAdmin ;
22use crate :: {
3- weights, Balances , EVMAccounts , Ismp , IsmpParachain , NativeAssetId , Runtime , RuntimeEvent ,
3+ weights, Balances , EVMAccounts , Ismp , IsmpParachain , NativeAssetId , Parameters , Runtime , RuntimeEvent ,
44 TechCommitteeSuperMajority , Timestamp , TokenGateway , TreasuryAccount ,
55} ;
66use frame_support:: parameter_types;
@@ -18,6 +18,7 @@ use pallet_token_gateway::types::EvmToSubstrate;
1818use primitive_types:: H160 ;
1919use primitives:: constants:: currency:: NATIVE_DECIMALS ;
2020use primitives:: { AccountId , AssetId , Balance } ;
21+ use sp_core:: Get ;
2122use sp_std:: { boxed:: Box , vec:: Vec } ;
2223
2324impl pallet_hyperbridge:: Config for Runtime {
@@ -27,19 +28,29 @@ impl pallet_hyperbridge::Config for Runtime {
2728}
2829
2930parameter_types ! {
30- // The hyperbridge parachain on Polkadot
31- pub const Coprocessor : Option <StateMachine > = Some ( StateMachine :: Polkadot ( 3367 ) ) ;
32-
33- // The host state machine of this pallet on Polkadot
34- pub const HostStateMachine : StateMachine = StateMachine :: Polkadot ( 2034 ) ;
35-
36- // The hyperbridge parachain on Paseo
37- // pub const Coprocessor: Option<StateMachine> = Some(StateMachine::Kusama(4009));
31+ pub const USDC : AssetId = 22 ; // USDC asset id on Hydration
32+ }
3833
39- // The host state machine of this pallet on Paseo
40- // pub const HostStateMachine: StateMachine = StateMachine::Kusama(2034);
34+ pub struct IsmpCoprocessor ;
35+ impl Get < Option < StateMachine > > for IsmpCoprocessor {
36+ fn get ( ) -> Option < StateMachine > {
37+ if Parameters :: is_testnet ( ) {
38+ Some ( StateMachine :: Kusama ( 4009 ) )
39+ } else {
40+ Some ( StateMachine :: Polkadot ( 3367 ) )
41+ }
42+ }
43+ }
4144
42- pub const USDC : AssetId = 22 ; // USDC asset id on Hydration
45+ pub struct IsmpHostStateMachine ;
46+ impl Get < StateMachine > for IsmpHostStateMachine {
47+ fn get ( ) -> StateMachine {
48+ if Parameters :: is_testnet ( ) {
49+ StateMachine :: Kusama ( 2034 )
50+ } else {
51+ StateMachine :: Polkadot ( 2034 )
52+ }
53+ }
4354}
4455
4556impl pallet_ismp:: Config for Runtime {
@@ -51,9 +62,9 @@ impl pallet_ismp::Config for Runtime {
5162 // The token used to collect fees, only stablecoins are supported
5263 type Currency = ItemOf < FungibleCurrencies < Runtime > , USDC , AccountId > ;
5364 // The state machine identifier of the chain -- parachain id
54- type HostStateMachine = HostStateMachine ;
65+ type HostStateMachine = IsmpHostStateMachine ;
5566 // Co-processor
56- type Coprocessor = Coprocessor ;
67+ type Coprocessor = IsmpCoprocessor ;
5768 // The router provides the implementation for the IsmpModule as the module id.
5869 type Router = IsmpRouterStruct ;
5970 // A tuple of types implementing the ConsensusClient interface, which defines all consensus algorithms supported by this protocol deployment
0 commit comments