[][src]Function transaction_builder::encode_preburn_script

pub fn encode_preburn_script(token: TypeTag, amount: u64) -> Script


Moves a specified number of coins in a given currency from the account's balance to its preburn area after which the coins may be burned. This transaction may be sent by any account that holds a balance and preburn area in the specified currency.

Technical Description

Moves the specified amount of coins in Token currency from the sending account's LibraAccount::Balance<Token> to the Libra::Preburn<Token> published under the same account. account must have both of these resources published under it at the start of this transaction in order for it to execute successfully.


Successful execution of this script emits two events:


TokenTypeThe Move type for the Token currency being moved to the preburn area. Token must be an already-registered currency on-chain.
account&signerThe signer reference of the sending account.
amountu64The amount in Token to be moved to the preburn area.

Common Abort Conditions

Error CategoryError ReasonDescription
Errors::NOT_PUBLISHEDLibra::ECURRENCY_INFOThe Token is not a registered currency on-chain.
Errors::INVALID_STATELibraAccount::EWITHDRAWAL_CAPABILITY_ALREADY_EXTRACTEDThe withdrawal capability for account has already been extracted.
Errors::LIMIT_EXCEEDEDLibraAccount::EINSUFFICIENT_BALANCEamount is greater than payer's balance in Token.
Errors::NOT_PUBLISHEDLibraAccount::EPAYER_DOESNT_HOLD_CURRENCYaccount doesn't hold a balance in Token.
Errors::NOT_PUBLISHEDLibra::EPREBURNaccount doesn't have a Libra::Preburn<Token> resource published under it.
Errors::INVALID_STATELibra::EPREBURN_OCCUPIEDThe value field in the Libra::Preburn<Token> resource under the sender is non-zero.

Related Scripts