microwavedcola1
5b549fb59f
program: fix bug where expansion would not move positions whose size remained same ( #262 )
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-10-03 13:06:04 +02:00
Christian Kamm
b906e3dc78
Token deposit: Split into signed and permissionless ix
...
Token accounts are a limited resource, so allowing other users to make
use of them can cause problems.
2022-10-02 16:06:39 +02:00
microwavedcola1
bafaf73745
Mc/ts numbers - cleanup usage of all numbers ( #259 )
...
* ts: a higher error tolerance is sufficient
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* ts: move stuff around
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* ts: string representation while printing
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* ts: number cleanup
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* ts: fix tsc errors
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* ts: cleanup creation of I80F48 from BN
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* ts: fixes from review
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* ts: fixed from review
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* revert
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* ts: fix from call
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-09-30 15:07:43 +02:00
microwavedcola1
d1079bb1b9
Mc/ts increase error tolerance for binary search ( #258 )
...
* ts: a higher error tolerance is sufficient
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* Fixes from review
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* program: fix error size
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-09-30 14:59:12 +02:00
microwavedcola1
a2f4cef940
mc/ts derive and not hardcode size ( #257 )
...
* ts: simplify getOrCreateMangoAccount
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* ts: derive and not hardcode sizes for perp accounts when creating
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* ts: fix script
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* ts: remove todo, not relevant anymore
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* Fixes from review
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-09-30 13:33:21 +02:00
microwavedcola1
4b52d9a072
ts: simplify getOrCreateMangoAccount ( #256 )
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-09-30 12:16:24 +02:00
microwavedcola1
c22302a1da
ts client improvement ( #254 )
...
* Perps: Support trusted markets
* ts: health on client side
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* ts: change perp lookup
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* ts: reword error messages, refactor common uses of lookups
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* ts: reformat
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* ts: improve typing
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* ts: fix some todos
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* ts: fix some todos
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* ts: fixes from review
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* ts: type aliasing
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* ts: remove '| undefined' where not required as return type
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* ts: use trusted market flag for perp health
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
Co-authored-by: Christian Kamm <mail@ckamm.de>
2022-09-29 15:51:09 +02:00
Christian Kamm
7e180c7b3a
Perps: Support trusted markets
2022-09-29 15:40:31 +02:00
Christian Kamm
8ba52f46c2
Perp settle pnl: incentive for settler ( #252 )
...
This adds three new options to perp markets:
- a flat fee, that is paid for all perp settlements
- given that they exceed the configured min settle amount threshold to
be eligible for fees
- and a fractional fee, that only applies when the benefiting account
has low health and gradually becomes bigger as the account slides
towards liquidation
2022-09-29 12:59:55 +02:00
Nicholas Clarke
01a958cd22
Clarkeni/onchain interest ( #244 )
...
* Onchain interest calculation
* Fix to TokenBalanceLog for token_liq_bankruptcy (was previously using liqee liab position for liqor liab position).
* Log cumulative interest when token position is deactivated.
2022-09-28 23:04:33 -07:00
Christian Kamm
984695e8d0
liquidator: Call liq_perp_bankruptcy
2022-09-29 07:36:00 +02:00
Christian Kamm
12864e15a6
Merge pull request #245 from blockworks-foundation/ckamm/perp-settle
...
Liquidator: Settle pnl on perp accounts
2022-09-29 07:35:37 +02:00
Christian Kamm
77abfd0529
Perp liq: Fix base position liquidation amount computation
...
It was wrong for quote weights != 1.
2022-09-29 07:34:52 +02:00
microwavedcola1
dd83aeb156
ts: ALTs integration
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-09-28 17:09:59 +02:00
Christian Kamm
15d3a0cdfa
ts client: fix reading perp event queue
2022-09-28 10:48:41 +02:00
Christian Kamm
15d0a98c94
liquidator: settle pnl on liquidatable accounts
2022-09-28 10:48:41 +02:00
Christian Kamm
11daf4d0eb
client: fetch top settle pnl counterparties
2022-09-28 10:48:41 +02:00
Christian Kamm
9cbc352197
liquidator: force-cancel perp orders, liq perp base positions
2022-09-28 10:47:05 +02:00
conj0iner
a97b40a521
Merge pull request #234 from blockworks-foundation/cj/ioc_fees
...
Extra fees for IOC orders
2022-09-28 00:05:25 +08:00
microwavedcola1
8d86883190
ts: remove debug code
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-09-27 17:33:51 +02:00
microwavedcola1
b57e50c75b
ts: fix tsc issues
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-09-27 13:59:00 +02:00
microwavedcola1
b7aa6dbd5d
ts: tiny liabs pushes health ratio beyond what I80F48 can support ( #243 )
...
* ts: tiny liabs pushes health ratio beyond what I80F48 can support
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* add alias
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-09-24 07:11:57 +02:00
Nicholas Clarke
e509a3ae9c
Clarkeni/overall pnl ( #232 )
...
* Add getPNL client function
2022-09-23 11:39:51 -07:00
Nicholas Clarke
1320451e1a
Add serum open orders balance logging. Remove price from token and perp balances. ( #236 )
2022-09-23 10:42:43 -07:00
Christian Kamm
f6c9a93ac5
Health: Avoid overflow panic in health ratio for tiny liabs
...
Spotted by microwavedcola
2022-09-23 12:04:14 +02:00
microwavedcola1
bb6790e678
ts: use price factor in maxSourceForSwap + max perp bid and ask + tests ( #237 )
...
* ts: use price factor in maxSourceForSwap
ts: max perp bid and ask
ts: mocha test for max swap
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* ts: comemnt
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-09-23 11:43:26 +02:00
Christian Kamm
39bdf20813
ts: Add group.findPerpMarket()
2022-09-23 09:48:35 +02:00
microwavedcola1
4090cf407e
ts: fix max serum bid and ask that can be placed by a mango account ( #241 )
...
* ts: fix getMaxQuoteForSerum3BidUi and getMaxBaseForSerum3AskUi where the zero amount was not tight enough for binary search
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* Fixes from review
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-09-23 09:34:28 +02:00
Christian Kamm
d86b3dd757
Rust client: Fix remaining accounts perp oracles
2022-09-23 09:07:51 +02:00
Christian Kamm
ecbd4028f7
ts client: Fix remaining accounts when opening a perp position
2022-09-23 08:42:01 +02:00
microwavedcola1
3c98a9fd0a
keeper: Fix logging of how many events are consumed ( #235 )
...
* keeper: Fix logging of how many events are consumed
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* format
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-09-23 08:23:37 +02:00
Conj0iner
a8ae59f0fe
IDL and client changes
2022-09-23 01:03:45 +08:00
Conj0iner
55f77ad6c6
Added IOC penalty
2022-09-23 00:55:12 +08:00
microwavedcola1
ae42356b22
program: remove todos for ix which have now been implemented or not relevant ( #240 )
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-09-22 17:43:01 +02:00
Christian Kamm
0040a1477e
Client: Compute max perp trade amount ( #231 )
2022-09-21 11:45:05 +02:00
Christian Kamm
96218fb7ba
Update IDL and merge issue fixups
2022-09-21 10:19:23 +02:00
Christian Kamm
52f8b61240
Merge remote-tracking branch 'origin/dev'
2022-09-21 10:14:34 +02:00
Christian Kamm
a41a245e24
PerpLiqBankruptcy instruction
2022-09-21 09:46:54 +02:00
conj0iner
1c67b8ed5f
remove base_token_index from perps and include oracles ( #224 )
...
Co-authored-by: Conj0iner <conj0iner@users.noreply.github.com>
2022-09-21 09:42:45 +02:00
microwavedcola1
f96b9ded0d
ts: fix event queue rawevents
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-09-20 19:50:21 +02:00
Christian Kamm
ddb68b7991
Test build fix
2022-09-20 16:59:55 +02:00
Christian Kamm
8c91541d12
ts client: Fix serum3DeregisterMarket
...
The indexReservation arg wasn't passed.
2022-09-20 16:58:07 +02:00
Christian Kamm
6399e6cb6c
Fix PerpMarket data layout breakage
...
The new fees_settled must be added at the end and the reserved amount
needs to be reduced.
2022-09-20 16:58:07 +02:00
Christian Kamm
347b225480
TokenEdit: remove bank_num arg
2022-09-20 14:22:25 +02:00
microwavedcola1
b7e79a4663
WIP: ts/perps ( #220 )
...
* ts: further fleshing out of perps code
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* cleanup scripts
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* Fixes from reviews
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-09-20 12:57:01 +02:00
Christian Kamm
11160ae2fe
Health: Pass price to max_swap_source_for_health_ratio
...
Because it's not correct to think we'll always swap at oracle price.
That was an ok assumption for liquidations, where we'll swap at slightly
better than that, but not for jup.
2022-09-20 10:41:33 +02:00
Christian Kamm
a6d25071cd
Test: Fix test_alt compile
2022-09-15 19:06:46 +02:00
Christian Kamm
20eb61527b
Compile fixups after merge
2022-09-15 09:40:14 +02:00
Christian Kamm
1b3a2b07db
Update idl
2022-09-15 09:24:35 +02:00
Christian Kamm
14ca1dac35
Add alt_set / alt_extend instructions
...
alt_extend will only work in the future, when alt_set can receive lookup
tables where the authority is set to be the mango group pda.
2022-09-15 09:20:08 +02:00