-
Notifications
You must be signed in to change notification settings - Fork 2.2k
feat: Add anvil set erc20 allowance endpoint #10746
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add anvil set erc20 allowance endpoint #10746
Conversation
Unfortunately anvil has the parameter order (owner, token) while tenderly has (token, owner), so they are not compatible. Fixing my previous mistake here.
|
hey @pistomat mind to resolve conflicts in order to approve and run CI? thank you |
…/add-anvil-set-erc20-allowance-endpoint
|
@grandizzy done |
is this otherwise the same impl, if so we should consider changing the order |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
there possibly a way to unify this search behaviour
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
makes sense, thank you. I think we could reduce amount of code by having a helper fn to accept calldata and override and reuse in both deal / allowance calls?
|
agreed on the above, other than that implementation lgtm 👍 , supportive of having this endpoint |
|
yeah, but def easier to do this in a followup |
Extracts duplicated access list handling code from `anvil_deal_erc20` and `anvil_set_erc20_allowance` into a shared `find_erc20_storage_slot` helper function. Changes: - Add comprehensive documentation explaining the slot discovery process - Reduce code duplication by ~80 lines - Improve maintainability and consistency between functions - Fix unfulfilled clippy expectation in cast/tx.rs This is a follow-up cleanup to #10746 which introduced `anvil_set_erc20_allowance`. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
* refactor: unify ERC20 storage slot discovery logic Extracts duplicated access list handling code from `anvil_deal_erc20` and `anvil_set_erc20_allowance` into a shared `find_erc20_storage_slot` helper function. Changes: - Add comprehensive documentation explaining the slot discovery process - Reduce code duplication by ~80 lines - Improve maintainability and consistency between functions - Fix unfulfilled clippy expectation in cast/tx.rs This is a follow-up cleanup to #10746 which introduced `anvil_set_erc20_allowance`. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]> * chore: add clippy back --------- Co-authored-by: Claude <[email protected]>
Motivation
I love the new
anvil_dealERC20endpoint! So why not add an endpoint to override allowances? I present you the brand newanvil_setERC20Allowanceendpoint! One should not exist without the other imho, it is very useful to have both.Solution
Basically copied the code from
anvil_dealERC20and modified it to use theallowance(owner,spender,val)function of ERC20.Note: I also fixed my mistake of adding
tenderly_setErc20Balancealias, but Tenderly has different order of parameters, so it would be very confusing.PR Checklist