-
Notifications
You must be signed in to change notification settings - Fork 193
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat, test (perp): Liquidate (1/4) - 'ExecuteFullLiquidation' (#432)
* feat: liquidate proto changes, new params, and new methods on perp interfaces * fix: restore passing state * refactor: coalesce errors to one location * feat (liquidate.go): ExecuteFullLiquidation, distributeLiquidateRewards * test: Check expected fee to liquidator * test (liquidate_test.go): turn tests green with expectedPerpEFBalance * test: Test_distributeLiquidateRewards * typo correction * typo correction * refactor: replace panic(err) with require.NoError * fix: ExecuteFullLiquidation * feat (perp): Emit internal events when positionResp objects are returned * linter * fix, test: perp.go and margin.go tests pass again * fix: settleposition test restored * fix: calc_test.go, calc_unit_test.go * test: liquidate_unit_test passing * fix, refactor: passing margin_test, liquidate_test * fix (clearing_house_test.go): Margin and MarginToVault should be sdk.Int, not sdk.Dec * test, docs (liquidate_test.go): Check correctness of emitted events. Add docs for calculations * refactor: require.EqualValues -> assert.EqualValues + more docs * docs: small decription * refactor: universal sdk.Decs * verify event calls * refactor: consistency b/w assert and require * refactor: rename CalcFee -> CalcPerpTxFee * refactor: rename CalcFee -> CalcPerpTxFee * refactor: Liquidate (0/4) - asserts, String() calls, and new params * refactor: clean up old TODOs in clearing_house.go * feat: add liquidateresp as a proto type * feat: Remove duplicate sdk.AccAddress transform * Update x/perp/keeper/liquidate_test.go Co-authored-by: Walter White <[email protected]> * fix: added check to please linter * fix: all remsining margin goes to ef fund; might break tests * Add memStoreKey to perp keeper * Fix fee to perpEF and return liquidation resp * Add unit tests with mock for ExecuteFullLiquidation * Change xxx:yyy to BTC:NUSD * Rename typo * Refactor ExecuteFullLiquidation test scenario * Refactor test more * Refactor tests * Add early return in getPositionNotionalAndUnrealizedPnl * Refactor liquidation unit tests * Add short position test cases * Fix sender of funds to vault instead of PerpEF * fix: Resolve missing store issue on NibiruApp.PerpKeeper * Run executeliquidate from Liquidate * fix (liquidate_unit_test.go): Add mock for realized bad debt * refactor: cleanup * refactor: cleanup * Add realizeBadDebt method * Add method comment * Add realize bad debt calculation Co-authored-by: AgentSmithMatrix <[email protected]> Co-authored-by: MD <[email protected]> Co-authored-by: Mat-Cosmos <[email protected]> Co-authored-by: Walter White <[email protected]> Co-authored-by: Walter White <[email protected]>
- Loading branch information
1 parent
883dceb
commit f490773
Showing
11 changed files
with
1,596 additions
and
60 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.