Skip to content

Instantly share code, notes, and snippets.

@petejkim
Created December 21, 2020 20:38
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/a67678c0523836f32b56ce63de8be5ab to your computer and use it in GitHub Desktop.
Save petejkim/a67678c0523836f32b56ce63de8be5ab to your computer and use it in GitHub Desktop.
USDC v2: Upgrading a $1.4B Token - Testing Storage Slot 0
// Storage slot 1 contains "pauser" (bool) and "paused" (address)
const data = await web3.eth.getStorageAt(contract.address, 1);
const pauserData = data.slice(-40); // Take the last 20 bytes
const pausedData = data.slice(-42, -40); // Take 1 byte before that
expect(pauserData).to.equal(pauserAddress.slice(2).toLowerCase());
expect(!!parseInt(pausedData, 16)).to.equal(paused); // Convert to boolean
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment