-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
program: add lp shares rebase (#568)
* start test * improve lp_delta_quote * improve per_lp_delta_quote * init per_lp_base * add rebase functions (wip) * rm err msg * add controller rebase to proper locations * add rebase cargo test * (wip) k out of wack * fix rebase test and add more asserts * format fix * incorp basic example to typescript tests * fix rebase math in position.rs (wip) * wip continue * working baseAssetAmountWithUnsettledLp * mvp encapsulation of update_lp_market_position * src/user.ts: add perLpBase to empty position * remove logs * simplify base unit logic more * add get_per_lp_base_unit * simplify per_lp_fee and add numbers to test * properly set per_lp_base for lp_share=0 in mint_lp_shares (and add sdk/test) * incorp feedback / format * tests/liquidityProvider.ts: work with sdk change * admin.rs: add constraint on per_lp_base range * add apply_lp_rebase_to_perp_position to simulate_settled_lp_position * use get_per_lp_base_unit consistently (wip sdk test for negative lp base) * cut excess return values in calculate_lp_delta * fix getPerpPositionWithLPSettle with negative perLpBase delta --------- Co-authored-by: Chris Heaney <[email protected]>
- Loading branch information
1 parent
04dd6a2
commit c54d114
Showing
19 changed files
with
982 additions
and
106 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
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
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
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.