Commit Graph

1133 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
Christian Kamm 6f85dfa42d Merge remote-tracking branch 'origin/deploy' into dev 2024-03-14 11:26:33 +01:00
Christian Kamm 4bf45f2576 liqtest readme update 2024-03-14 09:53:43 +01:00
Christian Kamm e20052f6e5 Fix logging in liqtest scripts 2024-03-14 08:58:04 +01:00
Christian Kamm 25bf71c646 Add liqtest test script readme 2024-03-14 08:43:49 +01:00
microwavedcola1 dc8e903d13 ts: update
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2024-03-13 10:44:54 +01:00
microwavedcola1 a93ef13310 ts: new changes to token param updates
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2024-03-12 11:39:31 +01:00
Serge Farny b3b4cc8223
program: add a min health check (#913)
add a min health check
2024-03-12 08:27:40 +01:00
Serge Farny 0728bb566f
program: sequence check as u8 (#909)
* program: sequence check as u8 (reuse existing padding)
2024-03-11 10:45:53 +01:00
microwavedcola1 d9068758d2 ts: fix lint
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2024-03-10 14:27:31 +01:00
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 ef5da37fba switchboard migrator example 2024-03-08 16:47:24 +01:00
Serge Farny 494835631b
program: add a sequence check IX (#908)
Add a sequence check IX

This new IX `SequenceCheck` can be used to avoid having multiple concurrent TX in flight causing unexpected result (multiple borrow for example)
2024-03-07 14:59:05 +01:00
Adrian Brzeziński 6841ca5166 add mangolana, fee and auto retry to create proposal for scripts 2024-03-07 13:27:57 +01:00
microwavedcola1 043b08fcc3 ts: update
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2024-03-07 09:08:36 +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
microwavedcola1 a006b25e39 ts: fix client errors
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2024-03-04 13:21:42 +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
Christian Kamm e7f5cd7498 Bump program version to v0.24.0, update idl 2024-03-04 11:15:23 +01:00
Christian Kamm 834f15923d Merge remote-tracking branch 'origin/deploy' into dev 2024-03-04 11:09:07 +01:00
Serge Farny 53517f876b
ts client: fix imports (#898) 2024-03-01 11:21:58 +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 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
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
microwavedcola1 5b001a9002 ts: update script
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2024-02-15 10:05:20 +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
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 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
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 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