Commit Graph

969 Commits

Author SHA1 Message Date
microwavedcola1 f2442428b6 Merge branch 'main' into deploy 2024-03-10 14:26:29 +01:00
Christian Kamm 077199ed39
ts: rework getMaxWithdrawWithBorrowForToken (#900)
* ts: rework getMaxWithdrawWithBorrowForToken

* binary seach for maxWithdraw

* tests

* warnings

* revert later, change for debugging

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

* fix looking deeper than 0.5 tokens

* no borrows on no-borrow-tokens

---------

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
Co-authored-by: microwavedcola1 <microwavedcola@gmail.com>
2024-03-10 14:11:30 +01:00
Adrian Brzeziński 1a6a544ecd
max accounts error margin fcn (#905)
* add error for max accounts limit

* fix
2024-03-05 16:56:35 +01:00
microwavedcola1 8aff0fb8c5 ts: add missing fields
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2024-03-04 14:28:49 +01:00
Christian Kamm 27ecc14000 Merge tag 'program-v0.22.0' into deploy 2024-03-04 11:32:42 +01:00
Christian Kamm a30c5a9e06 Bump program version to v0.23.0, update idl 2024-03-04 11:22:08 +01:00
Serge Farny bc166ea54b ts client: fix imports (#898)
(cherry picked from commit 53517f876b)
2024-03-04 11:21:54 +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
Christian Kamm e107b281f9 Idl update 2024-02-21 15:06:34 +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 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
Adrian Brzeziński 5bbed4a519
adjust loanoriginafeerate for untrusted (#885) 2024-02-16 11:26:12 +01:00
Christian Kamm 7a1be5a188 Merge remote-tracking branch 'origin/deploy' into dev 2024-02-14 10:24:12 +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
Adrian Brzeziński 6c29adddae fix conversion for sourceamount (tokens with a lot of decimals) 2024-02-07 17:42:21 +04: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 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
GoodDaisy 2f10a710c9
chore: fix typos (#854) 2024-01-29 13:39:33 +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 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 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
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 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
microwavedcola1 5d677b858d ts: fix import
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2024-01-16 14:55:23 +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
microwavedcola1 6e3c284220 ts: deposit limits 2024-01-16 10:21:15 +01:00
Christian Kamm 18729cf04c
Configurable interest rate for 0% utilization (#848) 2024-01-15 12:45:00 +01:00
microwavedcola1 f7dcb99c5f ts: fix node fetch
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2024-01-12 13:12:19 +01:00
Christian Kamm 637b43fec4 Idl update 2024-01-12 10:56:24 +01:00
Adrian Brzeziński 6e72188bd4 Revert "Improve tx confirmation (#846)"
This reverts commit 19a0f7d59d.
2024-01-12 02:03:46 +01:00
Adrian Brzeziński 19a0f7d59d
Improve tx confirmation (#846)
* improve tx confirmation with mangolana

* dedupe

* support multiple connections

* fix
2024-01-11 21:14:05 +01:00
Adrian Brzeziński 68e119e726
use fast clone (#843)
* use fast clone

* fix

* add health check copy tests

* fix

* fix

* add more test
2024-01-11 21:13:41 +01:00
Lou-Kamades c9531f4bc4
Add TxCallbackOptions (#844)
* ts: include slot when fetching LatestBlockHash

* ts: add txSignatureBlockHash to postTxConfirmationCallback

* v0.21.9

* v0.21.11

* v0.21.12

* v0.21.13 - add TxCallbackOptions
2024-01-10 14:12:04 -06:00
Lou-Kamades 0971557047
Expand usage of postTxConfirmationCallback (#842)
* ts: include slot when fetching LatestBlockHash

* ts: add txSignatureBlockHash to postTxConfirmationCallback

* v0.21.9
2024-01-09 14:38:57 -06:00
Christian Kamm ce0713070a Merge remote-tracking branch 'origin/deploy' into dev 2024-01-09 12:31:20 +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