1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#![feature(lang_items)]
#![feature(core_intrinsics)]
#![feature(allocator_api)]
#![feature(alloc_prelude)]
#![feature(slice_concat_ext)]
#![cfg_attr(not(feature = "std"), no_std)]
#![feature(exclusive_range_pattern)]
#![feature(proc_macro_hygiene)]
#![feature(panic_info_message)]
cfg_if::cfg_if! {
if #[cfg(all(not(feature = "std"), feature = "bump-alloc"))] {
use ontio_bump_alloc::BumpAlloc;
#[global_allocator]
static ALLOC: BumpAlloc = BumpAlloc::new();
} else if #[cfg(not(feature = "std"))] {
extern crate wee_alloc;
#[global_allocator]
static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT;
}
}
cfg_if::cfg_if! {
if #[cfg(not(feature = "std"))] {
use prelude::*;
#[no_mangle]
#[panic_handler]
pub fn panic_fmt(info: &core::panic::PanicInfo) -> ! {
let msg = info.message().map(|msg| format!("{}", msg)).unwrap_or_default();
let (file, line) = if let Some(loc) = info.location() {
(loc.file(), loc.line())
} else {
("", 0)
};
let panic_msg = format!("{} at {}:{}", msg, file, line);
runtime::panic(&panic_msg)
}
#[lang = "eh_personality"]
extern "C" fn eh_personality() {}
#[lang = "oom"]
#[no_mangle]
pub extern fn oom(_: core::alloc::Layout) -> ! {
unsafe { core::intrinsics::abort() }
}
}
}
extern crate alloc;
pub mod prelude {
pub use crate::contract::TransferParam;
pub use crate::types::{Address, H256, I128, U128};
pub use alloc::boxed::Box;
pub use alloc::prelude::*;
pub use alloc::str;
pub use alloc::string::{self, String, ToString};
pub use alloc::vec::Vec;
pub use alloc::{format, vec};
pub use core::cmp;
pub use core::prelude::v1::*;
}
pub mod abi;
pub mod console;
pub mod contract;
pub mod database;
pub mod runtime;
pub mod types;
pub mod macros {
pub use ontio_codegen::base58;
pub use ontio_codegen::contract;
pub use ontio_codegen::event;
}
#[cfg(feature = "mock")]
pub mod mock;