This repository has been archived by the owner on Nov 7, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy path03-write.sh
executable file
·98 lines (73 loc) · 2.59 KB
/
03-write.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
91
92
93
94
95
96
97
98
#!/usr/bin/env bash
. env.sh
echo
### No control.
cardano-cli transaction build $MAGIC --alonzo-era \
--protocol-params-file $PROTOCOL \
--tx-in $TXID_3#1 \
--tx-in-script-file $SCRIPT_O \
--tx-in-datum-value "$(cat $DATUM_0)" \
--tx-in-redeemer-file ../redeemer-write.json \
--tx-in $TXID_3#0 \
--tx-out "$ADDRESS_S+5000000+1 $TOKEN_D+10 $TOKEN_F" \
--tx-out-datum-hash $HASH_1 \
--tx-out "$ADDRESS_1+5000000" \
--change-address $ADDRESS_1 \
--tx-in-collateral $TXID_2#3 \
--out-file tx.raw 2>/dev/null
assert_failure "03a No writing without control."
### Stealing datum token.
cardano-cli transaction build $MAGIC --alonzo-era \
--protocol-params-file $PROTOCOL \
--tx-in $TXID_3#1 \
--tx-in-script-file $SCRIPT_O \
--tx-in-datum-value "$(cat $DATUM_0)" \
--tx-in-redeemer-file ../redeemer-write.json \
--tx-in $TXID_2#2 \
--tx-in $TXID_3#0 \
--tx-out "$ADDRESS_S+5000000+10 $TOKEN_F" \
--tx-out-datum-hash $HASH_1 \
--tx-out "$ADDRESS_1+5000000+1 $TOKEN_C+1 $TOKEN_D" \
--change-address $ADDRESS_1 \
--tx-in-collateral $TXID_2#3 \
--out-file tx.raw 2>/dev/null
assert_failure "03b No writing if stealing datum token."
### Stealing everything.
cardano-cli transaction build $MAGIC --alonzo-era \
--protocol-params-file $PROTOCOL \
--tx-in $TXID_3#1 \
--tx-in-script-file $SCRIPT_O \
--tx-in-datum-value "$(cat $DATUM_0)" \
--tx-in-redeemer-file ../redeemer-write.json \
--tx-in $TXID_2#2 \
--tx-in $TXID_3#0 \
--tx-out "$ADDRESS_1+5000000+1 $TOKEN_C+1 $TOKEN_D+10 $TOKEN_F" \
--change-address $ADDRESS_1 \
--tx-in-collateral $TXID_2#3 \
--out-file tx.raw 2>/dev/null
assert_failure "03c No writing if stealing everything."
### Depositing control token.
cardano-cli transaction build $MAGIC --alonzo-era \
--protocol-params-file $PROTOCOL \
--tx-in $TXID_3#1 \
--tx-in-script-file $SCRIPT_O \
--tx-in-datum-value "$(cat $DATUM_0)" \
--tx-in-redeemer-file ../redeemer-write.json \
--tx-in $TXID_2#2 \
--tx-in $TXID_3#0 \
--tx-out "$ADDRESS_S+5000000+1 $TOKEN_C+1 $TOKEN_D+10 $TOKEN_F" \
--tx-out-datum-hash $HASH_1 \
--tx-out "$ADDRESS_1+5000000" \
--change-address $ADDRESS_1 \
--tx-in-collateral $TXID_2#3 \
--out-file tx.raw 2>/dev/null
assert_failure "03d No writing if depositing control token."
### Writing.
mantra-oracle write $CONFIG \
$ADDRESS_1 \
$PAYMENT_1 \
$DATUM_0 \
$DATUM_1
assert_success "03e Writing."
### Record transaction.
echo "Run query.sh to find the resulting transaction and enter that as TXID_4 in local.sh."