Commit Graph

2593 Commits

Author SHA1 Message Date
Christian Kamm 857dcb397f
Allow fast listing admin to register openbook v1 markets (#839) 2024-01-08 14:18:43 +01:00
Adrian Brzeziński bc8bdaed89
small type fixes + post tx approve fcn (#830)
* background confirmations

* fixes

* background confirmation callback

* fix

* fix
2024-01-07 20:14:26 +01:00
Christian Kamm 40f2842c10
ts client: Support deposit-into-existing (#837)
And add a script for using it.
2024-01-04 20:21:09 +01:00
Lou-Kamades 9ce6b67831
Add an Orca oracle type (#813)
* deps: add whirlpool crate

* allow oracle to read price from Orca CLMM

* test: add test for raw orca CLMM price

* require the USD/USDC oracle when using a CLMM oracle

* test: add CLMM oracle tests

* use KeyedAccountReader instead of AccountInfoRef for fallback fetching functions

* calculate price for inverted orca pools

* ensure that Orca fallback oracles have USDC side

* remove unused Whirlpool impl

* clmm prices have correct decimals and pyth update slot

* manually deserialize the orca Whirlpool

* refactor: use OracleAccountInfos when checking oracle price

* properly handle inverted clmm prices

* update rs client with OracleAccountInfos struct

* refactor: simplify OracleAccountInfos impl

* add clmm oracle integration test

* use OracleAccountInfos::from_reader in account_retriever

* CLM oracles inherit deviation from supplementary quote oracle

* review fixes

* use f64 division for clmm sqrt price

* standardize fixed to f64 conversion

* review fixes
2024-01-04 11:29:54 -06:00
Britt Cyr 797e866f04
Add a type to the perp cancel order instructions when not found (#833) 2024-01-04 16:00:54 +01:00
Christian Kamm 7d177fdb26
Merge pull request #827 from blockworks-foundation/ckamm/persistent-errors
Liquidator: more useful logs by tracking repeated errors better
2024-01-03 16:22:08 +01:00
microwavedcola1 cf1ca29cee ts: stock mm, fix perp market name
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2024-01-03 10:25:54 +01:00
microwavedcola1 56e45ad7e4 ts: rndr stock mm, quote at liq price for liqudiations
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2024-01-03 10:17:26 +01:00
microwavedcola1 f3365d4e58 ts: make backup keeper relaxed
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2024-01-03 09:55:39 +01:00
microwavedcola1 375284df25 ts: update script
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2024-01-03 09:46:17 +01:00
microwavedcola1 5636146fac ts: clean up script
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2024-01-03 09:08:18 +01:00
microwavedcola1 55d22e07c5 risk: use know mm's endpoint + add fallback to known mms pubkeys
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2024-01-03 08:43:48 +01:00
Christian Kamm 34aebf01f2
oracle: don't force logging in OracleState functions (#828)
The msg!() caused writes to stdout in the liquidator etc in codepaths
that just wanted to check if the oracle was usable.
2024-01-03 08:37:35 +01:00
Christian Kamm f10fc01388
Fix idl generation, update it (#834) 2024-01-03 08:36:19 +01:00
Christian Kamm 332478dee6 Changelog update for v0.21.1 2024-01-02 11:09:22 +01:00
Christian Kamm 30e639fe84 Bank: require borrows <= deposits
- require borrows <= deposits, even if vaults have more tokens
- change min_vault_to_deposits_ratio to be about max utilization

Reviewed and audited as part of the v0.21.1 release, original
commit was 5c2f857112
2024-01-02 11:05:58 +01:00
Christian Kamm 0e3b52b0ef Clamp utilization at 100%
To avoid excessive interest rates or interest curve moves.

Reviewed and audited as part of the v0.21.1 release, original
commit was 3914e48c24
2024-01-02 11:05:22 +01:00
Christian Kamm 997f9abe52 Changelog update 2023-12-31 13:42:43 +01:00
Christian Kamm 943f578bc5 Program v0.21.1 version bump, changelog draft, idl update 2023-12-31 11:45:09 +01:00
Christian Kamm 5c2f857112 Bank: require borrows <= deposits
- require borrows <= deposits, even if vaults have more tokens
- change min_vault_to_deposits_ratio to be about max utilization
2023-12-30 17:50:38 +01:00
Christian Kamm 3914e48c24 Clamp utilization at 100%
To avoid excessive interest rates or interest curve moves.
2023-12-30 11:41:10 +01:00
Adrian Brzeziński fd806dab9f v0.21.8 2023-12-29 14:27:07 +01:00
microwavedcola1 a57ec4018d
Mc/no usdc health cache (#831)
* ts: sim usdc pos for max perp trades even if no usdc token position exists

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

* Fixes from review

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

---------

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2023-12-29 14:21:01 +01:00
Christian Kamm 5e5900f94e liquidator: less error spam on bad jup price updates 2023-12-29 10:16:18 +01:00
Christian Kamm b18d0dd154 Rework ErrorTracking
- keep track of different error types per key
- skip for a given duration once too many errors came in
- wipe if no new errors are seen for a while
- simplify logging of actively skipped cases
2023-12-29 10:16:18 +01:00
Lou-Kamades 48993ed130
ts: improve sending txns using muiltiple connections (#826) 2023-12-28 21:48:59 -06:00
Christian Kamm 79ddbf21f1
Liquidation: Use asset and liab liq fee (#825) 2023-12-28 10:46:43 +01:00
Christian Kamm eb6622b4fc client/liq: support jupiter api tokens 2023-12-27 14:47:58 +01:00
Christian Kamm e2bfa9a1e6 client: configurable jupiter urls (#800)
(cherry picked from commit 71f0e5cc13)
2023-12-27 14:15:45 +01:00
Maximilian Schneider e83052a036
helpers for estimating order sizes (#823) 2023-12-27 09:56:54 +01:00
microwavedcola1 571e8d483c v0.21.5 2023-12-26 11:36:29 +01:00
microwavedcola1 ce3a243749 ts: export class
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2023-12-26 11:35:11 +01:00
Christian Kamm d2327f8d11 liquidator: rebalance asynchronously 2023-12-22 09:02:06 +01:00
Christian Kamm 0a55184ec7 liquidator: stop withdraw attempts on delgated accounts 2023-12-22 08:35:21 +01:00
Christian Kamm cdf804e971 liquidator: don't panic when unable to build health cache 2023-12-22 08:11:34 +01:00
Christian Kamm 428e71e07f
Allow delegates to withdraw small token amounts (#820)
- if they're withdrawing to the owner's ata
- if they're closing the token position
- if the amount is small
2023-12-20 11:15:47 +01:00
Christian Kamm b5614e98c3
test: Add interest rate test (#818) 2023-12-20 11:15:29 +01:00
Christian Kamm 7655a87404
Perp: Always allow users to free perp open order slots (#817)
Previously, freeing would be impossible if a canceling fill or out event
was already in-flight - then the order would no longer be on the
orderbook.

Now, FillEvent and OutEvent store the order id and can check if the open
order slot on the account has been reused already. That allows canceling
orders to always free up the user slot immediately.
2023-12-20 11:15:10 +01:00
Christian Kamm 86334020e2
Use custom allocator for the program (#801)
To allow making use of extended heap sizes.
2023-12-20 11:10:18 +01:00
Christian Kamm 27b1ceebe8 Accounts: Expect only the v3 MangoAccounts now (#783) 2023-12-19 10:08:46 +01:00
Christian Kamm 64d6c8c3c4
Add doc comments for new fields (#819) 2023-12-18 17:41:17 +01:00
Christian Kamm b12b998e3a liquidator: cover errors during tcs execution
previously they could abort the liquidator
2023-12-15 11:55:21 +01:00
Christian Kamm 99cb3d4f4c liquidator: Pick better asset/liab for liq_token 2023-12-15 11:40:25 +01:00
Christian Kamm b6ddd991b0 liquidator: early out when no tcs tx were sent 2023-12-14 21:48:01 +01:00
Christian Kamm 06da4768f3 Gov instruction creation helpers
- Add one to make a proposal for all serum markets
- Switch created proposals to be drafts
- Add PROPOSAL_LINK env arg
- Add serum3EditMarketIx()
2023-12-14 11:34:17 +01:00
microwavedcola1 66bb74c2fd ts: add prop to serum3 markets
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2023-12-14 05:59:44 +01:00
microwavedcola1 f342595a88 ts keeper: skip broken tokens
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2023-12-13 10:52:18 +01:00
Christian Kamm 47faa8a7f1 liq: get rid of separate rebalance job (#815)
Previously, the separate job and the post-liquidation rebalance could
run at the same time and would occasionally perform the same action at
the same time, leading to overshooting.

Now rebalancing never happens twice. In the future it should potentially
just run separately from liquidation, but that needs a review of the
assumptions the liquidation job is making first.

(cherry picked from commit e8e7e445d3)
2023-12-13 09:27:21 +01:00
Christian Kamm 9ba0004760 bins: Fix restarting on new or changed listings (#802)
- Don't just restart on new listings, but also on significant changes to
  old listings such as oracle changes.
- Cover the liquidator and settler in addition to the keeper.

(cherry picked from commit ce16d79b13)
2023-12-13 09:27:04 +01:00
Christian Kamm 5cfbb8386d liquidator: fix token info for same-name, fix delays (#795)
(cherry picked from commit 0483faef1e)
2023-12-13 09:20:52 +01:00