SafeExternalStorage is a solidity contract which stores arbitrary account-scoped data. It allows storage for an account to be locked within a transaction, enabling contracts which permit arbitrary delegatecall operations to protect against storage collision attacks.
$ forge install jaydenwindle/safe-external-storageaddress caller = 0x...;
bytes32 slot = bytes32(0);
bytes32 value = bytes32(uint256(1));
SafeExternalStorage extStorage = new SafeExternalStorage();
// Store data scoped by sender address
extStorage.extsstore(slot, value);
// Query data by address scope
bytes32 value = extStorage.extsload(caller, slot)
// Lock storage (future calls to extsstore within the same transaction will revert)
extStorage.lock();
extStorage.extsstore(slot, value); // Revert: StorageLocked()Inspired by Uniswap v4's extsload pattern.