pub fn clear_slice_quads(slot: b256) -> bool 
Expand description

Clears a slice, stored in slots of 32 bytes, from storage, starting at the slot.

Arguments

  • slot: [b256] - The storage slot to begin clearing the slice from.

Returns

  • [bool] - true if all of the cleared storage slots were previously set. Otherwise, false.

Number of Storage Accesses

  • Reads: 1 (to determine the length of the slice)
  • Clears: 2 (one for the length of the slice, and one for the slice content)

Examples

use std::{alloc::alloc_bytes, storage::{clear_slice_quads, write_slice_quads, read_slice_quads}};

fn foo() {
    let slice = asm(ptr: (alloc_bytes(1), 1)) { ptr: raw_slice };
    write_slice_quads(b256::zero(), slice);
    assert(read_slice_quads(b256::zero()).is_some());
    let cleared = clear_slice_quads(b256::zero());
    assert(cleared);
    assert(read_slice_quads(b256::zero()).is_none());
}