Commit Graph

818 Commits

Author SHA1 Message Date
Christian Kamm 21815612ae
Let all PDA seeds start with a unique prefix (#166)
This is mostly paranoia. Now it's guaranteed that different PDA types
have unique seeds.
2022-08-13 19:30:35 +02:00
Christian Kamm a3067e2448 Avoid custom Debug impls by using derivative crate 2022-08-13 10:18:04 +02:00
Riordan Panayides 8335c5495e Fix liquidator command 2022-08-12 15:31:53 +01:00
Riordan Panayides fa82980508 Upgrade docker runtime distro 2022-08-12 14:17:18 +01:00
Riordan Panayides bd5f874609 Add glibc to runtime image 2022-08-12 13:36:50 +01:00
microwavedcola1 261c856bb2 reduce max source swap targetError so that we dont error out
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-08-12 11:08:08 +02:00
microwavedcola1 a484aed42b
simulate on non existent token positions (#162)
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-08-12 11:05:39 +02:00
microwavedcola1 164303e005 uncomment
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-08-12 10:21:06 +02:00
microwavedcola1 00c533d9d7 Merge branch 'dev' 2022-08-12 08:31:20 +02:00
microwavedcola1 4f25742b26 simHealthWithTokenPositionChanges -> simHealthRatioWithTokenPositionChanges
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-08-12 08:30:13 +02:00
tjs ac0155b79d fix for simHealthWithTokenPositionChanges
needs to keep track of health changes in the loop
2022-08-11 16:43:46 -07:00
Christian Kamm 92a37f23ed Remove is_bankrupt
Instead, check for any liquidatable assets in liq_token_bankruptcy.

Bankrupt accounts may use the same operations as any other
negative-health account.
2022-08-11 22:57:53 +02:00
tjs 4507a6a72a health ratio ui function 2022-08-11 12:06:01 -07:00
conj0iner 52660f1476
Merge pull request #158 from blockworks-foundation/cj/optimisedentryprice
Optimised entry position calculation
2022-08-12 01:36:25 +08:00
microwavedcola1 5402012064 apply loan origination fee buffer
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-08-11 17:59:49 +02:00
microwavedcola1 185b077285 remove stray log
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-08-11 17:48:43 +02:00
microwavedcola1 eee10a22bb
mc/max swap (#159)
* rework getMaxSourceForTokenSwap

* Fix assets and liabs method

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-08-11 17:44:12 +02:00
Conj0iner 02c19a6eb4 Optimise entry price calculations 2022-08-11 22:58:47 +08:00
Christian Kamm ac58081430 Audit: Fix some account constraints 2022-08-11 13:30:04 +02:00
Christian Kamm 7dc3fc2ad9 Merge remote-tracking branch 'origin/main' into dev 2022-08-10 17:18:42 +02:00
microwavedcola1 cfdd59379e improve logging
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-08-10 17:17:16 +02:00
Christian Kamm fbdc5ee6b4
Merge pull request #147 from blockworks-foundation/ckamm/liq-and-rebalance
Liquidate and buy/sell to keep only quote
2022-08-10 17:09:16 +02:00
Christian Kamm 2f3c5e281c ts: prettier 2022-08-10 16:25:06 +02:00
Christian Kamm b52aad82e1 Liquidator: more pyth -> oracles renames 2022-08-10 16:24:48 +02:00
Christian Kamm 405c41edcf Liquidator: Fix rebalance to empty token accounts
By withdrawing to the liqor wallet if necessary.
2022-08-10 16:24:48 +02:00
Christian Kamm f169bcdafe Client: add token_withdraw 2022-08-10 16:24:48 +02:00
Christian Kamm 7fcee1af96 Liquidator: reload account between rebalance steps 2022-08-10 16:24:48 +02:00
Christian Kamm e8479e2e7c liq_token_with_token: Correctly adjust health cache for dusting
Previously the health cache adjustments didn't take into account that
positions between 0 and 1 native token would be dusted to 0.

This makes a difference for valuable tokens with few decimals. For
example 1 BTC-native token is currently worth 500k SOL-native tokens.
That means 0.9 BTC-native would easily be enough collateral for a 10k
SOL-native borrow -- but if the 0.9 get dusted, then the whole account
is bankrupt instead.
2022-08-10 16:24:48 +02:00
Christian Kamm 3139b0816a Client: Jupiter swaps preserve ata/token instructions 2022-08-10 16:24:48 +02:00
Christian Kamm 38f5502dc7 Liquidator: round up when paying back borrows to close token pos 2022-08-10 16:24:48 +02:00
Christian Kamm 19153b8874 Client: Fix jupiter api field that is sometimes null 2022-08-10 16:24:48 +02:00
Christian Kamm 6d8290bebd ts: script to decode anchor events 2022-08-10 16:22:58 +02:00
Christian Kamm ad3cee5568 ts: improve liqtest scripts 2022-08-10 16:22:58 +02:00
Christian Kamm 222358ff14 ts: script to make liquidation candidates 2022-08-10 16:22:58 +02:00
Christian Kamm 79e3b2db98 ts: disable loan fees in liq tests 2022-08-10 16:22:58 +02:00
Christian Kamm 68c52dbdc8 ts: Settle and close in script, including borrows 2022-08-10 16:22:58 +02:00
Christian Kamm 3257017770 ts: client and script fixes 2022-08-10 16:22:56 +02:00
Christian Kamm 55e891417e ts: also close accounts after withdraws 2022-08-10 16:20:25 +02:00
Christian Kamm 45327e7dd1 ts: script to withdraw everything, to lose fewer funds on close 2022-08-10 16:20:25 +02:00
Christian Kamm b2056c82e0 ts: script to add funds to liqtest group 2022-08-10 16:20:25 +02:00
Christian Kamm aff011c774 ts: script to create liqtest group with stub oracles 2022-08-10 16:20:25 +02:00
Christian Kamm 29c7d5b45a ts: mb-admin-close script closes all groups for the key 2022-08-10 16:20:23 +02:00
Christian Kamm 13e4d0a432 Client: Fix loan amount for jupiter ExactOut swaps 2022-08-10 16:18:41 +02:00
Christian Kamm 2552bffc66 Liquidator: blocking-wait for data after actions
To avoid sending a second jupiter-swap while the first one is still
in-flight.
2022-08-10 16:18:41 +02:00
Christian Kamm cce1881223 Liquidator: basic sell/buy to keep only quote 2022-08-10 16:18:41 +02:00
Christian Kamm 9bb125d016 Client: Allow getting the jupiter route 2022-08-10 16:18:41 +02:00
Christian Kamm 5c40c12cf5 Liquidator: cleanups 2022-08-10 16:18:41 +02:00
microwavedcola1 5c34b60105 Fix health account builder code
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-08-10 10:15:28 +02:00
microwavedcola1 68de248c5b fix
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-08-10 09:31:58 +02:00
microwavedcola1 476241e8b8 fix
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-08-10 09:29:08 +02:00