inkpad_seal/
lib.rs

1//! Inkpad supported host functions
2#![cfg_attr(not(feature = "std"), no_std)]
3use inkpad_std::{vec, Vec};
4
5mod chain;
6mod contract;
7mod crypto;
8mod derive;
9mod event;
10mod fun;
11mod instantiate;
12mod restore;
13mod storage;
14mod transfer;
15
16pub use self::derive::Host;
17use inkpad_sandbox::RuntimeInterfaces;
18
19/// Seal calls
20pub type SealCall =
21    inkpad_executor::derive::HostCall<&'static str, &'static str, inkpad_sandbox::Sandbox>;
22
23/// Pallet contract host functions
24pub fn pallet_contracts(ri: Option<impl RuntimeInterfaces>) -> Vec<SealCall> {
25    let mut wasm = vec![
26        chain::Seal0Gas::pack(),
27        chain::Seal0SealGasLeft::pack(),
28        chain::Seal0BlockNumber::pack(),
29        chain::Seal0SealWeightToFee::pack(),
30        chain::Seal0SealCallChainExtension::pack(),
31        contract::Seal0SealTombstoneDeposit::pack(),
32        contract::Seal0SealRentAllowance::pack(),
33        contract::Seal0SealSetRentAllowance::pack(),
34        event::Seal0SealDepositEvent::pack(),
35        fun::Seal0SealInput::pack(),
36        fun::Seal0SealReturn::pack(),
37        fun::Seal0SealTerminate::pack(),
38        restore::Seal0SealRestoreTo::pack(),
39        storage::Seal0SealGetStorage::pack(),
40        storage::Seal0SealClearStorage::pack(),
41        storage::Seal0SealSetStorage::pack(),
42        transfer::Seal0SealTransfer::pack(),
43        transfer::Seal0SealAddress::pack(),
44        transfer::Seal0SealBalance::pack(),
45        transfer::Seal0SealMinimumBalance::pack(),
46        transfer::Seal0SealCaller::pack(),
47        transfer::Seal0SealValueTransferred::pack(),
48        instantiate::Seal0SealCall::pack(),
49        instantiate::Seal0SealInstantiate::pack(),
50        // #[seal1]
51        contract::Seal1SealSetRentAllowance::pack(),
52        fun::Seal1SealTerminate::pack(),
53        instantiate::Seal1SealInstantiate::pack(),
54        restore::Seal1SealRestoreTo::pack(),
55        // #[__unstable__]
56        chain::UnstableSealCallRuntime::pack(),
57        crypto::UnstableSealEcdsaRecover::pack(),
58        instantiate::UnstableSealCall::pack(),
59    ];
60
61    if let Some(interfaces) = ri {
62        wasm.append(&mut RuntimeInterfaces::pack(&interfaces))
63    }
64
65    wasm
66}