Open tab00 opened 2 years ago
What I do now is call contract.functions.nonces(DUMMY_ADDRESS)
and contract.functions.DOMAIN_SEPARATOR()
and see if they don't throw + return expected values (zero for nonces
and non-zero bytes for DOMAIN_SEPARATOR
.
I'm developing a dapp with a smart contract that can receive ERC20 tokens. What's the best way for a dapp (using
ethers
orweb3
) to check whether a token has thepermit
function, so that execution can fall back to usingapprove
if not?I had just tried
signERC2612Permit
with WETH on Rinkeby and it succeeded to create signature values, however when the smart contract tries to callpermit
the transaction is reverted without a reason. I then checked WETH and found that that WETH doesn't havepermit
.Should
signERC2612Permit
check forpermit
before returning signature values, throwing an error if it doesn't exist?