Skip to content

Commit 3f89af8

Browse files
Merge pull request #6 from projectNEWM/MRKT-105-Update-network-flag-in-newm-minter-to-not-hardcode-testnet-magic
hardcoded testnet magic are now replaced with network
2 parents a7d8118 + cd75a3f commit 3f89af8

20 files changed

+161
-99
lines changed

config.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"__comment1__": "This is the starter token for the data reference contract",
3-
"starterPid": "b88cdb6d77bcb6ca9a227bab5d0b6a3b4a47960b41cbab4ede0c8b00",
4-
"starterTkn": "6ca2a0f0d17ec1732611675702ba9672ab033a6bf7fffb1aaf35cf3caf8b5cc4",
3+
"starterPid": "09a41275121df6ca8fc06d687827e7ec0c5d5af59d96f24562cd246a",
4+
"starterTkn": "283130302902382d3a2b36bfe8b795c74779b4d1cb6e1a879b31c76143093abf",
55
"__comment2__": "The change address for the starter token transaction",
66
"starterChangeAddr": "addr_test1qrvnxkaylr4upwxfxctpxpcumj0fl6fdujdc72j8sgpraa9l4gu9er4t0w7udjvt2pqngddn6q4h8h3uv38p8p9cq82qav4lmp",
77
"__comment3__": "This is the initial pool id for staking",

scripts/00_createScriptReferences.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ set -e
44
# SET UP VARS HERE
55
export CARDANO_NODE_SOCKET_PATH=$(cat ./data/path_to_socket.sh)
66
cli=$(cat ./data/path_to_cli.sh)
7-
testnet_magic=$(cat ./data/testnet.magic)
8-
network="--testnet-magic ${testnet_magic}"
7+
network=$(cat ./data/network.sh)
98

109

1110
mkdir -p ./tmp

scripts/all_balances.sh

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,35 +4,36 @@ set -e
44
#
55
export CARDANO_NODE_SOCKET_PATH=$(cat ./data/path_to_socket.sh)
66
cli=$(cat ./data/path_to_cli.sh)
7-
testnet_magic=$(cat ./data/testnet.magic)
7+
network=$(cat ./data/network.sh)
8+
89

910
# staking contract
1011
stake_script_path="../contracts/stake_contract.plutus"
1112

1213
# cip 68 storage contract
1314
storage_script_path="../contracts/storage_contract.plutus"
14-
storage_script_address=$(${cli} address build --payment-script-file ${storage_script_path} --stake-script-file ${stake_script_path} --testnet-magic ${testnet_magic})
15+
storage_script_address=$(${cli} address build --payment-script-file ${storage_script_path} --stake-script-file ${stake_script_path} ${network})
1516

1617
# staked smart contract address
1718
ref_script_path="../contracts/reference_contract.plutus"
18-
ref_script_address=$(${cli} address build --payment-script-file ${ref_script_path} --testnet-magic ${testnet_magic})
19+
ref_script_address=$(${cli} address build --payment-script-file ${ref_script_path} ${network})
1920

20-
${cli} query protocol-parameters --testnet-magic ${testnet_magic} --out-file ./tmp/protocol.json
21-
${cli} query tip --testnet-magic ${testnet_magic} | jq
22-
${cli} query tx-mempool info --testnet-magic ${testnet_magic} | jq
21+
${cli} query protocol-parameters ${network} --out-file ./tmp/protocol.json
22+
${cli} query tip ${network} | jq
23+
${cli} query tx-mempool info ${network} | jq
2324

2425
#
2526
echo -e "\033[1;35m\nReference Script Address: \033[0m"
2627
echo -e "\n \033[1;32m ${ref_script_address} \033[0m \n";
27-
${cli} query utxo --address ${ref_script_address} --testnet-magic ${testnet_magic}
28+
${cli} query utxo --address ${ref_script_address} ${network}
2829
# update the data folder with the current reference datum
29-
${cli} query utxo --address ${ref_script_address} --testnet-magic ${testnet_magic} --out-file ./tmp/current_reference_utxo.json
30+
${cli} query utxo --address ${ref_script_address} ${network} --out-file ./tmp/current_reference_utxo.json
3031
jq -r 'to_entries[] | .value.inlineDatum' tmp/current_reference_utxo.json > data/reference/current-reference-datum.json
3132

3233
#
3334
echo -e "\033[1;35m\nStorage Script Address: \033[0m"
3435
echo -e "\n \033[1;32m ${storage_script_address} \033[0m \n";
35-
${cli} query utxo --address ${storage_script_address} --testnet-magic ${testnet_magic}
36+
${cli} query utxo --address ${storage_script_address} ${network}
3637

3738
# Loop through each -wallet folder
3839
for wallet_folder in wallets/*-wallet; do
@@ -47,8 +48,8 @@ for wallet_folder in wallets/*-wallet; do
4748

4849
echo -e "\033[1;33m"
4950
# Run the cardano-cli command with the reference address and testnet magic
50-
${cli} query utxo --address ${addr} --testnet-magic ${testnet_magic}
51-
${cli} query utxo --address ${addr} --testnet-magic ${testnet_magic} --out-file ./tmp/"${addr}.json"
51+
${cli} query utxo --address ${addr} ${network}
52+
${cli} query utxo --address ${addr} ${network} --out-file ./tmp/"${addr}.json"
5253

5354
baseLovelace=$(jq '[.. | objects | .lovelace] | add' ./tmp/"${addr}.json")
5455
echo -e "\033[0m"

scripts/create_wallet.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#!/usr/bin/env bash
22
set -e
33

4+
network=$(cat ./data/network.sh)
5+
46
if [[ $# -eq 0 ]] ; then
57
echo 'Please Supply A Wallet Folder'
68
exit 1
@@ -11,7 +13,7 @@ folder=${1}
1113
if [ ! -d ${folder} ]; then
1214
mkdir ${folder}
1315
cardano-cli address key-gen --verification-key-file ${folder}/payment.vkey --signing-key-file ${folder}/payment.skey
14-
cardano-cli address build --payment-verification-key-file ${folder}/payment.vkey --out-file ${folder}/payment.addr --testnet-magic 1
16+
cardano-cli address build --payment-verification-key-file ${folder}/payment.vkey --out-file ${folder}/payment.addr ${network}
1517
cardano-cli address key-hash --payment-verification-key-file ${folder}/payment.vkey --out-file ${folder}/payment.hash
1618
else
1719
echo "Folder already exists"

scripts/data/network.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
--testnet-magic 1
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
{
2+
"constructor": 0,
3+
"fields": [
4+
{
5+
"bytes": "f4a78bbff6d5e7e492915986abc495382247af659018451a25cec92c"
6+
},
7+
{
8+
"constructor": 0,
9+
"fields": [
10+
{
11+
"list": [
12+
{
13+
"bytes": "d858ecf3e73e18bef8383a16e856778e033cfd1c8867c70dc9b68b42"
14+
},
15+
{
16+
"bytes": "10a20db9464d89dab407b3397e67facf83db8d442e601b627c0a351f"
17+
},
18+
{
19+
"bytes": "121ce13907d40c7a598d182ed751d39279cf30d50decb17151b3a587"
20+
}
21+
]
22+
},
23+
{
24+
"int": 2
25+
}
26+
]
27+
},
28+
{
29+
"constructor": 0,
30+
"fields": [
31+
{
32+
"bytes": "1e3105f23f2ac91b3fb4c35fa4fe301421028e356e114944e902005b"
33+
},
34+
{
35+
"constructor": 0,
36+
"fields": [
37+
{
38+
"bytes": "8f7b0ce283a92df9a3b69ac0b8f10d8bc8bcf8fbd1fe72596ee8bd6c"
39+
},
40+
{
41+
"bytes": ""
42+
}
43+
]
44+
}
45+
]
46+
},
47+
{
48+
"constructor": 0,
49+
"fields": [
50+
{
51+
"bytes": "184294a1d971ea82a25f8633484e6b106db56c94a0fd18201946cb4b"
52+
},
53+
{
54+
"bytes": "b101170ce6c04387c6a88260666054350cdfa39d0f56e9498d74341a"
55+
}
56+
]
57+
}
58+
]
59+
}

scripts/data/reference/reference-datum.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,10 @@
4848
"constructor": 0,
4949
"fields": [
5050
{
51-
"bytes": "9716578e980be10a47ecb36a0a2c6a71e6142be10cdc15e1e286396a"
51+
"bytes": "184294a1d971ea82a25f8633484e6b106db56c94a0fd18201946cb4b"
5252
},
5353
{
54-
"bytes": "3106ac51de4266a08f73099f20627d8749bb7f495ffecd93b9f50cfe"
54+
"bytes": "b101170ce6c04387c6a88260666054350cdfa39d0f56e9498d74341a"
5555
}
5656
]
5757
}

scripts/data/staking/delegate-redeemer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"constructor": 1,
33
"fields": [
44
{
5-
"bytes": "3106ac51de4266a08f73099f20627d8749bb7f495ffecd93b9f50cfe"
5+
"bytes": "b101170ce6c04387c6a88260666054350cdfa39d0f56e9498d74341a"
66
}
77
]
88
}

scripts/data/testnet.magic

Lines changed: 0 additions & 1 deletion
This file was deleted.

scripts/mint/01_mintTokens.sh

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,17 @@ set -e
33

44
export CARDANO_NODE_SOCKET_PATH=$(cat ../data/path_to_socket.sh)
55
cli=$(cat ../data/path_to_cli.sh)
6-
testnet_magic=$(cat ../data/testnet.magic)
6+
network=$(cat ../data/network.sh)
77

88
# get params
9-
${cli} query protocol-parameters --testnet-magic ${testnet_magic} --out-file ../tmp/protocol.json
9+
${cli} query protocol-parameters ${network} --out-file ../tmp/protocol.json
1010

1111
# staking contract
1212
stake_script_path="../../contracts/stake_contract.plutus"
1313

1414
# cip 68 contract
1515
storage_script_path="../../contracts/storage_contract.plutus"
16-
storage_script_address=$(${cli} address build --payment-script-file ${storage_script_path} --stake-script-file ${stake_script_path} --testnet-magic ${testnet_magic})
16+
storage_script_address=$(${cli} address build --payment-script-file ${storage_script_path} --stake-script-file ${stake_script_path} ${network})
1717

1818
# pays for tx
1919
newm_address=$(cat ../wallets/newm-wallet/payment.addr)
@@ -32,7 +32,7 @@ policy_id=$(cat ../../hashes/policy.hash)
3232

3333
echo -e "\033[0;36m Gathering NEWM UTxO Information \033[0m"
3434
${cli} query utxo \
35-
--testnet-magic ${testnet_magic} \
35+
${network} \
3636
--address ${newm_address} \
3737
--out-file ../tmp/newm_utxo.json
3838

@@ -89,7 +89,7 @@ echo "Fraction Mint OUTPUT:" ${fraction_address_out}
8989
#
9090
echo -e "\033[0;36m Gathering Collateral UTxO Information \033[0m"
9191
${cli} query utxo \
92-
--testnet-magic ${testnet_magic} \
92+
${network} \
9393
--address ${collat_address} \
9494
--out-file ../tmp/collat_utxo.json
9595
txns=$(jq length ../tmp/collat_utxo.json)
@@ -121,7 +121,7 @@ fee=$(${cli} transaction build \
121121
--mint-plutus-script-v2 \
122122
--policy-id="${policy_id}" \
123123
--mint-reference-tx-in-redeemer-file ../data/mint/mint-redeemer.json \
124-
--testnet-magic ${testnet_magic})
124+
${network})
125125

126126
# --tx-out-datum-embed-file ../data/storage/empty.metadata-datum.json \
127127

@@ -138,13 +138,13 @@ ${cli} transaction sign \
138138
--signing-key-file ../wallets/collat-wallet/payment.skey \
139139
--tx-body-file ../tmp/tx.draft \
140140
--out-file ../tmp/tx.signed \
141-
--testnet-magic ${testnet_magic}
141+
${network}
142142
#
143143
# exit
144144
#
145145
echo -e "\033[0;36m Submitting \033[0m"
146146
${cli} transaction submit \
147-
--testnet-magic ${testnet_magic} \
147+
${network} \
148148
--tx-file ../tmp/tx.signed
149149

150150
tx=$(cardano-cli transaction txid --tx-file ../tmp/tx.signed)

0 commit comments

Comments
 (0)