Commit Graph

19 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
microwavedcola1 39686d3d0f CU of test has increased, accomodate only for this test
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-07-20 15:51:10 +02:00
Christian Kamm ffd83a7a05
Rename instructions to follow naming pattern (#97) 2022-07-06 14:51:15 +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 86d635f5d0 FlashLoan3: Variant that transfers directly
FlashLoan2 requires the user to set up transfers to and from the Mango
vault accounts. This version directly provides the loaned funds into a
target token account and repays everything that exceeds the initial
token account balance at the end.
2022-06-28 15:32:26 +02:00
Christian Kamm d786a672f1 FlashLoan2: API with Begin and End instructions
For FlashLoan users had to pass the target cpi programs, accounts and
data to the FlashLoan instruction itself.

The new API allows existing instructions to be used unchanged, they
just need to be bracketed by FlashLoan2Begin and FlashLoan2End.
2022-06-28 15:30:13 +02:00
Christian Kamm c8ebc1f611 Rename MarginTrade -> FlashLoan 2022-06-23 10:23:52 +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
Christian Kamm 53a5e208fd margin_trade: loan origination fees, limited withdraws 2022-05-23 08:55:30 +02:00
Christian Kamm 21af012d1f Improvements to margin_trade
- don't hard-code the group as the first passed account
- token::approve() banks for each token vault
- sign for each bank
- deal with using tokens without an existing position
- handle deactivation of token account if balance goes to 0
2022-05-20 10:16:09 +02:00
microwavedcola1 1b1dd1a541 poc keeper
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-04-09 21:18:07 +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 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 3bb94777f3 MangoAccount field renames
indexed_positions -> token_account_map
serum_open_orders_map -> serum_account_map

in the future we should add the perp_account_map
2022-03-15 15:08:53 +01:00
Christian Kamm 1cd0f8d6be RegisterToken: Pass token_index explicitly
This guarantees stability when a gov proposal adds a new token and a new
market in one transaction. This way the RegisterMarket instruction knows
exactly what index the new token will have.

Previously, the new token index was generated automatically, meaning
you couldn't be sure what index a new token would get in advance.
2022-03-14 13:19:50 +01:00
microwavedcola1 e742926ce2 change seeds literals to camelcase, camel case was how mango did in v3, also matches struct names
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-03-11 20:10:15 +01:00
microwavedcola1 b3f2ca51fa fixes from cr
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-03-08 11:11:28 +01:00