Commit Graph

2568 Commits

Author SHA1 Message Date
Christian Kamm 007cf0da6e
liquidator: make tcs max amount configurable (#874) 2024-02-09 11:31:37 +01:00
Serge Farny 08a5ee8f53
rust client: Perp - Auto close account when needed (#875)
* perp: auto close perp market account when needing to open a new one with no slot available

* rust_client: do not send health accounts when deactivating a perp position (not needed on program side)

* rust_client: add perp place order command
2024-02-09 11:19:52 +01:00
Christian Kamm b5d49381ed rust clippy fix 2024-02-09 09:09:42 +01:00
microwavedcola1 4cce7aad32
extend maintain alts script (#872)
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2024-02-08 08:04:52 +01:00
Adrian Brzeziński b2a3e151ab v0.21.29 2024-02-07 17:47:37 +04:00
Adrian Brzeziński 6c29adddae fix conversion for sourceamount (tokens with a lot of decimals) 2024-02-07 17:42:21 +04:00
Christian Kamm 5e4da1dd3c 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.

(cherry picked from commit a4cddf3129)
2024-02-07 14:20:19 +01:00
Christian Kamm 0380b3f097 Settler: Keep going on error (#873)
in particular: don't panic when a health cache can't be constructed

(cherry picked from commit 712a2e3bd6)
2024-02-07 14:18:29 +01:00
Christian Kamm dd9ea78dde Settler: Fix bad health accounts in tcs_start ix (#871)
(cherry picked from commit 9f4cb0f776)
2024-02-07 14:13:14 +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
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