foundry_common::utils

Function erc7201

Source
pub fn erc7201(id: &str) -> B256
Expand description

Computes the storage slot as specified by ERC-7201, using the erc7201 formula ID.

This is defined as:

erc7201(id: string) = keccak256(keccak256(id) - 1) & ~0xff

ยงExamples

use alloy_primitives::b256;
use foundry_common::erc7201;

assert_eq!(
    erc7201("example.main"),
    b256!("183a6125c38840424c4a85fa12bab2ab606c4b6d0e7cc73c0c06ba5300eab500"),
);