pub enum ScriptFunctionCall {
Show 19 variants AddCurrencyToAccount { currency: TypeTag, }, BurnWithAmount { token: TypeTag, sliding_nonce: u64, preburn_address: AccountAddress, amount: u64, }, CancelBurnWithAmount { token: TypeTag, preburn_address: AccountAddress, amount: u64, }, CreateDesignatedDealer { currency: TypeTag, sliding_nonce: u64, addr: AccountAddress, auth_key_prefix: Vec<u8>, human_name: Vec<u8>, add_all_currencies: bool, }, CreateRegularAccount { currency: TypeTag, new_account_address: AccountAddress, auth_key_prefix: Vec<u8>, }, CreateValidatorAccount { sliding_nonce: u64, new_account_address: AccountAddress, auth_key_prefix: Vec<u8>, human_name: Vec<u8>, }, CreateValidatorOperatorAccount { sliding_nonce: u64, new_account_address: AccountAddress, auth_key_prefix: Vec<u8>, human_name: Vec<u8>, }, FreezeAccount { sliding_nonce: u64, to_freeze_account: AccountAddress, }, MintCoin { amount: u64, }, Preburn { token: TypeTag, amount: u64, }, RotateAuthenticationKey { new_key: Vec<u8>, }, RotateAuthenticationKeyWithNonce { sliding_nonce: u64, new_key: Vec<u8>, }, RotateAuthenticationKeyWithNonceAdmin { sliding_nonce: u64, new_key: Vec<u8>, }, RotateDualAttestationInfo { new_url: Vec<u8>, new_key: Vec<u8>, }, TieredMint { coin_type: TypeTag, sliding_nonce: u64, designated_dealer_address: AccountAddress, mint_amount: u64, tier_index: u64, }, UnfreezeAccount { sliding_nonce: u64, to_unfreeze_account: AccountAddress, }, UpdateDualAttestationLimit { sliding_nonce: u64, new_micro_xdx_limit: u64, }, UpdateExchangeRate { currency: TypeTag, sliding_nonce: u64, new_exchange_rate_numerator: u64, new_exchange_rate_denominator: u64, }, UpdateMintingAbility { currency: TypeTag, allow_minting: bool, },
}
Expand description

Structured representation of a call into a known Move script function.

impl ScriptFunctionCall {
    pub fn encode(self) -> TransactionPayload { .. }
    pub fn decode(&TransactionPayload) -> Option<ScriptFunctionCall> { .. }
}

Variants§

§

AddCurrencyToAccount

Fields

§currency: TypeTag

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.
accountsignerThe 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.
  • AccountCreationScripts::create_child_vasp_account
  • AccountCreationScripts::create_parent_vasp_account
  • PaymentScripts::peer_to_peer_with_metadata
§

BurnWithAmount

Fields

§token: TypeTag
§sliding_nonce: u64
§preburn_address: AccountAddress
§amount: u64

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
§

CancelBurnWithAmount

Fields

§token: TypeTag
§preburn_address: AccountAddress
§amount: u64

Summary

Cancels and returns the coins held in the preburn area under preburn_address, which are equal to the amount specified in the transaction. Finds the first preburn resource with the matching amount and returns the funds to the preburn_address’s balance. Can only be successfully sent by an account with Treasury Compliance role.

Technical Description

Cancels and returns all coins held in the Diem::Preburn<Token> resource under the preburn_address and return the funds to the preburn_address account’s DiemAccount::Balance<Token>. The transaction must be sent by an account with a Diem::BurnCapability<Token> resource published under it. The account at preburn_address must have a Diem::Preburn<Token> resource published under it, and its value must be nonzero. The transaction removes the entire balance held in the Diem::Preburn<Token> resource, and returns it back to the account’s DiemAccount::Balance<Token> under preburn_address. Due to this, the account at preburn_address must already have a balance in the Token currency published before this script is called otherwise the transaction will fail.

Events

The successful execution of this transaction will emit:

  • A Diem::CancelBurnEvent on the event handle held in the Diem::CurrencyInfo<Token> resource’s burn_events published under 0xA550C18.
  • A DiemAccount::ReceivedPaymentEvent on the preburn_address’s DiemAccount::DiemAccount received_events event handle with both the payer and payee being preburn_address.

Parameters

NameTypeDescription
TokenTypeThe Move type for the Token currenty that burning is being cancelled for. Token must be an already-registered currency on-chain.
accountsignerThe signer of the sending account of this transaction, must have a burn capability for Token published under it.
preburn_addressaddressThe address where the coins to-be-burned are currently held.
amountu64The amount to be cancelled.

Common Abort Conditions

Error CategoryError ReasonDescription
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.
Errors::INVALID_ARGUMENTDiemAccount::EPAYEE_CANT_ACCEPT_CURRENCY_TYPEThe account at preburn_address doesn’t have a balance resource for Token.
Errors::LIMIT_EXCEEDEDDiemAccount::EDEPOSIT_EXCEEDS_LIMITSThe depositing of the funds held in the prebun area would exceed the account’s account limits.
Errors::INVALID_STATEDualAttestation::EPAYEE_COMPLIANCE_KEY_NOT_SETThe account does not have a compliance key set on it but dual attestion checking was performed.
  • TreasuryComplianceScripts::burn_txn_fees
  • TreasuryComplianceScripts::burn_with_amount
  • TreasuryComplianceScripts::preburn
§

CreateDesignatedDealer

Fields

§currency: TypeTag
§sliding_nonce: u64
§addr: AccountAddress
§auth_key_prefix: Vec<u8>
§human_name: Vec<u8>
§add_all_currencies: bool

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. Authentication keys, prefixes, and how to construct them from an ed25519 public key are described here.

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.

Events

Successful execution will emit:

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

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_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.
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_PUBLISHEDDiem::ECURRENCY_INFOThe Currency is not a registered currency on-chain.
Errors::ALREADY_PUBLISHEDRoles::EROLE_IDThe addr address is already taken.
  • TreasuryComplianceScripts::tiered_mint
  • PaymentScripts::peer_to_peer_with_metadata
  • AccountAdministrationScripts::rotate_dual_attestation_info
§

CreateRegularAccount

Fields

§currency: TypeTag
§new_account_address: AccountAddress
§auth_key_prefix: Vec<u8>

Create a regular account

§

CreateValidatorAccount

Fields

§sliding_nonce: u64
§new_account_address: AccountAddress
§auth_key_prefix: Vec<u8>
§human_name: Vec<u8>

Summary

Creates a Validator account. This transaction can only be sent by the Diem Root account.

Technical Description

Creates an account with a Validator role at new_account_address, with authentication key auth_key_prefix | new_account_address. It publishes a ValidatorConfig::ValidatorConfig resource with empty config, and operator_account fields. The human_name field of the ValidatorConfig::ValidatorConfig is set to the passed in human_name. This script does not add the validator to the validator set or the system, but only creates the account. 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::VALIDATOR_ROLE_ID. This is emitted on the DiemAccount::AccountOperationsCapability creation_events handle.

Parameters

NameTypeDescription
dr_accountsignerThe signer of the sending account of this transaction. Must be the Diem Root signer.
sliding_nonceu64The sliding_nonce (see: SlidingNonce) to be used for this transaction.
new_account_addressaddressAddress of the to-be-created Validator 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 validator.

Common Abort Conditions

Error CategoryError ReasonDescription
Errors::NOT_PUBLISHEDSlidingNonce::ESLIDING_NONCEA SlidingNonce resource is not published under dr_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::EDIEM_ROOTThe sending account is not the Diem Root account.
Errors::REQUIRES_ROLERoles::EDIEM_ROOTThe sending account is not the Diem Root account.
Errors::ALREADY_PUBLISHEDRoles::EROLE_IDThe new_account_address address is already taken.
  • AccountCreationScripts::create_validator_operator_account
  • ValidatorAdministrationScripts::add_validator_and_reconfigure
  • ValidatorAdministrationScripts::register_validator_config
  • ValidatorAdministrationScripts::remove_validator_and_reconfigure
  • ValidatorAdministrationScripts::set_validator_operator
  • ValidatorAdministrationScripts::set_validator_operator_with_nonce_admin
  • ValidatorAdministrationScripts::set_validator_config_and_reconfigure
§

CreateValidatorOperatorAccount

Fields

§sliding_nonce: u64
§new_account_address: AccountAddress
§auth_key_prefix: Vec<u8>
§human_name: Vec<u8>

Summary

Creates a Validator Operator account. This transaction can only be sent by the Diem Root account.

Technical Description

Creates an account with a Validator Operator role at new_account_address, with authentication key auth_key_prefix | new_account_address. It publishes a ValidatorOperatorConfig::ValidatorOperatorConfig resource with the specified human_name. This script does not assign the validator operator to any validator accounts but only creates the account. Authentication key 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::VALIDATOR_OPERATOR_ROLE_ID. This is emitted on the DiemAccount::AccountOperationsCapability creation_events handle.

Parameters

NameTypeDescription
dr_accountsignerThe signer of the sending account of this transaction. Must be the Diem Root signer.
sliding_nonceu64The sliding_nonce (see: SlidingNonce) to be used for this transaction.
new_account_addressaddressAddress of the to-be-created Validator 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 validator.

Common Abort Conditions

Error CategoryError ReasonDescription
Errors::NOT_PUBLISHEDSlidingNonce::ESLIDING_NONCEA SlidingNonce resource is not published under dr_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::EDIEM_ROOTThe sending account is not the Diem Root account.
Errors::REQUIRES_ROLERoles::EDIEM_ROOTThe sending account is not the Diem Root account.
Errors::ALREADY_PUBLISHEDRoles::EROLE_IDThe new_account_address address is already taken.
  • AccountCreationScripts::create_validator_account
  • ValidatorAdministrationScripts::add_validator_and_reconfigure
  • ValidatorAdministrationScripts::register_validator_config
  • ValidatorAdministrationScripts::remove_validator_and_reconfigure
  • ValidatorAdministrationScripts::set_validator_operator
  • ValidatorAdministrationScripts::set_validator_operator_with_nonce_admin
  • ValidatorAdministrationScripts::set_validator_config_and_reconfigure
§

FreezeAccount

Fields

§sliding_nonce: u64
§to_freeze_account: AccountAddress

Summary

Freezes the account at address. The sending account of this transaction must be the Treasury Compliance account. The account being frozen cannot be the Diem Root or Treasury Compliance account. After the successful execution of this transaction no transactions may be sent from the frozen account, and the frozen account may not send or receive coins.

Technical Description

Sets the AccountFreezing::FreezingBit to true and emits a AccountFreezing::FreezeAccountEvent. The transaction sender must be the Treasury Compliance account, but the account at to_freeze_account must not be either 0xA550C18 (the Diem Root address), or 0xB1E55ED (the Treasury Compliance address). Note that this is a per-account property e.g., freezing a Parent VASP will not effect the status any of its child accounts and vice versa.

Events

Successful execution of this transaction will emit a AccountFreezing::FreezeAccountEvent on the freeze_event_handle held in the AccountFreezing::FreezeEventsHolder resource published under 0xA550C18 with the frozen_address being the to_freeze_account.

Parameters

NameTypeDescription
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.
to_freeze_accountaddressThe account address to be frozen.

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::INVALID_ARGUMENTAccountFreezing::ECANNOT_FREEZE_TCto_freeze_account was the Treasury Compliance account (0xB1E55ED).
Errors::INVALID_ARGUMENTAccountFreezing::ECANNOT_FREEZE_DIEM_ROOTto_freeze_account was the Diem Root account (0xA550C18).
  • TreasuryComplianceScripts::unfreeze_account
§

MintCoin

Fields

§amount: u64
§

Preburn

Fields

§token: TypeTag
§amount: u64

Summary

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 DiemAccount::Balance<Token> to the Diem::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.

Events

Successful execution of this script emits two events:

  • DiemAccount::SentPaymentEvent on account’s DiemAccount::DiemAccount sent_events handle with the payee and payer fields being account’s address; and
  • A Diem::PreburnEvent with Token’s currency code on the Diem::CurrencyInfo<Token’s preburn_events handle for Token and with preburn_address set to account’s address.

Parameters

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

Common Abort Conditions

Error CategoryError ReasonDescription
Errors::NOT_PUBLISHEDDiem::ECURRENCY_INFOThe Token is not a registered currency on-chain.
Errors::INVALID_STATEDiemAccount::EWITHDRAWAL_CAPABILITY_ALREADY_EXTRACTEDThe withdrawal capability for account has already been extracted.
Errors::LIMIT_EXCEEDEDDiemAccount::EINSUFFICIENT_BALANCEamount is greater than payer’s balance in Token.
Errors::NOT_PUBLISHEDDiemAccount::EPAYER_DOESNT_HOLD_CURRENCYaccount doesn’t hold a balance in Token.
Errors::NOT_PUBLISHEDDiem::EPREBURNaccount doesn’t have a Diem::Preburn<Token> resource published under it.
Errors::INVALID_STATEDiem::EPREBURN_OCCUPIEDThe value field in the Diem::Preburn<Token> resource under the sender is non-zero.
Errors::NOT_PUBLISHEDRoles::EROLE_IDThe account did not have a role assigned to it.
Errors::REQUIRES_ROLERoles::EDESIGNATED_DEALERThe account did not have the role of DesignatedDealer.
  • TreasuryComplianceScripts::cancel_burn_with_amount
  • TreasuryComplianceScripts::burn_with_amount
  • TreasuryComplianceScripts::burn_txn_fees
§

RotateAuthenticationKey

Fields

§new_key: Vec<u8>

Summary

Rotates the account’s authentication key to the supplied new authentication key. May be sent by any account.

Technical Description

Rotate the account’s DiemAccount::DiemAccount authentication_key field to new_key. new_key must be a valid authentication key that corresponds to an ed25519 public key as described here, and account must not have previously delegated its DiemAccount::KeyRotationCapability.

Parameters

NameTypeDescription
accountsignerSigner of the sending account of the transaction.
new_keyvector<u8>New authentication key to be used for account.

Common Abort Conditions

Error CategoryError ReasonDescription
Errors::INVALID_STATEDiemAccount::EKEY_ROTATION_CAPABILITY_ALREADY_EXTRACTEDaccount has already delegated/extracted its DiemAccount::KeyRotationCapability.
Errors::INVALID_ARGUMENTDiemAccount::EMALFORMED_AUTHENTICATION_KEYnew_key was an invalid length.
  • AccountAdministrationScripts::rotate_authentication_key_with_nonce
  • AccountAdministrationScripts::rotate_authentication_key_with_nonce_admin
  • AccountAdministrationScripts::rotate_authentication_key_with_recovery_address
§

RotateAuthenticationKeyWithNonce

Fields

§sliding_nonce: u64
§new_key: Vec<u8>

Summary

Rotates the sender’s authentication key to the supplied new authentication key. May be sent by any account that has a sliding nonce resource published under it (usually this is Treasury Compliance or Diem Root accounts).

Technical Description

Rotates the account’s DiemAccount::DiemAccount authentication_key field to new_key. new_key must be a valid authentication key that corresponds to an ed25519 public key as described here, and account must not have previously delegated its DiemAccount::KeyRotationCapability.

Parameters

NameTypeDescription
accountsignerSigner of the sending account of the transaction.
sliding_nonceu64The sliding_nonce (see: SlidingNonce) to be used for this transaction.
new_keyvector<u8>New authentication key to be used for account.

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::INVALID_STATEDiemAccount::EKEY_ROTATION_CAPABILITY_ALREADY_EXTRACTEDaccount has already delegated/extracted its DiemAccount::KeyRotationCapability.
Errors::INVALID_ARGUMENTDiemAccount::EMALFORMED_AUTHENTICATION_KEYnew_key was an invalid length.
  • AccountAdministrationScripts::rotate_authentication_key
  • AccountAdministrationScripts::rotate_authentication_key_with_nonce_admin
  • AccountAdministrationScripts::rotate_authentication_key_with_recovery_address
§

RotateAuthenticationKeyWithNonceAdmin

Fields

§sliding_nonce: u64
§new_key: Vec<u8>

Summary

Rotates the specified account’s authentication key to the supplied new authentication key. May only be sent by the Diem Root account as a write set transaction.

Technical Description

Rotate the account’s DiemAccount::DiemAccount authentication_key field to new_key. new_key must be a valid authentication key that corresponds to an ed25519 public key as described here, and account must not have previously delegated its DiemAccount::KeyRotationCapability.

Parameters

NameTypeDescription
dr_accountsignerThe signer of the sending account of the write set transaction. May only be the Diem Root signer.
accountsignerSigner of account specified in the execute_as field of the write set transaction.
sliding_nonceu64The sliding_nonce (see: SlidingNonce) to be used for this transaction for Diem Root.
new_keyvector<u8>New authentication key to be used for account.

Common Abort Conditions

Error CategoryError ReasonDescription
Errors::NOT_PUBLISHEDSlidingNonce::ESLIDING_NONCEA SlidingNonce resource is not published under dr_account.
Errors::INVALID_ARGUMENTSlidingNonce::ENONCE_TOO_OLDThe sliding_nonce in dr_account is too old and it’s impossible to determine if it’s duplicated or not.
Errors::INVALID_ARGUMENTSlidingNonce::ENONCE_TOO_NEWThe sliding_nonce in dr_account is too far in the future.
Errors::INVALID_ARGUMENTSlidingNonce::ENONCE_ALREADY_RECORDEDThe sliding_nonce in dr_account has been previously recorded.
Errors::INVALID_STATEDiemAccount::EKEY_ROTATION_CAPABILITY_ALREADY_EXTRACTEDaccount has already delegated/extracted its DiemAccount::KeyRotationCapability.
Errors::INVALID_ARGUMENTDiemAccount::EMALFORMED_AUTHENTICATION_KEYnew_key was an invalid length.
  • AccountAdministrationScripts::rotate_authentication_key
  • AccountAdministrationScripts::rotate_authentication_key_with_nonce
  • AccountAdministrationScripts::rotate_authentication_key_with_recovery_address
§

RotateDualAttestationInfo

Fields

§new_url: Vec<u8>
§new_key: Vec<u8>

Summary

Updates the url used for off-chain communication, and the public key used to verify dual attestation on-chain. Transaction can be sent by any account that has dual attestation information published under it. In practice the only such accounts are Designated Dealers and Parent VASPs.

Technical Description

Updates the base_url and compliance_public_key fields of the DualAttestation::Credential resource published under account. The new_key must be a valid ed25519 public key.

Events

Successful execution of this transaction emits two events:

  • A DualAttestation::ComplianceKeyRotationEvent containing the new compliance public key, and the blockchain time at which the key was updated emitted on the DualAttestation::Credential compliance_key_rotation_events handle published under account; and
  • A DualAttestation::BaseUrlRotationEvent containing the new base url to be used for off-chain communication, and the blockchain time at which the url was updated emitted on the DualAttestation::Credential base_url_rotation_events handle published under account.

Parameters

NameTypeDescription
accountsignerSigner of the sending account of the transaction.
new_urlvector<u8>ASCII-encoded url to be used for off-chain communication with account.
new_keyvector<u8>New ed25519 public key to be used for on-chain dual attestation checking.

Common Abort Conditions

Error CategoryError ReasonDescription
Errors::NOT_PUBLISHEDDualAttestation::ECREDENTIALA DualAttestation::Credential resource is not published under account.
Errors::INVALID_ARGUMENTDualAttestation::EINVALID_PUBLIC_KEYnew_key is not a valid ed25519 public key.
  • AccountCreationScripts::create_parent_vasp_account
  • AccountCreationScripts::create_designated_dealer
  • AccountAdministrationScripts::rotate_dual_attestation_info
§

TieredMint

Fields

§coin_type: TypeTag
§sliding_nonce: u64
§designated_dealer_address: AccountAddress
§mint_amount: u64
§tier_index: u64

Summary

Mints a specified number of coins in a currency to a Designated Dealer. The sending account must be the Treasury Compliance account, and coins can only be minted to a Designated Dealer account.

Technical Description

Mints mint_amount of coins in the CoinType currency to Designated Dealer account at designated_dealer_address. The tier_index parameter specifies which tier should be used to check verify the off-chain approval policy, and is based in part on the on-chain tier values for the specific Designated Dealer, and the number of CoinType coins that have been minted to the dealer over the past 24 hours. Every Designated Dealer has 4 tiers for each currency that they support. The sending tc_account must be the Treasury Compliance account, and the receiver an authorized Designated Dealer account.

Events

Successful execution of the transaction will emit two events:

  • A Diem::MintEvent with the amount and currency code minted is emitted on the mint_event_handle in the stored Diem::CurrencyInfo<CoinType> resource stored under 0xA550C18; and
  • A DesignatedDealer::ReceivedMintEvent with the amount, currency code, and Designated Dealer’s address is emitted on the mint_event_handle in the stored DesignatedDealer::Dealer resource published under the designated_dealer_address.

Parameters

NameTypeDescription
CoinTypeTypeThe Move type for the CoinType being minted. 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.
designated_dealer_addressaddressThe address of the Designated Dealer account being minted to.
mint_amountu64The number of coins to be minted.
tier_indexu64[Deprecated] The mint tier index to use for the Designated Dealer account. Will be ignored

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_COMPLIANCEtc_account is not the Treasury Compliance account.
Errors::REQUIRES_ROLERoles::ETREASURY_COMPLIANCEtc_account is not the Treasury Compliance account.
Errors::INVALID_ARGUMENTDesignatedDealer::EINVALID_MINT_AMOUNTmint_amount is zero.
Errors::NOT_PUBLISHEDDesignatedDealer::EDEALERDesignatedDealer::Dealer or DesignatedDealer::TierInfo<CoinType> resource does not exist at designated_dealer_address.
Errors::REQUIRES_CAPABILITYDiem::EMINT_CAPABILITYtc_account does not have a Diem::MintCapability<CoinType> resource published under it.
Errors::INVALID_STATEDiem::EMINTING_NOT_ALLOWEDMinting is not currently allowed for CoinType coins.
Errors::LIMIT_EXCEEDEDDiemAccount::EDEPOSIT_EXCEEDS_LIMITSThe depositing of the funds would exceed the account’s account limits.
  • AccountCreationScripts::create_designated_dealer
  • PaymentScripts::peer_to_peer_with_metadata
  • AccountAdministrationScripts::rotate_dual_attestation_info
§

UnfreezeAccount

Fields

§sliding_nonce: u64
§to_unfreeze_account: AccountAddress

Summary

Unfreezes the account at address. The sending account of this transaction must be the Treasury Compliance account. After the successful execution of this transaction transactions may be sent from the previously frozen account, and coins may be sent and received.

Technical Description

Sets the AccountFreezing::FreezingBit to false and emits a AccountFreezing::UnFreezeAccountEvent. The transaction sender must be the Treasury Compliance account. Note that this is a per-account property so unfreezing a Parent VASP will not effect the status any of its child accounts and vice versa.

Events

Successful execution of this script will emit a AccountFreezing::UnFreezeAccountEvent with the unfrozen_address set the to_unfreeze_account’s address.

Parameters

NameTypeDescription
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.
to_unfreeze_accountaddressThe account address to be frozen.

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_ADDRESSCoreAddresses::ETREASURY_COMPLIANCEThe sending account is not the Treasury Compliance account.
  • TreasuryComplianceScripts::freeze_account
§

UpdateDualAttestationLimit

Fields

§sliding_nonce: u64
§new_micro_xdx_limit: u64

Summary

Update the dual attestation limit on-chain. Defined in terms of micro-XDX. The transaction can only be sent by the Treasury Compliance account. After this transaction all inter-VASP payments over this limit must be checked for dual attestation.

Technical Description

Updates the micro_xdx_limit field of the DualAttestation::Limit resource published under 0xA550C18. The amount is set in micro-XDX.

Parameters

NameTypeDescription
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_micro_xdx_limitu64The new dual attestation limit to be used on-chain.

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_COMPLIANCEtc_account is not the Treasury Compliance account.
  • TreasuryComplianceScripts::update_exchange_rate
  • TreasuryComplianceScripts::update_minting_ability
§

UpdateExchangeRate

Fields

§currency: TypeTag
§sliding_nonce: u64
§new_exchange_rate_numerator: u64
§new_exchange_rate_denominator: u64

Summary

Update the rough on-chain exchange rate between a specified currency and XDX (as a conversion to micro-XDX). The transaction can only be sent by the Treasury Compliance account. After this transaction the updated exchange rate will be used for normalization of gas prices, and for dual attestation checking.

Technical Description

Updates the on-chain exchange rate from the given Currency to micro-XDX. The exchange rate is given by new_exchange_rate_numerator/new_exchange_rate_denominator.

Parameters

NameTypeDescription
CurrencyTypeThe Move type for the Currency whose exchange rate is being updated. Currency 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 the transaction.
new_exchange_rate_numeratoru64The numerator for the new to micro-XDX exchange rate for Currency.
new_exchange_rate_denominatoru64The denominator for the new to micro-XDX exchange rate for Currency.

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_COMPLIANCEtc_account is not the Treasury Compliance account.
Errors::REQUIRES_ROLERoles::ETREASURY_COMPLIANCEtc_account is not the Treasury Compliance account.
Errors::INVALID_ARGUMENTFixedPoint32::EDENOMINATORnew_exchange_rate_denominator is zero.
Errors::INVALID_ARGUMENTFixedPoint32::ERATIO_OUT_OF_RANGEThe quotient is unrepresentable as a FixedPoint32.
Errors::LIMIT_EXCEEDEDFixedPoint32::ERATIO_OUT_OF_RANGEThe quotient is unrepresentable as a FixedPoint32.
  • TreasuryComplianceScripts::update_dual_attestation_limit
  • TreasuryComplianceScripts::update_minting_ability
§

UpdateMintingAbility

Fields

§currency: TypeTag
§allow_minting: bool

Summary

Script to allow or disallow minting of new coins in a specified currency. This transaction can only be sent by the Treasury Compliance account. Turning minting off for a currency will have no effect on coins already in circulation, and coins may still be removed from the system.

Technical Description

This transaction sets the can_mint field of the Diem::CurrencyInfo<Currency> resource published under 0xA550C18 to the value of allow_minting. Minting of coins if allowed if this field is set to true and minting of new coins in Currency is disallowed otherwise. This transaction needs to be sent by the Treasury Compliance account.

Parameters

NameTypeDescription
CurrencyTypeThe Move type for the Currency whose minting ability is being updated. Currency must be an already-registered currency on-chain.
accountsignerSigner of the sending account. Must be the Diem Root account.
allow_mintingboolWhether to allow minting of new coins in Currency.

Common Abort Conditions

Error CategoryError ReasonDescription
Errors::REQUIRES_ADDRESSCoreAddresses::ETREASURY_COMPLIANCEtc_account is not the Treasury Compliance account.
Errors::NOT_PUBLISHEDDiem::ECURRENCY_INFOCurrency is not a registered currency on-chain.
  • TreasuryComplianceScripts::update_dual_attestation_limit
  • TreasuryComplianceScripts::update_exchange_rate

Implementations§

source§

impl ScriptFunctionCall

source

pub fn encode(self) -> TransactionPayload

Build a Diem TransactionPayload from a structured object ScriptFunctionCall.

source

pub fn decode(payload: &TransactionPayload) -> Option<ScriptFunctionCall>

Try to recognize a Diem TransactionPayload and convert it into a structured object ScriptFunctionCall.

Trait Implementations§

source§

impl Clone for ScriptFunctionCall

source§

fn clone(&self) -> ScriptFunctionCall

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for ScriptFunctionCall

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl PartialEq<ScriptFunctionCall> for ScriptFunctionCall

source§

fn eq(&self, other: &ScriptFunctionCall) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd<ScriptFunctionCall> for ScriptFunctionCall

source§

fn partial_cmp(&self, other: &ScriptFunctionCall) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl StructuralPartialEq for ScriptFunctionCall

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V