pub trait MultiTokenPayModule: ContractBase + Sized {
    fn accepted_tokens(
        &self,
        token: &EgldOrEsdtTokenIdentifier<Self::Api>
    ) -> SingleValueMapper<Self::Api, BigUint<Self::Api>>; fn add_payment_token(
        &self,
        token: EgldOrEsdtTokenIdentifier<Self::Api>,
        amount: BigUint<Self::Api>
    ) { ... } fn remove_payment_token(&self, token: EgldOrEsdtTokenIdentifier<Self::Api>) { ... } fn require_valid_payment(&self) { ... } fn require_valid_payments<const X: usize>(&self) { ... } }
Expand description

This module contains the logic for accepting multiple ESDT payments.

Required Methods§

Storage mapper used for storing the accepted tokens. All tokens stored must contain the amount that is accepted for payment.

Provided Methods§

Adds a payment token to the list of accepted tokens.

Removes a payment token from the list of accepted tokens.

Require clause used for validating a single ESDT payment. It checks if the payment received contains the correct token and amount.

Require clause used for validating multiple ESDT payments. It checks if the payments received contain the correct tokens and amounts.

The generic parameter X is used to specify the maximum number of payments that can be received.

NOTE: This can be easily used for when the contract accepts NFT and ESDT payments as well.

Implementors§