Skip to content
This repository was archived by the owner on Sep 17, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

A collection of contracts used my Project Newm.

- NEEDS UPDATE FOR MVP

- @TODO: README NEEDS UPDATE FOR MVP

# E2E Testing

Expand Down
Binary file modified __pycache__/update_contracts.cpython-310.pyc
Binary file not shown.
4 changes: 2 additions & 2 deletions final.check
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 ./fractionalize-scripts/data/hash.hashes
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 ./fractionalize-scripts/data/policy.hashes
97600e074a51608faabff6319648c4854e6b928829281d0ebdc7c9714752ba2b ./hash.hashes
7f326fe4d9cd5598a95434d941df3939a646deba6d810a23043579da8fe7259d ./hash.hashes
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 ./tokenize-scripts/hash.hashes
7102b36d82e5f418161451f3299b79fbab70b3febb91b249fdf4325a6eadbc00 ./tokenize-scripts/policy.hashes
b077f2c6282c875bf52e38d780f2a6576c7b69ff1f7c9e8d9b0ffcf27acdf887 ./policy.hashes
1bc15478c73ccb7ee3bcec4a859888fe91a8832426b2b584160247fdf0576613 ./policy.hashes
16 changes: 9 additions & 7 deletions fractionalize-scripts/balances.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,34 @@ set -e

export CARDANO_NODE_SOCKET_PATH=$(cat path_to_socket.sh)
cli=$(cat path_to_cli.sh)
testnet_magic=$(cat ../testnet.magic)

script_path="../locking-contract/locking-contract.plutus"

SCRIPT_ADDRESS=$(${cli} address build --payment-script-file ${script_path} --testnet-magic 1097911063)
SCRIPT_ADDRESS=$(${cli} address build --payment-script-file ${script_path} --testnet-magic ${testnet_magic})
SELLER_ADDRESS=$(cat wallets/seller-wallet/payment.addr)
BUYER_ADDRESS=$(cat wallets/buyer-wallet/payment.addr)
REFERENCE_ADDRESS=$(cat wallets/reference-wallet/payment.addr)

${cli} query protocol-parameters --testnet-magic 1097911063 --out-file tmp/protocol.json
${cli} query tip --testnet-magic 1097911063 | jq
${cli} query protocol-parameters --testnet-magic ${testnet_magic} --out-file tmp/protocol.json
${cli} query tip --testnet-magic ${testnet_magic} | jq
#
echo
echo -e "\033[1;35m Script Address: \033[0m"
echo -e "\n \033[1;35m ${SCRIPT_ADDRESS} \033[0m \n";
${cli} query utxo --address ${SCRIPT_ADDRESS} --testnet-magic 1097911063
${cli} query utxo --address ${SCRIPT_ADDRESS} --testnet-magic ${testnet_magic}
#
echo
echo -e "\033[1;36m NewM Address: \033[0m"
echo -e "\n \033[1;36m ${SELLER_ADDRESS} \033[0m \n";
${cli} query utxo --address ${SELLER_ADDRESS} --testnet-magic 1097911063
${cli} query utxo --address ${SELLER_ADDRESS} --testnet-magic ${testnet_magic}
#
echo
echo -e "\033[1;32m Artist Address: \033[0m"
echo -e "\n \033[1;32m ${BUYER_ADDRESS} \033[0m \n";
${cli} query utxo --address ${BUYER_ADDRESS} --testnet-magic 1097911063
${cli} query utxo --address ${BUYER_ADDRESS} --testnet-magic ${testnet_magic}
#
echo
echo -e "\033[1;34m Reference Address: \033[0m"
echo -e "\n \033[1;34m ${REFERENCE_ADDRESS} \033[0m \n";
${cli} query utxo --address ${REFERENCE_ADDRESS} --testnet-magic 1097911063
${cli} query utxo --address ${REFERENCE_ADDRESS} --testnet-magic ${testnet_magic}
14 changes: 9 additions & 5 deletions fractionalize-scripts/createFractionalUTxO.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,26 @@ set -e

export CARDANO_NODE_SOCKET_PATH=$(cat path_to_socket.sh)
cli=$(cat path_to_cli.sh)
testnet_magic=$(cat ../testnet.magic)

#
script_path="../locking-contract/locking-contract.plutus"
script_address=$(${cli} address build --payment-script-file ${script_path} --testnet-magic 1097911063)
script_address=$(${cli} address build --payment-script-file ${script_path} --testnet-magic ${testnet_magic})
seller_address=$(cat wallets/seller-wallet/payment.addr)

sc_address_out="${script_address} + 5000000"
echo "Script OUTPUT: "${sc_address_out}

echo "Use mintStarterNFT.sh"
exit
#
# exit
#

echo -e "\033[0;36m Gathering UTxO Information \033[0m"
# get utxo
${cli} query utxo \
--testnet-magic 1097911063 \
--testnet-magic ${testnet_magic} \
--address ${seller_address} \
--out-file tmp/seller_utxo.json

Expand All @@ -41,7 +45,7 @@ FEE=$(${cli} transaction build \
--tx-in ${seller_tx_in} \
--tx-out="${sc_address_out}" \
--tx-out-inline-datum-file data/datum.json \
--testnet-magic 1097911063)
--testnet-magic ${testnet_magic})

# --tx-out-datum-embed-file data/datum.json \
IFS=':' read -ra VALUE <<< "${FEE}"
Expand All @@ -57,11 +61,11 @@ ${cli} transaction sign \
--signing-key-file wallets/seller-wallet/payment.skey \
--tx-body-file tmp/tx.draft \
--out-file tmp/tx.signed \
--testnet-magic 1097911063
--testnet-magic ${testnet_magic}
#
# exit
#
echo -e "\033[0;36m Submitting \033[0m"
${cli} transaction submit \
--testnet-magic 1097911063 \
--testnet-magic ${testnet_magic} \
--tx-file tmp/tx.signed
11 changes: 5 additions & 6 deletions fractionalize-scripts/createReferenceScript.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ set -e
# SET UP VARS HERE
export CARDANO_NODE_SOCKET_PATH=$(cat path_to_socket.sh)
cli=$(cat path_to_cli.sh)

TESTNET_MAGIC=1097911063
testnet_magic=$(cat ../testnet.magic)

lock_script_path="../locking-contract/locking-contract.plutus"
mint_script_path="../minting-contract/minting-contract.plutus"
Expand Down Expand Up @@ -38,7 +37,7 @@ echo -e "\nCreating Minting Reference:\n" ${mint_script_reference_utxo}
#
echo -e "\033[0;36m Gathering UTxO Information \033[0m"
${cli} query utxo \
--testnet-magic ${TESTNET_MAGIC} \
--testnet-magic ${testnet_magic} \
--address ${reference_address} \
--out-file tmp/reference_utxo.json

Expand All @@ -63,7 +62,7 @@ FEE=$(${cli} transaction build \
--tx-out-reference-script-file ${lock_script_path} \
--tx-out="${mint_script_reference_utxo}" \
--tx-out-reference-script-file ${mint_script_path} \
--testnet-magic ${TESTNET_MAGIC})
--testnet-magic ${testnet_magic})

IFS=':' read -ra VALUE <<< "${FEE}"
IFS=' ' read -ra FEE <<< "${VALUE[1]}"
Expand All @@ -77,11 +76,11 @@ ${cli} transaction sign \
--signing-key-file wallets/reference-wallet/payment.skey \
--tx-body-file tmp/tx.draft \
--out-file tmp/tx-reference-utxo.signed \
--testnet-magic ${TESTNET_MAGIC}
--testnet-magic ${testnet_magic}
#
# exit
#
echo -e "\033[0;36m Submitting \033[0m"
${cli} transaction submit \
--testnet-magic ${TESTNET_MAGIC} \
--testnet-magic ${testnet_magic} \
--tx-file tmp/tx-reference-utxo.signed
2 changes: 1 addition & 1 deletion fractionalize-scripts/data/datum.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"bytes": "a3a9787f35925763b77dc856b8122d0892deff2bbfde523991f012fe"
},
{
"bytes": "9ac57aaf19dcb5fa133566e9fe9d0b32d88cbf14050fed3b3a6de9ea"
"bytes": "143ced0884b67130024312cb62ca274281021631229e81c518ba2624"
},
{
"bytes": "4e65774d5f30"
Expand Down
21 changes: 12 additions & 9 deletions fractionalize-scripts/lockAndFractionalize.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ set -e

export CARDANO_NODE_SOCKET_PATH=$(cat path_to_socket.sh)
cli=$(cat path_to_cli.sh)
testnet_magic=$(cat ../testnet.magic)

#
script_path="../locking-contract/locking-contract.plutus"
mint_path="../minting-contract/minting-contract.plutus"

script_address=$(${cli} address build --payment-script-file ${script_path} --testnet-magic 1097911063)
#
script_address=$(${cli} address build --payment-script-file ${script_path} --testnet-magic ${testnet_magic})
#
deleg_pkh=$(cardano-cli address key-hash --payment-verification-key-file wallets/delegator-wallet/payment.vkey)
#
Expand All @@ -21,8 +23,9 @@ SC_ASSET="1 ${nft_id}.4e65774d5f30"
#
MINT_ASSET="100000000 ${policy_id}.4e65774d5f30"
UTXO_VALUE=$(${cli} transaction calculate-min-required-utxo \
--alonzo-era \
--babbage-era \
--protocol-params-file tmp/protocol.json \
--tx-out-inline-datum-value 42 \
--tx-out="${buyer_address} ${SC_ASSET}" | tr -dc '0-9')
#
script_address_out="${script_address} + 5000000 + ${SC_ASSET}"
Expand All @@ -34,7 +37,7 @@ echo "Mint OUTPUT: "${buyer_address_out}
#
echo -e "\033[0;36m Gathering Buyer UTxO Information \033[0m"
${cli} query utxo \
--testnet-magic 1097911063 \
--testnet-magic ${testnet_magic} \
--address ${buyer_address} \
--out-file tmp/buyer_utxo.json

Expand All @@ -52,7 +55,7 @@ buyer_tx_in=${TXIN::-8}
echo -e "\033[0;36m Gathering Script UTxO Information \033[0m"
${cli} query utxo \
--address ${script_address} \
--testnet-magic 1097911063 \
--testnet-magic ${testnet_magic} \
--out-file tmp/script_utxo.json

# transaction variables
Expand All @@ -68,7 +71,7 @@ script_tx_in=${TXIN::-8}
script_ref_utxo=$(cardano-cli transaction txid --tx-file tmp/tx-reference-utxo.signed)
# collat info
collat_pkh=$(${cli} address key-hash --payment-verification-key-file wallets/collat-wallet/payment.vkey)
collat_utxo="87a43ee3889f827356a23a7459ef5f9eaf843880da1996d1b68595fb4171f63c" # in collat wallet
collat_utxo="10e5b05d90199da3f7cb581f00926f5003e22aac8a3d5a33607cd4c57d13aaf3" # in collat wallet

# exit
echo -e "\033[0;36m Building Tx \033[0m"
Expand All @@ -94,7 +97,7 @@ FEE=$(${cli} transaction build \
--mint-plutus-script-v2 \
--policy-id="${policy_id}" \
--mint-reference-tx-in-redeemer-file data/datum.json \
--testnet-magic 1097911063)
--testnet-magic ${testnet_magic})

# --tx-out-datum-embed-file data/datum.json \
# --spending-reference-tx-in-datum-file data/datum.json \
Expand All @@ -112,11 +115,11 @@ ${cli} transaction sign \
--signing-key-file wallets/collat-wallet/payment.skey \
--tx-body-file tmp/tx.draft \
--out-file tmp/tx.signed \
--testnet-magic 1097911063
--testnet-magic ${testnet_magic}
#
# exit
#
echo -e "\033[0;36m Submitting \033[0m"
${cli} transaction submit \
--testnet-magic 1097911063 \
--testnet-magic ${testnet_magic} \
--tx-file tmp/tx.signed
47 changes: 25 additions & 22 deletions fractionalize-scripts/removeFractionalUTxO.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,44 +3,47 @@ set -e

export CARDANO_NODE_SOCKET_PATH=$(cat path_to_socket.sh)
cli=$(cat path_to_cli.sh)
testnet_magic=$(cat ../testnet.magic)

#
script_path="../locking-contract/locking-contract.plutus"
script_address=$(${cli} address build --payment-script-file ${script_path} --testnet-magic 1097911063)
script_address=$(${cli} address build --payment-script-file ${script_path} --testnet-magic ${testnet_magic})
#
seller_address=$(cat wallets/seller-wallet/payment.addr)
seller_pkh=$(cardano-cli address key-hash --payment-verification-key-file wallets/seller-wallet/payment.vkey)
buyer_address=$(cat wallets/buyer-wallet/payment.addr)
buyer_pkh=$(cardano-cli address key-hash --payment-verification-key-file wallets/buyer-wallet/payment.vkey)
deleg_pkh=$(cardano-cli address key-hash --payment-verification-key-file wallets/delegator-wallet/payment.vkey)


seller_address_out="${seller_address} + 5000000"
echo "Exit OUTPUT: "${seller_address_out}
buyer_address_out="${buyer_address} + 5000000"
echo "Exit OUTPUT: "${buyer_address_out}

#
echo -e "\033[0;31m THIS WILL BE REMOVED IN PRODUCTION \033[0m"
echo "Use unlockAndSolidify.sh"
exit
#

echo -e "\033[0;36m Gathering UTxO Information \033[0m"
${cli} query utxo \
--testnet-magic 1097911063 \
--address ${seller_address} \
--out-file tmp/seller_utxo.json
--testnet-magic ${testnet_magic} \
--address ${buyer_address} \
--out-file tmp/buyer_utxo.json

TXNS=$(jq length tmp/seller_utxo.json)
TXNS=$(jq length tmp/buyer_utxo.json)
if [ "${TXNS}" -eq "0" ]; then
echo -e "\n \033[0;31m NO UTxOs Found At ${seller_address} \033[0m \n";
echo -e "\n \033[0;31m NO UTxOs Found At ${buyer_address} \033[0m \n";
exit;
fi
alltxin=""
TXIN=$(jq -r --arg alltxin "" 'keys[] | . + $alltxin + " --tx-in"' tmp/seller_utxo.json)
CTXIN=$(jq -r --arg alltxin "" 'keys[] | . + $alltxin + " --tx-in-collateral"' tmp/seller_utxo.json)
TXIN=$(jq -r --arg alltxin "" 'keys[] | . + $alltxin + " --tx-in"' tmp/buyer_utxo.json)
CTXIN=$(jq -r --arg alltxin "" 'keys[] | . + $alltxin + " --tx-in-collateral"' tmp/buyer_utxo.json)
collateral_tx_in=${CTXIN::-19}
seller_tx_in=${TXIN::-8}
buyer_tx_in=${TXIN::-8}

echo -e "\033[0;36m Gathering Script UTxO Information \033[0m"
${cli} query utxo \
--address ${script_address} \
--testnet-magic 1097911063 \
--testnet-magic ${testnet_magic} \
--out-file tmp/script_utxo.json
# transaction variables
TXNS=$(jq length tmp/script_utxo.json)
Expand All @@ -55,25 +58,25 @@ script_tx_in=${TXIN::-8}
script_ref_utxo=$(cardano-cli transaction txid --tx-file tmp/tx-reference-utxo.signed)
# collat info
collat_pkh=$(${cli} address key-hash --payment-verification-key-file wallets/collat-wallet/payment.vkey)
collat_utxo="87a43ee3889f827356a23a7459ef5f9eaf843880da1996d1b68595fb4171f63c" # in collat wallet
collat_utxo="10e5b05d90199da3f7cb581f00926f5003e22aac8a3d5a33607cd4c57d13aaf3" # in collat wallet

echo -e "\033[0;36m Building Tx \033[0m"
FEE=$(${cli} transaction build \
--babbage-era \
--protocol-params-file tmp/protocol.json \
--out-file tmp/tx.draft \
--change-address ${seller_address} \
--tx-in ${seller_tx_in} \
--change-address ${buyer_address} \
--tx-in ${buyer_tx_in} \
--tx-in-collateral="${collat_utxo}#0" \
--tx-in ${script_tx_in} \
--spending-tx-in-reference="${script_ref_utxo}#1" \
--spending-plutus-script-v2 \
--spending-reference-tx-in-inline-datum-present \
--spending-reference-tx-in-redeemer-file data/exit_redeemer.json \
--tx-out="${seller_address_out}" \
--tx-out="${buyer_address_out}" \
--required-signer-hash ${collat_pkh} \
--required-signer-hash ${deleg_pkh} \
--testnet-magic 1097911063)
--testnet-magic ${testnet_magic})

# --spending-reference-tx-in-datum-file data/datum.json \
IFS=':' read -ra VALUE <<< "${FEE}"
Expand All @@ -85,16 +88,16 @@ echo -e "\033[1;32m Fee: \033[0m" $FEE
#
echo -e "\033[0;36m Signing \033[0m"
${cli} transaction sign \
--signing-key-file wallets/seller-wallet/payment.skey \
--signing-key-file wallets/buyer-wallet/payment.skey \
--signing-key-file wallets/delegator-wallet/payment.skey \
--signing-key-file wallets/collat-wallet/payment.skey \
--tx-body-file tmp/tx.draft \
--out-file tmp/tx.signed \
--testnet-magic 1097911063
--testnet-magic ${testnet_magic}
#
# exit
#
echo -e "\033[0;36m Submitting \033[0m"
${cli} transaction submit \
--testnet-magic 1097911063 \
--testnet-magic ${testnet_magic} \
--tx-file tmp/tx.signed
8 changes: 4 additions & 4 deletions fractionalize-scripts/tradeToken.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ echo -e "\nTrading A Token:\n" ${token_to_be_traded}
#
echo -e "\033[0;36m Gathering UTxO Information \033[0m"
${cli} query utxo \
--testnet-magic 1097911063 \
--testnet-magic ${testnet_magic} \
--address ${sender_address} \
--out-file tmp/sender_utxo.json

Expand All @@ -44,7 +44,7 @@ FEE=$(${cli} transaction build \
--change-address ${sender_address} \
--tx-in ${HEXTXIN} \
--tx-out="${token_to_be_traded}" \
--testnet-magic 1097911063)
--testnet-magic ${testnet_magic})

IFS=':' read -ra VALUE <<< "${FEE}"
IFS=' ' read -ra FEE <<< "${VALUE[1]}"
Expand All @@ -58,11 +58,11 @@ ${cli} transaction sign \
--signing-key-file wallets/seller-wallet/payment.skey \
--tx-body-file tmp/tx.draft \
--out-file tmp/tx.signed \
--testnet-magic 1097911063
--testnet-magic ${testnet_magic}
#
# exit
#
echo -e "\033[0;36m Submitting \033[0m"
${cli} transaction submit \
--testnet-magic 1097911063 \
--testnet-magic ${testnet_magic} \
--tx-file tmp/tx.signed
Loading