arb_storage/
gas.rs

1//! Flat EIP-2200 storage-access gas for ArbOS state: a single read/write price
2//! per slot, with no EVM cold/warm distinction or refunds.
3
4/// Gas for reading one storage slot.
5pub const STORAGE_READ_GAS: u64 = 800;
6/// Gas for writing a non-zero value to one storage slot.
7pub const STORAGE_WRITE_GAS: u64 = 20_000;
8/// Gas for clearing one storage slot to zero.
9pub const STORAGE_WRITE_ZERO_GAS: u64 = 5_000;
10
11/// Gas for one storage write, priced lower when the slot is cleared to zero.
12pub const fn write_cost(value_is_zero: bool) -> u64 {
13    if value_is_zero {
14        STORAGE_WRITE_ZERO_GAS
15    } else {
16        STORAGE_WRITE_GAS
17    }
18}