-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
init parameterized vote and removed use of alias
- Loading branch information
Showing
17 changed files
with
167 additions
and
119 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
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
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
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
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
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
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
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
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 |
---|---|---|
@@ -1,36 +1,52 @@ | ||
#!/bin/sh | ||
#!/bin/bash | ||
|
||
# ~~~~~~~~~~~~ CHANGE THIS ~~~~~~~~~~~~ | ||
choice="yes" # "yes", "no" or "abstain" | ||
ga_hash="66cbbf693a8549d0abb1b5219f1127f8176a4052ef774c11a52ff18ad1845102" | ||
ga_index="0" | ||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
# Function to execute cardano-cli commands inside the container | ||
container_cli() { | ||
docker exec -ti sancho-node cardano-cli "$@" | ||
} | ||
|
||
# Voting on a governance action | ||
echo "Voting on $ga_hash#$ga_index with a $choice." | ||
# Function to display script usage | ||
usage() { | ||
echo "Usage: $0 <choice> <ga_id>" | ||
echo "Example: $0 yes 66cbbf693a8549d0abb1b5219f1127f8176a4052ef774c11a52ff18ad1845102#0" | ||
} | ||
|
||
# Check if the correct number of arguments is provided | ||
if [ "$#" -ne 2 ]; then | ||
usage | ||
exit 1 | ||
fi | ||
|
||
# Assigning parameters to variables | ||
choice="$1" | ||
ga_id="$2" | ||
|
||
# Set alias for convenience | ||
alias container-cli="docker exec -ti sancho-node cardano-cli" | ||
# Extract ga_hash and ga_index from ga_id | ||
ga_hash=$(echo "$ga_id" | cut -d '#' -f 1) | ||
ga_index=$(echo "$ga_id" | cut -d '#' -f 2) | ||
|
||
# Voting on a governance action | ||
echo "Voting on $ga_id with a $choice." | ||
|
||
container-cli conway governance vote create \ | ||
container_cli conway governance vote create \ | ||
"--$choice" \ | ||
--governance-action-tx-id $ga_hash \ | ||
--governance-action-index $ga_index \ | ||
--governance-action-tx-id "$ga_hash" \ | ||
--governance-action-index "$ga_index" \ | ||
--drep-verification-key-file ./keys/drep.vkey \ | ||
--out-file ./txs/ga.vote | ||
|
||
container-cli conway transaction build --testnet-magic 4 \ | ||
--tx-in "$(container-cli query utxo --address $(cat ./keys/payment.addr) --testnet-magic 4 --out-file /dev/stdout | jq -r 'keys[0]')" \ | ||
--change-address $(cat ./keys/payment.addr) \ | ||
container_cli conway transaction build --testnet-magic 4 \ | ||
--tx-in "$(container_cli query utxo --address "$(cat ./keys/payment.addr)" --testnet-magic 4 --out-file /dev/stdout | jq -r 'keys[0]')" \ | ||
--change-address "$(cat ./keys/payment.addr)" \ | ||
--vote-file ./txs/ga.vote \ | ||
--witness-override 2 \ | ||
--out-file ./txs/vote-tx.raw | ||
|
||
container-cli transaction sign \ | ||
container_cli transaction sign \ | ||
--tx-body-file ./txs/vote-tx.raw \ | ||
--signing-key-file ./keys/drep.skey \ | ||
--signing-key-file ./keys/payment.skey \ | ||
--testnet-magic 4 \ | ||
--out-file ./txs/vote-tx.signed | ||
|
||
container-cli transaction submit --testnet-magic 4 --tx-file ./txs/vote-tx.signed | ||
container_cli transaction submit --testnet-magic 4 --tx-file ./txs/vote-tx.signed |
Oops, something went wrong.