[][src]Function transaction_builder::encode_burn_script

pub fn encode_burn_script(
    token: TypeTag,
    sliding_nonce: u64,
    preburn_address: AccountAddress
) -> Script


Burns all coins held in the preburn resource at the specified preburn address and removes them from the system. The sending account must be the Treasury Compliance account. The account that holds the preburn resource will normally be a Designated Dealer, but there are no enforced requirements that it be one.

Technical Description

This transaction permanently destroys all the coins of Token type stored in the Libra::Preburn<Token> resource published under the preburn_address account address.

This transaction will only succeed if the sending account has a Libra::BurnCapability<Token>, and a Libra::Preburn<Token> resource exists under preburn_address, with a non-zero to_burn field. After the successful execution of this transaction the total_value field in the Libra::CurrencyInfo<Token> resource published under 0xA550C18 will be decremented by the value of the to_burn field of the preburn resource under preburn_address immediately before this transaction, and the to_burn field of the preburn resource will have a zero value.


The successful execution of this transaction will emit a Libra::BurnEvent on the event handle held in the Libra::CurrencyInfo<Token> resource's burn_events published under 0xA550C18.


TokenTypeThe Move type for the Token currency being burned. Token must be an already-registered currency on-chain.
tc_account&signerThe signer reference of the sending account of this transaction, must have a burn capability for Token published under it.
sliding_nonceu64The sliding_nonce (see: SlidingNonce) to be used for this transaction.
preburn_addressaddressThe address where the coins to-be-burned are currently held.

Common Abort Conditions

Error CategoryError ReasonDescription
Errors::NOT_PUBLISHEDSlidingNonce::ESLIDING_NONCEA SlidingNonce resource is not published under account.
Errors::INVALID_ARGUMENTSlidingNonce::ENONCE_TOO_OLDThe sliding_nonce is too old and it's impossible to determine if it's duplicated or not.
Errors::INVALID_ARGUMENTSlidingNonce::ENONCE_TOO_NEWThe sliding_nonce is too far in the future.
Errors::INVALID_ARGUMENTSlidingNonce::ENONCE_ALREADY_RECORDEDThe sliding_nonce has been previously recorded.
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::INVALID_STATELibra::EPREBURN_EMPTYThe Libra::Preburn<Token> resource is empty (has a value of 0).
Errors::NOT_PUBLISHEDLibra::ECURRENCY_INFOThe specified Token is not a registered currency on-chain.

Related Scripts