1#[cfg(not(feature = "scrt"))]
7std::compile_error!("Fadroma only currently supports Secret Network so the \"scrt\" feature must be enabled.");
8
9#[cfg(feature = "scrt")]
10pub use secret_cosmwasm_std as cosmwasm_std;
11pub use schemars;
12pub use serde;
13
14pub mod bin_serde;
15pub mod core;
16
17#[cfg(feature = "scrt")]
18pub mod scrt;
19
20pub mod tokens;
21pub use fadroma_dsl as dsl;
22pub mod killswitch;
23pub mod admin;
24#[cfg(feature = "crypto")]
25pub mod crypto;
26
27pub mod storage;
29
30#[cfg(all(feature = "ensemble", not(target_arch = "wasm32")))]
32pub mod ensemble;
33
34pub mod prelude {
37 pub type UsuallyOk = cosmwasm_std::StdResult<()>;
39
40 pub type Eventually<V> = cosmwasm_std::StdResult<Option<V>>;
42
43 pub use crate::core::*;
44
45 pub use crate::bin_serde::{FadromaSerialize, FadromaDeserialize};
46
47 pub use crate::cosmwasm_std::{self, *};
48 #[cfg(feature = "scrt")]
49 pub use crate::scrt::{ResponseExt, to_cosmos_msg, space_pad, BLOCK_SIZE};
50
51 pub use crate::tokens::*;
52
53 pub use schemars::{self, JsonSchema};
54
55 pub use crate::storage::{
56 self, Key, Namespace, CompositeKey, StaticKey, FixedSegmentSizeKey,
57 TypedKey, TypedKey2, TypedKey3, TypedKey4, SingleItem, ItemSpace
58 };
59
60 #[cfg(feature = "vk")]
61 pub use crate::scrt::vk::{ViewingKey, ViewingKeyHashed};
62
63 #[cfg(feature = "permit")]
64 pub use crate::scrt::permit::{Permission, Permit};
65}
66
67#[macro_export]
120macro_rules! entrypoint {
121 (@init $($init:ident)::+) => {
122 #[no_mangle]
123 extern "C" fn instantiate(env_ptr: u32, info_ptr: u32, msg_ptr: u32) -> u32 {
124 $crate::cosmwasm_std::do_instantiate(&super::$($init)::+, env_ptr, info_ptr, msg_ptr)
125 }
126 };
127
128 (@execute $($execute:ident)::+) => {
129 #[no_mangle]
130 extern "C" fn execute(env_ptr: u32, info_ptr: u32, msg_ptr: u32) -> u32 {
131 $crate::cosmwasm_std::do_execute(&super::$($execute)::+, env_ptr, info_ptr, msg_ptr)
132 }
133 };
134
135 (@query $($query:ident)::+) => {
136 #[no_mangle]
137 extern "C" fn query(env_ptr: u32, msg_ptr: u32) -> u32 {
138 $crate::cosmwasm_std::do_query(&super::$($query)::+, env_ptr, msg_ptr)
139 }
140 };
141
142 (@reply $($reply:ident)::+) => {
143 #[no_mangle]
144 extern "C" fn reply(env_ptr: u32, msg_ptr: u32) -> u32 {
145 $crate::cosmwasm_std::do_reply(&super::$($reply)::+, env_ptr, msg_ptr)
146 }
147 };
148
149 (@wasm_mod $($contents:tt)*) => {
150 #[cfg(target_arch = "wasm32")]
151 mod wasm {
152 $($contents)*
153 }
154 };
155
156 (
157 init: $($init:ident)::+,
158 execute: $($execute:ident)::+,
159 query: $($query:ident)::+
160 $(, reply: $($reply:ident)::+)?
161 ) => {
162 $crate::entrypoint! {
163 @wasm_mod
164 $crate::entrypoint!(@init $($init)::+);
165 $crate::entrypoint!(@execute $($execute)::+);
166 $crate::entrypoint!(@query $($query)::+);
167 $($crate::entrypoint!(@reply $($reply)::+);)?
168 }
169 };
170}