Created
March 4, 2024 11:34
-
-
Save sterlu/901893ac0ca75e3aa0c12e436bcd2204 to your computer and use it in GitHub Desktop.
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
const rlp = require("rlp"); | |
const web3Utils = require("web3-utils"); | |
/** | |
* Calculates address of contract created by deployerAddr if CREATE is used (not CREATE2) | |
**/ | |
const calcAddress = (deployerAddr, nonce) => { | |
const rlpEncoded = Buffer.from(rlp.encode([deployerAddr, nonce])).toString('hex'); | |
const address = '0x' + web3Utils.sha3('0x' + rlpEncoded).substr(66 - 40); | |
return address; | |
} | |
// List first 300k DsProxy addresses (not all of them already exist) | |
const dsProxyFactoryAddr = '0xa26e15c895efc0616177b7c1e7270a4c7d51c997'; | |
for (var i = 1; i <= 300_000; i++) { | |
// #1 is DsProxyCache, DsProxies start from #2 | |
// #3953 is mislabeled on Etherscan causing misnumbered labels for all after it | |
console.log(`${i},\t${calcAddress(dsProxyFactoryAddr, i)}`); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment