Christian Kamm
baa980c659
PlaceSerumOrder: Track vault balances before and after
2022-03-15 14:44:47 +01:00
Christian Kamm
28a26e66da
PlaceSerumOrder: More account validation
2022-03-14 21:53:30 +01:00
Christian Kamm
6b342ffeb9
PlaceSerumOrder basic test
2022-03-14 17:21:16 +01:00
Christian Kamm
a51fdd42f7
Serialization of new serum order instruction data
2022-03-14 15:28:06 +01:00
Christian Kamm
0b2f691f5b
RegisterSerumMarket: pass market_index explicitly
2022-03-14 13:47:34 +01:00
Christian Kamm
07c9b9de7e
Further harmonizing of PDA seeds
2022-03-14 13:39:54 +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
2502f0ac1b
checked_math: use a panic
...
This reduces compute use further and still produces good error messages.
2022-03-14 12:45:32 +01:00
Christian Kamm
38d239462f
checked_math: construct errors lazily
...
bad benchmark of compute needs for 100 add-assigns of I80F48:
3465 a + b
3465 a.checked_add(b).unwrap()
3465 cm with unwrap() <- maybe future if we fix panics
4366 cm with ok_or_else() <- now
56494 cm with ok_or() <- old
2022-03-13 20:55:28 +01:00
Christian Kamm
6964340773
CI: Fix test runs
...
For some reason an explicit build-bpf step is needed, otherwise test-bpf
will fail with an error.
2022-03-13 15:45:50 +01:00
Christian Kamm
449fe4dc6d
Add checked_math library for convenient overflow checking
...
Instead of
x.checked_add(y).ok_or(error!(MangoError::MathError))?
we can write
cm!(x + y)
2022-03-13 15:45:50 +01:00
Christian Kamm
fce2316b03
Simplify health fn call, use in place serum order
2022-03-12 14:13:19 +01:00
Christian Kamm
16c0a95679
PlaceSerumOrder instruction stub
2022-03-12 14:13:19 +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
241dd6080a
Merge pull request #24 from blockworks-foundation/mc/re-org
...
move unused to a unused mod, preparation for working on perp markets
2022-03-11 17:51:32 +01:00
Christian Kamm
693ac17996
Serum: Store open orders pubkey in account
2022-03-11 17:50:04 +01:00
microwavedcola1
c2f91489af
move unused to a unused mod
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-03-11 17:11:46 +01:00
microwavedcola1
59220f762e
update regex pkg due to vulnerability in the old one
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-03-11 17:11:35 +01:00
Christian Kamm
c86a6f8d29
Serum: Create OOs is functional and called from a test
2022-03-11 15:28:27 +01:00
Christian Kamm
9be5ad6488
Test: Add CreateSerumOpenOrders test stub
2022-03-11 14:26:42 +01:00
Christian Kamm
da31b6317f
Drop unnecessary rent accounts
2022-03-11 13:02:20 +01:00
Christian Kamm
dbd8409ce8
Test: Add RegisterSerumMarket test stub
2022-03-11 12:59:42 +01:00
Christian Kamm
e3960dc5e2
Outlines of RegisterSerumMarket / CreateSerumOpenOrders
2022-03-11 12:40:16 +01:00
microwavedcola1
4dc0262546
reformat
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-03-08 12:45:59 +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
Christian Kamm
2d65078c23
Fix margin_trade instruction call
2022-03-07 15:43:29 +01:00
Christian Kamm
cea0f9441a
Build fixes
2022-03-07 15:29:44 +01:00
microwavedcola1
8921ac0441
todo
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-03-07 15:24:50 +01:00
microwavedcola1
2882476724
clipppy
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-03-07 15:24:50 +01:00
microwavedcola1
dcacadbcbf
margin trade test
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-03-07 15:24:50 +01:00
Christian Kamm
425e22a086
Deposit: Compute account health
...
Even if it's currently unused, it will become useful in the future.
Make a function to get the list of accounts needed for health checks in
tests, which is now shared between deposit and withdraw.
2022-03-07 15:22:23 +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
51991d8546
Add global address lookup table test
2022-03-04 20:57:33 +01:00
Christian Kamm
c6031acbdb
Move to global address lookup tables
2022-03-04 20:57:33 +01:00
microwavedcola1
e7736a8c88
Merge pull request #15 from blockworks-foundation/mc/py
...
wip mangopy
2022-03-03 13:12:45 +01:00
Christian Kamm
9692f9976f
Compile and warning fixes
2022-03-03 13:10:20 +01:00
microwavedcola1
528baab867
Merge pull request #17 from blockworks-foundation/mc/margin_trade
...
wip: mc/margin trade
2022-03-03 11:44:23 +01:00
microwavedcola1
ce5f2027a1
extract health, flesh out margin trade, todo - test
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-03-03 11:43:56 +01:00
microwavedcola1
6702cdbba6
mc/pyth ( #14 )
...
* pyth integration
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-03-02 21:11:05 +01:00
microwavedcola1
359c6ab814
rename
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-03-01 20:55:10 +01:00
microwavedcola1
aa35a7ff4e
basic poetry setup
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-03-01 20:53:09 +01:00
microwavedcola1
071feea56c
prepare for monorepo
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-03-01 20:48:59 +01:00
Christian Kamm
01e8458093
Tests: Read banks/oracles from address lookup table
2022-03-01 15:12:53 +01:00
Christian Kamm
fa008a8aa1
Move address map functions into separate module
2022-03-01 15:01:50 +01:00
Christian Kamm
eb38fb4f18
Make module for address_lookup_table functions
2022-03-01 13:57:46 +01:00
Christian Kamm
a7975d390d
Tests: Fix warnings
2022-03-01 13:49:59 +01:00
microwavedcola1
2a698f3135
Merge pull request #13 from blockworks-foundation/mc/oracle-in-withdraw
...
basic stub oracle integration in tests and withdraw
2022-03-01 06:38:13 +01:00
microwavedcola1
d9c7260375
code review
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-03-01 06:28:12 +01:00