pub fn encode_add_currency_to_account_script(currency: TypeTag) -> Script
Expand description

Summary

Adds a zero Currency balance to the sending account. This will enable account to send, receive, and hold Diem::Diem<Currency> coins. This transaction can be successfully sent by any account that is allowed to hold balances (e.g., VASP, Designated Dealer).

Technical Description

After the successful execution of this transaction the sending account will have a DiemAccount::Balance<Currency> resource with zero balance published under it. Only accounts that can hold balances can send this transaction, the sending account cannot already have a DiemAccount::Balance<Currency> published under it.

Parameters

NameTypeDescription
CurrencyTypeThe Move type for the Currency being added to the sending account of the transaction. Currency must be an already-registered currency on-chain.
account&signerThe signer of the sending account of the transaction.

Common Abort Conditions

Error CategoryError ReasonDescription
Errors::NOT_PUBLISHEDDiem::ECURRENCY_INFOThe Currency is not a registered currency on-chain.
Errors::INVALID_ARGUMENTDiemAccount::EROLE_CANT_STORE_BALANCEThe sending account’s role does not permit balances.
Errors::ALREADY_PUBLISHEDDiemAccount::EADD_EXISTING_CURRENCYA balance for Currency is already published under the sending account.
  • Script::create_child_vasp_account
  • Script::create_parent_vasp_account
  • Script::peer_to_peer_with_metadata