Commit Graph

21 Commits

Author SHA1 Message Date
Christian Kamm cbd3d915ba liqtest: Confirm ALT tx before proceeding
Not waiting can leave the alt-create and alt-extend in the same slot,
and ordered incorrectly.
2023-02-03 17:23:25 +01:00
Christian Kamm 6c8204e9ef ts: Allow control over tx confirmation commitment level
When talking to a load balanced endpoint it can be useful to read data
from rpc nodes at processed while waiting for confirmed commitment
on transactions.
2023-02-03 17:23:25 +01:00
Christian Kamm 628feafcb0
ts: Use sendAndConfirmTransaction instead of anchor's .rpc() (#432)
This allows us to configure a prioritization fee for these calls.
2023-02-02 14:23:22 +01:00
Christian Kamm a91a9ae998
Perp: Fix liq instructions (#424)
- Rename to perp_liq_base_or_positive_pnl and perp_liq_negative_pnl_or_bankruptcy
- Deal with situations where overall asset weight is zero and base position reduction
  would not improve liqee health
- Add ability for liqors to take over positive unsettled pnl if that improves liqee health
2023-02-02 09:00:37 +01:00
Christian Kamm ec99376a8f
Perp: Allow setting pnl asset weights (#391)
This replaces the previous distinction between trusted and untrusted
markets, they are equivalent to setting the asset weights to 1 or 0
instead.

This way, we can weigh positive pnl in the trusted case at less than 1
which is more correct from a risk point of view and allows for more
flexibility when it comes to liquidation.

Co-authored-by: microwavedcola1 <microwavedcola@gmail.com>
2023-01-16 16:49:09 +01:00
Christian Kamm 5a38506f04
Liquidator, liqtest and rust client fixes (#336)
Liquidator, liqtest and rust client fixes

- Make rust MangoClient fully async
- Update and improve liquidation test setup scripts
- Update liquidator to use versioned transactions
- Update liquidator to use mango and jupiter account lookup tables
- Use jupiter v4 api to get versioned transactions

Perp liquidation is still not fully good. See discussion aboult perp_liq_pnl_with_token.
2022-12-16 13:10:46 +01:00
Christian Kamm c8f1f3c821
Net borrow limits: Limit in quote, not native (#312)
* Net borrow limits: Limit in quote, not native
* make perp settle limit disableable
2022-12-02 12:24:11 +01:00
microwavedcola1 1732a5aff4
net borrow limits (#301)
* net borrow limits

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>

* fix client

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>

* Fixes from review

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>

* Fix tests

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
Co-authored-by: Christian Kamm <mail@ckamm.de>
2022-11-25 13:45:17 +01:00
microwavedcola1 d82608ebee Revert "add support for msrm vault for serum3 discounts (#285)"
This reverts commit 0a4f7150d6.
2022-11-20 15:31:16 +01:00
Christian Kamm 58f7ff2e0e Add staleness param to OracleConfig
Since Bank can't expand the existing OracleConfig, add a new one to Bank
and (temporarily!) copy over the old value to the new one in
TokenUpdateIndexAndRate.

Add some reserved space to OracleConfig to make this easier in the
future.

Breaks the PerpMarket and PerpPosition layouts
2022-11-12 12:11:09 +01:00
microwavedcola1 0a4f7150d6
add support for msrm vault for serum3 discounts (#285)
* add support for msrm vault for serum3 discounts

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>

* Fix client

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>

* client support

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>

* More client code and todos

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>

* prettoer

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>

* remove mint, not needed

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-11-09 09:59:42 +01:00
Maximilian Schneider 4d134f266b
reloadAll is now idsSource aware (#275)
add markets to test SOL quote serum trading
tweak dust leverage so we can test isolated markets and liquidation
add unregister token & market
2022-11-04 14:35:40 +00:00
Christian Kamm f2cc869795 Perps: Prepare for settlement token != oracle token
Make sure the setting is available and that the needed accounts are
passed to the perp instructions.
2022-10-06 08:32:58 +02:00
Christian Kamm 8ba52f46c2
Perp settle pnl: incentive for settler (#252)
This adds three new options to perp markets:
- a flat fee, that is paid for all perp settlements
- given that they exceed the configured min settle amount threshold to
  be eligible for fees
- and a fractional fee, that only applies when the benefiting account
  has low health and gradually becomes bigger as the account slides
  towards liquidation
2022-09-29 12:59:55 +02:00
Christian Kamm 9cbc352197 liquidator: force-cancel perp orders, liq perp base positions 2022-09-28 10:47:05 +02:00
Christian Kamm ef5552c1c0 Liqtest: Build serum test case 2022-09-02 12:24:18 +02:00
Christian Kamm 22dc07df1d Liquidation test: Fix scripts 2022-09-02 10:22:35 +02:00
Christian Kamm ad3cee5568 ts: improve liqtest scripts 2022-08-10 16:22:58 +02:00
Christian Kamm 79e3b2db98 ts: disable loan fees in liq tests 2022-08-10 16:22:58 +02:00
Christian Kamm 3257017770 ts: client and script fixes 2022-08-10 16:22:56 +02:00
Christian Kamm aff011c774 ts: script to create liqtest group with stub oracles 2022-08-10 16:20:25 +02:00