f54bb6f0b0
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) |
||
---|---|---|
.. | ||
README.md | ||
liqtest-check-tcs.ts | ||
liqtest-close-group.ts | ||
liqtest-create-group.ts | ||
liqtest-create-tokens-and-markets.ts | ||
liqtest-make-candidates.ts | ||
liqtest-make-tcs-candidates-perf.ts | ||
liqtest-make-tcs-candidates.ts | ||
liqtest-settle-and-close-all.ts |
README.md
Set environment variables
CLUSTER=devnet
CLUSTER_URL=https://mango.devnet.rpcpool.com/<token>
PAYER_KEYPAIR=~/.config/solana/mb-liqtest.json
# Adjust this to a free group
GROUP_NUM=200
Get devnet SOL
The scripts need a lot of SOL for mint, market, group and account creation. There's ample available, best to ask around.
Create tokens and markets
This is one-time setup:
yarn ts-node ts/client/scripts/liqtest/liqtest-create-tokens-and-markets.ts
It'll emit some MINTS=... and SERUM_MARKETS=.. env vars, set those, all further commands will use them.
Make a group
yarn ts-node ts/client/scripts/liqtest/liqtest-create-group.ts
Groups can be reused a lot, but sometimes closing them may be necessary
yarn ts-node ts/client/scripts/liqtest/liqtest-close-group.ts
Preferably close all mango accounts first.
Create candidate mango accounts
yarn ts-node ts/client/scripts/liqtest/liqtest-make-candidates.ts
This creates a bunch of to-be-liquidated accounts as well as a LIQOR account.
Liquidate
Run the liquidator on the group with the liqor account.
Since devnet doesn't have any jupiter, run with
JUPITER_VERSION=mock
TCS_MODE=borrow-buy
REBALANCE=false
Settle and close all open mango accounts
At any point, to reset by closing all accounts:
yarn ts-node ts/client/scripts/liqtest/liqtest-settle-and-close-all.ts