Skip to content
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

Add ERC20 Premints #48

Merged
merged 10 commits into from
May 3, 2024
Merged

Conversation

ligustah
Copy link
Collaborator

@ligustah ligustah commented Apr 23, 2024

Needed to use macros for a lot of things. The main problem is that we need to use separate namespaces for V2 and ERC20 ABI types, because we need to tweak the abi.json and change the names of some types. That's required for signatures to work correctly, but they can't both have the same names.

Experimented with a generic based solution, but ultimately went for the macros because of that.

Copy link
Collaborator Author

ligustah commented Apr 23, 2024

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @ligustah and the rest of your teammates on Graphite Graphite

This was referenced Apr 23, 2024
@ligustah ligustah force-pushed the andre/back-2636-support-erc20-premints-1 branch from 5828068 to a4b4688 Compare April 26, 2024 17:16
@ligustah ligustah force-pushed the andre/back-2636-support-erc20-premints-1 branch from a4b4688 to 802cbaf Compare May 2, 2024 16:55
@ligustah ligustah changed the title Rename zora_premint_v2 -> zora_premint Add ERC20 Premints May 2, 2024
@ligustah ligustah marked this pull request as ready for review May 3, 2024 15:22
@ligustah ligustah requested a review from erikreppel May 3, 2024 15:22
Copy link
Contributor

@erikreppel erikreppel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm curious why so much of this needed to be macros?

Copy link
Collaborator Author

ligustah commented May 3, 2024

I'm curious why so much of this needed to be macros?

I tried going with generics first, but couldn't make it work. The underlying problem is that even though there is strong overlap between the two premints, it's hard to express that in generics. I was going with a generic shared zora premint type (similarly to what we have in the python version), but then ended up having to implement all data access through traits, which i then would need to implement for all new types. Also needed to put generic bounds all over the place, which to be honest I found much harder on the eyse than the macro. So I figured it's easier to just macro everything, since the function and field names are all the same, so it's basically copy&paste territory (for now).

If alloy supports aliasing types in the sol macro at some point we could come back and consolidate this a little more outside of the macros.

@ligustah ligustah merged commit d21f180 into main May 3, 2024
7 checks passed
Copy link
Collaborator Author

ligustah commented May 3, 2024

Merge activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants