From 024d68e0b355cfe72c214428626410cc43dca366 Mon Sep 17 00:00:00 2001 From: Kaloyan Gangov <6922910+gangov@users.noreply.github.com> Date: Fri, 6 Sep 2024 16:37:35 +0300 Subject: [PATCH 1/2] deploy script --- scripts/deploy.sh | 82 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100755 scripts/deploy.sh diff --git a/scripts/deploy.sh b/scripts/deploy.sh new file mode 100755 index 00000000..089800ad --- /dev/null +++ b/scripts/deploy.sh @@ -0,0 +1,82 @@ +# Ensure the script exits on any errors +set -e + +# Check if the argument is provided +if [ -z "$1" ]; then + echo "Usage: $0 " + exit 1 +fi + +IDENTITY_STRING=$1 +NETWORK="testnet" + +echo "Build and optimize the contracts..."; +echo "Building the contracts..."; + +make build > /dev/null +cd target/wasm32-unknown-unknown/release + +echo "Contracts compiled." +echo "Optimizing contracts..." + +soroban contract optimize --wasm phoenix_nft_collections.wasm +soroban contract optimize --wasm phoenix_nft_deployer.wasm + +echo "Contracts optimized." + +echo "Deploy and install the deployer contract and capture its contract ID and hash..." + +DEPLOYER_ADDR=$( +stellar contract deploy \ + --wasm phoenix_nft_deployer.optimized.wasm \ + --source $IDENTITY_STRING \ + --network $NETWORK +) + +DEPLOYER_WASM_HASH=$( +soroban contract install \ + --wasm phoenix_nft_deployer.optimized.wasm \ + --source $IDENTITY_STRING \ + --network $NETWORK +) + +echo "Deployer set." + +echo "Deploy and install the collections contract and capture its contract ID and hash..." + +COLLECTIONS_ADDR=$( +stellar contract deploy \ + --wasm phoenix_nft_collections.optimized.wasm \ + --source $IDENTITY_STRING \ + --network $NETWORK +) + +COLLECTIONS_WASM_HASH=$( +soroban contract install \ + --wasm phoenix_nft_collections.optimized.wasm \ + --source $IDENTITY_STRING \ + --network $NETWORK +) + +echo "Collections set." + +echo "Initialize deployer with the collections hash..." + + +soroban contract invoke \ + --id $DEPLOYER_ADDR \ + --source $IDENTITY_STRING \ + --network $NETWORK \ + -- \ + initialize \ + --collections_wasm_hash $COLLECTIONS_WASM_HASH + +echo "Deployer initialized." + +echo "#############################" + +echo "Setup complete!" +echo "Deployer address: $DEPLOYER_ADDR" +echo "Deployer wasm hash: $DEPLOYER_WASM_HASH" +echo "Collections address: $COLLECTIONS_ADDR" +echo "Collections wasm hash: $COLLECTIONS_WASM_HASH" From b2e89e8d76320920d0dc76223b0c690f16b782a5 Mon Sep 17 00:00:00 2001 From: Kaloyan Gangov <6922910+gangov@users.noreply.github.com> Date: Thu, 12 Sep 2024 11:24:07 +0300 Subject: [PATCH 2/2] adds auction to the deployer script --- scripts/deploy.sh | 44 +++++++++++++++++++++++++++++++++++++++----- 1 file changed, 39 insertions(+), 5 deletions(-) diff --git a/scripts/deploy.sh b/scripts/deploy.sh index 089800ad..dcb84ff5 100755 --- a/scripts/deploy.sh +++ b/scripts/deploy.sh @@ -1,13 +1,15 @@ # Ensure the script exits on any errors set -e -# Check if the argument is provided -if [ -z "$1" ]; then - echo "Usage: $0 " +# Check if the arguments are provided +if [ $# -ne 3 ]; then + echo "Usage: $0 " exit 1 fi IDENTITY_STRING=$1 +ADMIN_ADDR=$2 +AUCTION_TOKEN_ADDR=$3 NETWORK="testnet" echo "Build and optimize the contracts..."; @@ -21,6 +23,7 @@ echo "Optimizing contracts..." soroban contract optimize --wasm phoenix_nft_collections.wasm soroban contract optimize --wasm phoenix_nft_deployer.wasm +soroban contract optimize --wasm phoenix_nft_auctions.wasm echo "Contracts optimized." @@ -40,7 +43,7 @@ soroban contract install \ --network $NETWORK ) -echo "Deployer set." +echo "Deployer contract deployed and installed." echo "Deploy and install the collections contract and capture its contract ID and hash..." @@ -58,7 +61,25 @@ soroban contract install \ --network $NETWORK ) -echo "Collections set." +echo "Collections contract deployed and installed." + +echo "Deploy and install the collections contract and capture its contract ID and hash..." + +AUCTION_ADDR=$( +stellar contract deploy \ + --wasm phoenix_nft_auctions.optimized.wasm \ + --source $IDENTITY_STRING \ + --network $NETWORK +) + +AUCTION_WASM_HASH=$( +soroban contract install \ + --wasm phoenix_nft_auctions.optimized.wasm \ + --source $IDENTITY_STRING \ + --network $NETWORK +) + +echo "Auctions contract deployed and installed." echo "Initialize deployer with the collections hash..." @@ -73,6 +94,19 @@ soroban contract invoke \ echo "Deployer initialized." +echo "Initialize auctions with the auction token address" + +soroban contract invoke \ + --id $AUCTION_ADDR \ + --source $IDENTITY_STRING \ + --network $NETWORK \ + -- \ + initialize \ + --admin $ADMIN_ADDR + --auction_token $AUCTION_TOKEN_ADDR + +echo "Auction initialized" + echo "#############################" echo "Setup complete!"