drt_sc/api/
call_value_api.rs

1use super::{ErrorApiImpl, HandleTypeInfo, ManagedTypeApiImpl};
2
3pub trait CallValueApi: HandleTypeInfo {
4    type CallValueApiImpl: CallValueApiImpl
5        + HandleTypeInfo<
6            ManagedBufferHandle = Self::ManagedBufferHandle,
7            BigIntHandle = Self::BigIntHandle,
8            BigFloatHandle = Self::BigFloatHandle,
9            EllipticCurveHandle = Self::EllipticCurveHandle,
10        >;
11
12    fn call_value_api_impl() -> Self::CallValueApiImpl;
13}
14
15pub trait CallValueApiImpl: ErrorApiImpl + ManagedTypeApiImpl + Sized {
16    fn check_not_payable(&self);
17
18    /// Retrieves the REWA call value from the VM.
19    /// Will return 0 in case of an DCDT transfer (cannot have both REWA and DCDT transfer simultaneously).
20    fn load_rewa_value(&self, dest_handle: Self::BigIntHandle);
21
22    /// Loads all DCDT call values into a managed vec. Overwrites destination.
23    fn load_all_dcdt_transfers(&self, dest_handle: Self::ManagedBufferHandle);
24
25    /// Gets the total number of DCDT transfers (Fungible/SFT/NFT).
26    ///
27    /// It is redundant, since the number can also be retrieved from `load_all_dcdt_transfers`,
28    /// but it is easier and cheaper to call when the content of those transfers is of no interest.
29    fn dcdt_num_transfers(&self) -> usize;
30}