Last active
March 25, 2022 09:03
-
-
Save danielnordh/d0e174b66ebd3af6ddbf07b48a91813b to your computer and use it in GitHub Desktop.
USDC transferWithAuthorization call failing on zkSync, but working on Ropsten
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// See comment below with code example |
Ethers code:
// transferWithAuthorization (fails)
var txHash = await contractWithSigner.transferWithAuthorization(fromAddress, toAddress, amount, validAfter, validBefore, nonce, sigParams.v, sigParams.r, sigParams.s, {gasPrice: ethers.utils.parseUnits('100', 'gwei'), gasLimit: 1000000});
console.log("txHash:" + JSON.stringify(txHash, null, 2));
// transfer (succeeds)
let txHash2 = await contractWithSigner.transfer(toAddress, amount);
console.log("txHash2:" + JSON.stringify(txHash2, null, 2));
Turns out the issue is that the 'USDC' contract currently deployed on the zkSync 2.0 Alpha testnet is only a standard ERC20 contract and does NOT contain the transferWithAuthorization
function.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Tried the same thing with Ethers.js instead of Web3.js, but same thing:
Error: processing response error (body="{"jsonrpc":"2.0","error":{"code":3,"message":"Execution error","data":{"code":104,"message":"Cannot estimate transaction: VM execution resulted in a revert: VM Error."}},"id":53}\n", error={"code":3,"data":{"code":104,"message":"Cannot estimate transaction: VM execution resulted in a revert: VM Error."}}, requestBody="{"method":"eth_sendRawTransaction","params":["0xf9018d0785174876e800830f424094d35cceead182dcee0f148ebac9447da2c4d449c480b90124e3ee160e000000000000000000000000d9d3768621774c3c357b9b5fcb23b5735ea2c7ae00000000000000000000000033eecb4a75c9241eea0190e5dcdfb76d2ed6761300000000000000000000000000000000000000000000000000000000000186a00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006239c7bbe7348e305d9e8f9ea286a33097e413507739d6039f188f6eddb647a490bbbdde000000000000000000000000000000000000000000000000000000000000001c72a7a861f5394e6a6b83d201241a51bb9c45f1560a87cdcd245293adbcd4cb9837f7ef4c69dd9a1533c3ee7cf10121d0389e9fbafe3e71ef687c03899be12c13820253a0e95c7f809f092daec4769400f9f374c0338a93f0e6a84fc001c24ed119274b23a03bdd3ae65aaa024fc42086516b1b4a5605bd91ac8bd5e4bedb80c1b113afbdea"],"id":53,"jsonrpc":"2.0"}", requestMethod="POST", url="https://zksync2-testnet.zksync.dev", code=SERVER_ERROR, version=web/5.6.0)