Created
December 21, 2020 20:38
-
-
Save petejkim/a67678c0523836f32b56ce63de8be5ab to your computer and use it in GitHub Desktop.
USDC v2: Upgrading a $1.4B Token - Testing Storage Slot 0
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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