You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For a given pair in a flashloan arbitrage operation, taking the example of uniswap and sushiswap as the selected DEX´s for executing an arbitrage opportunity, and for 1INCH/WETH token pair, sushiswap WETH price is cheaper than uniswap (despite having larger reserve volumes in comparison).
The problem lies when I execute the following two lines of code in my uniswapV2call method:
and it returns amountToRepay > amountReceived when I was expecting the result to be other way round owing to spotted price difference opportunity under arbitrage operation.
Output error message
Error: VM Exception while processing transaction: reverted with reason string 'UniswapV2Router: INSUFFICIENT_OUTPUT_AMOUNT'
at . (0x7a250d5630b4cf539739df2c5dacb4c659f2488d)
at FlashloanerArbitrage.uniswapV2Call (contracts/FlashloanerArbitrage.sol:261)
at . (0x86f518368e0d49d5916e2bd9eb162e9952b7b04d)
at FlashloanerArbitrage.startSwap (contracts/FlashloanerArbitrage.sol:180)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at EthModule._estimateGasAction (C:\Samuel\Blockchain\Flashloan-arbitrage-bot-uniswapV2_hardhat\node_modules\hardhat\src\internal\hardhat-network\provider\modules\eth.ts:429:7)
at HardhatNetworkProvider._sendWithLogging (C:\Samuel\Blockchain\Flashloan-arbitrage-bot-uniswapV2_hardhat\node_modules\hardhat\src\internal\hardhat-network\provider\provider.ts:139:22)
at HardhatNetworkProvider.request (C:\Samuel\Blockchain\Flashloan-arbitrage-bot-uniswapV2_hardhat\node_modules\hardhat\src\internal\hardhat-network\provider\provider.ts:116:18)
at JsonRpcHandler._handleRequest (C:\Samuel\Blockchain\Flashloan-arbitrage-bot-uniswapV2_hardhat\node_modules\hardhat\src\internal\hardhat-network\jsonrpc\handler.ts:188:20)
at JsonRpcHandler._handleSingleRequest (C:\Samuel\Blockchain\Flashloan-arbitrage-bot-uniswapV2_hardhat\node_modules\hardhat\src\internal\hardhat-network\jsonrpc\handler.ts:167:17)
at Server.JsonRpcHandler.handleHttp (C:\Samuel\Blockchain\Flashloan-arbitrage-bot-uniswapV2_hardhat\node_modules\hardhat\src\internal\hardhat-network\jsonrpc\handler.ts:52:21)
Where am I going wrong here as this issue has been troubling me for several weeks now.
I have tried implementing other_ pricing oracle methods but it comes back to this very same issue.
Any help or suggestions would be greatly appreciated.
Thank you
The text was updated successfully, but these errors were encountered:
Samboy76
changed the title
Arbitrage profit through combination of getAmountsIn and getAmountsOut functions
Determine arbitrage profit based on price differences and reserve amounts between two selected DEXs
Oct 9, 2022
Samboy76
changed the title
Determine arbitrage profit based on price differences and reserve amounts between two selected DEXs
Determine flashloan token amount to yield a profit based on price differences and reserve amounts in two selected DEXs
Oct 9, 2022
Samboy76
changed the title
Determine flashloan token amount to yield a profit based on price differences and reserve amounts in two selected DEXs
Output value from getAmountsIn > getAmountsIn in arbitrage price difference opportunity
Oct 30, 2022
Samboy76
changed the title
Output value from getAmountsIn > getAmountsIn in arbitrage price difference opportunity
Output value from getAmountsIn > swapExactTokensForTokens in arbitrage price difference opportunity
Dec 5, 2022
Hello,
For a given pair in a flashloan arbitrage operation, taking the example of uniswap and sushiswap as the selected DEX´s for executing an arbitrage opportunity, and for 1INCH/WETH token pair, sushiswap WETH price is cheaper than uniswap (despite having larger reserve volumes in comparison).
The problem lies when I execute the following two lines of code in my
uniswapV2call
method:and it returns amountToRepay > amountReceived when I was expecting the result to be other way round owing to spotted price difference opportunity under arbitrage operation.
Output console.log (from my back-end smart contract)
getAmountsIn() results.......
path[0] 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2
path[1] 0x111111111117dc0aa78b770fa6a738034120c302
amountBorrowed 2497817866881194385864
amountToRepay 964334905750628563
getAmountsOut() results.......
path[0] 0x111111111117dc0aa78b770fa6a738034120c302
path[1] 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2
amountReceived 950114205093874394
Output error message
Error: VM Exception while processing transaction: reverted with reason string 'UniswapV2Router: INSUFFICIENT_OUTPUT_AMOUNT'
at . (0x7a250d5630b4cf539739df2c5dacb4c659f2488d)
at FlashloanerArbitrage.uniswapV2Call (contracts/FlashloanerArbitrage.sol:261)
at . (0x86f518368e0d49d5916e2bd9eb162e9952b7b04d)
at FlashloanerArbitrage.startSwap (contracts/FlashloanerArbitrage.sol:180)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at EthModule._estimateGasAction (C:\Samuel\Blockchain\Flashloan-arbitrage-bot-uniswapV2_hardhat\node_modules\hardhat\src\internal\hardhat-network\provider\modules\eth.ts:429:7)
at HardhatNetworkProvider._sendWithLogging (C:\Samuel\Blockchain\Flashloan-arbitrage-bot-uniswapV2_hardhat\node_modules\hardhat\src\internal\hardhat-network\provider\provider.ts:139:22)
at HardhatNetworkProvider.request (C:\Samuel\Blockchain\Flashloan-arbitrage-bot-uniswapV2_hardhat\node_modules\hardhat\src\internal\hardhat-network\provider\provider.ts:116:18)
at JsonRpcHandler._handleRequest (C:\Samuel\Blockchain\Flashloan-arbitrage-bot-uniswapV2_hardhat\node_modules\hardhat\src\internal\hardhat-network\jsonrpc\handler.ts:188:20)
at JsonRpcHandler._handleSingleRequest (C:\Samuel\Blockchain\Flashloan-arbitrage-bot-uniswapV2_hardhat\node_modules\hardhat\src\internal\hardhat-network\jsonrpc\handler.ts:167:17)
at Server.JsonRpcHandler.handleHttp (C:\Samuel\Blockchain\Flashloan-arbitrage-bot-uniswapV2_hardhat\node_modules\hardhat\src\internal\hardhat-network\jsonrpc\handler.ts:52:21)
Where am I going wrong here as this issue has been troubling me for several weeks now.
I have tried implementing other_ pricing oracle methods but it comes back to this very same issue.
Any help or suggestions would be greatly appreciated.
Thank you
The text was updated successfully, but these errors were encountered: