Created
December 21, 2020 20:40
-
-
Save petejkim/d2203e0049a888e5ae9e29a5f136e637 to your computer and use it in GitHub Desktop.
USDC v2: Upgrading a $1.4B Token - Testing Storage Slot 9
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 9 contains "balances" (mapping(address => uint256)) | |
// Derive slot position for the key k | |
const k = holderAddr.slice(2).toLowerCase().padStart(64, "0"); | |
const p = "9".padStart(64, "0"); | |
const valueSlotPos = web3.utils.keccak256("0x" + k + p); | |
const data = await web3.eth.getStorageAt(contract.address, valueSlotPos); | |
expect(new BN(data.slice(2), 16).eq(expectedBalance)).to.be.true; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment