Commit Graph

2601 Commits

Author SHA1 Message Date
Christian Kamm d2c55c23e1 Bank: more parameter sanity checks (#895)
(cherry picked from commit aa9bc8b1f1)
2024-02-29 08:10:09 +01:00
Lou-Kamades e7f9af9261
add TokenBalanceLog in token_charge_collateral_fees (#894)
* add TokenBalanceLog in token_charge_collateral_fees

* increase cu_per_charge_collateral_fees_token
2024-02-28 09:31:00 -08:00
Christian Kamm fd5914f1fc doc: releasing.md update 2024-02-28 15:49:18 +01:00
Christian Kamm aa9bc8b1f1
Bank: more parameter sanity checks (#895) 2024-02-27 15:56:14 +01:00
Christian Kamm ebe3e455a2
tests: cleanup (#896)
- nicer floating point equality comparisons using macros
- nicer send-tx-and-expect-error calls
2024-02-27 15:56:03 +01:00
Lou-Kamades 4c91d36255
Add raydium CLMM oracle fallbacks (#856)
* add RaydiumCLMM oracle type

* add deserializing raydium pool state

* test: consolidate clmm oralce unit tests

* test: add failure check to test_orca_fallback_oracle

* test: add test_raydium_fallback_oracle

* restore get_quote_oracle()

* ensure RaydiumCLMM is a valid fallback type
2024-02-26 09:45:14 -08:00
Christian Kamm 54674e4b20 keeper: fix tx size limits on charge collateral fee batching 2024-02-26 09:21:53 +01:00
Christian Kamm d9f55c4c22 keeper: cu limit when batching charge_collateral_fee ix 2024-02-24 10:04:30 +01:00
microwavedcola1 cacf668999
ts: account for max swap fee rate, when swapping (#892)
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2024-02-23 09:23:30 +01:00
Serge Farny ab8393b52d
liquidator: avoid logging same oracle error (same token) in loop (#889)
* liquidator: avoid logging same oracle error (same token) in loop
2024-02-21 16:35:28 +01:00
Christian Kamm e107b281f9 Idl update 2024-02-21 15:06:34 +01:00
Christian Kamm d6a25f0699 Changelog for v0.22.0 2024-02-21 15:06:26 +01:00
Christian Kamm 8f19514a25 Audit v0.22 fixes (#887)
- apply recurring settle allowance constraint also in
  available_settle_limit
- bank constraints on util0, util1
- cleanup
- perp liq: take over oneshot and recurring limits separately

(cherry picked from commit efe4a1ae3d)
2024-02-21 09:01:23 +01:00
Christian Kamm efe4a1ae3d
Audit v0.22 fixes (#887)
- apply recurring settle allowance constraint also in
  available_settle_limit
- bank constraints on util0, util1
- cleanup
- perp liq: take over oneshot and recurring limits separately
2024-02-21 09:00:57 +01:00
Adrian Brzeziński 2e5883324a v0.21.31 2024-02-20 12:54:50 +01:00
Adrian Brzeziński 6aabbb4ded
fix multi cancel (#888)
* fix multi cancel

* fix

* fix
2024-02-20 12:45:06 +01:00
Christian Kamm 46c6e86206
Add force_withdraw state and instruction (#884)
Co-authored-by: microwavedcola1 <microwavedcola@gmail.com>
2024-02-19 15:06:51 +01:00
microwavedcola1 4f84f984e8 ts: update script
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2024-02-19 13:30:12 +01:00
microwavedcola1 355bc55955 ts: sort
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2024-02-19 12:24:39 +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
microwavedcola1 654b7b6ad5 v0.21.30 2024-02-19 09:34:21 +01:00
microwavedcola1 f216b7b696
Mc/tcs premium auction (#870)
* tcs: move to premium auctions by default

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

* tcs: error out if premium cant be computed

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

---------

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2024-02-19 09:32:39 +01:00
Christian Kamm 8a3a3bf70b
flash loan: Add a "swap without fees" option (#882) 2024-02-19 09:00:30 +01:00
Serge Farny 5d29eb2f0b
Rust client: auto close spot account if needed to place a new order (#877)
rust client: 
- add serum3 place order to command
- add serum3 create open orders command
- add serum3 close open orders command
- auto create serum3 open orders if needed when placing a new order
- auto close serum3 slot if needed when placing a new order & also close unused token if needed to place a serum3 order
2024-02-16 14:01:18 +01:00
Christian Kamm 34d86ef0f4
collateral fees: better compute estimation (#881) 2024-02-16 11:30:32 +01:00
Adrian Brzeziński 5bbed4a519
adjust loanoriginafeerate for untrusted (#885) 2024-02-16 11:26:12 +01:00
microwavedcola1 5b001a9002 ts: update script
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2024-02-15 10:05:20 +01:00
Serge Farny 7a8d46e362
rust client: remove jupiter v4 (#879)
* rust client: remove jupiter v4

* rust client: remove dead code

* rust client: allow large enum variant for RawQuote enum
2024-02-14 14:20:23 +01:00
Christian Kamm 3993a3fa66
collateral fees: fixes after devnet test (#880) 2024-02-14 11:32:57 +01:00
Christian Kamm 7a1be5a188 Merge remote-tracking branch 'origin/deploy' into dev 2024-02-14 10:24:12 +01:00
Christian Kamm 4f5ec41d7a
tests: Check mango account backwards compatibility (#878) 2024-02-14 10:00:09 +01:00
Christian Kamm e57dcdc2a9
Add collateral fees (#868)
- New permissionless instruction to regularly charge collateral fees
- Bank and group configuration to set rate and interval
- Keeper addition to call the instruction
2024-02-13 12:39:28 +01:00
Christian Kamm ae833621ad
ci/releasing: Include git sha and refname in release builds (#876) 2024-02-12 15:32:43 +01:00
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