2021-04-05 08:51:23 -07:00
|
|
|
KEYPAIR=$1
|
2021-04-05 08:53:02 -07:00
|
|
|
source ~/mango/cli/devnet.env $KEYPAIR
|
2021-03-23 12:02:15 -07:00
|
|
|
|
|
|
|
DEX_PROGRAM_ID=$(cat $IDS_PATH | jq .devnet.dex_program_id -r)
|
2021-03-15 09:50:01 -07:00
|
|
|
|
2021-04-05 08:51:23 -07:00
|
|
|
MARKET_STR="${2^^}/${3^^}"
|
2021-04-28 10:08:55 -07:00
|
|
|
LOG_FILE="${2^^}-${3^^}.log"
|
2021-03-15 09:50:01 -07:00
|
|
|
|
|
|
|
if [ $MARKET_STR = "BTC/USDT" ]; then
|
|
|
|
MARKET=$(cat ~/mango-client-ts/src/ids.json | jq '.devnet.spot_markets|.["BTC/USDT"]' -r)
|
2021-04-05 10:22:06 -07:00
|
|
|
BASE_WALLET=$(spl-token accounts --verbose --url $CLUSTER --owner $KEYPAIR $BTC | tail -1 | cut -d' ' -f1)
|
|
|
|
QUOTE_WALLET=$(spl-token accounts --verbose --url $CLUSTER --owner $KEYPAIR $USDT | tail -1 | cut -d' ' -f1)
|
2021-03-15 09:50:01 -07:00
|
|
|
elif [ $MARKET_STR = "ETH/USDT" ]; then
|
|
|
|
MARKET=$(cat ~/mango-client-ts/src/ids.json | jq '.devnet.spot_markets|.["ETH/USDT"]' -r)
|
2021-04-05 10:22:06 -07:00
|
|
|
BASE_WALLET=$(spl-token accounts --verbose --url $CLUSTER --owner $KEYPAIR $ETH | tail -1 | cut -d' ' -f1)
|
|
|
|
QUOTE_WALLET=$(spl-token accounts --verbose --url $CLUSTER --owner $KEYPAIR $USDT | tail -1 | cut -d' ' -f1)
|
2021-04-28 10:08:55 -07:00
|
|
|
|
|
|
|
elif [ $MARKET_STR = "SOL/USDT" ]; then
|
|
|
|
MARKET=$(cat ~/mango-client-ts/src/ids.json | jq '.devnet.spot_markets|.["SOL/USDT"]' -r)
|
|
|
|
BASE_WALLET=$(spl-token accounts --verbose --url $CLUSTER --owner $KEYPAIR $BTC | tail -1 | cut -d' ' -f1)
|
|
|
|
QUOTE_WALLET=$(spl-token accounts --verbose --url $CLUSTER --owner $KEYPAIR $USDC | tail -1 | cut -d' ' -f1)
|
|
|
|
|
|
|
|
elif [ $MARKET_STR = "SRM/USDT" ]; then
|
|
|
|
MARKET=$(cat ~/mango-client-ts/src/ids.json | jq '.devnet.spot_markets|.["SRM/USDT"]' -r)
|
|
|
|
BASE_WALLET=$(spl-token accounts --verbose --url $CLUSTER --owner $KEYPAIR $ETH | tail -1 | cut -d' ' -f1)
|
|
|
|
QUOTE_WALLET=$(spl-token accounts --verbose --url $CLUSTER --owner $KEYPAIR $USDC | tail -1 | cut -d' ' -f1)
|
|
|
|
|
|
|
|
|
2021-03-15 09:50:01 -07:00
|
|
|
elif [ $MARKET_STR = "BTC/USDC" ]; then
|
|
|
|
MARKET=$(cat ~/mango-client-ts/src/ids.json | jq '.devnet.spot_markets|.["BTC/USDC"]' -r)
|
2021-04-05 10:22:06 -07:00
|
|
|
BASE_WALLET=$(spl-token accounts --verbose --url $CLUSTER --owner $KEYPAIR $BTC | tail -1 | cut -d' ' -f1)
|
|
|
|
QUOTE_WALLET=$(spl-token accounts --verbose --url $CLUSTER --owner $KEYPAIR $USDC | tail -1 | cut -d' ' -f1)
|
2021-03-23 12:02:15 -07:00
|
|
|
|
2021-03-15 09:50:01 -07:00
|
|
|
elif [ $MARKET_STR = "ETH/USDC" ]; then
|
|
|
|
MARKET=$(cat ~/mango-client-ts/src/ids.json | jq '.devnet.spot_markets|.["ETH/USDC"]' -r)
|
2021-04-05 10:22:06 -07:00
|
|
|
BASE_WALLET=$(spl-token accounts --verbose --url $CLUSTER --owner $KEYPAIR $ETH | tail -1 | cut -d' ' -f1)
|
|
|
|
QUOTE_WALLET=$(spl-token accounts --verbose --url $CLUSTER --owner $KEYPAIR $USDC | tail -1 | cut -d' ' -f1)
|
2021-03-23 12:02:15 -07:00
|
|
|
|
2021-03-22 09:28:52 -07:00
|
|
|
elif [ $MARKET_STR = "BTC/WUSDT" ]; then
|
|
|
|
MARKET=$(cat ~/mango-client-ts/src/ids.json | jq '.devnet.spot_markets|.["BTC/WUSDT"]' -r)
|
2021-03-23 12:02:15 -07:00
|
|
|
|
2021-04-05 10:22:06 -07:00
|
|
|
BASE_WALLET=$(spl-token accounts --verbose --url $CLUSTER --owner $KEYPAIR $BTC | tail -1 | cut -d' ' -f1)
|
|
|
|
QUOTE_WALLET=$(spl-token accounts --verbose --url $CLUSTER --owner $KEYPAIR $WUSDT | tail -1 | cut -d' ' -f1)
|
2021-03-22 09:28:52 -07:00
|
|
|
elif [ $MARKET_STR = "ETH/WUSDT" ]; then
|
|
|
|
MARKET=$(cat ~/mango-client-ts/src/ids.json | jq '.devnet.spot_markets|.["ETH/WUSDT"]' -r)
|
2021-04-05 10:22:06 -07:00
|
|
|
BASE_WALLET=$(spl-token accounts --verbose --url $CLUSTER --owner $KEYPAIR $ETH | tail -1 | cut -d' ' -f1)
|
|
|
|
QUOTE_WALLET=$(spl-token accounts --verbose --url $CLUSTER --owner $KEYPAIR $WUSDT | tail -1 | cut -d' ' -f1)
|
2021-03-15 09:50:01 -07:00
|
|
|
else
|
|
|
|
echo "invalid args"
|
|
|
|
fi
|
|
|
|
|
2021-04-28 10:08:55 -07:00
|
|
|
|
|
|
|
pushd ~/blockworks-foundation/serum-dex/dex/crank
|
|
|
|
cargo run -- $CLUSTER consume-events --dex-program-id $DEX_PROGRAM_ID --payer $KEYPAIR --market $MARKET --coin-wallet $BASE_WALLET --pc-wallet $QUOTE_WALLET --num-workers 1 --events-per-worker 5 --log-directory $LOG_FILE || popd
|