This gives us better compatibility with released anchor versions.
Instead of using AccountLoaderDynamic<MangoAccount>, we now use
a standard AccountLoader<MangoAccountFixed>. This will generally work
(except for load_init(), which is dangerous).
A new trait, MangoAccountLoader, provides load_full(), load_full_mut()
etc on the AccountLoader<MangoAccountFixed> to create accessor structs
that can read and write to the dynamic part of the mango account data.
Liquidation and perp pnl settlement may not bring spot amounts to
exactly zero. Having a small spot amount < 1 native token can otherwise
make the liquidation get stuck and not move one to the next phase.
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.
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
Because it's not correct to think we'll always swap at oracle price.
That was an ok assumption for liquidations, where we'll swap at slightly
better than that, but not for jup.
You can do
- HealthRegionBegin
- ... mango instructions ...
- HealthRegionEnd
and the account health will only be checked at the start and end
instead of for every instruction.
Instead, check for any liquidatable assets in liq_token_bankruptcy.
Bankrupt accounts may use the same operations as any other
negative-health account.
* checkout submodules on ci
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* change to https, so that ci can clone
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* fix clippy
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* redundant clone
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
1. Only the CreatedBank message contains the parent and often that was
not the first message received. That confused the data structure,
because it then considered a chain of slots alive that had only a
single slot in it.
Fixed by tracking as "best_chain" only the top slot that actually has
a parent set.
2. OptimisticallyConfirm messages sometimes arrive before CreateBank,
which would change the slot status from Confirmed back to Processed.
Nothing dependend on confirmed vs processed, but it's been fixed
anyway by making slot status only increase confirmation status.
3. Accept account writes for slots newer than the current best_chain
head as alive.