Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add the ability to close all open orders #5038

Merged
merged 16 commits into from
Aug 23, 2024
Merged

Conversation

marcellorigotti
Copy link
Contributor

Pull Request

Closes: PRO-1471

Checklist

Please conduct a thorough self-review before opening the PR.

  • I am confident that the code works.
  • I have updated documentation where appropriate.

Summary

Added cancel_orders_batch extrinsic to allow lp to close multiple orders at the same time (up to 100)
Added cancel_orders_batch and cancel_all_orders to the LP API, the latter simply query for all the open orders and then submit a cancel_orders_batch, in case the open orders are more than 100 it will submit multiple extrinsics with batch of 100 orders each (if the WaitFor parameter is set to InBlock or Finalized the extrinsics will be split across multiple blocks)

The events emitted are the same as before (RangeOrderUpdated, LimitOrderUpdated), there will be one event for each order being closed, in case an order passed is not correct (wrong orderId or the order was fully filled before the extrinsic is executed) the deletion of that order is skipped and a new event OrderDeletionFailed { order: CloseOrder } is emitted.

Breaking changes

New extrinsic and event added

Copy link

codecov bot commented Jul 12, 2024

Codecov Report

Attention: Patch coverage is 41.38973% with 194 lines in your changes missing coverage. Please review.

Project coverage is 70%. Comparing base (a49451d) to head (3175f98).
Report is 13 commits behind head on main.

Files Patch % Lines
state-chain/pallets/cf-pools/src/weights.rs 5% 76 Missing ⚠️
api/lib/src/lp.rs 0% 75 Missing ⚠️
state-chain/pallets/cf-pools/src/tests.rs 78% 18 Missing and 6 partials ⚠️
state-chain/pallets/cf-pools/src/lib.rs 72% 13 Missing and 6 partials ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##            main   #5038     +/-   ##
=======================================
- Coverage     71%     70%     -1%     
=======================================
  Files        458     481     +23     
  Lines      82125   86159   +4034     
  Branches   82125   86159   +4034     
=======================================
+ Hits       58138   60341   +2203     
- Misses     20917   22534   +1617     
- Partials    3070    3284    +214     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@dandanlen dandanlen added this pull request to the merge queue Aug 23, 2024
@albert-llimos albert-llimos removed this pull request from the merge queue due to a manual request Aug 23, 2024
@albert-llimos albert-llimos added this pull request to the merge queue Aug 23, 2024
Merged via the queue into main with commit c9ed3d9 Aug 23, 2024
48 checks passed
@albert-llimos albert-llimos deleted the feature/pro-1471 branch August 23, 2024 11:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants