The PaymentsModule
trait defines the functionalities related to handling payments within a smart contract on the MultiversX blockchain. It includes the ability to whitelist acceptable payment tokens and to process deposits.
add_accepted_payment_tokens(accepted_tokens: MultiValueEncoded<EgldOrEsdtTokenIdentifier>)
accepted_payment_tokens
set.deposit()
withdraw(tokens_to_withdraw: MultiValueEncoded<MultiValue2<EgldOrEsdtTokenIdentifier, BigUint>>)
deposit
function is marked as #[payable("*")]
, which means it can accept a payment in EGLD or any single fungible ESDT token.deposit
, the caller must send an acceptable payment token and a positive payment amount.#[only_owner]
macro restricts the add_accepted_payment_tokens
function to the contract owner.