[][src]Function transaction_builder::encode_peer_to_peer_with_metadata_script

pub fn encode_peer_to_peer_with_metadata_script(
    currency: TypeTag,
    payee: AccountAddress,
    amount: u64,
    metadata: Vec<u8>,
    metadata_signature: Vec<u8>
) -> Script

Summary

Transfers a given number of coins in a specified currency from one account to another. Transfers over a specified amount defined on-chain that are between two different VASPs, or other accounts that have opted-in will be subject to on-chain checks to ensure the receiver has agreed to receive the coins. This transaction can be sent by any account that can hold a balance, and to any account that can hold a balance. Both accounts must hold balances in the currency being transacted.

Technical Description

Transfers amount coins of type Currency from payer to payee with (optional) associated metadata and an (optional) metadata_signature on the message metadata | Signer::address_of(payer) | amount | DualAttestation::DOMAIN_SEPARATOR. The metadata and metadata_signature parameters are only required if amount >= DualAttestation::get_cur_microlibra_limit LBR and payer and payee are distinct VASPs. However, a transaction sender can opt in to dual attestation even when it is not required (e.g., a DesignatedDealer -> VASP payment) by providing a non-empty metadata_signature. Standardized metadata LCS format can be found in libra_types::transaction::metadata::Metadata.

Events

Successful execution of this script emits two events:

Parameters

NameTypeDescription
CurrencyTypeThe Move type for the Currency being sent in this transaction. Currency must be an already-registered currency on-chain.
payer&signerThe signer reference of the sending account that coins are being transferred from.
payeeaddressThe address of the account the coins are being transferred to.
metadatavector<u8>Optional metadata about this payment.
metadata_signaturevector<u8>Optional signature over metadata and payment information. See

Common Abort Conditions

Error CategoryError ReasonDescription
Errors::NOT_PUBLISHEDLibraAccount::EPAYER_DOESNT_HOLD_CURRENCYpayer doesn't hold a balance in Currency.
Errors::LIMIT_EXCEEDEDLibraAccount::EINSUFFICIENT_BALANCEamount is greater than payer's balance in Currency.
Errors::INVALID_ARGUMENTLibraAccount::ECOIN_DEPOSIT_IS_ZEROamount is zero.
Errors::NOT_PUBLISHEDLibraAccount::EPAYEE_DOES_NOT_EXISTNo account exists at the payee address.
Errors::INVALID_ARGUMENTLibraAccount::EPAYEE_CANT_ACCEPT_CURRENCY_TYPEAn account exists at payee, but it does not accept payments in Currency.
Errors::INVALID_STATEAccountFreezing::EACCOUNT_FROZENThe payee account is frozen.
Errors::INVALID_ARGUMENTDualAttestation::EMALFORMED_METADATA_SIGNATUREmetadata_signature is not 64 bytes.
Errors::INVALID_ARGUMENTDualAttestation::EINVALID_METADATA_SIGNATUREmetadata_signature does not verify on the against the payee's DualAttestation::Credential compliance_public_key public key.
Errors::LIMIT_EXCEEDEDLibraAccount::EWITHDRAWAL_EXCEEDS_LIMITSpayer has exceeded its daily withdrawal limits for the backing coins of LBR.
Errors::LIMIT_EXCEEDEDLibraAccount::EDEPOSIT_EXCEEDS_LIMITSpayee has exceeded its daily deposit limits for LBR.

Related Scripts