microwavedcola1
e06736660a
remove account size, make mango account feature position counts explicit ( #148 )
...
* remove account size from program, make position counts explicit
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* cargo-fix
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-08-07 14:16:06 +02:00
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
b77af54f15
Fix tests
2022-07-11 22:31:00 +02:00
microwavedcola1
ef7d2862da
wip: dynamic rates ( #98 )
...
* dynamic rates
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* fmt
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-07-11 17:08:32 +02:00
Christian Kamm
ffd83a7a05
Rename instructions to follow naming pattern ( #97 )
2022-07-06 14:51:15 +02:00
Nicholas Clarke
348fbc1cb9
Track cumulative net deposits (deposits - withdraws) ( #91 )
...
Track cumulative net deposits (deposits - withdraws) using prices at the time of the deposit and withdraw.
This is used for calculating overall pnl (across all tokens).
I want to store UI amount * UI price = (native amount / base decimals) * (oracle price * base decimals / quote decimals) => native amount * oracle price / quote decimals.
I have used f32 here to reduce the space required on the mango account - we don't need so much precision for this as it's purely a display value.
I've also included a field for net_settled - this will be used for perp pnl but is not implemented yet (as perp settling instructions are not ready).
Co-authored-by: Christian Kamm <mail@ckamm.de>
2022-07-06 12:07:30 +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
Nicholas Clarke
30fc7def77
Add oracle price to update_index logging. ( #89 )
...
* Add oracle price to update_index logging.
* Update IDL with changes to update_index instruction and logging.
2022-07-05 11:59:44 -07:00
microwavedcola1
dff3f7cd8c
client functions via program simulation
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-07-04 14:11:38 +02:00
Christian Kamm
30a221047c
Bank: rename indexed total deposits and schedule for removal
2022-07-01 14:08:28 +02:00
microwavedcola1
e8cb27610e
close mango account without checks when testing flag is set on the group, workaround weird issues when all dust cant be withdraw ( #92 )
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-07-01 13:38:50 +02:00
microwavedcola1
1c02ccd21d
Transfer dust from bank vaults to a dust account, without this we wont be able to close bank vaults ( #88 )
2022-06-29 09:11:14 +02:00
microwavedcola1
9fc8a5a56a
multiple banks ( #82 )
...
* multiple banks
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* Fixes from review
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* test for closing multiple banks for a registered token
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* fix deregister_token
* update idl
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* Fixes from review
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
Co-authored-by: Christian Kamm <mail@ckamm.de>
2022-06-27 11:27:17 +02:00
Christian Kamm
6ff4ff5910
Add a ComputeHealth instruction
...
This way the client can ask for simulation to determine an account's
health.
2022-06-21 11:05:32 +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
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
8038f9e257
Add CloseAccount instruction to make testing easier
2022-03-31 17:22:56 +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
baa980c659
PlaceSerumOrder: Track vault balances before and after
2022-03-15 14:44:47 +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
Christian Kamm
c86a6f8d29
Serum: Create OOs is functional and called from a test
2022-03-11 15:28:27 +01:00
microwavedcola1
b3f2ca51fa
fixes from cr
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-03-08 11:11:28 +01:00
Christian Kamm
f6d2df1ad4
Rename to Bank and Group
2022-03-07 16:16:34 +01:00
microwavedcola1
dcacadbcbf
margin trade test
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-03-07 15:24:50 +01:00
Christian Kamm
c6031acbdb
Move to global address lookup tables
2022-03-04 20:57:33 +01:00
Christian Kamm
01e8458093
Tests: Read banks/oracles from address lookup table
2022-03-01 15:12:53 +01:00
Christian Kamm
a7975d390d
Tests: Fix warnings
2022-03-01 13:49:59 +01:00
microwavedcola1
d9c7260375
code review
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-03-01 06:28:12 +01:00
microwavedcola1
5299e31ff8
basic stub oracle integration in tests and withdraw
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-02-28 17:17:01 +01:00
Christian Kamm
75092f7681
CreateAccount: Initialize an address lookup table
2022-02-28 15:43:08 +01:00
microwavedcola1
e8b1563223
optimise imports
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-02-28 11:07:04 +01:00
Christian Kamm
b88989bf3a
Tests: Transport error info on send_tx()
2022-02-28 09:12:24 +01:00
Christian Kamm
7aa2cd7e13
Test cleanups
2022-02-28 09:03:43 +01:00
Christian Kamm
1b404cc652
Basic health check, no oracles yet
2022-02-26 17:47:16 +01:00
Christian Kamm
8f5becc0d5
Asset/liab weights and withdraw amounts
2022-02-25 18:29:54 +01:00
Christian Kamm
d1e2cc28b7
Outline of withdraw instruction
2022-02-25 15:14:15 +01:00
Christian Kamm
5f5ba723d6
Add basic test setup
2022-02-25 13:12:16 +01:00