diff --git a/gauntlet/packages/gauntlet-solana-contracts/networks/.env.staging b/gauntlet/packages/gauntlet-solana-contracts/networks/.env.staging new file mode 100644 index 000000000..96ded0826 --- /dev/null +++ b/gauntlet/packages/gauntlet-solana-contracts/networks/.env.staging @@ -0,0 +1,11 @@ +NODE_URL=https://api.devnet.solana.com + +PROGRAM_ID_OCR2=STGhiM1ZaLjDLZDGcVFp3ppdetggLAs6MXezw5DXXH3 +PROGRAM_ID_ACCESS_CONTROLLER=STGsNB3u63hnBqJsL69HFjA9TTBRxovKfV4N9x9KzR6 +PROGRAM_ID_STORE=STGxAk2tuSMv7iwt2vRRuijRp1ageiRcwrjhdPBsAXn + +LINK=4bZeE4RQ5N2HFUU18p6R2Xcdv3yvgGSTJ5VKKtvNqm8C + +BILLING_ACCESS_CONTROLLER=CBWXiwPGX6ykWtPGXp4cuFJP53SW81pe9q1YfUASWC46 +REQUESTER_ACCESS_CONTROLLER=5vkHdxPiTyfY5VdRpPu8tNTpeik6Cy93M6GzztMPWfAk +LOWERING_ACCESS_CONTROLLER=CBWXiwPGX6ykWtPGXp4cuFJP53SW81pe9q1YfUASWC46 diff --git a/ops/README.md b/ops/README.md index ce0222c89..58915c471 100644 --- a/ops/README.md +++ b/ops/README.md @@ -37,7 +37,7 @@ From the root of the repo, use the following commands to use localnet keys in th ./scripts/anchor-shell.sh # build artifacts and copy -./scripts/setup-local-artifacts.sh +./scripts/setup-local.sh ``` Start up the solana test validator (recommend always using `-r` for a clean slate, runs into deployment issues otherwise) diff --git a/scripts/lib.sh b/scripts/lib.sh new file mode 100644 index 000000000..0adfa67db --- /dev/null +++ b/scripts/lib.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env bash + +function modify_program { + ac=$1 + ocr2=$2 + store=$3 + + # Replace existing declare_id!() + sed -i "s/DzzjdPWNfwHZmzPVxnmqkkMJraYQQRCpgFZajqkqmU6G/$ac/" contracts/programs/access-controller/src/lib.rs + sed -i "s/HW3ipKzeeduJq6f1NqRCw4doknMeWkfrM4WxobtG3o5v/$ocr2/" contracts/programs/ocr2/src/lib.rs + sed -i "s/CaH12fwNTKJAG8PxEvo9R96Zc2j8qNHZaFj8ZW49yZNT/$store/" contracts/programs/store/src/lib.rs +} + +function build { + cd contracts + anchor build + cd .. +} diff --git a/scripts/setup-local-artifacts.sh b/scripts/setup-local.sh similarity index 64% rename from scripts/setup-local-artifacts.sh rename to scripts/setup-local.sh index 8e091fd73..0d0326574 100755 --- a/scripts/setup-local-artifacts.sh +++ b/scripts/setup-local.sh @@ -1,20 +1,16 @@ #!/usr/bin/env bash set -e +source ./scripts/lib.sh ACCESS_CONTROLLER_PROGRAM_ID=$(<./contracts/artifacts/localnet/access_controller-keypair.pub) -STORE_PROGRAM_ID=$(<./contracts/artifacts/localnet/store-keypair.pub) OCR2_PROGRAM_ID=$(<./contracts/artifacts/localnet/ocr2-keypair.pub) +STORE_PROGRAM_ID=$(<./contracts/artifacts/localnet/store-keypair.pub) -# Replace existing declare_id!() -sed -i "s/DzzjdPWNfwHZmzPVxnmqkkMJraYQQRCpgFZajqkqmU6G/$ACCESS_CONTROLLER_PROGRAM_ID/" contracts/programs/access-controller/src/lib.rs -sed -i "s/CaH12fwNTKJAG8PxEvo9R96Zc2j8qNHZaFj8ZW49yZNT/$STORE_PROGRAM_ID/" contracts/programs/store/src/lib.rs -sed -i "s/HW3ipKzeeduJq6f1NqRCw4doknMeWkfrM4WxobtG3o5v/$OCR2_PROGRAM_ID/" contracts/programs/ocr2/src/lib.rs +modify_program $ACCESS_CONTROLLER_PROGRAM_ID $OCR2_PROGRAM_ID $STORE_PROGRAM_ID # build artifacts -cd contracts -anchor build -cd .. +build # copy build artifacts mkdir -p ./gauntlet/packages/gauntlet-solana-contracts/artifacts/bin diff --git a/scripts/setup-staging.sh b/scripts/setup-staging.sh new file mode 100755 index 000000000..2fa6e0fe4 --- /dev/null +++ b/scripts/setup-staging.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +# note call from repo root +set -e +source ./scripts/lib.sh +source ./gauntlet/packages/gauntlet-solana-contracts/networks/.env.staging + +modify_program $PROGRAM_ID_ACCESS_CONTROLLER $PROGRAM_ID_OCR2 $PROGRAM_ID_STORE + +# build artifacts +build