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>
- Abstract away account fetching, so it can be done via RPC or from a
websocket stream (or a geyser plugin) that populates a ChainData
instance.
- Separate out information about tokens, markets into MangoGroupContext.
- Separate all gPA calls into functions in a new file
- The liquidator re-fetches critical accounts via RPC before
liquidation. Unfortunately the websocket stream seems slower :/
- Don't re-implement health account derivation in the liquidator.
Instead reuse the existing code from the client.
- More smaller stuff.