Commit Graph

1548 Commits

Author SHA1 Message Date
tylersssss 4c9f99832f
Update package.json build steps and move js scripts out of src folder (#470)
* extracts scripts from source; update tsc build configs and packages

* publish latest

* remove type module
2023-02-22 08:36:59 +01:00
tylersssss f41f2ab337
Ts/client fixes (#471)
* fix bug with marking perp orders as expired

* support passing in perp books to find mango account orders

* support force reloading of acct perp open orders

* make perp market _bids and _asks public

* dont fetch open order accts if no serum3active
2023-02-22 08:07:06 +01:00
Christian Kamm 5c7f23adb1
Perp place order: more logging for reduce only (#468) 2023-02-21 13:14:40 +01:00
microwavedcola1 70b65c5880 Fix more paths
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2023-02-21 12:10:21 +01:00
microwavedcola1 0eeda22441 Fix path for docker images
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2023-02-21 12:05:07 +01:00
microwavedcola1 ae761c9270
support 32 perp oo by default (#467)
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2023-02-21 10:40:15 +01:00
Christian Kamm 7b9e19cc08
Organize paths, rename crates (#466)
liquidator, keeper, cli and settle-bot moved to bin/
client moved to lib/client

All crates have a "mango-v4-" prefix
2023-02-20 14:08:38 +01:00
Christian Kamm 7a51ce0619
Add a "settle-bot" binary (#465)
The bot will call settle on all accounts with unsettled pnl where it can
receive either the flat or low-health fee.
2023-02-20 12:09:17 +01:00
microwavedcola1 1cffd75681
Update DEVELOPING.md 2023-02-17 09:48:28 +01:00
microwavedcola1 227b1a4269 keeper: rust client accounts for priority fees already
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2023-02-16 16:20:37 +01:00
Christian Kamm 70fb8a6cf5
Liquidator: don't exit immediately (#463)
But do exit when one of the core jobs exits.
2023-02-16 14:52:39 +01:00
Christian Kamm 6439eb5531
Client: Print the error kind on simulation failure (#462) 2023-02-16 10:55:35 +01:00
tylersssss a87705fa37
fix fillevent type in client (#460) 2023-02-16 10:55:12 +01:00
Christian Kamm 07acb0236e client, liquidator: Cleanups for more code reuse
In particular, the liquidation no longer happens in the same thread that
deals with updating accounts. Queues stay smaller now.
2023-02-15 15:12:14 +01:00
Christian Kamm 15b509b353 Client: Move data feeds to client/ 2023-02-15 15:12:14 +01:00
Christian Kamm 023d2f96cb Settle pnl: Don't avoid settlement on being_liquidated accounts
The action doesn't decrease health and is already limited by
perp-settle-health, so it's fine to allow. (the instruction already
allows it, this fix is just for finding counterparties)
2023-02-15 15:11:58 +01:00
Christian Kamm 8f9700ed2d Settle pnl: Always grant the fractional fee on low health 2023-02-15 15:11:58 +01:00
Christian Kamm a3a6d9d636 Settle pnl: Move fee-computation to PerpMarket
So it can be used in client code to decide what accounts to settle.
2023-02-15 15:11:58 +01:00
Christian Kamm 722c5ff10b
Readme: Try to add a licensing summary. (#456) 2023-02-15 19:03:29 +09:00
microwavedcola1 a53e1e6daa keeper fix filter
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2023-02-15 09:18:07 +01:00
Christian Kamm 8916c28b99
License: Mark instructions GPLv3 and everything else MIT (#454)
To do that, split up the Accounts objects and the instruction
implementations.

GPL code is only used when the "enable-gpl" feature is enabled. That
means compiling the program or running tests need explicit feature
activation now.
2023-02-15 08:42:07 +01:00
microwavedcola1 719f14a900 fix for clippy
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2023-02-15 08:38:21 +01:00
microwavedcola1 fa41c1c543
keeper: dont try to update mngo-perp-old since its in reduce only with no oi (#455)
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2023-02-15 08:14:28 +01:00
Christian Kamm 30a84ce6c0 Bump to program version to v0.7.0 2023-02-14 16:09:53 +01:00
Christian Kamm 4ee591e991 Add program v0.6.0 release info 2023-02-14 16:07:15 +01:00
Christian Kamm 820ab36209 Update idl 2023-02-14 16:04:37 +01:00
Christian Kamm 8eb177fb32 Changelog for program v0.6.0 2023-02-14 16:03:34 +01:00
Christian Kamm f6abd9579d
Perp cancel all: Don't error when orders are filled/expired (#453) 2023-02-14 10:44:51 +01:00
microwavedcola1 02d980f4e4
restrict what a security admin can do (#452)
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2023-02-13 20:02:47 +01:00
Adrian Brzeziński 5534b9e46b
Merge pull request #451 from blockworks-foundation/feature/fix-close-account
exclude perp oracle pk from helthaccount during close account inst
2023-02-13 16:58:15 +01:00
Adrian Brzeziński 02321e705f excude perp oracle pk from helthaccount during close account inst 2023-02-13 16:54:14 +01:00
riordanp 6139c716ba
Add doc generation job (#450)
* Add doc generation job

* Debug cargo doc

* Checkout submodules

* Remove unused build artifacts

* Remove debug commands

* Build on pushes to dev and main
2023-02-13 08:29:50 +01:00
Christian Kamm 1f66bef88f
Change liquidation end target to a new, third health type (#447)
Due to the safety features in v4, the init health can differ from maint
health a lot more than it used to in v3. This is because of stable-price
adjusted oracle prices used in init health, and the weight scaling based
on total deposits and borrows used in init health.

The effect is that once an account becomes liquidatable, it could be
liquidated a lot until it reaches init>=0.

The original idea of liquidating until init>=0 was just to provide some
buffer, such that liquidated accounts wouldn't immediately become
liquidatable again.

This patch decouples the buffer idea explicit from init health by
creating a new LiquidationEnd health type. Liquidation proceeds until
the LiquidationEnd health becomes positive.

Co-authored-by: microwavedcola1 <89031858+microwavedcola1@users.noreply.github.com>
2023-02-10 09:00:36 +01:00
microwavedcola1 b2b029e21e
upgrade a bunch of ts packages (#449)
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2023-02-09 18:02:28 +01:00
microwavedcola1 184cf82e22
update settle limit before returning settleable pnl (#445)
* update settle limit before returning settleable pnl

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

* Revert "update settle limit before returning settleable pnl"

This reverts commit 29e38a85ef.

* provide a canSettlePnl to reflect constraints in perp settle pnl ix

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>

---------

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2023-02-09 13:31:56 +01:00
microwavedcola1 74a6c72f45
fix log amount in token deposit (#446)
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2023-02-09 13:31:41 +01:00
Christian Kamm e65eb79860
CI: Fix soteria action (#443) 2023-02-09 11:28:53 +01:00
silas 5e637c3b79
change 'ci' to 'devops' label (#444) 2023-02-09 10:14:09 +01:00
microwavedcola1 a1b3b8bfc0 set start quote on banks
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2023-02-08 10:41:58 +01:00
microwavedcola1 0639681c33 configure max staleness slots
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2023-02-08 10:29:11 +01:00
microwavedcola1 0dba464a28 make dai reduce only
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2023-02-08 10:19:47 +01:00
Christian Kamm 2cb4da8b58
Liquidation: Fix amounts when stable price != oracle price (#440)
Previously liquidation would overestimate the amount required, because
it used the oracle price for computing the health gain from
liquidation.

Now it uses the correct (stable price adjusted) price for figuring out
the amount of liquidation required, while still executing at
fee-adjusted oracle price.
2023-02-08 09:05:17 +01:00
riordanp e4bcb218a2
Add branch labels to docker images (#441) 2023-02-07 15:48:44 +01:00
microwavedcola1 d4a41aa96e
various readme updates (#431)
* add release notes

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

* Update readme

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

---------

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2023-02-06 11:59:22 +01:00
microwavedcola1 4e3a7f22b9
remove perp zero out, was only added to cleanup testing perp market, can be re-added if needed (#430)
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2023-02-06 11:59:12 +01:00
Christian Kamm 257aeb298c
Enable release-mode overflow checks (#438)
The checked_math macro is still needed for I80F48 though
2023-02-06 08:33:08 +01:00
Maximilian Schneider 4c9490f004
update serum to most recent openbook version (#437) 2023-02-05 10:26:04 +09:00
Christian Kamm 75ec640820 liqtest: script fixes
- perp market should have zero asset weight to allow positive pnl
  takeover tests
- stable price should be reset, to allow better reasoning about health
2023-02-03 17:23:25 +01:00
Christian Kamm cbd3d915ba liqtest: Confirm ALT tx before proceeding
Not waiting can leave the alt-create and alt-extend in the same slot,
and ordered incorrectly.
2023-02-03 17:23:25 +01:00
Christian Kamm 3b9e8c7d2b ts: Add new convenience sendAndConfirmTx function 2023-02-03 17:23:25 +01:00