Skip to content

Instantly share code, notes, and snippets.

@petejkim
Created December 21, 2020 20:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save petejkim/6500894fec683aa9e02f2f22034d8c99 to your computer and use it in GitHub Desktop.
Save petejkim/6500894fec683aa9e02f2f22034d8c99 to your computer and use it in GitHub Desktop.
USDC v2: Upgrading a $1.4B Token - Testing Storage Slot 0
// Storage slot 0 contains "owner" (address)
const data = await web3.eth.getStorageAt(contract.address, 0);
// Take the last 20 bytes, left-pad with zeros if needed
const ownerData = data.slice(-40).padStart(40, "0");
expect(ownerData).to.equal(
ownerAddress.slice(2).toLowerCase() // Remove "0x"
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment