-
Notifications
You must be signed in to change notification settings - Fork 207
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: move faucet account onto the controller where it is safer
- Loading branch information
1 parent
8a81365
commit 8ba1c46
Showing
4 changed files
with
101 additions
and
22 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
12 changes: 12 additions & 0 deletions
12
packages/deployment/ansible/roles/cosmos-genesis/templates/provision.sh.j2
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,12 @@ | ||
#! /bin/bash | ||
set -e | ||
|
||
thisdir=$(dirname -- "$0") | ||
|
||
UNIQUE=$1 | ||
ADDR=$2 | ||
NAME=$3 | ||
|
||
exec ag-cosmos-helper --home=$thisdir/faucet tx swingset provision-one \ | ||
--yes --gas=auto --gas-adjustment=1.5 --broadcast-mode=block --from=faucet -- \ | ||
"$NAME" "$ADDR" |
42 changes: 42 additions & 0 deletions
42
packages/deployment/ansible/roles/cosmos-genesis/templates/val.sh.j2
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,42 @@ | ||
#! /bin/bash | ||
set -e | ||
|
||
thisdir=$(dirname -- "$0") | ||
MAX_LINES=-1 | ||
|
||
STAKE=50000000uagstake | ||
UNIQUE=$1 | ||
ADDR=$2 | ||
NAME=$3 | ||
|
||
case "$ADDR$NAME" in | ||
*\'*) echo 1>&2 'Exploded!'; exit 1 ;; | ||
esac | ||
|
||
[[ -n $NAME ]] || exit 1 | ||
|
||
if [[ $UNIQUE != no && $MAX_LINES -ge 0 && $(wc -l $thisdir/cosmos-delegates.txt | sed -e 's/ .*//') -ge $MAX_LINES ]]; then | ||
echo "Sorry, we've capped the number of validators at $MAX_LINES" | ||
exit 1 | ||
fi | ||
if [[ $UNIQUE != no ]]; then | ||
line=$(grep -e ":$NAME$" $thisdir/cosmos-delegates.txt || true) | ||
if [[ -n $line ]]; then | ||
echo "$NAME has already tapped the faucet:" 1>&2 | ||
echo "$line" 1>&2 | ||
exit 1 | ||
|
||
fi | ||
fi | ||
if [[ $UNIQUE != no ]]; then | ||
line=$(grep -e "^$ADDR:" $thisdir/cosmos-delegates.txt || true) | ||
if [[ -n $line ]]; then | ||
echo "$ADDR already received a tap:" 1>&2 | ||
echo "$line" 1>&2 | ||
exit 1 | ||
fi | ||
fi | ||
|
||
ag-cosmos-helper --home=$thisdir/faucet -- tx send faucet "$ADDR" "$STAKE" | ||
sed -i -e "/:$NAME$/d" $thisdir/cosmos-delegates.txt | ||
echo "$ADDR:$STAKE:$NAME" >> $thisdir/cosmos-delegates.txt |
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