-
-
Notifications
You must be signed in to change notification settings - Fork 2k
[RESOLVED] Error : non-payable method cannot override value #2211
Replies: 1 comment · 8 replies
-
If you are swapping tokenA for tokenB, then you have to use ERC20 Approve, which seems you are already using. So just remove the |
Beta Was this translation helpful? Give feedback.
All reactions
-
❤️ 1
-
Yeaaah! This first issue has gone :) |
Beta Was this translation helpful? Give feedback.
All reactions
-
So, the tx return this error
I think my deadline value is not sufficient. I define it like that:
I modified it: |
Beta Was this translation helpful? Give feedback.
All reactions
-
I am trying to swapTokensForExactETH and running in the same issue. Here is my code set. Can anyone help? @Sm4rtC0ntr4ct @zemse `const { ethers } = require("ethers") const privateKey = "XXX";//fs.readFileSync(".secret").toString().trim() UNISWAP_ROUTER_ADDRESS = "0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D" const DAI = new Token( async function swapTokens(token1, token2, amount, slippage = "50") {
} //swapTokens(WETH[DAI.chainId],DAI, 0.2) //first argument = token we want, second = token we have, the amount we want swapTokens(DAI,WETH[DAI.chainId], 0.2)` |
Beta Was this translation helpful? Give feedback.
All reactions
-
The // you need to approve tokens so that router contract can pull them from your wallet
await DAI.approve(UNISWAP_ROUTER_CONTRACT.address, amountInMaxHex);
await UNISWAP_ROUTER_CONTRACT.populateTransaction.swapTokensForExactETH(amountOut, amountInMaxHex,path, to, deadline, {
// value: valueHex // you need to remove this line
}) |
Beta Was this translation helpful? Give feedback.
All reactions
-
@priyankaj1910 Hi did you find a solution for it ? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi everyone!
I try to interact with Kyber DMM contracts (Uniswap fork) and I face this error :
Unhandled Rejection (Error): non-payable method cannot override value (operation="overrides.value", value="0x056bc75e2d63100000", code=UNSUPPORTED_OPERATION, version=contracts/5.5.0)
It happens when I call the swapExactTokensForTokens method. I searched for hours but I didn't understand what is and where is the issue.
Could you please help me?
My code :
Beta Was this translation helpful? Give feedback.
All reactions