Skip to content

Commit

Permalink
add script for setting up staging artifacts
Browse files Browse the repository at this point in the history
  • Loading branch information
aalu1418 committed Feb 22, 2022
1 parent f3fb978 commit bd541a1
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 9 deletions.
11 changes: 11 additions & 0 deletions gauntlet/packages/gauntlet-solana-contracts/networks/.env.staging
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion ops/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
18 changes: 18 additions & 0 deletions scripts/lib.sh
Original file line number Diff line number Diff line change
@@ -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 ..
}
12 changes: 4 additions & 8 deletions scripts/setup-local-artifacts.sh → scripts/setup-local.sh
Original file line number Diff line number Diff line change
@@ -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
Expand Down
11 changes: 11 additions & 0 deletions scripts/setup-staging.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit bd541a1

Please sign in to comment.