Created
December 21, 2020 20:39
-
-
Save petejkim/78e187a6565f1e034046dfeee1c569ee to your computer and use it in GitHub Desktop.
USDC v2: Upgrading a $1.4B Token - Testing Storage Slot 4
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 4 contains "name" (string) | |
const data = await web3.eth.getStorageAt(contract.address, 4); | |
const len2 = parseInt(data.slice(-2), 16); // Last 1 byte = length * 2 | |
// Read the text (skip "0x") | |
const text = Buffer.from(data.slice(2, 2 + len2), "hex").toString("utf8"); | |
expect(text).to.equal(name); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment