#!/bin/bash # Remove BEER and PIZZA from splitfund as they are not notarized. declare -a skip=("BEER" "PIZZA") # Minimum number of UTXOs to maintain TARGETAMNT=10 print_txid () { txid=$(echo $1 | jq -r .txid) if [[ $txid = "" ]]; then echo -n "No valid UTXO to split" else echo -n $txid fi } # Amount of UTXOs to create at one time splitamount () { SPLITAMNT=$(( $TARGETAMNT -$1 )) } #Print Date and Time now=$(date +"%Y-%m-%d %T%z") echo $now echo "Checking CHIPS, KMD, GAME, VRSC" cd ~ echo -n CHIPS UTXOS="$(chips-cli listunspent | grep -c .00010000)" echo -n -e '\t\t';echo -n "$UTXOS" if [ "$UTXOS" -lt "15" ] then SPLITAMNT=$(( 25 -$UTXOS )) echo -n " - SPLITFUNDING CHIPS: " RESULT="$(acsplit CHIPS $SPLITAMNT)" print_txid $RESULT fi echo "" echo -n KMD UTXOS="$(komodo-cli listunspent | grep -c .00010000)" echo -n -e '\t\t';echo -n "$UTXOS" if [ "$UTXOS" -lt "25" ] then SPLITAMNT=$(( 50 -$UTXOS )) echo -n " - SPLITFUNDING KMD: " RESULT="$(acsplit KMD $SPLITAMNT)" print_txid $RESULT fi echo "" echo -n GAME UTXOS="$(gc-cli listunspent | grep -c .00100000)" echo -n -e '\t\t';echo -n "$UTXOS" if [ "$UTXOS" -lt "10" ] then echo -n " - SPLITFUNDING GAME: " RESULT=$(curl --silent --url "http://127.0.0.1:7776" --data "{\"coin\":\"GAME\",\"agent\":\"iguana\",\"method\":\"splitfunds\",\"satoshis\":\"100000\",\"sendflag\":1,\"duplicates\":"20"}") print_txid $RESULT fi echo "" echo -n VRSC UTXOS="$(komodo-cli -ac_name=VRSC listunspent | grep -c .00010000)" echo -n -e '\t\t';echo -n "$UTXOS" if [ "$UTXOS" -lt "5" ] then splitamount $UTXOS echo -n " - SPLITFUNDING VRSC: " RESULT="$(acsplit VRSC $SPLITAMNT)" print_txid $RESULT fi echo "" echo "Checking Other Coins" # Check the rest of the coins using a loop ~/komodo/src/listassetchains | while read chain; do if [[ " ${skip[@]} " =~ " ${chain} " ]]; then pointless=0 else echo -n $chain UTXOS="$(komodo-cli -ac_name=$chain listunspent | grep -c .00010000)" echo -n -e '\t\t';echo -n "$UTXOS" if [ "$UTXOS" -lt "5" ]; then splitamount $UTXOS echo -n " - SPLITFUNDING $chain: " RESULT="$(acsplit $chain $SPLITAMNT)" print_txid $RESULT fi echo "" fi done echo "--------------------------------------------------------------------------------------------------" echo ""