Closed 0f0crypto closed 11 months ago
The generated permit is incorrect when EIP712 is instantiated with any version other than "1" because the value is hardcoded in the gerDomain method https://github.com/dmihal/eth-permit/blob/34f3fb59f0e32d8c19933184f5a7121ee125d0a5/src/eth-permit.ts#L97
EIP712
"1"
gerDomain
For example, the current version of the USDC token on Ethereum uses version "2"
USDC
function initializeV2(string calldata newName) external { // solhint-disable-next-line reason-string require(initialized && _initializedVersion == 0); name = newName; DOMAIN_SEPARATOR = EIP712.makeDomainSeparator(newName, "2"); _initializedVersion = 1; }
Therefore, using the signERC2612Permit does not work for USDC, i.e. called permit() reverts with EIP2612: invalid signature
signERC2612Permit
permit()
EIP2612: invalid signature
Oh nevermind. I see the key is to use a domain object instead of the address as the second parameter 🤦
domain
address
The generated permit is incorrect when
EIP712
is instantiated with any version other than"1"
because the value is hardcoded in thegerDomain
method https://github.com/dmihal/eth-permit/blob/34f3fb59f0e32d8c19933184f5a7121ee125d0a5/src/eth-permit.ts#L97For example, the current version of the
USDC
token on Ethereum uses version "2"Therefore, using the
signERC2612Permit
does not work forUSDC
, i.e. calledpermit()
reverts withEIP2612: invalid signature