1use neo_syscalls::NeoVMSyscall;
5use neo_types::*;
6
7use crate::NeoStorage;
8
9pub struct NeoRuntime;
11
12impl NeoRuntime {
13 pub fn get_time() -> NeoResult<NeoInteger> {
14 NeoVMSyscall::get_time()
15 }
16
17 pub fn get_time_i64() -> NeoResult<i64> {
18 NeoVMSyscall::get_time_i64()
19 }
20
21 pub fn check_witness(account: &NeoByteString) -> NeoResult<NeoBoolean> {
22 NeoVMSyscall::check_witness(account)
23 }
24
25 pub fn check_witness_bytes(account: &[u8]) -> NeoResult<NeoBoolean> {
26 NeoVMSyscall::check_witness_bytes(account)
27 }
28
29 pub fn check_witness_i64(account: i64) -> NeoResult<NeoBoolean> {
30 NeoVMSyscall::check_witness_i64(account)
31 }
32
33 pub fn require_witness_i64(account: i64) -> bool {
41 NeoRuntime::check_witness_i64(account)
42 .map(|flag| flag.as_bool())
43 .unwrap_or(false)
44 }
45
46 pub fn notify(event: &NeoString, state: &NeoArray<NeoValue>) -> NeoResult<()> {
47 NeoVMSyscall::notify(event, state)
48 }
49
50 pub fn notify_event(event: &str) -> NeoResult<()> {
51 NeoVMSyscall::notify_event(event)
52 }
53
54 pub fn log(message: &NeoString) -> NeoResult<()> {
55 NeoVMSyscall::log(message)
56 }
57
58 pub fn platform() -> NeoResult<NeoString> {
59 NeoVMSyscall::platform()
60 }
61
62 pub fn get_trigger() -> NeoResult<NeoInteger> {
63 NeoVMSyscall::get_trigger()
64 }
65
66 pub fn get_invocation_counter() -> NeoResult<NeoInteger> {
67 NeoVMSyscall::get_invocation_counter()
68 }
69
70 pub fn get_random() -> NeoResult<NeoInteger> {
71 NeoVMSyscall::get_random()
72 }
73
74 pub fn get_network() -> NeoResult<NeoInteger> {
75 NeoVMSyscall::get_network()
76 }
77
78 pub fn get_address_version() -> NeoResult<NeoInteger> {
79 NeoVMSyscall::get_address_version()
80 }
81
82 pub fn get_gas_left() -> NeoResult<NeoInteger> {
83 NeoVMSyscall::get_gas_left()
84 }
85
86 pub fn get_calling_script_hash() -> NeoResult<NeoByteString> {
87 NeoVMSyscall::get_calling_script_hash()
88 }
89
90 pub fn get_calling_script_hash_i64() -> NeoResult<i64> {
91 NeoVMSyscall::get_calling_script_hash_i64()
92 }
93
94 pub fn get_entry_script_hash() -> NeoResult<NeoByteString> {
95 NeoVMSyscall::get_entry_script_hash()
96 }
97
98 pub fn get_entry_script_hash_i64() -> NeoResult<i64> {
99 NeoVMSyscall::get_entry_script_hash_i64()
100 }
101
102 pub fn get_executing_script_hash() -> NeoResult<NeoByteString> {
103 NeoVMSyscall::get_executing_script_hash()
104 }
105
106 pub fn get_executing_script_hash_i64() -> NeoResult<i64> {
107 NeoVMSyscall::get_executing_script_hash_i64()
108 }
109
110 pub fn get_notifications(script_hash: Option<&NeoByteString>) -> NeoResult<NeoArray<NeoValue>> {
111 NeoVMSyscall::get_notifications(script_hash)
112 }
113
114 pub fn get_script_container() -> NeoResult<NeoArray<NeoValue>> {
115 NeoVMSyscall::get_script_container()
116 }
117
118 pub fn get_storage_context() -> NeoResult<NeoStorageContext> {
119 NeoStorage::get_context()
120 }
121
122 pub fn burn_gas(gas: &NeoInteger) -> NeoResult<()> {
124 NeoVMSyscall::burn_gas(gas)
125 }
126
127 pub fn current_signers() -> NeoResult<NeoArray<NeoValue>> {
129 NeoVMSyscall::current_signers()
130 }
131
132 pub fn load_script(
134 script: &NeoByteString,
135 call_flags: &NeoInteger,
136 args: &NeoArray<NeoValue>,
137 ) -> NeoResult<()> {
138 NeoVMSyscall::load_script(script, call_flags, args)
139 }
140}