Closed anxolin closed 1 year ago
CLA Assistant Lite bot:
Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.
I have read the CLA Document and I hereby sign the CLA
You can retrigger this bot by commenting recheck in this Pull Request
Unit tests are not happy
@anxolin unit tests were still broken
Implement some basic Polling Also, applies some follow-ups from: comments in https://github.com/cowprotocol/cow-sdk/pull/147
Implement a Polling (as a Template Method in ComposableCow)
This generic polling logic will check the following:
reason
).undefined
if the polling checks should continue, otherwise it will instruct that is not time to create an order. For this, it can signal:TRY_NEXT_BLOCK
: This block is not good, but next one mightTRY_ON_BLOCK
: This block is not good, but try again in the givenblockNumber
TRY_AT_DATE
: This block is not good, but try again after a givendate
DONT_TRY_AGAIN
: This block is not good, but also the following blocks. Please don't try again because it will keep not being the right time!isAuthorised
Method in ComposableCow to check if the order is authorised.
Exposed as public method, but also convenient for the
polling
logic.Removed validation from constructor
I thought it was best to not do a validation in the constructor of the order, so we can programmatically call to
isValid
Also the method
isValid
doesn't throw any more, instead returns the reason. This reasons are convenient for other methods likepoll
to give a good description of why the order is not yet ready.Now polling can instruct to never poll again that smart order, and return a good reason why:
Generics for ConditionalOrders
Changed back to
T
andP
as suggested in https://github.com/cowprotocol/cow-sdk/pull/147Not implemented in this PR (follow up coming)
Custom logic in Twap conditional order to postpone some checks for the future (instead of checking on each block)
I left some TODOs: