odra_casper_wasm_env/
lib.rs1#![doc = "WASM environment for Odra Framework"]
2#![doc = "It is an implementation of the contract environment used by the contracts written in Odra,"]
3#![doc = "which are compiled to the WASM target architecture."]
4#![no_std]
5#![allow(internal_features)]
6#![cfg_attr(not(test), feature(core_intrinsics))]
7#![allow(dead_code)]
8#![allow(unused_imports)]
9#![allow(unused_variables)]
10
11extern crate alloc;
12
13pub(crate) mod consts;
14pub mod host_functions;
15mod wasm_contract_env;
16
17pub use crate::wasm_contract_env::WasmContractEnv;
18use alloc::rc::Rc;
19pub use casper_contract;
20
21#[cfg(all(target_arch = "wasm32", not(feature = "disable-allocator")))]
22#[allow(unused_imports)]
23use ink_allocator;
24use odra_core::casper_event_standard::Schemas;
25use odra_core::prelude::{ExecutionError, Revertible};
26use odra_core::ExecutionEnv;
27
28#[cfg(target_arch = "wasm32")]
30#[panic_handler]
31#[no_mangle]
32pub fn panic(_info: &core::panic::PanicInfo) -> ! {
33 core::intrinsics::abort();
34}
35
36#[no_mangle]
38pub fn migrate_events() {
39 let exec_env = {
40 let env = WasmContractEnv::new_env();
41 let env_rc = Rc::new(env);
42 ExecutionEnv::new(env_rc)
43 };
44 let schemas: Schemas = exec_env.get_named_arg("schemas");
45
46 exec_env.migrate_schemas(schemas.0);
47}