Skip to main content

neo_runtime/
runtime.rs

1use neo_syscalls::NeoVMSyscall;
2use neo_types::*;
3
4use crate::NeoStorage;
5
6/// Direct wrappers for the canonical System.Runtime syscalls.
7pub struct NeoRuntime;
8
9impl NeoRuntime {
10    pub fn get_time() -> NeoResult<NeoInteger> {
11        NeoVMSyscall::get_time()
12    }
13
14    pub fn check_witness(account: &NeoByteString) -> NeoResult<NeoBoolean> {
15        NeoVMSyscall::check_witness(account)
16    }
17
18    pub fn notify(event: &NeoString, state: &NeoArray<NeoValue>) -> NeoResult<()> {
19        NeoVMSyscall::notify(event, state)
20    }
21
22    pub fn log(message: &NeoString) -> NeoResult<()> {
23        NeoVMSyscall::log(message)
24    }
25
26    pub fn platform() -> NeoResult<NeoString> {
27        NeoVMSyscall::platform()
28    }
29
30    pub fn get_trigger() -> NeoResult<NeoInteger> {
31        NeoVMSyscall::get_trigger()
32    }
33
34    pub fn get_invocation_counter() -> NeoResult<NeoInteger> {
35        NeoVMSyscall::get_invocation_counter()
36    }
37
38    pub fn get_random() -> NeoResult<NeoInteger> {
39        NeoVMSyscall::get_random()
40    }
41
42    pub fn get_network() -> NeoResult<NeoInteger> {
43        NeoVMSyscall::get_network()
44    }
45
46    pub fn get_address_version() -> NeoResult<NeoInteger> {
47        NeoVMSyscall::get_address_version()
48    }
49
50    pub fn get_gas_left() -> NeoResult<NeoInteger> {
51        NeoVMSyscall::get_gas_left()
52    }
53
54    pub fn get_calling_script_hash() -> NeoResult<NeoByteString> {
55        NeoVMSyscall::get_calling_script_hash()
56    }
57
58    pub fn get_entry_script_hash() -> NeoResult<NeoByteString> {
59        NeoVMSyscall::get_entry_script_hash()
60    }
61
62    pub fn get_executing_script_hash() -> NeoResult<NeoByteString> {
63        NeoVMSyscall::get_executing_script_hash()
64    }
65
66    pub fn get_notifications(script_hash: Option<&NeoByteString>) -> NeoResult<NeoArray<NeoValue>> {
67        NeoVMSyscall::get_notifications(script_hash)
68    }
69
70    pub fn get_script_container() -> NeoResult<NeoArray<NeoValue>> {
71        NeoVMSyscall::get_script_container()
72    }
73
74    pub fn get_storage_context() -> NeoResult<NeoStorageContext> {
75        NeoStorage::get_context()
76    }
77}