-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add updated reward distribution script and .conf file template
- Loading branch information
Showing
2 changed files
with
26 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
WALLET_FILE="$HOME/.skycoin/wallets/<wallet-filename>.wlt" | ||
FROM_ADDRESS="HWteH5YSjqax9dnvkHsFPU4JzHiTxugbet" | ||
REWARD_WL_SK=<sec-key-of-pk-whitelisted-by-reward-system> | ||
REWARD_SYS_URL="dmsg://036a70e6956061778e1883e928c1236189db14dfd446df23d83e45c321b330c91f:80" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/usr/bin/bash | ||
## source configuration file | ||
source sendrewards.conf | ||
## check that skycoin wallet is running | ||
skycoin-cli status ; [[ $? -ne 0 ]] && (echo 'skycoin wallet not running ; exiting' && exit 1) | ||
## check that skywire-reward.service isn't running to ensure rewards calculation not ongoing | ||
skywire dmsg curl $REWARD_SYS_URL/skycoin-rewards/s | jq -r '.' | ||
[[ "$(skywire dmsg curl $REWARD_SYS_URL/skycoin-rewards/s | jq -r '.active')" == "active"* ]] && echo "skywire-rewards are calculating - reward service active ; not executing distribution to avoid partial file download" && exit 0 | ||
## preview current reward statistics | ||
source sendrewards.conf ; skywire dmsg curl $REWARD_SYS_URL/$(skywire dmsg curl $REWARD_SYS_URL/skycoin-rewards/csv | sed 's/_rewardtxn0.csv/_stats.txt/g') | ||
## allow to accept or decline | ||
read -n 1 -p "Send rewards? [Y/n]: " user_input | ||
echo | ||
if [[ "$user_input" != "Y" && "$user_input" != "y" ]]; then | ||
echo "exiting" | ||
exit 0 | ||
fi | ||
## get link to the latest CSV | ||
#skywire dmsg curl $REWARD_SYS_URL/skycoin-rewards/csv -s $REWARD_WL_SK | ||
## get reward csv data | ||
# skywire dmsg curl $REWARD_SYS_URL/$(skywire dmsg curl $REWARD_SYS_URL/skycoin-rewards/csv -s $REWARD_WL_SK) -s $REWARD_WL_SK | tr -d ' ' | awk -F, '{printf "%s,%.3f\n", $1, int($2*1000)/1000}' | grep -v '^,0.000$' | ||
skywire dmsg curl $REWARD_SYS_URL/reward -d "$(skycoin-cli createRawTransaction $WALLET_FILE -a $FROM_ADDRESS --csv <(skywire dmsg curl $REWARD_SYS_URL/$(skywire dmsg curl $REWARD_SYS_URL/skycoin-rewards/csv -s $REWARD_WL_SK) -s $REWARD_WL_SK | tr -d ' ' | awk -F, '{printf "%s,%.3f\n", $1, int($2*1000)/1000}' | grep -v '^,0.000$'))" -s $REWARD_WL_SK |