pub fn encode_burn_with_amount_script_function(
    token: TypeTag,
    sliding_nonce: u64,
    preburn_address: AccountAddress,
    amount: u64
) -> TransactionPayload
Expand description

Summary

Burns the coins held in a preburn resource in the preburn queue at the specified preburn address, which are equal to the amount specified in the transaction. Finds the first relevant outstanding preburn request with matching amount and removes the contained coins from the system. The sending account must be the Treasury Compliance account. The account that holds the preburn queue 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 Diem::Preburn<Token> resource published under the preburn_address account address.

This transaction will only succeed if the sending account has a Diem::BurnCapability<Token>, and a Diem::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 Diem::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.

Events

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

Parameters

NameTypeDescription
TokenTypeThe Move type for the Token currency being burned. Token must be an already-registered currency on-chain.
tc_accountsignerThe signer 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.
amountu64The amount to be burned.

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_CAPABILITYDiem::EBURN_CAPABILITYThe sending account does not have a Diem::BurnCapability<Token> published under it.
Errors::INVALID_STATEDiem::EPREBURN_NOT_FOUNDThe Diem::PreburnQueue<Token> resource under preburn_address does not contain a preburn request with a value matching amount.
Errors::NOT_PUBLISHEDDiem::EPREBURN_QUEUEThe account at preburn_address does not have a Diem::PreburnQueue<Token> resource published under it.
Errors::NOT_PUBLISHEDDiem::ECURRENCY_INFOThe specified Token is not a registered currency on-chain.
  • TreasuryComplianceScripts::burn_txn_fees
  • TreasuryComplianceScripts::cancel_burn_with_amount
  • TreasuryComplianceScripts::preburn