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
use super::{
BigIntApi, BigUintApi, BlockchainApi, CallValueApi, CryptoApi, EndpointArgumentApi,
EndpointFinishApi, ErrorApi, LogApi, ProxyObjApi, SendApi, StorageReadApi, StorageWriteApi,
};
use crate::types::Address;
pub trait ContractBase: Sized {
type BigUint: BigUintApi + 'static;
type BigInt: BigIntApi + 'static;
type Storage: StorageReadApi + StorageWriteApi + ErrorApi + Clone + 'static;
type CallValue: CallValueApi<AmountType = Self::BigUint> + ErrorApi + Clone + 'static;
type SendApi: SendApi<
AmountType = Self::BigUint,
ProxyBigInt = Self::BigInt,
ProxyStorage = Self::Storage,
> + Clone
+ 'static;
type BlockchainApi: BlockchainApi<BalanceType = Self::BigUint> + Clone + 'static;
type CryptoApi: CryptoApi + Clone + 'static;
type LogApi: LogApi + ErrorApi + Clone + 'static;
type ErrorApi: ErrorApi + Clone + 'static;
fn get_storage_raw(&self) -> Self::Storage;
fn call_value(&self) -> Self::CallValue;
fn send(&self) -> Self::SendApi;
fn blockchain(&self) -> Self::BlockchainApi;
fn crypto(&self) -> Self::CryptoApi;
fn log_api_raw(&self) -> Self::LogApi;
fn error_api(&self) -> Self::ErrorApi;
fn proxy<P: ProxyObjApi<SendApi = Self::SendApi>>(&self, address: Address) -> P {
P::new_proxy_obj(self.send(), address)
}
}
pub trait ContractPrivateApi {
type ArgumentApi: EndpointArgumentApi + Clone + 'static;
type FinishApi: EndpointFinishApi + ErrorApi + Clone + 'static;
fn argument_api(&self) -> Self::ArgumentApi;
fn finish_api(&self) -> Self::FinishApi;
}