Skip to content

Instantly share code, notes, and snippets.

View 0xGorilla's full-sized avatar
👋

0xGorilla 0xGorilla

👋
View GitHub Profile
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.4 <0.9.0;
library StorageAddress {
/// @notice compute the storage address of any element of a dynamic array, by its index
/// @dev Primitive type agnostic. Elements are supposedly taking one word in storage
/// (for other length, you'd have to split/concat them accordingly).
/// Main use is in conjunction with hevm.store, as the second parameter
/// hevm.store(myContract, offset, valueToWrite)
/// @param slot the storage slot where the array is in the contract

Keybase proof

I hereby claim:

  • I am 0xgorilla on github.
  • I am 0xgorilla (https://keybase.io/0xgorilla) on keybase.
  • I have a public key ASDNqHsxbmqb2EHMXxpY-0Mtc0uNhRwnvVWsSRrdgePpjQo

To claim this, I am signing this object: