NomicFoundation / NomicFoundation/hardhat
Create a helper to set an ERC-20 balance
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 8.5k
- Forks
- 1.7k
- Avg merge
- 6d 20h
- Merged PRs (30d)
- 35
Description
Now that we have an RPC method to overwrite a storage slot, we can create a helper to set an arbitrary balance to an address in any ERC20 token.
One way to implement it is:
- Get the access list of calling
balanceOf(address) - Take a snapshot
- Modify the first slot in the token's access list by setting it to a well known magic number
- Check if calling
balanceOf(address)returns the magic number now - If it doesn't, revert to the snapshot and repeat the process with the next slot
- If it does, revert the snapshot and overwrite it with the desired balance
We haven't implemented eth_createAccessList yet, so I'm flagging this as blocked.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by checking the existing RPC method for overwriting storage slots and whether eth_createAccessList is now available. The helper should locate the balanceOf storage slot through access-list trials, verify the magic value, then restore snapshots and set the desired balance; the issue currently identifies this work as blocked.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- blockchain, tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100