pub fn encode_create_parent_vasp_account_script_function(
    coin_type: TypeTag,
    sliding_nonce: u64,
    new_account_address: AccountAddress,
    auth_key_prefix: Vec<u8>,
    human_name: Vec<u8>,
    add_all_currencies: bool
) -> TransactionPayload
Expand description

Summary

Creates a Parent VASP account with the specified human name. Must be called by the Treasury Compliance account.

Technical Description

Creates an account with the Parent VASP role at address with authentication key auth_key_prefix | new_account_address and a 0 balance of type CoinType. If add_all_currencies is true, 0 balances for all available currencies in the system will also be added. This can only be invoked by an TreasuryCompliance account. sliding_nonce is a unique nonce for operation, see SlidingNonce for details. Authentication keys, prefixes, and how to construct them from an ed25519 public key are described here.

Events

Successful execution will emit:

  • A DiemAccount::CreateAccountEvent with the created field being new_account_address, and the rold_id field being Roles::PARENT_VASP_ROLE_ID. This is emitted on the DiemAccount::AccountOperationsCapability creation_events handle.

Parameters

NameTypeDescription
CoinTypeTypeThe Move type for the CoinType currency that the Parent VASP account should be initialized with. CoinType must be an already-registered currency on-chain.
tc_accountsignerThe signer of the sending account of this transaction. Must be the Treasury Compliance account.
sliding_nonceu64The sliding_nonce (see: SlidingNonce) to be used for this transaction.
new_account_addressaddressAddress of the to-be-created Parent VASP account.
auth_key_prefixvector<u8>The authentication key prefix that will be used initially for the newly created account.
human_namevector<u8>ASCII-encoded human name for the Parent VASP.
add_all_currenciesboolWhether to publish balance resources for all known currencies when the account is created.

Common Abort Conditions

Error CategoryError ReasonDescription
Errors::NOT_PUBLISHEDSlidingNonce::ESLIDING_NONCEA SlidingNonce resource is not published under tc_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_ADDRESSCoreAddresses::ETREASURY_COMPLIANCEThe sending account is not the Treasury Compliance account.
Errors::REQUIRES_ROLERoles::ETREASURY_COMPLIANCEThe sending account is not the Treasury Compliance account.
Errors::NOT_PUBLISHEDDiem::ECURRENCY_INFOThe CoinType is not a registered currency on-chain.
Errors::ALREADY_PUBLISHEDRoles::EROLE_IDThe new_account_address address is already taken.
  • AccountCreationScripts::create_child_vasp_account
  • AccountAdministrationScripts::add_currency_to_account
  • AccountAdministrationScripts::rotate_authentication_key
  • AccountAdministrationScripts::add_recovery_rotation_capability
  • AccountAdministrationScripts::create_recovery_address
  • AccountAdministrationScripts::rotate_dual_attestation_info