@@ -63,7 +63,7 @@ use sp_std::{
6363pub use frame_system:: Config as SysConfig ;
6464pub use pallet_contracts_primitives:: ReturnFlags ;
6565pub use sp_core:: crypto:: UncheckedFrom ;
66- pub use crate :: exec:: Ext ;
66+ pub use crate :: { Config , exec:: Ext } ;
6767pub use state:: Init as InitState ;
6868
6969/// Result that returns a [`DispatchError`] on error.
@@ -74,7 +74,7 @@ pub type Result<T> = sp_std::result::Result<T, DispatchError>;
7474/// In order to create a custom chain extension this trait must be implemented and supplied
7575/// to the pallet contracts configuration trait as the associated type of the same name.
7676/// Consult the [module documentation](self) for a general explanation of chain extensions.
77- pub trait ChainExtension {
77+ pub trait ChainExtension < C : Config > {
7878 /// Call the chain extension logic.
7979 ///
8080 /// This is the only function that needs to be implemented in order to write a
@@ -91,8 +91,9 @@ pub trait ChainExtension {
9191 /// In case of `Err` the contract execution is immediately suspended and the passed error
9292 /// is returned to the caller. Otherwise the value of [`RetVal`] determines the exit
9393 /// behaviour.
94- fn call < E : Ext > ( func_id : u32 , env : Environment < E , InitState > ) -> Result < RetVal >
94+ fn call < E > ( func_id : u32 , env : Environment < E , InitState > ) -> Result < RetVal >
9595 where
96+ E : Ext < T = C > ,
9697 <E :: T as SysConfig >:: AccountId : UncheckedFrom < <E :: T as SysConfig >:: Hash > + AsRef < [ u8 ] > ;
9798
9899 /// Determines whether chain extensions are enabled for this chain.
@@ -108,9 +109,10 @@ pub trait ChainExtension {
108109}
109110
110111/// Implementation that indicates that no chain extension is available.
111- impl ChainExtension for ( ) {
112- fn call < E : Ext > ( _func_id : u32 , mut _env : Environment < E , InitState > ) -> Result < RetVal >
112+ impl < C : Config > ChainExtension < C > for ( ) {
113+ fn call < E > ( _func_id : u32 , mut _env : Environment < E , InitState > ) -> Result < RetVal >
113114 where
115+ E : Ext < T = C > ,
114116 <E :: T as SysConfig >:: AccountId : UncheckedFrom < <E :: T as SysConfig >:: Hash > + AsRef < [ u8 ] > ,
115117 {
116118 // Never called since [`Self::enabled()`] is set to `false`. Because we want to
0 commit comments