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
use super::{
    BlockchainApi, CallTypeApi, CallValueApi, CryptoApi, EndpointArgumentApi, EndpointFinishApi,
    ErrorApi, LogApi, ManagedTypeApi, PrintApi, SendApi, StorageMapperApi, StorageReadApi,
    StorageReadApiImpl, StorageWriteApi,
};

pub trait VMApi:
    ManagedTypeApi
    + BlockchainApi
    + CallValueApi
    + CryptoApi
    + EndpointArgumentApi
    + EndpointFinishApi
    + ErrorApi
    + LogApi
    + SendApi
    + StorageReadApi
    + StorageWriteApi
    + PrintApi
    + CallTypeApi
    + StorageMapperApi
    + Clone // TODO: remove
    + PartialEq // for helping derive PartialEq for managed types
    + Eq
{
    /// Slightly hacky way of overriding the constructor for external view contracts.
    /// 
    /// Only required for the tests, in production the meta crate makes sure to replace it.
    /// 
    /// TODO: find a more robust and maybe extendable solution.
    fn external_view_init_override() -> bool {
        false
    }
    fn init_static() {
        Self::storage_read_api_impl().storage_read_api_init();
    }
}