swapping tokens via uniswapv2router on kovan network. but transaction always fails
swapping tokens via uniswapv2router on kovan network. but transaction always fails
Loading saved threads...
Abhijay Paliwal · External communityPost link
External question — Ethereum Stack Exchange
Author: Abhijay Paliwal
Original post: https://ethereum.stackexchange.com/questions/129656
License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/
Adaptation: HTML converted to plain text; contact email addresses removed.
I was making a swapping contract where a user could swap tokens using uniswapv2router. I have taken example code from here -
https://cryptomarketpool.com/how-to-swap-tokens-on-uniswap-using-a-smart-contract/
I was swapping WETH to doge and getAmountOutMin function gives out min tokens. their contract addresses are:
WETH:
0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6
DOGE:
0x962Da63FF7a33875b2D4ed47112ADe44B1Db96E7
However when I tried to swap tokens, it always fails with an error. I have deployed it to Kovan testnet. Any help is appreciated.
Failed transaction is-
https://goerli.etherscan.io/tx/0xcbe5bae9b0bd77ae25f2cb900f1d355090d3f1b90c86c9627e609b06ea176864
Smart contract address is:
0x3801e3e49dc73e2a124ea82ec1327068d1b517d9
(Kovan)
Quote
Report
Kaki Master Of Time · External communityPost link
External answer — Ethereum Stack Exchange
Author: Kaki Master Of Time
Original post: https://ethereum.stackexchange.com/a/129679
License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/
Adaptation: HTML converted to plain text; contact email addresses removed.
This is probably due to you not passing value to the call to WETH function in order to deposit ETH and get WETH.
If you check the traces
here
you would see that your contract is contacting the WETH contract but not sending any value (
value : 0x0
).
Quote
Report
Post Reply
Quoted from Forex.com.bd-Editorial External answer — Ethereum Stack Exchange Author: Kaki Master Of Time Source score (net votes, not local likes): 0 Original post: https://ethereum.stackexchange.com/a/129679 License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/ Adaptation: HTML converted to plain text; contact email addresses removed. This is probably due to you not passing value to the call to WETH function in order to deposit ETH and get WETH. If you check the traces here you would see that your contract is contacting the WETH contract but not sending any value ( value : 0x0 ).
Checking account access…