-
Notifications
You must be signed in to change notification settings - Fork 702
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(docs): EIP-712 Tutorial #252
Conversation
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.
Love the example - thank you for taking the time for this.
But maybe something that is easier for people to grok would be just showing how to use permit
in ERC2612 / DAI? That is something that you'll encounter more frequently!
i.e. show that instead of doing approve
-> function that calls transferFrom
you can do permit
off-chain and then function that calls transferFrom
including the v,r,s
or the signature
?
On the code pattern:
Can you replace DSTest
with forge-std/Test
? Would let you remove the need to specify VM internal vm
and instantiate it.
Also would recommend moving EIP_712_DOMAIN_SEPARATOR
and SIGNED_TICKET_TYPEHASH
into helper fns / state vars?
some helper fns which make it clearer:
https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/cryptography/ECDSA.sol#L228
https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/cryptography/draft-EIP712.sol#L53-L103
hmmm yeah agreed. i'll update |
Sorry to jump in on this thread but something I've been trying to figure out is how to use forge to test a signed message that is provided to the function as a single string: Is there a way to convert the v, r, s returned from For context, the way I'm creating the signature off chain is with ethers.js's |
hey @gigamesh! |
ah ok super easy - thank you! |
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, let's iterate on it if needed :)
resolves #159