value crosses the boundary of a storage slot, reading continues at the following slot.
slot
: [b256] - The storage slot to load the value from.offset
: [u64] - An offset, in words, from the start of slot
, from which the value should be read.Option(value)
if the storage slots read were valid and contain value
. Otherwise,None
.1
use std::storage::storage_api::{read, write};
fn foo() {
let five = 5_u64;
write(b256::zero(), 2, five);
let stored_five = read::<u64>(b256::zero(), 2);
assert(five == stored_five.unwrap());
}