You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm able to console log all the variables and I tripled checked everything matches. However no matter what I do I always get the error message 'Dai/invalid-permit'
This is for the DAI token
The text was updated successfully, but these errors were encountered:
I know this was posted a long time ago but I wanted to provide a possible answer. If you are deploying a DAI contract on your test fork then you need to make sure to deploy as chainId "31337". If you are using the DAI contract that was deployed on mainnet it was deployed as chainId "1". The DAI contract uses the DOMAIN_SEPARATOR pattern to ensure safety of transaction replay. If you are making a permit call on the mainnet deployment you need to sign the permit data with chainId=1, if you are making the permit call to a fresh deployment of DAI then you can use the provided chainId=31337. I am currently running into the issue that I cannot use Metamask to sign a message that claims chainId=1 when the active chainId=31337 because it is set up to refuse to do this (safety). However, I also cannot get the dai-permit library to use ethers to sign based on a wallet set up using chainId=1.
Im using this exact demo code while using Hardhat on a forked Ethereum mainnet node.
const result = await signDaiPermit(window.ethereum, tokenAddress, senderAddress, spender);
await token.methods.permit(senderAddress, spender, result.nonce, result.expiry, true, result.v, result.r, result.s)
I'm able to console log all the variables and I tripled checked everything matches. However no matter what I do I always get the error message 'Dai/invalid-permit'
This is for the DAI token
The text was updated successfully, but these errors were encountered: