Open drbh opened 3 years ago
Hey @drbh,
Thanks for your kind comments.
Please note that this project is a simple old proof of concept, that it should only be considered as such, and that the accompanying demo operates under quite virtual settings today.
In fact, I would say that it only makes sense to fetch your DEX exchange rates from actual mined and pending transactions, as they may directly impact your arbitrage. Of course you may trust a number of service providers to deliver this data and then the actual choice of a 3rd party you rely on is up to you but the aim of this PoC was in part to demonstrate how we could leverage the speed of Dfuse services.
You are totally right in your observation : in this context, in case of an unprofitable arbitrage regarding your operations on DEXes, a basic flash loan receiver would simply fail at transferring back the flash loaned amount and fees, causing the transaction to be reverted. But this does not imply that in all other cases, your transaction is necessarily profitable (mining fees should be considered) or that your broader strategy is being followed.
For this simple reason, I believe that the ability to closely monitor all transactions, even pending ones, that could change your results or your strategy, and maintain control over all the levers of action, even the cancellation of a transaction in the most severe cases, is a valuable feature.
Hope it helps. Thanks for the nice comments.
Hey @PhilippeMts
This is an awesome project and has been an invaluable learning resource! Thank you for sharing this work. 🙌
I have a couple of questions about extending the project's functionality.
What would you suggest for fetching exchange rates and gas prices? Does it make sense to use transactions on chain to determine those rates? Or does it make more sense to poll the exchanges in HTTP or WS?
Im terms of using Dfuse to track transactions - is this functionality needed? wouldn’t the transactions fail when the block completes if they aren’t profitable? Is it necessary to submit an empty transaction if the trade is no longer profitable? I guess I’m a bit confused on situations where the arbitrage ends with a net loss. I was under the impression that the flash loan only gets committed to the block when it’s fully complete (meaning that the loan can be paid back in full, including the interest and gas on intermittent transactions). Based on that - the worst case is a net neutral trade...
Any insight to the questions above are super helpful! Thanks again for the great work and congratulations on the Dfuse Web3 submission 🎉