Expanding the 1inch limit order protocol with some small financial object additions
This project explores the possibility of creating OCO (one cancels the other) orders using 1inch limit order protocol. One great thing about this protocol is that orders are only created and signed and the status is tracked with a single bit value. To extend this for OCO orders, we can just create two orders, assigned to the same bit so that when one or the other is filled the bit is invalidated and the other order automatically gets cancelled.
Okay, so first I thought of doing it all on chain, so I created a contract to create and track OCO order pairs and handle the bit invalidation there, but later I realized it could be done without a contract by just using the bit invalidation of individual orders to cancel/invalidate one if the other is filled/cancelled. So I looked into using the javascript sdk for developing a script that does this but there's a whole mountain of issues with node versions and imports as modules and stuff like that. But I was somehow able to get something working only to not be able to create orders with the API, all requests resulted in failure. I switched to mainnet but haven't yet been able to get it working, but I still have time so let's see