From 09eef5a0bff6b2987a3c36af69a3c7d9c1e01e76 Mon Sep 17 00:00:00 2001 From: dd Date: Mon, 5 Apr 2021 11:40:43 -0400 Subject: [PATCH] updated crank --- crank.sh | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/crank.sh b/crank.sh index 8fff69f..45cab3a 100644 --- a/crank.sh +++ b/crank.sh @@ -1,6 +1,5 @@ source ~/mango/cli/devnet.env -solana config set --url https://devnet.solana.com DEX_PROGRAM_ID=$(cat $IDS_PATH | jq .devnet.dex_program_id -r) @@ -8,36 +7,34 @@ MARKET_STR="${1^^}/${2^^}" if [ $MARKET_STR = "BTC/USDT" ]; then MARKET=$(cat ~/mango-client-ts/src/ids.json | jq '.devnet.spot_markets|.["BTC/USDT"]' -r) - BASE_WALLET=$(spl-token accounts --owner $KEYPAIR $BTC | tail -1 | cut -d' ' -f1) - QUOTE_WALLET=$(spl-token accounts --owner $KEYPAIR $USDT | tail -1 | cut -d' ' -f1) + BASE_WALLET=$(spl-token accounts --url $CLUSTER --owner $KEYPAIR $BTC | tail -1 | cut -d' ' -f1) + QUOTE_WALLET=$(spl-token accounts --url $CLUSTER --owner $KEYPAIR $USDT | tail -1 | cut -d' ' -f1) elif [ $MARKET_STR = "ETH/USDT" ]; then MARKET=$(cat ~/mango-client-ts/src/ids.json | jq '.devnet.spot_markets|.["ETH/USDT"]' -r) - BASE_WALLET=$(spl-token accounts --owner $KEYPAIR $ETH | tail -1 | cut -d' ' -f1) - QUOTE_WALLET=$(spl-token accounts --owner $KEYPAIR $USDT | tail -1 | cut -d' ' -f1) + BASE_WALLET=$(spl-token accounts --url $CLUSTER --owner $KEYPAIR $ETH | tail -1 | cut -d' ' -f1) + QUOTE_WALLET=$(spl-token accounts --url $CLUSTER --owner $KEYPAIR $USDT | tail -1 | cut -d' ' -f1) elif [ $MARKET_STR = "BTC/USDC" ]; then MARKET=$(cat ~/mango-client-ts/src/ids.json | jq '.devnet.spot_markets|.["BTC/USDC"]' -r) - BASE_WALLET=$(spl-token accounts --owner $KEYPAIR $BTC | tail -1 | cut -d' ' -f1) - QUOTE_WALLET=$(spl-token accounts --owner $KEYPAIR $USDC | tail -1 | cut -d' ' -f1) + BASE_WALLET=$(spl-token accounts --url $CLUSTER --owner $KEYPAIR $BTC | tail -1 | cut -d' ' -f1) + QUOTE_WALLET=$(spl-token accounts --url $CLUSTER --owner $KEYPAIR $USDC | tail -1 | cut -d' ' -f1) elif [ $MARKET_STR = "ETH/USDC" ]; then MARKET=$(cat ~/mango-client-ts/src/ids.json | jq '.devnet.spot_markets|.["ETH/USDC"]' -r) - BASE_WALLET=$(spl-token accounts --owner $KEYPAIR $ETH | tail -1 | cut -d' ' -f1) - QUOTE_WALLET=$(spl-token accounts --owner $KEYPAIR $USDC | tail -1 | cut -d' ' -f1) + BASE_WALLET=$(spl-token accounts --url $CLUSTER --owner $KEYPAIR $ETH | tail -1 | cut -d' ' -f1) + QUOTE_WALLET=$(spl-token accounts --url $CLUSTER --owner $KEYPAIR $USDC | tail -1 | cut -d' ' -f1) elif [ $MARKET_STR = "BTC/WUSDT" ]; then MARKET=$(cat ~/mango-client-ts/src/ids.json | jq '.devnet.spot_markets|.["BTC/WUSDT"]' -r) - BASE_WALLET=$(spl-token accounts --owner $KEYPAIR $BTC | tail -1 | cut -d' ' -f1) - QUOTE_WALLET=$(spl-token accounts --owner $KEYPAIR $WUSDT | tail -1 | cut -d' ' -f1) + BASE_WALLET=$(spl-token accounts --url $CLUSTER --owner $KEYPAIR $BTC | tail -1 | cut -d' ' -f1) + QUOTE_WALLET=$(spl-token accounts --url $CLUSTER --owner $KEYPAIR $WUSDT | tail -1 | cut -d' ' -f1) elif [ $MARKET_STR = "ETH/WUSDT" ]; then MARKET=$(cat ~/mango-client-ts/src/ids.json | jq '.devnet.spot_markets|.["ETH/WUSDT"]' -r) - BASE_WALLET=$(spl-token accounts --owner $KEYPAIR $ETH | tail -1 | cut -d' ' -f1) - QUOTE_WALLET=$(spl-token accounts --owner $KEYPAIR $WUSDT | tail -1 | cut -d' ' -f1) + BASE_WALLET=$(spl-token accounts --url $CLUSTER --owner $KEYPAIR $ETH | tail -1 | cut -d' ' -f1) + QUOTE_WALLET=$(spl-token accounts --url $CLUSTER --owner $KEYPAIR $WUSDT | tail -1 | cut -d' ' -f1) else echo "invalid args" fi -solana config set --url https://api.mainnet-beta.solana.com - pushd ~/blockworks-foundation/serum-dex/dex/crank || exit 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 .