Commit Graph

28 Commits

Author SHA1 Message Date
microwavedcola1 ec5e959804 further work on perps
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-03-22 07:06:33 +01:00
Christian Kamm 9fb16f3906 Add comments 2022-03-19 08:54:33 +01:00
microwavedcola1 9475d9545c add comment
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-03-19 08:52:38 +01:00
microwavedcola1 479bd60ecf extend perp market with indices, which make it easier to lookup the perp market and base and quote tokens
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-03-19 07:28:37 +01:00
Christian Kamm 9d05db68f9 Serum: Prefix instructions with serum3_ and related renames 2022-03-18 13:42:20 +01:00
Christian Kamm f5d2964f1d Serum: Store base/quote token index in MangoAccount
To avoid having to pass SerumMarket when health needs to be computed.
2022-03-16 13:48:43 +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 baa980c659 PlaceSerumOrder: Track vault balances before and after 2022-03-15 14:44:47 +01:00
Christian Kamm 71cd1755ec Stop storing token info in Group
It is just not needed, the individual Bank accounts have all the
necessary info.
2022-03-14 13:35:38 +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 693ac17996 Serum: Store open orders pubkey in account 2022-03-11 17:50:04 +01:00
Christian Kamm f6d2df1ad4 Rename to Bank and Group 2022-03-07 16:16:34 +01:00
Christian Kamm 2d65078c23 Fix margin_trade instruction call 2022-03-07 15:43:29 +01:00
Christian Kamm 98cf8a7cff Position lifetime, dust etc
- withdraw and deposit may deactivate positions explicitly
- adjusting bank positions may collect dust for positions between
  0 and 1 native tokens
- health check always assumes all active and new banks/oracles are
  passed
2022-03-07 15:21:19 +01:00
Christian Kamm 75092f7681 CreateAccount: Initialize an address lookup table 2022-02-28 15:43:08 +01:00
microwavedcola1 12d2a9f962 make clippy happy
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-02-28 12:56:26 +01:00
microwavedcola1 e8b1563223 optimise imports
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-02-28 11:07:04 +01:00
Christian Kamm 1b404cc652 Basic health check, no oracles yet 2022-02-26 17:47:16 +01:00
Christian Kamm d1e2cc28b7 Outline of withdraw instruction 2022-02-25 15:14:15 +01:00
Christian Kamm 5a4b6263ac Add deposits/borrows tracking 2022-02-23 10:09:01 +01:00
Christian Kamm 8bc0416ef6 Helper functions to simplify 2022-02-22 17:13:26 +01:00
Christian Kamm 1b935335fb Drop Default impls, manually set account space
This fixes stack issues.

I don't know why anchor uses bytemuck::from_bytes(&T::default()).len()
2022-02-22 15:55:30 +01:00
Christian Kamm c9ad4f0c94 Very basic deposit instruction 2022-02-22 14:23:13 +01:00
Christian Kamm 9b16feaf44 CreateAccount instruction outline 2022-02-22 13:15:13 +01:00
Christian Kamm 6160a80457 First ideas for MangoGroup and MangoAccount accounts 2022-02-22 10:15:37 +01:00
microwavedcola1 f2921d2272 add todos
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-02-10 10:49:45 +01:00
microwavedcola1 268db58294 fix imports
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-02-10 10:04:47 +01:00
microwavedcola1 5ab8f6e09e copy structs from v3, next goal is to see what we can retain and what to change
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-02-10 09:07:34 +01:00