Locate an object based on its keylet and place it into a slot

Behaviour

  • Locate an object given the Keylet provided in read_ptr
  • Emplace the located object into the slot specified or into a new slot if no slot (zero) is specified

Definition

int64_t slot_set (
    uint32_t read_ptr,
    uint32_t read_len,
  	uint32_t slot_no
);

Example

int64_t slot_no = 
  slot_set(keylet, 34, 0);

Parameters

NameTypeDescription
read_ptruint32_tPointer to a buffer containing the keylet of the object to locate. This can also be a txn hash.
read_lenuint32_tLength of the read buffer. Should always be 32 or 34.
slot_nouint32_tThe slot number to emplace into, or 0 if you wish to pick the next available.

Return Code

TypeDescription
int64_tThe slot number the object was inserted into

If negative, an error:
OUT_OF_BOUNDS
- pointers/lengths specified outside of hook memory.

INVALID_ARGUMENT
- read_len must be either 32 or 34 bytes depending on whether a txn hash or a keylet is being used in read_ptr
- the hash or keylet was invalid

DOESNT_EXIST
- the requested object was not found