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
use crate::types::LockableStaticBuffer;

use super::Handle;

pub trait StaticVarApi {
    type StaticVarApiImpl: StaticVarApiImpl;

    fn static_var_api_impl() -> Self::StaticVarApiImpl;
}

/// A raw bytes buffer stored statically:
/// - in wasm as a static variable
/// - in debug mode on the thread local context
pub trait StaticVarApiImpl {
    fn with_lockable_static_buffer<R, F: FnOnce(&mut LockableStaticBuffer) -> R>(&self, f: F) -> R;

    fn set_external_view_target_address_handle(&self, handle: Handle);

    fn get_external_view_target_address_handle(&self) -> Handle;

    fn next_handle(&self) -> Handle;

    fn set_num_arguments(&self, num_arguments: i32);

    fn get_num_arguments(&self) -> i32;

    fn set_call_value_egld_handle(&self, handle: Handle);

    fn get_call_value_egld_handle(&self) -> Handle;

    fn set_call_value_multi_esdt_handle(&self, handle: Handle);

    fn get_call_value_multi_esdt_handle(&self) -> Handle;
}