Commit Graph

16 Commits

Author SHA1 Message Date
microwavedcola1 0b2e1e6e6c
Mc/realloc 4 (#119)
Realloc + dynamic mango account

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
Co-authored-by: Christian Kamm <mail@ckamm.de>
2022-07-25 16:07:53 +02:00
Christian Kamm 6c7245adaa Serum3 liq force cancel orders: Deactivate inactive token positions 2022-07-07 13:22:25 +02:00
Christian Kamm 31831454b4 Return raw position index from get_mut() 2022-07-07 12:01:18 +02:00
Christian Kamm 35ca4d31b3 liq_token_bankruptcy instruction for socialized loss 2022-07-06 09:07:49 +02:00
Nicholas Clarke f8da1f6a40
Clarkeni/logging (#81)
* Add logging

* Added new_fixed_order_account_retriever to allow us to more easily access oracle prices outside of health calculations for logging purposes

* Add token balances logging to token and token liquidation and add logging to margin trade

* rust format

* fix clippy errors

* Address PR requested changes

* fix flash_loan

* Recalculate raw_token_index in token withdraw to account for position becoming inactive

* Fix retrieving oracle for logging

in get_mut_or_create(), return the raw index into the account's token
positions as well as the index into active positions only. The latter
index is useful for indexing into banks in the health account list.

* Add logging flash_loan2 and flash_loan3

* Refactoring flash loan logging

Co-authored-by: Christian Kamm <mail@ckamm.de>
2022-06-30 14:35:05 +02:00
Christian Kamm 20fc9d557a Satisfy anchor's lint by adding CHECK: comments 2022-06-24 12:36:35 +02:00
Christian Kamm 8a8b36e345 Fold loan origination fee handling into Bank 2022-05-18 22:53:03 +02:00
Christian Kamm cbc3cc7bbd MangoAccount: Rename how tokens/serum3/perps data is stored
token_account_map -> tokens
serum3_account_map -> serum3
perp -> perps
2022-04-02 13:51:26 +02:00
Christian Kamm 9cf4f1a748 Rearrange MangoAccount to avoid padding bytes 2022-03-31 14:01:08 +02:00
Christian Kamm babbff6bec Add is_bankrupt check to most instructions 2022-03-30 12:24:49 +02:00
Christian Kamm 69426d6d96 liq: Introduce HealthCache to get init/maint health after liquidation
The concept only works if all serum3 open orders have been fully
cancelled and settled.
2022-03-29 09:18:13 +02:00
Christian Kamm 82819720e0 liq token: progress
Change bank.deposit()/withdraw() to work with I80F48 values so we don't
need to round during liquidation.
2022-03-27 14:46:51 +02:00
microwavedcola1 5919a5a1df Merge branch 'main' into mc/clippy 2022-03-23 09:53:50 +01:00
microwavedcola1 f135ca4d9b fix clippy warnings
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-03-23 09:33:51 +01:00
Christian Kamm bfcb672116 Health: allow account order to be fixed, or to scan for accounts
The latter is important when we want to compute health for two different
accounts. Then the remainingAccounts would hold the union of the
necessary accounts, and each health check would need to look for the
accounts that it needs.

This patch al so reduces the compute needs for fixed-layout health
checks significantly (Deposit for an account with 8 tokens and 7 markets
takes 65k instead of 70k cu)
2022-03-22 14:13:07 +01:00
Christian Kamm 34d14ef267 Serum: serum3_liq_force_cancel_orders instruction
Still needs a test.
2022-03-21 17:39:52 +01:00