Commit Graph

2658 Commits

Author SHA1 Message Date
Christian Kamm d9a9c7d664
liquidation: Add flag to disable asset liquidation (#867)
This can be used to remove the oracle dependency for tokens with zero maint asset
weight that are not borrowable.
2024-02-07 12:52:01 +01:00
Christian Kamm 712a2e3bd6
Settler: Keep going on error (#873)
in particular: don't panic when a health cache can't be constructed
2024-02-07 12:50:35 +01:00
Christian Kamm 9f4cb0f776
Settler: Fix bad health accounts in tcs_start ix (#871) 2024-02-07 11:42:01 +01:00
Christian Kamm a4cddf3129
deposit limit: always allow obv1-selling deposits (#869)
Previously serum3_place_order would fail when deposit limits were
exhausted on the payer token side. Now the failure only happens when
payer tokens need to be borrowed.
2024-02-05 13:06:06 +01:00
Christian Kamm 1392f726ba fix perp settle limit materialization (#865)
Previously, we tried to keep track of "other" and "trade" realized pnl.
An issue occured when a perp base position went to zero: the way we
computed the trade pnl included potential non-trade unsettled pnl.

That caused follow-up trouble because the value could change sign and
reset the settle limit for trade pnl.

This change aims to simplify in some ways:
- explicitly talk about oneshot-settleable pnl (fees, funding,
  liquidation) and recurring-settleable pnl (materialization of settle
  limit derived from the stable value of the base position when reducing
  the base position)
- instead of directly tracking realized settleable amounts (which
  doesn't really work), just decrease the recurring settleable amount
  when it exceeds the remaining unsettled pnl
- get rid of the directionality to avoid bugs of that kind
- stop tracking unsettled-realized trade pnl (it was wrong before, and
  no client uses it) - we already track position-lifetime realized trade
  pnl

(cherry picked from commit ae5907ba3a)
2024-02-01 11:24:39 +01:00
Christian Kamm ae5907ba3a
fix perp settle limit materialization (#865)
Previously, we tried to keep track of "other" and "trade" realized pnl.
An issue occured when a perp base position went to zero: the way we
computed the trade pnl included potential non-trade unsettled pnl.

That caused follow-up trouble because the value could change sign and
reset the settle limit for trade pnl.

This change aims to simplify in some ways:
- explicitly talk about oneshot-settleable pnl (fees, funding,
  liquidation) and recurring-settleable pnl (materialization of settle
  limit derived from the stable value of the base position when reducing
  the base position)
- instead of directly tracking realized settleable amounts (which
  doesn't really work), just decrease the recurring settleable amount
  when it exceeds the remaining unsettled pnl
- get rid of the directionality to avoid bugs of that kind
- stop tracking unsettled-realized trade pnl (it was wrong before, and
  no client uses it) - we already track position-lifetime realized trade
  pnl
2024-02-01 11:23:45 +01:00
Adrian Brzeziński ea7eeb92dc
fix decoding of broken oracle (#864)
* fix

* fix

* fix

* fix
2024-01-31 15:52:06 +01:00
microwavedcola1 e16a7db8dd Merge branch 'main' into deploy 2024-01-30 12:19:45 +01:00
Christian Kamm 699321653a delegate withdraw: require target to have expected owner
(cherry picked from commit 719aee37ae)
2024-01-29 15:13:54 +01:00
Christian Kamm 5253db8495 allocator: Don't allow growth beyond heap memory region
(cherry picked from commit afc2ff9e80)
2024-01-29 15:13:52 +01:00
Christian Kamm 719aee37ae delegate withdraw: require target to have expected owner 2024-01-29 15:13:29 +01:00
Christian Kamm afc2ff9e80 allocator: Don't allow growth beyond heap memory region 2024-01-29 15:13:29 +01:00
Christian Kamm 6c6a75d90d
liquidator: batch serum-cancel step (#861) 2024-01-29 15:07:24 +01:00
GoodDaisy 2f10a710c9
chore: fix typos (#854) 2024-01-29 13:39:33 +01:00
Christian Kamm ed682cfd84 rs client: fix construction without explicit errors-by-type 2024-01-29 13:37:44 +01:00
Christian Kamm 5519f77d8e ts: fallback oracles in bank and token_edit 2024-01-29 13:37:44 +01:00
Adrian Brzeziński 80cad71af5 add set to deepclone 2024-01-28 14:34:04 +01:00
Christian Kamm 5fc5646aff
ts: Fix registering tokens and stub oracles (#859) 2024-01-26 21:10:33 +01:00
Christian Kamm 39c5d029d0 Program version bump, changelog and idl update 2024-01-26 12:39:31 +01:00
Christian Kamm f28d665048 Update openbook v1 fast listing default parameter (#841)
(cherry picked from commit 53bc52efe7)
2024-01-26 12:06:57 +01:00
Christian Kamm 93d109b4ed Allow fast listing admin to register openbook v1 markets (#839)
(cherry picked from commit 857dcb397f)
2024-01-26 12:06:47 +01:00
Christian Kamm 8f593e00b8 perp: Add platform liquidation fee for base (#858)
(cherry picked from commit fcc8c85f6e)
2024-01-26 10:25:35 +01:00
Christian Kamm a4e5cf9b02 Add a token-token platform liquidation fee (#849)
The liqor liquidation fee and platform liquidation fee for the asset and
liab token are both payed by the liqee.

The platform liquidation fee is added to the Bank's
collected_fees_native and tracked in collected_liquidation_fees.

(cherry picked from commit 8383109f0d)
2024-01-26 10:25:27 +01:00
Christian Kamm 5f97f60719 Configurable interest rate for 0% utilization (#848)
(cherry picked from commit 18729cf04c)
2024-01-26 10:25:13 +01:00
Christian Kamm fcc8c85f6e
perp: Add platform liquidation fee for base (#858) 2024-01-26 10:24:20 +01:00
microwavedcola1 9797ce70d7 v0.21.27 2024-01-24 14:29:52 +01:00
microwavedcola1 e079f199c2
ts: use potential serum tokens in deposit limits (#857)
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2024-01-24 14:26:33 +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
Adrian Brzeziński 84882a8d20 v0.21.24 2024-01-23 00:13:37 +01:00
Adrian Brzeziński 774ab42df8 upgrade mangolana 2024-01-23 00:11:23 +01:00
Adrian Brzeziński 5f6d75fb68 v0.21.23 2024-01-22 19:00:10 +01:00
Adrian Brzeziński e69214f408
max borrow fix (#855)
* fix

* ts: compute correct init scaled asset weight

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

---------

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
Co-authored-by: microwavedcola1 <microwavedcola@gmail.com>
2024-01-22 18:56:50 +01:00
Christian Kamm 40b6b49680 Test: Max borrow with init asset weight scaling 2024-01-22 12:56:37 +01:00
Christian Kamm 43b9cac3a1
Rust client: Allow sending transactions to multiple rpcs (#853) 2024-01-19 16:35:30 +01:00
Christian Kamm 8383109f0d
Add a token-token platform liquidation fee (#849)
The liqor liquidation fee and platform liquidation fee for the asset and
liab token are both payed by the liqee.

The platform liquidation fee is added to the Bank's
collected_fees_native and tracked in collected_liquidation_fees.
2024-01-19 16:34:55 +01:00
Adrian Brzeziński bff4828bbf
use deposit limits (#852)
* edit max source token

* deposit limits adjustments

* fix comment

* pr fixes

* fix

* fix
2024-01-18 17:47:57 +01:00
Christian Kamm 511814ca97
Rust client: Revamp transaction confirmation (#850)
- Allow user configuration of confirmation settings
- Provide a timeout setting, default is 60s
2024-01-17 10:30:25 +01:00
Adrian Brzeziński 8d11d27a13 publish 0.21.22 2024-01-16 15:08:00 +01:00
microwavedcola1 5d677b858d ts: fix import
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2024-01-16 14:55:23 +01:00
Adrian Brzeziński 146d87d9ec publish 0.21.21 2024-01-16 13:24:51 +01:00
Adrian Brzeziński 377a88b870 use polimorphic websockets 2024-01-16 13:17:10 +01:00
Adrian Brzeziński c1ff2c0777 v0.21.20 2024-01-16 12:30:31 +01:00
Adrian Brzeziński d695838f28 upgrade mangolana 2024-01-16 12:28:21 +01:00
Adrian Brzeziński a86f6614e7 fix node fetch 2024-01-16 11:23:08 +01:00
Adrian Brzeziński 791f31129c v0.21.19 2024-01-16 11:22:16 +01:00
Adrian Brzeziński fee9b41300 publish 0.21.18 2024-01-16 11:13:14 +01:00
Adrian Brzeziński e4bbc41a88 import fix 2024-01-16 11:02:39 +01:00
Adrian Brzeziński dfccdaf1fb
Feature/confirm txes fix (#847)
* connections

* merge

* use new mangolana

* v0.21.21

* fix

* fix

* fix error parsing

* fix

* fix

* fix

* v0.21.24

* fix version

* fix

* fix
2024-01-16 10:59:18 +01:00
microwavedcola1 5d186421bb ts: take liquidation batches to a script
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2024-01-16 10:47:52 +01:00
microwavedcola1 fce4e18735 Merge branch 'mc/deposit-limits' into deploy 2024-01-16 10:22:04 +01:00