Commit Graph

130 Commits

Author SHA1 Message Date
Christian Kamm a04f5e0df0 liquidator: better startup for tests 2023-08-14 16:15:32 +02:00
Christian Kamm f1e2b521f2 liquidator: Deal with net-borrow restricted tcs executions 2023-08-14 16:14:30 +02:00
Christian Kamm 8746060be0
liquidator: increase tx budget for tcs trigger instructions (#674) 2023-08-11 12:48:50 +02:00
Christian Kamm 4eca3eb9f0
liquidator: Collect and report persistent errors (#672) 2023-08-11 12:10:07 +02:00
Christian Kamm 1f55d549a6
liquidator: execute tcs with volume-weighted randomness (#670) 2023-08-11 12:08:34 +02:00
Christian Kamm a7705a2a1b
liquidator: Allow overriding compute limit for potentially costly ix (#669) 2023-08-09 15:26:13 +02:00
Christian Kamm 7e32e2e0bd
liquidator: Add telemetry (#668)
The DAO would like to know how many potential liquidators are around.
2023-08-08 18:17:23 +02:00
Christian Kamm cce2620de8
liquidator: Improve logging for tcs execution (#648) 2023-07-17 13:16:01 +02:00
Christian Kamm db8f5ae30d liquidator: when rebalancing allow multi-hop jupiter routes
and if that doesn't fit into a transaction, try a direct route with USDC
or SOL.
2023-07-12 08:57:21 +02:00
Christian Kamm c58ee91356 Client: jupiter swap and tx builder improvements
- jupiter swap now supports multiple hops
- tx builder can check resulting tx size
2023-07-12 08:57:21 +02:00
Christian Kamm b8376b4b89
logging improvements (#641)
- switch logging to tracing crate
- update liquidator logging to use tracing features
2023-07-12 08:38:38 +02:00
Christian Kamm e535e81257
Pyth: Read agg.price or prev_price, depending on staleness (#631)
This updates our use of pyth oracle accounts to be more in line with
what the pyth sdk is doing.
2023-07-05 12:58:42 +02:00
Christian Kamm 35064d4ab0
Token conditional swaps (#604)
Users can request token swaps to happen when the oracle price
is within a price band. Once the price is right, an executor can
trigger the swap. The executors are rewarded with a premium
over the oracle price.

This allows limit and stop loss orders on arbitrary spot pairs.

The PR comes with basic ts support and adjustments to the liquidator,
to execute available token conditional swaps.

Co-authored-by: microwavedcola1 <microwavedcola@gmail.com>
2023-07-03 14:09:11 +02:00
microwavedcola1 c38d2ec225
add disclaimer to bots (#610)
* Update README.md

* Update README.md

* Update README.md

* link to license

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-06-20 19:33:08 +02:00
Maximilian Schneider c956f153b0
Expose instruction builders for Openbook (#601) 2023-06-15 17:20:31 +02:00
Maximilian Schneider 0b22e41acd
manage dependencies in workspace (#588)
* move important dependencies to workspace
* enable workspace inheritance
2023-05-17 20:48:14 +02:00
Christian Kamm 5fc7aa1092
Configurable perp settle token (#550)
This changes perp market margining to no longer assume all pnl is in USD
while settlement is in USDC. Instead, a configurable settle token is used for
pnl and settlement, defaulting to USDC. 

There is no difference while the USDC price is forced to $1 and the init and liab
weights are 1. But with this patch, it becomes possible to change that.

For now it is not recommended to use a token other than USDC or USDT (or
another USD targeting stable token) for perp settlement.

The patch also updates all insurance vault use to be aware that the insurance
fund is not in USD but in USDC and apply the USDC price before payouts.
To do this, the previous PerpLiqNegativePnlOrBankruptcy was replaced by
a new PerpLiqNegativePnlOrBankruptcyV2 instruction.

Co-authored-by: microwavedcola1 <89031858+microwavedcola1@users.noreply.github.com>
2023-05-17 15:50:05 +02:00
Maximilian Schneider c006948319
Enable self-trading protection (#533)
Co-authored-by: Christian Kamm <mail@ckamm.de>
2023-05-15 10:40:41 +02:00
Christian Kamm 5a05e9cb2e
Update anchor to v0.27.0, stop using submodule (#582) 2023-05-12 13:54:53 +02:00
Christian Kamm 953e2f76b2
Ckamm/liq fixes (#571)
* liquidator: Don't attempt to close in-use token positions

This could happen if the user manually used serum on the liquidator
account.

* Client: Move jup's CU ix outside of flash loan

That makes a flash loan based jup swap usable with delegates.
2023-05-05 09:11:12 +02:00
riordanp 757a3ee0cc
Use ghcr.io container registry (#549)
* Use ghcr.io container registry

* Update base image urls
2023-04-17 16:57:51 +01:00
microwavedcola1 b796965d6a
re-enable token rebalance in liquidator (#545)
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2023-04-17 11:18:50 +02:00
microwavedcola1 350d558ee3 disable for now
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2023-04-14 11:42:02 +02:00
riordanp 6be7810c56
Add prometheus metrics to crank (#517)
* Add prometheus metrics to keeper
2023-03-29 15:51:32 +01:00
microwavedcola1 cce8bb4b14
liquidator docs (#512)
* liquidator docs

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

* update

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

* update

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

---------

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2023-03-21 18:37:01 +01:00
riordanp fc1341f731
Rename settle-bot to settler, fix build (#492)
* Fix settler build, rename due to heroku not liking '-'

* Temporarily remove ref tag

* Remove temporary branch trigger
2023-03-14 19:10:24 +01:00
Christian Kamm 0349ace3b6
Downgrade the `fixed` crate to v1.11.0 (#500) 2023-03-12 08:50:42 +01:00
Christian Kamm 7803c47912
Liquidator: Withdraw full dust amount on rebalance (#499)
The amount was sometimes too high (stale?), causing withdraw errors.
2023-03-09 10:01:02 +01:00
Christian Kamm 5c7a2e3e10
Use the overflow-checks=true equivalent with the fixed crate (#476)
* Vendor `fixed` crate to have checked math in release mode
* remove all cm!()
* drop superfluous parens
* drop use of checked_math crate
* manual removal of redundant checked_* functions
2023-02-24 11:56:33 +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