Read a serialized amount into an XFL

Concepts

Behaviour

  • Read a serialized floating point number
  • Return it as an XFL enclosing number

Definition

int64_t float_sto_set (
    uint32_t read_ptr,
    uint32_t read_len
);

Example

int64_t vault_pusd = float_sto_set(vault, 8);
if (vault_pusd < 0)
  rollback("Failed to parse serialized float.", 33, 1);

Parameters

Name

Type

Description

read_ptr

uint32_t

Pointer to a buffer contianing the serialized XFL. May be null.

read_len

uint32_t

The length of the buffer.

📘

Hint

As at Hooks Public Testnet this function currently only parses floating point amounts. Native (XRP) amounts cannot be parsed with this function.

🚧

Subject to change

The exact parameters and functionality of this API is still under review and subject to change in future, however most likely these changes will be backward compatibile with the API as it is documented here.

Return Code

Type

Description

int64_t

The number of bytes written to the output buffer.

If negative, an error:
NOT_AN_OBJECT

  • the supplied buffer did not contain a valid serialized floating point number

OUT_OF_BOUNDS

  • pointers/lengths specified outside of hook memory.