kaymen99 / uniswap-sushiswap-arbitrage

Smart contract for performing arbitrage between Uniswap and Sushiswap
MIT License
64 stars 16 forks source link

VirtualMachineError: revert: Arbitrage not profitable #3

Closed voltaxvoltax closed 1 year ago

voltaxvoltax commented 2 years ago

Hi!

I'm having the following error:

Transaction sent: 0x1c1d48dec4082b1f46b5a7b88adf3fac9105229389df25cb9f521d36217c27c3 Gas price: 0.0 gwei Gas limit: 12000000 Nonce: 6 SimpleArbitrage.makeArbitrage confirmed (Arbitrage not profitable) Block: 14762600 Gas used: 44416 (0.37%)

File "brownie/_cli/run.py", line 50, in main args[""], method_name=args[""] or "main", _include_frame=True File "brownie/project/scripts.py", line 103, in run return_value = f_locals[method_name](*args, *kwargs) File "./scripts/arbitrage.py", line 37, in main arbitrage_tx = arbitrage.makeArbitrage({"from": account}) File "brownie/network/contract.py", line 1693, in call return self.transact(args) File "brownie/network/contract.py", line 1577, in transact allow_revert=tx["allow_revert"], File "brownie/network/account.py", line 680, in transfer receipt._raise_if_reverted(exc) File "brownie/network/transaction.py", line 421, in _raise_if_reverted source=source, revert_msg=self._revert_msg, dev_revert_msg=self._dev_revert_msg VirtualMachineError: revert: Arbitrage not profitable Trace step -1, program counter 689: File "contracts/SimpleArbitrage.sol", line 38, in SimpleArbitrage.withdraw:
}

    modifier onlyOwner() {
        require(msg.sender == owner, "only owner can call this");
        _;
    }

Terminating local RPC client...

The only thing that I haven't done, it's having WETH in my wallet, could be that?

kaymen99 commented 2 years ago

No the contract reverts with "Arbitrage not profitable" which means that the current difference in price between the 2 exchanges is less than the transaction fee So the smart contract does not excute the arbitrage

voltaxvoltax commented 2 years ago

Ah! Ok, need to look better at the code so I can put it running in a loop. Good work you made here, thanks!

christianduncan commented 2 years ago

@Aymen1001 what percentage of the time will an arbitrage opportunity actually be available? seems like with eth on these two exchanges it will always revert with "Arbitrage not profitable"

kaymen99 commented 2 years ago

Yes ETH/DAI is a known pair to everyone so any arbitrage opportunity will not last long I think to find good arbitrage you need to check unknown tokens pairs on both exchanges or to build a bot that watches the hole market searching for those opportunities