Closed r001 closed 6 years ago
Something is wrong with travis. It builds fine at my home computer, and does not build here.
given the 4M gas limit only 40 offers can be matched at a time. If we need more, I need to redesign the contract to make it execute in several different blocks.
We need to finish the discussion about the proper way to handle O(n) gas ops. There are a few issues with the approach right now e.g. I think it is a bit fragile to use from long-running contracts
We need to finish the discussion about the proper way to handle O(n) gas ops. There are a few issues with the approach right now e.g. I think it is a bit fragile to use from long-running contracts
I agree. My idea about this is to use keepers. But we want to limit keepers from doing arbitrage to receive some fee instead. The main reason for this is the fact that with Oasis we compete with other exchanges, and the arbitrage is simply too expensive for users. And offers that are too small are not worth buying, so they are never matched. What I propose is that all users placing an offer must send W-eth to the contract to cover the matching. On the contract side we would apply keepers to do the O(n) stuff outside of the contract (but without having to trust them), and we would limit the number of keepers that can connect to the system (to make matching somewhat profitable for them), and require a kind of responsivity, so that all offers are matched immediately. So we would create the group of Alpha Keepers, that should be 4 keepers at a time, that have the right to connect to the system, they must provide 99% of availability in order to have 99.9999% of availability for the Alpha Keepers combined. If keeper does not provide 99% he is kicked, and a new one gets a chance from the Keeper pool. This system is rather difficult, but provides O(1) for the contract to match offers; outside contracts can call offer() without having to provide an oracle and still execute in O(1); the price of matching is shared between the offer makers and the ones that actually do the matching, keepers do not receive arbitrage but receive fee for doing calculations. And probably whaat I wrote here is really hard to understand, so let's chat about it!
The purpose of this pull request is to make automated offer matching otc.
Limitations:
Gas usage:
You can find the original idea of the matcher here: https://docs.google.com/document/d/1O-bLCwz88pTv_0wMBlbd98iyQAjcv6WmjT0aBDY2hAQ/edit?usp=sharing