* ts: sim usdc pos for max perp trades even if no usdc token position exists
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* Fixes from review
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
---------
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
- limit deposits (via deposit, flash loan, tcs)
- limit potential deposits via openbook settle
by restricting placable orders via potential_serum_tokens
- introduce Serum3PlaceOrderV2 for this purpose
- account for new limits in liquidator, max_swap
(cherry picked from commit 42e31ae859)
- track min bid, max ask
- track maximal token outflow from oo
- add serum3_place_order_v2 with mutable receiver bank
- placing openbook orders is restricted to a certain distance from the
oracle
(cherry picked from commit 81501837a9)
- limit deposits (via deposit, flash loan, tcs)
- limit potential deposits via openbook settle
by restricting placable orders via potential_serum_tokens
- introduce Serum3PlaceOrderV2 for this purpose
- account for new limits in liquidator, max_swap
- track min bid, max ask
- track maximal token outflow from oo
- add serum3_place_order_v2 with mutable receiver bank
- placing openbook orders is restricted to a certain distance from the
oracle
- token_edit can set it up to gradually scale to new target values
- security admin can abort an ongoing change via token_edit
- all health computations are now time dependent and get the weight
based on it
- when the change is done, the keeper "cleans up" and moves the new
values into the default fields
* ts: get yarn lock from dev
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* v0.19.20
* ts: add missing dependency
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* ts: add error when no free token position is found (#707)
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* Mc/tcs improvements (#706)
* ts: additional tcs helpers
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* Fixes from review
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* Revert "Fixes from review"
This reverts commit 1def10353511802c030a100fd23b2c2f4f198eaa.
---------
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* v0.19.21
* v0.19.22
* ts: tcs fix price display input to tx
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* v0.19.23
* v0.19.25
* script: log all
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* ts: fix tcs order price limits
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* v0.19.27
* ts: fix getTimeToNextBorrowLimitWindowStartsTs (#710)
* ts: fix getTimeToNextBorrowLimitWindowStartsTs
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* Fixes from review
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
---------
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* Mc/keeper (#714)
* v0.19.28
* ts: tokenWithdrawAllDepositForMint
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* Fix
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* Fix
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* rust: dont include tokens with errors in crank
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* Fixes from review
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* review fixes
* Fixes from review
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
---------
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
Co-authored-by: Christian Kamm <mail@ckamm.de>
* v0.19.29
* ts: update debug script
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* release 19.1 -> deploy + serum3 open orders estimation ts patch (#719)
* Serum3 open orders: Fix health overestimation (#716)
When bids or asks crossed the oracle price, the serum3 health would be
overestimated before.
The health code has no access to the open order quantites or prices and
used to assume all orders are at oracle price.
Now we track an account's max bid and min ask in each market and use that
as a worst-case price. The tracking isn't perfect for technical reasons
(compute cost, no notifications on fill) but produces an upper bound on
bids (lower bound on asks) that is sufficient to make health not
overestimate.
The tracked price is reset every time the serum3 open orders on a book
side are completely cleared.
(cherry picked from commit 2adc0339dc)
* Changelog, version bump for program v0.19.1
* ts: ts patch for the PR
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
---------
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
Co-authored-by: Christian Kamm <mail@ckamm.de>
* Rust client: Use alts for every transaction (#720)
(cherry picked from commit 40ad0b7b66)
* Jupiter: ensure source account is initialized
Backport of 9b224eae1b / #721
* client/liquidator: jupiter v6 (#684)
Add rust client functions for v6 API that are usuable in parallel to the v4 ones.
(cherry picked from commit 0f10cb4d92)
* Jupiter: Ensure source account is initialized (#721)
(cherry picked from commit 9b224eae1b)
* Mc/update cu budget for perp settle pnl (#724)
* ts: bump perp settle pnl cu budget
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* ts: helpers for withdrawing tokens from bad oracles (#726)
* ts: helpers for withdrawing tokens from bad oracles
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* Fixes from review
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* Fixes from review
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* Fixes from review
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* Fixes from review
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* rename
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* rename
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* Fix usage of field
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* Fixes from review
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
---------
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* v0.19.31
* ts: higher min. cu limit for each tx (#727)
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* v0.19.32
* ts: if more ixs then more cu (#728)
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* Mc/tcs p95 (#708)
* use more fine grain price impact
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* ts: for computing tcs premium use more fine grain price impact
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
---------
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* update
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* Mc/settler cu limit (#725)
* v0.19.30
* settler: extend cu limit to 250k for perp pnl settling
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* TransactionBuilder: add cu limit/price based on config
---------
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
Co-authored-by: Christian Kamm <mail@ckamm.de>
* ts: rename params to indicate that they are in native
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* ts: cleanup tcs create parameter naming (#730)
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* wip: Mc/update risk params (#729)
* v0.19.33
* ts: script to update risk params
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* create proposals helpers
* fix
* Update env params
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* Update
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* Update
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* simulate before run
* fix presets
* fix
---------
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
Co-authored-by: Adrian Brzeziński <a.brzezinski94@gmail.com>
* ts: upgrade anchor (#735)
* ts: upgrade anchor
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* Fixes from review
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
---------
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* script for tx error grouping, and ts helper code for finding tx error reason (#747)
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* v0.19.34
* ts: fix script for updating token params
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* Fix typo
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* script: update script to remove files which are of 0 size
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* script: error tx grouping, blacklist some more
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* fix (#753)
* jupiter: clearer slippage_bps argument name
---------
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
Co-authored-by: Christian Kamm <mail@ckamm.de>
Co-authored-by: Adrian Brzeziński <a.brzezinski94@gmail.com>
Which applies to the in token amount of swaps only.
Charging a deposit fee on flash loans was a bad idea:
- It incentivizes flash loan users to make the deposit a separate
instruction, defeating the purpose.
- For swaps, it makes traders pay a loan origination fee in in-token and
a deposit fee in out-token, leading to more complex bookkeeping and ui
display.
Instead, charge a fee on the in-token for all flash loans explicitly
marked as swaps only.
* use more fine grain price impact
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* ts: for computing tcs premium use more fine grain price impact
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
---------
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* Serum3 open orders: Fix health overestimation (#716)
When bids or asks crossed the oracle price, the serum3 health would be
overestimated before.
The health code has no access to the open order quantites or prices and
used to assume all orders are at oracle price.
Now we track an account's max bid and min ask in each market and use that
as a worst-case price. The tracking isn't perfect for technical reasons
(compute cost, no notifications on fill) but produces an upper bound on
bids (lower bound on asks) that is sufficient to make health not
overestimate.
The tracked price is reset every time the serum3 open orders on a book
side are completely cleared.
(cherry picked from commit 2adc0339dc)
* Changelog, version bump for program v0.19.1
* ts: ts patch for the PR
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
---------
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
Co-authored-by: Christian Kamm <mail@ckamm.de>
- The AccountExpand instruction can now shrink accounts by reducing
the number of token/perp/serum/tcs/perp oo slots.
- A new AccountSizeMigration instruction can permissionlessly shrink
accounts that are too large and migrate them to the v3 layout.
- Rename the new "swap fee" to "deposit fee" and let it apply to all
deposits, not just for Swap-type flash loans.
- But don't apply it to withdrawals (effectively giving rebates!)
Result of audit feedback
(cherry picked from commit 1d6ce550f3)
- Rename the new "swap fee" to "deposit fee" and let it apply to all
deposits, not just for Swap-type flash loans.
- But don't apply it to withdrawals (effectively giving rebates!)
Result of audit feedback
* Account size: Don't fail on unrelated resize
If the account was previously resized to larger than is allowed now,
don't fail unrelated resizes.
* Further reduce account size limits
Out of caution and future-proofing. Can always raise again.
Perp settle pnl needs 6 accounts plus 2 health account lists that could
be nearly fully disjoint.