pub struct PaymentRefs<'a, M>where
M: ManagedTypeApi,{
pub token_identifier: ManagedRef<'a, M, TokenId<M>>,
pub token_nonce: u64,
pub amount: ManagedRef<'a, M, NonZeroBigUint<M>>,
}Expand description
The version of Payment that contains references instead of owned fields.
Fields§
§token_identifier: ManagedRef<'a, M, TokenId<M>>§token_nonce: u64§amount: ManagedRef<'a, M, NonZeroBigUint<M>>Implementations§
Source§impl<'a, M> PaymentRefs<'a, M>where
M: ManagedTypeApi,
impl<'a, M> PaymentRefs<'a, M>where
M: ManagedTypeApi,
pub fn new( token_identifier: &'a TokenId<M>, token_nonce: u64, amount: &'a NonZeroBigUint<M>, ) -> PaymentRefs<'a, M>
Sourcepub fn map_egld_or_esdt<Context, D, F, U>(
&self,
context: Context,
for_egld: D,
for_esdt: F,
) -> Uwhere
D: FnOnce(Context, Egld<&BigUint<M>>) -> U,
F: FnOnce(Context, EsdtTokenPaymentRefs<'_, M>) -> U,
pub fn map_egld_or_esdt<Context, D, F, U>(
&self,
context: Context,
for_egld: D,
for_esdt: F,
) -> Uwhere
D: FnOnce(Context, Egld<&BigUint<M>>) -> U,
F: FnOnce(Context, EsdtTokenPaymentRefs<'_, M>) -> U,
Mostly used for communication with the VM.
Trait Implementations§
Source§impl<'a, M> Debug for PaymentRefs<'a, M>where
M: Debug + ManagedTypeApi,
impl<'a, M> Debug for PaymentRefs<'a, M>where
M: Debug + ManagedTypeApi,
Source§impl<Env> TxPayment<Env> for PaymentRefs<'_, <Env as TxEnv>::Api>where
Env: TxEnv,
impl<Env> TxPayment<Env> for PaymentRefs<'_, <Env as TxEnv>::Api>where
Env: TxEnv,
Source§fn is_no_payment(&self, _env: &Env) -> bool
fn is_no_payment(&self, _env: &Env) -> bool
Returns true if payment indicates transfer of either non-zero EGLD or ESDT amounts.
Source§fn perform_transfer_execute_fallible(
self,
env: &Env,
to: &ManagedAddress<<Env as TxEnv>::Api>,
gas_limit: u64,
fc: FunctionCall<<Env as TxEnv>::Api>,
) -> Result<(), TransferExecuteFailed>
fn perform_transfer_execute_fallible( self, env: &Env, to: &ManagedAddress<<Env as TxEnv>::Api>, gas_limit: u64, fc: FunctionCall<<Env as TxEnv>::Api>, ) -> Result<(), TransferExecuteFailed>
Transfer-execute calls have different APIs for different payments types.
This method selects between them.
Source§fn perform_transfer_execute_legacy(
self,
env: &Env,
to: &ManagedAddress<<Env as TxEnv>::Api>,
gas_limit: u64,
fc: FunctionCall<<Env as TxEnv>::Api>,
)
fn perform_transfer_execute_legacy( self, env: &Env, to: &ManagedAddress<<Env as TxEnv>::Api>, gas_limit: u64, fc: FunctionCall<<Env as TxEnv>::Api>, )
Allows transfer-execute without payment.
Source§fn with_normalized<From, To, F, R>(
self,
env: &Env,
from: &From,
to: To,
fc: FunctionCall<<Env as TxEnv>::Api>,
f: F,
) -> Rwhere
From: TxFrom<Env>,
To: TxToSpecified<Env>,
F: FnOnce(&ManagedAddress<<Env as TxEnv>::Api>, &BigUint<<Env as TxEnv>::Api>, FunctionCall<<Env as TxEnv>::Api>) -> R,
fn with_normalized<From, To, F, R>(
self,
env: &Env,
from: &From,
to: To,
fc: FunctionCall<<Env as TxEnv>::Api>,
f: F,
) -> Rwhere
From: TxFrom<Env>,
To: TxToSpecified<Env>,
F: FnOnce(&ManagedAddress<<Env as TxEnv>::Api>, &BigUint<<Env as TxEnv>::Api>, FunctionCall<<Env as TxEnv>::Api>) -> R,
Converts an ESDT call to a built-in function call, if necessary.
Source§fn into_full_payment_data(
self,
env: &Env,
) -> FullPaymentData<<Env as TxEnv>::Api>
fn into_full_payment_data( self, env: &Env, ) -> FullPaymentData<<Env as TxEnv>::Api>
Payment data to be used by the testing framework. Will be refactored.
Source§fn perform_transfer_fallible(
self,
env: &Env,
to: &ManagedAddress<<Env as TxEnv>::Api>,
) -> Result<(), TransferExecuteFailed>
fn perform_transfer_fallible( self, env: &Env, to: &ManagedAddress<<Env as TxEnv>::Api>, ) -> Result<(), TransferExecuteFailed>
Shortcut for doing direct transfers. Read more
Auto Trait Implementations§
impl<'a, M> Freeze for PaymentRefs<'a, M>where
<M as HandleTypeInfo>::ManagedBufferHandle: Freeze,
<M as HandleTypeInfo>::BigIntHandle: Freeze,
impl<'a, M> RefUnwindSafe for PaymentRefs<'a, M>where
<M as HandleTypeInfo>::ManagedBufferHandle: RefUnwindSafe,
<M as HandleTypeInfo>::BigIntHandle: RefUnwindSafe,
M: RefUnwindSafe,
impl<'a, M> Send for PaymentRefs<'a, M>where
<M as HandleTypeInfo>::ManagedBufferHandle: Send + Sync,
<M as HandleTypeInfo>::BigIntHandle: Send + Sync,
M: Send + Sync,
impl<'a, M> Sync for PaymentRefs<'a, M>where
<M as HandleTypeInfo>::ManagedBufferHandle: Sync,
<M as HandleTypeInfo>::BigIntHandle: Sync,
M: Sync,
impl<'a, M> Unpin for PaymentRefs<'a, M>where
<M as HandleTypeInfo>::ManagedBufferHandle: Unpin,
<M as HandleTypeInfo>::BigIntHandle: Unpin,
M: Unpin,
impl<'a, M> UnwindSafe for PaymentRefs<'a, M>where
<M as HandleTypeInfo>::ManagedBufferHandle: UnwindSafe + RefUnwindSafe,
<M as HandleTypeInfo>::BigIntHandle: UnwindSafe + RefUnwindSafe,
M: UnwindSafe + RefUnwindSafe,
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> InterpretableFrom<T> for T
impl<T> InterpretableFrom<T> for T
fn interpret_from(from: T, _context: &InterpreterContext) -> T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more