Skip to content

Instantly share code, notes, and snippets.

@Aviksaikat
Created May 17, 2025 18:10
Show Gist options
  • Save Aviksaikat/98b40510ed20ddecbb8da7221d8d7e2c to your computer and use it in GitHub Desktop.
Save Aviksaikat/98b40510ed20ddecbb8da7221d8d7e2c to your computer and use it in GitHub Desktop.
Set accounts with native gas tokens in anvil fork on any Chain
def wallet_with_native_token(web3_fork: Web3, test_address: HexAddress) -> None:
# Directly set test_address’s balance to 100 ETH
amount_wei = 100 * 10**18
web3_fork.provider.make_request(
"anvil_setBalance",
[test_address, hex(amount_wei)]
)
assert web3_fork.eth.get_balance(test_address) == amount_wei
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment