[][src]Function transaction_builder::encode_cancel_burn_script

pub fn encode_cancel_burn_script(
    token: TypeTag,
    preburn_address: AccountAddress
) -> Script

Summary

Cancels and returns all coins held in the preburn area under preburn_address and returns the funds to the preburn_address's balance. Can only be successfully sent by an account with Treasury Compliance role.

Technical Description

Cancels and returns all coins held in the Libra::Preburn<Token> resource under the preburn_address and return the funds to the preburn_address account's LibraAccount::Balance<Token>. The transaction must be sent by an account with a Libra::BurnCapability<Token> resource published under it. The account at preburn_address must have a Libra::Preburn<Token> resource published under it, and its value must be nonzero. The transaction removes the entire balance held in the Libra::Preburn<Token> resource, and returns it back to the account's LibraAccount::Balance<Token> under preburn_address. Due to this, the account at preburn_address must already have a balance in the Token currency published before this script is called otherwise the transaction will fail.

Events

The successful execution of this transaction will emit:

Parameters

NameTypeDescription
TokenTypeThe Move type for the Token currenty that burning is being cancelled for. Token must be an already-registered currency on-chain.
account&signerThe signer reference of the sending account of this transaction, must have a burn capability for Token published under it.
preburn_addressaddressThe address where the coins to-be-burned are currently held.

Common Abort Conditions

Error CategoryError ReasonDescription
Errors::REQUIRES_CAPABILITYLibra::EBURN_CAPABILITYThe sending account does not have a Libra::BurnCapability<Token> published under it.
Errors::NOT_PUBLISHEDLibra::EPREBURNThe account at preburn_address does not have a Libra::Preburn<Token> resource published under it.
Errors::NOT_PUBLISHEDLibra::ECURRENCY_INFOThe specified Token is not a registered currency on-chain.
Errors::INVALID_ARGUMENTLibraAccount::ECOIN_DEPOSIT_IS_ZEROThe value held in the preburn resource was zero.
Errors::INVALID_ARGUMENTLibraAccount::EPAYEE_CANT_ACCEPT_CURRENCY_TYPEThe account at preburn_address doesn't have a balance resource for Token.
Errors::LIMIT_EXCEEDEDLibraAccount::EDEPOSIT_EXCEEDS_LIMITSThe depositing of the funds held in the prebun area would exceed the account's account limits.
Errors::INVALID_STATEDualAttestation::EPAYEE_COMPLIANCE_KEY_NOT_SETThe account does not have a compliance key set on it but dual attestion checking was performed.

Related Scripts