I'm trying to get a WETH by calling the WETH contract on Kovan (using ethers.js) but something goes wrong. Here's my code:

const swapETHForWETH = async(eth: string) => {
    const wethAddr = "0xd0a1e359811322d97991e03f863a0c30c2cf029c";
    const wetAbi = [
    "function allowance(address owner, address spender) external view returns (uint256 remaining)",
    "function approve(address spender, uint256 value) external returns (bool success)",
    "function balanceOf(address owner) external view returns (uint256 balance)",
    "function decimals() external view returns (uint8 decimalPlaces)",
    "function name() external view returns (string memory tokenName)",
    "function symbol() external view returns (string memory tokenSymbol)",
    "function totalSupply() external view returns (uint256 totalTokensIssued)",
    "function transfer(address to, uint256 value) external returns (bool success)",
    "function transferFrom(address from, address to, uint256 value) external returns (bool success)",
    "function deposit() external",
    "function withdraw(uint wad) external"

    const contract = new Contract(wethAddr, wetAbi, wallet);
    try {
        const tx = await contract.deposit({
            from: wallet.address,
            value: utils.parseEther(eth)
        const txResponse = await tx.wait();
    } catch(err) {

The error states that:

Error: non-payable method cannot override value (operation="overrides.value", value={"type":"BigNumber","hex":"0x016345785d8a0000"}, code=UNSUPPORTED_OPERATION, version=contracts/5.5.0) at Logger.makeError (/home/whiteboii/POC/aave_poc/node_modules/@ethersproject/logger/lib/index.js:199:21) at Logger.throwError (/home/whiteboii/POC/aave_poc/node_modules/@ethersproject/logger/lib/index.js:208:20) at /home/whiteboii/POC/aave_poc/node_modules/@ethersproject/contracts/lib/index.js:247:36 at step (/home/whiteboii/POC/aave_poc/node_modules/@ethersproject/contracts/lib/index.js:48:23) at Object.next (/home/whiteboii/POC/aave_poc/node_modules/@ethersproject/contracts/lib/index.js:29:53) at fulfilled (/home/whiteboii/POC/aave_poc/node_modules/@ethersproject/contracts/lib/index.js:20:58) { reason: 'non-payable method cannot override value', code: 'UNSUPPORTED_OPERATION', operation: 'overrides.value', value: BigNumber { _hex: '0x016345785d8a0000', _isBigNumber: true } }

1 Answer 1


As far as I know your deposit function should be marked as payable in your ABI definition.

So using function deposit() external payable should work.

  • oh yeah, you're right. works now. i just copied the abi from someones github, best i watch those things in the future Commented Jan 20, 2022 at 13:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.