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
Name | Type | Description |
---|---|---|
Currency | Type | The Move type for the Currency being added to the sending account of the transaction. Currency must be an already-registered currency on-chain. |
account | signer | The signer of the sending account of the transaction. |
Common Abort Conditions
Error Category | Error Reason | Description |
---|---|---|
Errors::NOT_PUBLISHED | Diem::ECURRENCY_INFO | The Currency is not a registered currency on-chain. |
Errors::INVALID_ARGUMENT | DiemAccount::EROLE_CANT_STORE_BALANCE | The sending account ’s role does not permit balances. |
Errors::ALREADY_PUBLISHED | DiemAccount::EADD_EXISTING_CURRENCY | A balance for Currency is already published under the sending account . |
Related Scripts
AccountCreationScripts::create_child_vasp_account
AccountCreationScripts::create_parent_vasp_account
PaymentScripts::peer_to_peer_with_metadata
BurnWithAmount
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
Name | Type | Description |
---|---|---|
Token | Type | The Move type for the Token currency being burned. Token must be an already-registered currency on-chain. |
tc_account | signer | The signer of the sending account of this transaction, must have a burn capability for Token published under it. |
sliding_nonce | u64 | The sliding_nonce (see: SlidingNonce ) to be used for this transaction. |
preburn_address | address | The address where the coins to-be-burned are currently held. |
amount | u64 | The amount to be burned. |
Common Abort Conditions
Error Category | Error Reason | Description |
---|---|---|
Errors::NOT_PUBLISHED | SlidingNonce::ESLIDING_NONCE | A SlidingNonce resource is not published under account . |
Errors::INVALID_ARGUMENT | SlidingNonce::ENONCE_TOO_OLD | The sliding_nonce is too old and it’s impossible to determine if it’s duplicated or not. |
Errors::INVALID_ARGUMENT | SlidingNonce::ENONCE_TOO_NEW | The sliding_nonce is too far in the future. |
Errors::INVALID_ARGUMENT | SlidingNonce::ENONCE_ALREADY_RECORDED | The sliding_nonce has been previously recorded. |
Errors::REQUIRES_CAPABILITY | Diem::EBURN_CAPABILITY | The sending account does not have a Diem::BurnCapability<Token> published under it. |
Errors::INVALID_STATE | Diem::EPREBURN_NOT_FOUND | The Diem::PreburnQueue<Token> resource under preburn_address does not contain a preburn request with a value matching amount . |
Errors::NOT_PUBLISHED | Diem::EPREBURN_QUEUE | The account at preburn_address does not have a Diem::PreburnQueue<Token> resource published under it. |
Errors::NOT_PUBLISHED | Diem::ECURRENCY_INFO | The specified Token is not a registered currency on-chain. |
Related Scripts
TreasuryComplianceScripts::burn_txn_fees
TreasuryComplianceScripts::cancel_burn_with_amount
TreasuryComplianceScripts::preburn
CancelBurnWithAmount
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 theDiem::CurrencyInfo<Token>
resource’sburn_events
published under0xA550C18
. - A
DiemAccount::ReceivedPaymentEvent
on thepreburn_address
’sDiemAccount::DiemAccount
received_events
event handle with both thepayer
andpayee
beingpreburn_address
.
Parameters
Name | Type | Description |
---|---|---|
Token | Type | The Move type for the Token currenty that burning is being cancelled for. Token must be an already-registered currency on-chain. |
account | signer | The signer of the sending account of this transaction, must have a burn capability for Token published under it. |
preburn_address | address | The address where the coins to-be-burned are currently held. |
amount | u64 | The amount to be cancelled. |
Common Abort Conditions
Error Category | Error Reason | Description |
---|---|---|
Errors::REQUIRES_CAPABILITY | Diem::EBURN_CAPABILITY | The sending account does not have a Diem::BurnCapability<Token> published under it. |
Errors::INVALID_STATE | Diem::EPREBURN_NOT_FOUND | The Diem::PreburnQueue<Token> resource under preburn_address does not contain a preburn request with a value matching amount . |
Errors::NOT_PUBLISHED | Diem::EPREBURN_QUEUE | The account at preburn_address does not have a Diem::PreburnQueue<Token> resource published under it. |
Errors::NOT_PUBLISHED | Diem::ECURRENCY_INFO | The specified Token is not a registered currency on-chain. |
Errors::INVALID_ARGUMENT | DiemAccount::EPAYEE_CANT_ACCEPT_CURRENCY_TYPE | The account at preburn_address doesn’t have a balance resource for Token . |
Errors::LIMIT_EXCEEDED | DiemAccount::EDEPOSIT_EXCEEDS_LIMITS | The depositing of the funds held in the prebun area would exceed the account ’s account limits. |
Errors::INVALID_STATE | DualAttestation::EPAYEE_COMPLIANCE_KEY_NOT_SET | The account does not have a compliance key set on it but dual attestion checking was performed. |
Related Scripts
TreasuryComplianceScripts::burn_txn_fees
TreasuryComplianceScripts::burn_with_amount
TreasuryComplianceScripts::preburn
CreateDesignatedDealer
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 thecreated
field beingaddr
, and therold_id
field beingRoles::DESIGNATED_DEALER_ROLE_ID
. This is emitted on theDiemAccount::AccountOperationsCapability
creation_events
handle.
Parameters
Name | Type | Description |
---|---|---|
Currency | Type | The Move type for the Currency that the Designated Dealer should be initialized with. Currency must be an already-registered currency on-chain. |
tc_account | signer | The signer of the sending account of this transaction. Must be the Treasury Compliance account. |
sliding_nonce | u64 | The sliding_nonce (see: SlidingNonce ) to be used for this transaction. |
addr | address | Address of the to-be-created Designated Dealer account. |
auth_key_prefix | vector<u8> | The authentication key prefix that will be used initially for the newly created account. |
human_name | vector<u8> | ASCII-encoded human name for the Designated Dealer. |
add_all_currencies | bool | Whether 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 Category | Error Reason | Description |
---|---|---|
Errors::NOT_PUBLISHED | SlidingNonce::ESLIDING_NONCE | A SlidingNonce resource is not published under tc_account . |
Errors::INVALID_ARGUMENT | SlidingNonce::ENONCE_TOO_OLD | The sliding_nonce is too old and it’s impossible to determine if it’s duplicated or not. |
Errors::INVALID_ARGUMENT | SlidingNonce::ENONCE_TOO_NEW | The sliding_nonce is too far in the future. |
Errors::INVALID_ARGUMENT | SlidingNonce::ENONCE_ALREADY_RECORDED | The sliding_nonce has been previously recorded. |
Errors::REQUIRES_ADDRESS | CoreAddresses::ETREASURY_COMPLIANCE | The sending account is not the Treasury Compliance account. |
Errors::REQUIRES_ROLE | Roles::ETREASURY_COMPLIANCE | The sending account is not the Treasury Compliance account. |
Errors::NOT_PUBLISHED | Diem::ECURRENCY_INFO | The Currency is not a registered currency on-chain. |
Errors::ALREADY_PUBLISHED | Roles::EROLE_ID | The addr address is already taken. |
Related Scripts
TreasuryComplianceScripts::tiered_mint
PaymentScripts::peer_to_peer_with_metadata
AccountAdministrationScripts::rotate_dual_attestation_info
CreateRegularAccount
Create a regular account
CreateValidatorAccount
Fields
new_account_address: AccountAddress
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 thecreated
field beingnew_account_address
, and therold_id
field beingRoles::VALIDATOR_ROLE_ID
. This is emitted on theDiemAccount::AccountOperationsCapability
creation_events
handle.
Parameters
Name | Type | Description |
---|---|---|
dr_account | signer | The signer of the sending account of this transaction. Must be the Diem Root signer. |
sliding_nonce | u64 | The sliding_nonce (see: SlidingNonce ) to be used for this transaction. |
new_account_address | address | Address of the to-be-created Validator account. |
auth_key_prefix | vector<u8> | The authentication key prefix that will be used initially for the newly created account. |
human_name | vector<u8> | ASCII-encoded human name for the validator. |
Common Abort Conditions
Error Category | Error Reason | Description |
---|---|---|
Errors::NOT_PUBLISHED | SlidingNonce::ESLIDING_NONCE | A SlidingNonce resource is not published under dr_account . |
Errors::INVALID_ARGUMENT | SlidingNonce::ENONCE_TOO_OLD | The sliding_nonce is too old and it’s impossible to determine if it’s duplicated or not. |
Errors::INVALID_ARGUMENT | SlidingNonce::ENONCE_TOO_NEW | The sliding_nonce is too far in the future. |
Errors::INVALID_ARGUMENT | SlidingNonce::ENONCE_ALREADY_RECORDED | The sliding_nonce has been previously recorded. |
Errors::REQUIRES_ADDRESS | CoreAddresses::EDIEM_ROOT | The sending account is not the Diem Root account. |
Errors::REQUIRES_ROLE | Roles::EDIEM_ROOT | The sending account is not the Diem Root account. |
Errors::ALREADY_PUBLISHED | Roles::EROLE_ID | The new_account_address address is already taken. |
Related Scripts
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
new_account_address: AccountAddress
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 thecreated
field beingnew_account_address
, and therold_id
field beingRoles::VALIDATOR_OPERATOR_ROLE_ID
. This is emitted on theDiemAccount::AccountOperationsCapability
creation_events
handle.
Parameters
Name | Type | Description |
---|---|---|
dr_account | signer | The signer of the sending account of this transaction. Must be the Diem Root signer. |
sliding_nonce | u64 | The sliding_nonce (see: SlidingNonce ) to be used for this transaction. |
new_account_address | address | Address of the to-be-created Validator account. |
auth_key_prefix | vector<u8> | The authentication key prefix that will be used initially for the newly created account. |
human_name | vector<u8> | ASCII-encoded human name for the validator. |
Common Abort Conditions
Error Category | Error Reason | Description |
---|---|---|
Errors::NOT_PUBLISHED | SlidingNonce::ESLIDING_NONCE | A SlidingNonce resource is not published under dr_account . |
Errors::INVALID_ARGUMENT | SlidingNonce::ENONCE_TOO_OLD | The sliding_nonce is too old and it’s impossible to determine if it’s duplicated or not. |
Errors::INVALID_ARGUMENT | SlidingNonce::ENONCE_TOO_NEW | The sliding_nonce is too far in the future. |
Errors::INVALID_ARGUMENT | SlidingNonce::ENONCE_ALREADY_RECORDED | The sliding_nonce has been previously recorded. |
Errors::REQUIRES_ADDRESS | CoreAddresses::EDIEM_ROOT | The sending account is not the Diem Root account. |
Errors::REQUIRES_ROLE | Roles::EDIEM_ROOT | The sending account is not the Diem Root account. |
Errors::ALREADY_PUBLISHED | Roles::EROLE_ID | The new_account_address address is already taken. |
Related Scripts
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
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
Name | Type | Description |
---|---|---|
tc_account | signer | The signer of the sending account of this transaction. Must be the Treasury Compliance account. |
sliding_nonce | u64 | The sliding_nonce (see: SlidingNonce ) to be used for this transaction. |
to_freeze_account | address | The account address to be frozen. |
Common Abort Conditions
Error Category | Error Reason | Description |
---|---|---|
Errors::NOT_PUBLISHED | SlidingNonce::ESLIDING_NONCE | A SlidingNonce resource is not published under tc_account . |
Errors::INVALID_ARGUMENT | SlidingNonce::ENONCE_TOO_OLD | The sliding_nonce is too old and it’s impossible to determine if it’s duplicated or not. |
Errors::INVALID_ARGUMENT | SlidingNonce::ENONCE_TOO_NEW | The sliding_nonce is too far in the future. |
Errors::INVALID_ARGUMENT | SlidingNonce::ENONCE_ALREADY_RECORDED | The sliding_nonce has been previously recorded. |
Errors::REQUIRES_ADDRESS | CoreAddresses::ETREASURY_COMPLIANCE | The sending account is not the Treasury Compliance account. |
Errors::REQUIRES_ROLE | Roles::ETREASURY_COMPLIANCE | The sending account is not the Treasury Compliance account. |
Errors::INVALID_ARGUMENT | AccountFreezing::ECANNOT_FREEZE_TC | to_freeze_account was the Treasury Compliance account (0xB1E55ED ). |
Errors::INVALID_ARGUMENT | AccountFreezing::ECANNOT_FREEZE_DIEM_ROOT | to_freeze_account was the Diem Root account (0xA550C18 ). |
Related Scripts
TreasuryComplianceScripts::unfreeze_account
MintCoin
Preburn
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
onaccount
’sDiemAccount::DiemAccount
sent_events
handle with thepayee
andpayer
fields beingaccount
’s address; and- A
Diem::PreburnEvent
withToken
’s currency code on theDiem::CurrencyInfo<Token
’spreburn_events
handle forToken
and withpreburn_address
set toaccount
’s address.
Parameters
Name | Type | Description |
---|---|---|
Token | Type | The Move type for the Token currency being moved to the preburn area. Token must be an already-registered currency on-chain. |
account | signer | The signer of the sending account. |
amount | u64 | The amount in Token to be moved to the preburn area. |
Common Abort Conditions
Error Category | Error Reason | Description |
---|---|---|
Errors::NOT_PUBLISHED | Diem::ECURRENCY_INFO | The Token is not a registered currency on-chain. |
Errors::INVALID_STATE | DiemAccount::EWITHDRAWAL_CAPABILITY_ALREADY_EXTRACTED | The withdrawal capability for account has already been extracted. |
Errors::LIMIT_EXCEEDED | DiemAccount::EINSUFFICIENT_BALANCE | amount is greater than payer ’s balance in Token . |
Errors::NOT_PUBLISHED | DiemAccount::EPAYER_DOESNT_HOLD_CURRENCY | account doesn’t hold a balance in Token . |
Errors::NOT_PUBLISHED | Diem::EPREBURN | account doesn’t have a Diem::Preburn<Token> resource published under it. |
Errors::INVALID_STATE | Diem::EPREBURN_OCCUPIED | The value field in the Diem::Preburn<Token> resource under the sender is non-zero. |
Errors::NOT_PUBLISHED | Roles::EROLE_ID | The account did not have a role assigned to it. |
Errors::REQUIRES_ROLE | Roles::EDESIGNATED_DEALER | The account did not have the role of DesignatedDealer. |
Related Scripts
TreasuryComplianceScripts::cancel_burn_with_amount
TreasuryComplianceScripts::burn_with_amount
TreasuryComplianceScripts::burn_txn_fees
RotateAuthenticationKey
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
Name | Type | Description |
---|---|---|
account | signer | Signer of the sending account of the transaction. |
new_key | vector<u8> | New authentication key to be used for account . |
Common Abort Conditions
Error Category | Error Reason | Description |
---|---|---|
Errors::INVALID_STATE | DiemAccount::EKEY_ROTATION_CAPABILITY_ALREADY_EXTRACTED | account has already delegated/extracted its DiemAccount::KeyRotationCapability . |
Errors::INVALID_ARGUMENT | DiemAccount::EMALFORMED_AUTHENTICATION_KEY | new_key was an invalid length. |
Related Scripts
AccountAdministrationScripts::rotate_authentication_key_with_nonce
AccountAdministrationScripts::rotate_authentication_key_with_nonce_admin
AccountAdministrationScripts::rotate_authentication_key_with_recovery_address
RotateAuthenticationKeyWithNonce
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
Name | Type | Description |
---|---|---|
account | signer | Signer of the sending account of the transaction. |
sliding_nonce | u64 | The sliding_nonce (see: SlidingNonce ) to be used for this transaction. |
new_key | vector<u8> | New authentication key to be used for account . |
Common Abort Conditions
Error Category | Error Reason | Description |
---|---|---|
Errors::NOT_PUBLISHED | SlidingNonce::ESLIDING_NONCE | A SlidingNonce resource is not published under account . |
Errors::INVALID_ARGUMENT | SlidingNonce::ENONCE_TOO_OLD | The sliding_nonce is too old and it’s impossible to determine if it’s duplicated or not. |
Errors::INVALID_ARGUMENT | SlidingNonce::ENONCE_TOO_NEW | The sliding_nonce is too far in the future. |
Errors::INVALID_ARGUMENT | SlidingNonce::ENONCE_ALREADY_RECORDED | The sliding_nonce has been previously recorded. |
Errors::INVALID_STATE | DiemAccount::EKEY_ROTATION_CAPABILITY_ALREADY_EXTRACTED | account has already delegated/extracted its DiemAccount::KeyRotationCapability . |
Errors::INVALID_ARGUMENT | DiemAccount::EMALFORMED_AUTHENTICATION_KEY | new_key was an invalid length. |
Related Scripts
AccountAdministrationScripts::rotate_authentication_key
AccountAdministrationScripts::rotate_authentication_key_with_nonce_admin
AccountAdministrationScripts::rotate_authentication_key_with_recovery_address
RotateAuthenticationKeyWithNonceAdmin
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
Name | Type | Description |
---|---|---|
dr_account | signer | The signer of the sending account of the write set transaction. May only be the Diem Root signer. |
account | signer | Signer of account specified in the execute_as field of the write set transaction. |
sliding_nonce | u64 | The sliding_nonce (see: SlidingNonce ) to be used for this transaction for Diem Root. |
new_key | vector<u8> | New authentication key to be used for account . |
Common Abort Conditions
Error Category | Error Reason | Description |
---|---|---|
Errors::NOT_PUBLISHED | SlidingNonce::ESLIDING_NONCE | A SlidingNonce resource is not published under dr_account . |
Errors::INVALID_ARGUMENT | SlidingNonce::ENONCE_TOO_OLD | The sliding_nonce in dr_account is too old and it’s impossible to determine if it’s duplicated or not. |
Errors::INVALID_ARGUMENT | SlidingNonce::ENONCE_TOO_NEW | The sliding_nonce in dr_account is too far in the future. |
Errors::INVALID_ARGUMENT | SlidingNonce::ENONCE_ALREADY_RECORDED | The sliding_nonce in dr_account has been previously recorded. |
Errors::INVALID_STATE | DiemAccount::EKEY_ROTATION_CAPABILITY_ALREADY_EXTRACTED | account has already delegated/extracted its DiemAccount::KeyRotationCapability . |
Errors::INVALID_ARGUMENT | DiemAccount::EMALFORMED_AUTHENTICATION_KEY | new_key was an invalid length. |
Related Scripts
AccountAdministrationScripts::rotate_authentication_key
AccountAdministrationScripts::rotate_authentication_key_with_nonce
AccountAdministrationScripts::rotate_authentication_key_with_recovery_address
RotateDualAttestationInfo
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 theDualAttestation::Credential
compliance_key_rotation_events
handle published underaccount
; 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 theDualAttestation::Credential
base_url_rotation_events
handle published underaccount
.
Parameters
Name | Type | Description |
---|---|---|
account | signer | Signer of the sending account of the transaction. |
new_url | vector<u8> | ASCII-encoded url to be used for off-chain communication with account . |
new_key | vector<u8> | New ed25519 public key to be used for on-chain dual attestation checking. |
Common Abort Conditions
Error Category | Error Reason | Description |
---|---|---|
Errors::NOT_PUBLISHED | DualAttestation::ECREDENTIAL | A DualAttestation::Credential resource is not published under account . |
Errors::INVALID_ARGUMENT | DualAttestation::EINVALID_PUBLIC_KEY | new_key is not a valid ed25519 public key. |
Related Scripts
AccountCreationScripts::create_parent_vasp_account
AccountCreationScripts::create_designated_dealer
AccountAdministrationScripts::rotate_dual_attestation_info
TieredMint
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 themint_event_handle
in the storedDiem::CurrencyInfo<CoinType>
resource stored under0xA550C18
; and - A
DesignatedDealer::ReceivedMintEvent
with the amount, currency code, and Designated Dealer’s address is emitted on themint_event_handle
in the storedDesignatedDealer::Dealer
resource published under thedesignated_dealer_address
.
Parameters
Name | Type | Description |
---|---|---|
CoinType | Type | The Move type for the CoinType being minted. CoinType must be an already-registered currency on-chain. |
tc_account | signer | The signer of the sending account of this transaction. Must be the Treasury Compliance account. |
sliding_nonce | u64 | The sliding_nonce (see: SlidingNonce ) to be used for this transaction. |
designated_dealer_address | address | The address of the Designated Dealer account being minted to. |
mint_amount | u64 | The number of coins to be minted. |
tier_index | u64 | [Deprecated] The mint tier index to use for the Designated Dealer account. Will be ignored |
Common Abort Conditions
Error Category | Error Reason | Description |
---|---|---|
Errors::NOT_PUBLISHED | SlidingNonce::ESLIDING_NONCE | A SlidingNonce resource is not published under tc_account . |
Errors::INVALID_ARGUMENT | SlidingNonce::ENONCE_TOO_OLD | The sliding_nonce is too old and it’s impossible to determine if it’s duplicated or not. |
Errors::INVALID_ARGUMENT | SlidingNonce::ENONCE_TOO_NEW | The sliding_nonce is too far in the future. |
Errors::INVALID_ARGUMENT | SlidingNonce::ENONCE_ALREADY_RECORDED | The sliding_nonce has been previously recorded. |
Errors::REQUIRES_ADDRESS | CoreAddresses::ETREASURY_COMPLIANCE | tc_account is not the Treasury Compliance account. |
Errors::REQUIRES_ROLE | Roles::ETREASURY_COMPLIANCE | tc_account is not the Treasury Compliance account. |
Errors::INVALID_ARGUMENT | DesignatedDealer::EINVALID_MINT_AMOUNT | mint_amount is zero. |
Errors::NOT_PUBLISHED | DesignatedDealer::EDEALER | DesignatedDealer::Dealer or DesignatedDealer::TierInfo<CoinType> resource does not exist at designated_dealer_address . |
Errors::REQUIRES_CAPABILITY | Diem::EMINT_CAPABILITY | tc_account does not have a Diem::MintCapability<CoinType> resource published under it. |
Errors::INVALID_STATE | Diem::EMINTING_NOT_ALLOWED | Minting is not currently allowed for CoinType coins. |
Errors::LIMIT_EXCEEDED | DiemAccount::EDEPOSIT_EXCEEDS_LIMITS | The depositing of the funds would exceed the account ’s account limits. |
Related Scripts
AccountCreationScripts::create_designated_dealer
PaymentScripts::peer_to_peer_with_metadata
AccountAdministrationScripts::rotate_dual_attestation_info
UnfreezeAccount
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
Name | Type | Description |
---|---|---|
tc_account | signer | The signer of the sending account of this transaction. Must be the Treasury Compliance account. |
sliding_nonce | u64 | The sliding_nonce (see: SlidingNonce ) to be used for this transaction. |
to_unfreeze_account | address | The account address to be frozen. |
Common Abort Conditions
Error Category | Error Reason | Description |
---|---|---|
Errors::NOT_PUBLISHED | SlidingNonce::ESLIDING_NONCE | A SlidingNonce resource is not published under account . |
Errors::INVALID_ARGUMENT | SlidingNonce::ENONCE_TOO_OLD | The sliding_nonce is too old and it’s impossible to determine if it’s duplicated or not. |
Errors::INVALID_ARGUMENT | SlidingNonce::ENONCE_TOO_NEW | The sliding_nonce is too far in the future. |
Errors::INVALID_ARGUMENT | SlidingNonce::ENONCE_ALREADY_RECORDED | The sliding_nonce has been previously recorded. |
Errors::REQUIRES_ADDRESS | CoreAddresses::ETREASURY_COMPLIANCE | The sending account is not the Treasury Compliance account. |
Related Scripts
TreasuryComplianceScripts::freeze_account
UpdateDualAttestationLimit
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
Name | Type | Description |
---|---|---|
tc_account | signer | The signer of the sending account of this transaction. Must be the Treasury Compliance account. |
sliding_nonce | u64 | The sliding_nonce (see: SlidingNonce ) to be used for this transaction. |
new_micro_xdx_limit | u64 | The new dual attestation limit to be used on-chain. |
Common Abort Conditions
Error Category | Error Reason | Description |
---|---|---|
Errors::NOT_PUBLISHED | SlidingNonce::ESLIDING_NONCE | A SlidingNonce resource is not published under tc_account . |
Errors::INVALID_ARGUMENT | SlidingNonce::ENONCE_TOO_OLD | The sliding_nonce is too old and it’s impossible to determine if it’s duplicated or not. |
Errors::INVALID_ARGUMENT | SlidingNonce::ENONCE_TOO_NEW | The sliding_nonce is too far in the future. |
Errors::INVALID_ARGUMENT | SlidingNonce::ENONCE_ALREADY_RECORDED | The sliding_nonce has been previously recorded. |
Errors::REQUIRES_ADDRESS | CoreAddresses::ETREASURY_COMPLIANCE | tc_account is not the Treasury Compliance account. |
Related Scripts
TreasuryComplianceScripts::update_exchange_rate
TreasuryComplianceScripts::update_minting_ability
UpdateExchangeRate
Fields
currency: TypeTag
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
Name | Type | Description |
---|---|---|
Currency | Type | The Move type for the Currency whose exchange rate is being updated. Currency must be an already-registered currency on-chain. |
tc_account | signer | The signer of the sending account of this transaction. Must be the Treasury Compliance account. |
sliding_nonce | u64 | The sliding_nonce (see: SlidingNonce ) to be used for the transaction. |
new_exchange_rate_numerator | u64 | The numerator for the new to micro-XDX exchange rate for Currency . |
new_exchange_rate_denominator | u64 | The denominator for the new to micro-XDX exchange rate for Currency . |
Common Abort Conditions
Error Category | Error Reason | Description |
---|---|---|
Errors::NOT_PUBLISHED | SlidingNonce::ESLIDING_NONCE | A SlidingNonce resource is not published under tc_account . |
Errors::INVALID_ARGUMENT | SlidingNonce::ENONCE_TOO_OLD | The sliding_nonce is too old and it’s impossible to determine if it’s duplicated or not. |
Errors::INVALID_ARGUMENT | SlidingNonce::ENONCE_TOO_NEW | The sliding_nonce is too far in the future. |
Errors::INVALID_ARGUMENT | SlidingNonce::ENONCE_ALREADY_RECORDED | The sliding_nonce has been previously recorded. |
Errors::REQUIRES_ADDRESS | CoreAddresses::ETREASURY_COMPLIANCE | tc_account is not the Treasury Compliance account. |
Errors::REQUIRES_ROLE | Roles::ETREASURY_COMPLIANCE | tc_account is not the Treasury Compliance account. |
Errors::INVALID_ARGUMENT | FixedPoint32::EDENOMINATOR | new_exchange_rate_denominator is zero. |
Errors::INVALID_ARGUMENT | FixedPoint32::ERATIO_OUT_OF_RANGE | The quotient is unrepresentable as a FixedPoint32 . |
Errors::LIMIT_EXCEEDED | FixedPoint32::ERATIO_OUT_OF_RANGE | The quotient is unrepresentable as a FixedPoint32 . |
Related Scripts
TreasuryComplianceScripts::update_dual_attestation_limit
TreasuryComplianceScripts::update_minting_ability
UpdateMintingAbility
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
Name | Type | Description |
---|---|---|
Currency | Type | The Move type for the Currency whose minting ability is being updated. Currency must be an already-registered currency on-chain. |
account | signer | Signer of the sending account. Must be the Diem Root account. |
allow_minting | bool | Whether to allow minting of new coins in Currency . |
Common Abort Conditions
Error Category | Error Reason | Description |
---|---|---|
Errors::REQUIRES_ADDRESS | CoreAddresses::ETREASURY_COMPLIANCE | tc_account is not the Treasury Compliance account. |
Errors::NOT_PUBLISHED | Diem::ECURRENCY_INFO | Currency is not a registered currency on-chain. |
Related Scripts
TreasuryComplianceScripts::update_dual_attestation_limit
TreasuryComplianceScripts::update_exchange_rate
Implementations§
source§impl ScriptFunctionCall
impl ScriptFunctionCall
sourcepub fn encode(self) -> TransactionPayload
pub fn encode(self) -> TransactionPayload
Build a Diem TransactionPayload
from a structured object ScriptFunctionCall
.
sourcepub fn decode(payload: &TransactionPayload) -> Option<ScriptFunctionCall>
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
impl Clone for ScriptFunctionCall
source§fn clone(&self) -> ScriptFunctionCall
fn clone(&self) -> ScriptFunctionCall
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for ScriptFunctionCall
impl Debug for ScriptFunctionCall
source§impl PartialEq<ScriptFunctionCall> for ScriptFunctionCall
impl PartialEq<ScriptFunctionCall> for ScriptFunctionCall
source§fn eq(&self, other: &ScriptFunctionCall) -> bool
fn eq(&self, other: &ScriptFunctionCall) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd<ScriptFunctionCall> for ScriptFunctionCall
impl PartialOrd<ScriptFunctionCall> for ScriptFunctionCall
source§fn partial_cmp(&self, other: &ScriptFunctionCall) -> Option<Ordering>
fn partial_cmp(&self, other: &ScriptFunctionCall) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read more