[][src]Function transaction_builder::encode_create_designated_dealer_script

pub fn encode_create_designated_dealer_script(
    currency: TypeTag,
    sliding_nonce: u64,
    addr: AccountAddress,
    auth_key_prefix: Vec<u8>,
    human_name: Vec<u8>,
    add_all_currencies: bool
) -> Script

Summary

Creates a Designated Dealer account with the provided information, and initializes it with default mint tiers. The transaction can only be sent by the Treasury Compliance account.

Technical Description

Creates an account with the Designated Dealer role at addr with authentication key auth_key_prefix | addr and a 0 balance of type Currency. 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 account with the TreasuryCompliance role.

At the time of creation the account is also initialized with default mint tiers of (500_000, 5000_000, 50_000_000, 500_000_000), and preburn areas for each currency that is added to the account.

Parameters

NameTypeDescription
CurrencyTypeThe Move type for the Currency that the Designated Dealer should be initialized with. Currency must be an already-registered currency on-chain.
tc_account&signerThe signer reference 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.
addraddressAddress of the to-be-created Designated Dealer 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 Designated Dealer.
add_all_currenciesboolWhether to publish preburn, balance, and tier info resources for all known (SCS) currencies or just Currency 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_PUBLISHEDLibra::ECURRENCY_INFOThe Currency is not a registered currency on-chain.
Errors::ALREADY_PUBLISHEDRoles::EROLE_IDThe addr address is already taken.

Related Scripts