Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
pgherveou committed Feb 23, 2024
1 parent ca382f3 commit 231acca
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
1 change: 1 addition & 0 deletions substrate/bin/node/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1367,6 +1367,7 @@ impl pallet_contracts::Config for Runtime {
type CodeHashLockupDepositPercent = CodeHashLockupDepositPercent;
type Debug = ();
type Environment = ();
type ApiVersion = ();
type Xcm = ();
}

Expand Down
19 changes: 19 additions & 0 deletions substrate/frame/contracts/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,19 @@ pub struct Environment<T: Config> {
block_number: EnvironmentType<BlockNumberFor<T>>,
}

/// Defines the current version of the HostFn APIs.
/// This is used to communicate the available APIs in pallet-contracts.
///
/// The version is bumped any time a new HostFn is added or stabilized.
#[derive(Encode, Decode, TypeInfo)]
#[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))]
pub struct ApiVersion(u16);
impl Default for ApiVersion {
fn default() -> Self {
Self(1)
}
}

#[frame_support::pallet]
pub mod pallet {
use super::*;
Expand Down Expand Up @@ -402,6 +415,12 @@ pub mod pallet {
#[pallet::constant]
type Environment: Get<Environment<Self>>;

/// The version of the HostFn APIs that are available in the runtime.
///
/// Only valid value is `()`.
#[pallet::constant]
type ApiVersion: Get<ApiVersion>;

/// A type that exposes XCM APIs, allowing contracts to interact with other parachains, and
/// execute XCM programs.
type Xcm: xcm_builder::Controller<
Expand Down
1 change: 1 addition & 0 deletions substrate/frame/contracts/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,7 @@ impl Config for Test {
type MaxDelegateDependencies = MaxDelegateDependencies;
type Debug = TestDebug;
type Environment = ();
type ApiVersion = ();
type Xcm = ();
}

Expand Down

0 comments on commit 231acca

Please sign in to comment.