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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
use crate::codec::{multi_types::IgnoreValue, TopDecodeMulti, TopEncodeMulti};
use crate::{
api::CallTypeApi, contract_base::ExitCodecErrorHandler, err_msg, types::ManagedBuffer,
};
use super::{AsyncCall, ContractCallNoPayment, ContractCallWithEgld, ManagedArgBuffer};
pub trait ContractCall<SA>: Sized
where
SA: CallTypeApi + 'static,
{
type OriginalResult: TopEncodeMulti;
#[doc(hidden)]
fn into_normalized(self) -> ContractCallWithEgld<SA, Self::OriginalResult>;
#[doc(hidden)]
fn get_mut_basic(&mut self) -> &mut ContractCallNoPayment<SA, Self::OriginalResult>;
#[doc(hidden)]
fn proxy_arg<T: TopEncodeMulti>(&mut self, endpoint_arg: &T) {
let h = ExitCodecErrorHandler::<SA>::from(err_msg::CONTRACT_CALL_ENCODE_ERROR);
let Ok(()) =
endpoint_arg.multi_encode_or_handle_err(&mut self.get_mut_basic().arg_buffer, h);
}
fn push_raw_argument<RawArg: Into<ManagedBuffer<SA>>>(&mut self, raw_arg: RawArg) {
self.get_mut_basic().arg_buffer.push_arg_raw(raw_arg.into())
}
fn with_raw_arguments(mut self, raw_argument_buffer: ManagedArgBuffer<SA>) -> Self {
self.get_mut_basic().arg_buffer = raw_argument_buffer;
self
}
#[inline]
fn with_gas_limit(mut self, gas_limit: u64) -> Self {
self.get_mut_basic().explicit_gas_limit = gas_limit;
self
}
#[inline]
fn async_call(self) -> AsyncCall<SA> {
self.into_normalized().async_call()
}
#[inline]
#[cfg(feature = "promises")]
fn async_call_promise(self) -> super::AsyncCallPromises<SA> {
self.into_normalized().async_call_promise()
}
#[inline]
fn execute_on_dest_context<RequestedResult>(self) -> RequestedResult
where
RequestedResult: TopDecodeMulti,
{
self.into_normalized().execute_on_dest_context()
}
#[deprecated(
since = "0.36.1",
note = "Redundant method, use `let _: IgnoreValue = contract_call.execute_on_dest_context(...)` instead"
)]
fn execute_on_dest_context_ignore_result(self) {
let _ = self.execute_on_dest_context::<IgnoreValue>();
}
#[inline]
fn execute_on_dest_context_readonly<RequestedResult>(self) -> RequestedResult
where
RequestedResult: TopDecodeMulti,
{
self.into_normalized().execute_on_dest_context_readonly()
}
#[inline]
fn execute_on_same_context<RequestedResult>(self) -> RequestedResult
where
RequestedResult: TopDecodeMulti,
{
self.into_normalized().execute_on_same_context()
}
fn transfer_execute(self);
}