pub fn clear<T>(slot: b256, offset: u64) -> bool 
Expand description

Clear a value starting at some slot with an offset.

Arguments

  • slot - The key of the stored value that will be cleared
  • offset - An offset, in words, from the start of slot, from which the value should be cleared.

Number of Storage Accesses

  • Clears: 1

Examples

use std::storage::storage_api::{read, write, clear};

fn foo() {
    let five = 5_u64;
    write(b256::zero(), 0, five);
    let cleared = clear::<u64>(b256::zero());
    assert(cleared);
    assert(read::<u64>(b256::zero(), 0).is_none());
}