Commit Graph

25 Commits

Author SHA1 Message Date
Serge Farny f54bb6f0b0
Serge/liquidator split tcs and liquidation (#914)
liquidator: split TCS triggering and liquidation job

Concurrent execution of candidate lookup and tx building/sending
- Also added an health assertion IX to protect liqor in multi liquidation scenario
- And a timeout for jupiter v6 queries (avoid blocking liquidation because of slow TCS)
2024-03-20 15:25:52 +01:00
Serge Farny 338a9cb7b8
liquidator: add allow/forbid token list (#883)
liquidator: add a way to restrict token accepted by the liquidator 

- add allow/forbid list of token for liquidation & conditional token swap triggering
- add allow/forbid list for perp market liquidation
- housekeeping: extract cli args to a dedicated file
- move more hardcoded thing to config and stop using token name (replace with token index)
2024-02-19 10:20:12 +01:00
Christian Kamm ea91d9d353
rust client: optionally derive prio fees from feed (#866)
This allows connecting to a lite-rpc feed to receive block priority
updates and computing recently good priority fee values based on that.
2024-02-07 12:52:32 +01:00
Lou-Kamades db98ba5edf
Use fallback oracles in Rust client (#838)
* rename usd_opt to usdc_opt in OracleAccountInfos

* use fallbacks when fetching bank+ price in AccountFetcher struct

* feat: add derive_fallback_oracle_keys to MangoGroupContext

* test: properly assert failure CU in test_health_compute_tokens_fallback_oracles

* provide fallback oracle accounts in the rust client

* liquidator: update for fallback oracles

* set fallback config in mango services

* support fallback oracles in rust settler + keeper

* fix send error related to fetching fallbacks dynamically in tcs_start

* drop derive_fallback_oracle_keys_sync

* add fetch_multiple_accounts to AccountFetcher trait

* revert client::new() api

* deriving oracle keys uses account_fetcher

* use client helpers for deriving health_check account_metas

* add health_cache helper to mango client

* add get_slot to account_fetcher

* lint

* cached account fetcher only fetches uncached accounts

* ensure keeper client does not use cached oracles for staleness checks

* address minor review comments

* create unique job keys for CachedAccountFetcher.fetch_multiple_accounts

* fmt

* improve hashing in CachedAccountFetcher.fetch_multiple_accounts

---------

Co-authored-by: Christian Kamm <mail@ckamm.de>
2024-01-23 10:26:31 -06:00
Christian Kamm 43b9cac3a1
Rust client: Allow sending transactions to multiple rpcs (#853) 2024-01-19 16:35:30 +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
Christian Kamm 42e31ae859
Deposit limits (#806)
- limit deposits (via deposit, flash loan, tcs)
- limit potential deposits via openbook settle
  by restricting placable orders via potential_serum_tokens
- introduce Serum3PlaceOrderV2 for this purpose
- account for new limits in liquidator, max_swap
2023-12-05 15:43:38 +01:00
Christian Kamm 71f0e5cc13
client: configurable jupiter urls (#800) 2023-12-05 13:23:11 +01:00
Christian Kamm ce16d79b13
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.
2023-12-05 13:22:24 +01:00
shuoer86 8129cf45b4
chore: fix typos (#778) 2023-11-23 08:59:19 +01:00
Christian Kamm 7af1d58558
Some clippy fixes (#776) 2023-11-08 09:51:36 +01:00
Christian Kamm f690514638
rust client: ix cu limits based on health compute cost (#768)
Many instructions now return PreparedInstructions instead of a direct
Instruction or Vec<Instruction>. That way they can keep track of the
expected cu cost of the instructions for the compute limit instruction
that gets added once all instructions are made.
2023-11-03 11:20:37 +01:00
Christian Kamm a4745dae27
liquidator: improve jupiter quote cache (#748) 2023-10-09 19:56:45 +02:00
Christian Kamm 817bf9bbc6
Tcs: linear and premium auctions (#717) 2023-10-07 21:27:19 +02:00
Christian Kamm 0f10cb4d92
client/liquidator: jupiter v6 (#684)
Add rust client functions for v6 API that are usuable in parallel to the v4 ones.
2023-08-24 16:45:01 +02:00
Christian Kamm 072cd766ca
liquidator: parallel tcs execution (#679) 2023-08-18 15:36:02 +02:00
Christian Kamm a04f5e0df0 liquidator: better startup for tests 2023-08-14 16:15:32 +02:00
Christian Kamm f1e2b521f2 liquidator: Deal with net-borrow restricted tcs executions 2023-08-14 16:14:30 +02:00
Christian Kamm 8746060be0
liquidator: increase tx budget for tcs trigger instructions (#674) 2023-08-11 12:48:50 +02:00
Christian Kamm 4eca3eb9f0
liquidator: Collect and report persistent errors (#672) 2023-08-11 12:10:07 +02:00
Christian Kamm 1f55d549a6
liquidator: execute tcs with volume-weighted randomness (#670) 2023-08-11 12:08:34 +02:00
Christian Kamm cce2620de8
liquidator: Improve logging for tcs execution (#648) 2023-07-17 13:16:01 +02:00
Christian Kamm c58ee91356 Client: jupiter swap and tx builder improvements
- jupiter swap now supports multiple hops
- tx builder can check resulting tx size
2023-07-12 08:57:21 +02:00
Christian Kamm b8376b4b89
logging improvements (#641)
- switch logging to tracing crate
- update liquidator logging to use tracing features
2023-07-12 08:38:38 +02:00
Christian Kamm 35064d4ab0
Token conditional swaps (#604)
Users can request token swaps to happen when the oracle price
is within a price band. Once the price is right, an executor can
trigger the swap. The executors are rewarded with a premium
over the oracle price.

This allows limit and stop loss orders on arbitrary spot pairs.

The PR comes with basic ts support and adjustments to the liquidator,
to execute available token conditional swaps.

Co-authored-by: microwavedcola1 <microwavedcola@gmail.com>
2023-07-03 14:09:11 +02:00