-
Notifications
You must be signed in to change notification settings - Fork 58
/
Copy pathlobster-contribute.sh
executable file
·90 lines (77 loc) · 2.37 KB
/
lobster-contribute.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#!/bin/bash
# arguments:
# utxo (wallet)
# utxo (lobster)
# wallet address file
# signinig key file
# old counter
# new counter
# old votes
export CARDANO_NODE_SOCKET_PATH=node.socket
bodyFile=lobster-tx-body.03
outFile=lobster-tx.03
nftPolicyFile="nft-mint-policy.plutus"
nftPolicyId=$(./policyid.sh $nftPolicyFile)
otherPolicyFile="other-mint-policy.plutus"
otherPolicyId=$(./policyid.sh $otherPolicyFile)
nftValue="1 $nftPolicyId.LobsterNFT"
counterValue="$6 $otherPolicyId.LobsterCounter"
newVotes=$(($7+1))
votesValue="$newVotes $otherPolicyId.LobsterVotes"
increaseValue="$(($6-$5)) $otherPolicyId.LobsterCounter + 1 $otherPolicyId.LobsterVotes"
walletAddr=$(cat $3)
scriptFile=lobster.plutus
scriptAddr=$(./mainnet-script-address.sh $scriptFile)
echo "wallet utxo: $1"
echo "script utxo: $2"
echo "bodyfile: $bodyFile"
echo "outfile: $outFile"
echo "nftPolicyfile: $nftPolicyFile"
echo "nftPolicyid: $nftPolicyId"
echo "otherPolicyfile: $otherPolicyFile"
echo "otherPolicyid: $otherPolicyId"
echo "nftValue: $nftValue"
echo "counterValue: $counterValue"
echo "votesValue: $votesValue"
echo "walletAddress: $walletAddr"
echo "scriptFile: $scriptFile"
echo "scriptAddress: $scriptAddr"
echo "signing key file: $4"
echo "old counter: $5"
echo "new counter: $6"
echo "increaseValue: $increaseValue"
echo "old votes: $7"
echo "new votes: $newVotes"
echo
echo "querying protocol parameters"
./mainnet-query-protocol-parameters.sh
echo
./cardano-cli transaction build \
--alonzo-era \
--mainnet \
--tx-in $1 \
--tx-in $2 \
--tx-in-script-file $scriptFile \
--tx-in-datum-value [] \
--tx-in-redeemer-value [] \
--tx-in-collateral $1 \
--tx-out "$scriptAddr + 2034438 lovelace + $nftValue + $counterValue + $votesValue" \
--tx-out-datum-hash 45b0cfc220ceec5b7c1c62c4d4193d38e4eba48e8815729ce75f9c0ab0e4c1c0 \
--mint "$increaseValue" \
--mint-script-file $otherPolicyFile \
--mint-redeemer-value [] \
--change-address $walletAddr \
--protocol-params-file mainnet-protocol-parameters.json \
--out-file $bodyFile
echo "saved transaction to $bodyFile"
./cardano-cli transaction sign \
--tx-body-file $bodyFile \
--signing-key-file $4 \
--mainnet \
--out-file $outFile
echo "signed transaction and saved as $outFile"
./cardano-cli transaction submit \
--mainnet \
--tx-file $outFile
echo "submitted transaction"
echo