Skip to content

Commit f0a1b54

Browse files
committed
add treasury donation script
1 parent 6277442 commit f0a1b54

File tree

2 files changed

+51
-0
lines changed

2 files changed

+51
-0
lines changed

scripts/simple/treasury-donate.sh

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
#!/bin/bash
2+
3+
# ~~~~~~~~~~~~ CHANGE THIS ~~~~~~~~~~~~
4+
LOVELACE_AMOUNT=10000000
5+
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
6+
7+
# Define directory paths
8+
keys_dir="./keys"
9+
txs_dir="./txs"
10+
tx_path_stub="$txs_dir/treasury-donate"
11+
tx_unsigned_path="$tx_path_stub.unsigned"
12+
tx_signed_path="$tx_path_stub.signed"
13+
14+
# Get the script's directory
15+
script_dir=$(dirname "$0")
16+
17+
# Get the container name from the get-container script
18+
container_name="$("$script_dir/../helper/get-container.sh")"
19+
20+
if [ -z "$container_name" ]; then
21+
echo "Failed to determine a running container."
22+
exit 1
23+
fi
24+
25+
echo "Using running container: $container_name"
26+
27+
# Function to execute cardano-cli commands inside the container
28+
container_cli() {
29+
docker exec -ti $container_name cardano-cli "$@"
30+
}
31+
32+
# Send ada to the multisig payment script
33+
echo "Sending $LOVELACE_AMOUNT lovelace to the treasury."
34+
35+
echo "Building transaction"
36+
37+
container_cli conway transaction build \
38+
--tx-in $(container_cli conway query utxo --address $(cat $keys_dir/payment.addr) --out-file /dev/stdout | jq -r 'keys[0]') \
39+
--change-address $(cat $keys_dir/payment.addr) \
40+
--treasury-donation $LOVELACE_AMOUNT \
41+
--out-file "$tx_unsigned_path"
42+
43+
container_cli conway transaction sign \
44+
--tx-body-file "$tx_unsigned_path" \
45+
--signing-key-file $keys_dir/payment.skey \
46+
--out-file "$tx_signed_path"
47+
48+
# Submit the transaction
49+
echo "Submitting transaction"
50+
51+
container_cli conway transaction submit --tx-file $tx_signed_path

0 commit comments

Comments
 (0)