Christian Kamm
de86b69e1a
Client/program interface changes
...
- rearrange structs to have gPA data in front and add comments about the
offsets being relevant
- add insuranceMint to group creation in client
- drop quoteTokenIndex storage on PerpMarket
- fixes to editAccount in example1-user and client
2022-07-06 11:34:07 +02:00
Christian Kamm
b25f6d5f4f
Insurance fund
2022-07-06 09:07:50 +02:00
Christian Kamm
35ca4d31b3
liq_token_bankruptcy instruction for socialized loss
2022-07-06 09:07:49 +02:00
Christian Kamm
ba79995c01
Health: order-independent serum3 health
...
Now all the reserved funds in serum3 open orders accounts are added into
each possible token at the same time. Then the worse case from applying
the reserved funds to either quote or base is selected.
This is reasonably cheap to compute, leads to unchanged results when no
markets share (non USDC) base or quote tokens, but can underestimate
the "true" health value when markets do.
An additional advantage is that HealthCache is now indepenent of serum
open orders and can compute the init and maint health when the user has
active OpenOrders accounts.
2022-06-22 16:52:11 +02:00
microwavedcola1
740ff0c09e
Close various things ( #65 )
...
* close bank, vaults, mint infos, stub oracles, serum OO (doesnt work, throws https://github.com/project-serum/serum-dex/blob/master/dex/src/error.rs\#L88 ), close serum market
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* serum oo closing example in ts
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* Fix from code review
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-06-09 18:27:31 +02:00
microwavedcola1
a20d04b6ff
Fix oracle price read by using decimals from pyth ( #62 )
...
* Fix oracle price read by using decimals from pyth
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* fix
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-06-02 10:36:04 +02:00
Christian Kamm
48cb1f0b88
Compute health in perp_place_order
2022-05-29 20:50:21 +02:00
Christian Kamm
65a5139db7
Tests: Send perp markets as health accounts
2022-05-29 20:50:21 +02:00
microwavedcola1
717b72857d
Remove anchor dummy type workaround ( #53 )
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-05-18 17:16:14 +02:00
microwavedcola1
1b1dd1a541
poc keeper
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-04-09 21:18:07 +02:00
Christian Kamm
afbfd3b7f9
serum3_register_market: better validation
...
Previously we just trusted the base and quote token index to be correct,
now the appropriate banks are validated.
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
a6ff388e20
health: avoid divisions, reducing compute needs
2022-03-27 14:47:42 +02:00
Christian Kamm
27f882a333
Tests: More flexible test context construction
2022-03-21 10:45:55 +01:00
Christian Kamm
a6a31f226c
Tests: Unify group + tokens setup
2022-03-21 07:49:51 +01:00
Christian Kamm
9d05db68f9
Serum: Prefix instructions with serum3_ and related renames
2022-03-18 13:42:20 +01:00
Christian Kamm
7b3cd9a81f
Health: Use split_at_mut to get two element &muts
...
Previously we re-indexed token_infos every time, now we can just have
mutable references to the base and quote elements at the same time.
2022-03-18 07:44:44 +01:00
Christian Kamm
430d5c85fa
Health: compute optimizations
...
Basic caching of multiplications and divisions.
2022-03-17 21:53:41 +01:00
Christian Kamm
af2f4a0923
Health compute tests
2022-03-17 14:17:28 +01:00