-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CL Vault optimize range math operations (#657)
## 1. Overview This PR aims to streamline and optimize the math operations related to `range.rs` in the scenario of `ModifyRange` message. ## 2. Implementation Details Simplified the math operation on withdrawal of position reply in the context of re-ranging. Considering that on the reply, the balances are already incremented with the withdrawn assets from the previous step, it is unnecessary to subtract that with the withdrawn amount, only to re-add them with a `saturating_sub` in between. Deprecated `CURRENT_BALANCE` state which was unnecessary. It was used before creating a position, and we were loading it to subtract the created position amounts from it. This has been replaced with a simple balances query which, in the context of a reply, already takes into account previous operations such as creating a position that already removes funds from the contract balance.
- Loading branch information
Showing
6 changed files
with
119 additions
and
375 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.