Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@ homepage = "https://github.com/Cardinal-Cryptography/drink"
license = "Apache-2.0"
readme = "README.md"
repository = "https://github.com/Cardinal-Cryptography/drink"
version = "0.1.5"
version = "0.1.6"

[workspace.dependencies]
anyhow = { version = "1.0.71" }
clap = { version = "4.3.4" }
contract-build = { version = "3.0.1" }
contract-transcode = { version = "3.0.1" }
crossterm = { version = "0.26.0" }
parity-scale-codec = { version = "=3.6.5" }
parity-scale-codec-derive = { version = "=3.6.5" }
parity-scale-codec = { version = "3.4" }
parity-scale-codec-derive = { version = "3.4" }
ratatui = { version = "0.21.0" }
scale-info = { version = "2.5.0" }
thiserror = { version = "1.0.40" }
Expand All @@ -48,4 +48,4 @@ sp-runtime-interface = { version = "18.0.0" }

# Local dependencies

drink = { version = "0.1.5", path = "drink" }
drink = { version = "0.1.6", path = "drink" }
14 changes: 13 additions & 1 deletion drink/src/runtime/minimal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
use std::time::SystemTime;

use frame_support::{
dispatch::Dispatchable,
metadata::RuntimeMetadataPrefixed,
parameter_types,
sp_runtime::{
testing::H256,
Expand All @@ -14,7 +16,7 @@ use frame_support::{
};
// Re-export all pallets.
pub use frame_system;
use frame_system::pallet_prelude::BlockNumberFor;
use frame_system::{pallet_prelude::BlockNumberFor, Config};
pub use pallet_balances;
pub use pallet_contracts;
use pallet_contracts::{DefaultAddressGenerator, Frame, Schedule};
Expand Down Expand Up @@ -172,4 +174,14 @@ impl Runtime for MinimalRuntime {
fn default_actor() -> AccountIdFor<Self> {
AccountId32::new([1u8; 32])
}

fn get_metadata() -> RuntimeMetadataPrefixed {
Self::metadata()
}

fn convert_account_to_origin(
account: AccountIdFor<Self>,
) -> <<Self as Config>::RuntimeCall as Dispatchable>::RuntimeOrigin {
Some(account).into()
}
}
17 changes: 16 additions & 1 deletion drink/src/runtime/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,20 @@
pub mod minimal;
pub mod pallet_contracts_debugging;

use frame_support::sp_runtime::Storage;
use frame_support::{
dispatch::Dispatchable, metadata::RuntimeMetadataPrefixed, sp_runtime::Storage,
};
use frame_system::pallet_prelude::BlockNumberFor;
pub use minimal::MinimalRuntime;

/// The type of an account identifier.
pub type AccountIdFor<R> = <R as frame_system::Config>::AccountId;

/// Export pallets that are used in the runtime.
pub use frame_system;
pub use pallet_balances;
pub use pallet_contracts;

/// A runtime to use.
///
/// Must contain at least system, balances and contracts pallets.
Expand Down Expand Up @@ -41,4 +48,12 @@ pub trait Runtime:

/// Default actor for the runtime.
fn default_actor() -> AccountIdFor<Self>;

/// Metadata of the runtime.
fn get_metadata() -> RuntimeMetadataPrefixed;

/// Convert an account to an call origin.
fn convert_account_to_origin(
account: AccountIdFor<Self>,
) -> <<Self as frame_system::Config>::RuntimeCall as Dispatchable>::RuntimeOrigin;
}