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
#![no_std]
#![feature(
alloc,
allocator_api,
core_intrinsics,
lang_items,
alloc_error_handler,
maybe_uninit
)]
extern crate alloc;
#[macro_use]
extern crate uint;
extern crate wee_alloc;
#[macro_use]
extern crate failure;
#[cfg(not(feature = "std"))]
#[global_allocator]
pub static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT;
pub mod bytesrepr;
pub mod contract_api;
pub mod key;
pub mod value;
mod ext_ffi {
extern "C" {
pub fn read_value(key_ptr: *const u8, key_size: usize) -> usize;
pub fn get_read(value_ptr: *mut u8);
pub fn write(key_ptr: *const u8, key_size: usize, value_ptr: *const u8, value_size: usize);
pub fn add(key_ptr: *const u8, key_size: usize, value_ptr: *const u8, value_size: usize);
pub fn new_uref(key_ptr: *mut u8);
pub fn serialize_function(name_ptr: *const u8, name_size: usize) -> usize;
pub fn get_function(dest_ptr: *mut u8);
pub fn store_function(
value_ptr: *const u8,
value_size: usize,
extra_urefs_ptr: *const u8,
extra_urefs_size: usize,
hash_ptr: *const u8,
);
pub fn load_arg(i: u32) -> usize;
pub fn get_arg(dest: *mut u8);
pub fn ret(
value_ptr: *const u8,
value_size: usize,
extra_urefs_ptr: *const u8,
extra_urefs_size: usize,
) -> !;
pub fn call_contract(
key_ptr: *const u8,
key_size: usize,
args_ptr: *const u8,
args_size: usize,
extra_urefs_ptr: *const u8,
extra_urefs_size: usize,
) -> usize;
pub fn get_call_result(res_ptr: *mut u8);
pub fn get_uref(name_ptr: *const u8, name_size: usize, dest: *mut u8);
pub fn has_uref_name(name_ptr: *const u8, name_size: usize) -> i32;
pub fn add_uref(name_ptr: *const u8, name_size: usize, key_ptr: *const u8, key_size: usize);
}
}
#[cfg(not(feature = "std"))]
pub mod handlers {
#[panic_handler]
#[no_mangle]
pub fn panic(_info: &::core::panic::PanicInfo) -> ! {
unsafe {
::core::intrinsics::abort();
}
}
#[alloc_error_handler]
#[no_mangle]
pub extern "C" fn oom(_: ::core::alloc::Layout) -> ! {
unsafe {
::core::intrinsics::abort();
}
}
#[lang = "eh_personality"]
extern "C" fn eh_personality() {}
}