You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

89 lines
2.3 KiB

#!/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 () {
echo -n $(echo $1 | jq -r .txid)
}
# 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 "25" ]
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 "50" ]
then
SPLITAMNT=$(( 50 -$UTXOS ))
echo -n " - SPLITFUNDING KMD: "
RESULT="$(acsplit KMD 77)"
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 "$TARGETAMNT" ]
then
splitamount $UTXOS
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\":"$SPLITAMNT"}")
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 "$TARGETAMNT" ]
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 "$TARGETAMNT" ]; then
splitamount $UTXOS
echo -n " - SPLITFUNDING $chain: "
RESULT="$(acsplit $chain $SPLITAMNT)"
print_txid $RESULT
fi
echo ""
fi
done
echo "--------------------------------------------------------------------------------------------------"
echo ""