Skip to content

Commit

Permalink
make filepaths relative
Browse files Browse the repository at this point in the history
  • Loading branch information
aalu1418 committed Feb 22, 2022
1 parent bd541a1 commit 0cfea04
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 20 deletions.
10 changes: 5 additions & 5 deletions scripts/lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ function modify_program {
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
sed -i "s/DzzjdPWNfwHZmzPVxnmqkkMJraYQQRCpgFZajqkqmU6G/$ac/" "${BASH_SOURCE%/*}/../contracts/programs/access-controller/src/lib.rs"
sed -i "s/HW3ipKzeeduJq6f1NqRCw4doknMeWkfrM4WxobtG3o5v/$ocr2/" "${BASH_SOURCE%/*}/../contracts/programs/ocr2/src/lib.rs"
sed -i "s/CaH12fwNTKJAG8PxEvo9R96Zc2j8qNHZaFj8ZW49yZNT/$store/" "${BASH_SOURCE%/*}/../contracts/programs/store/src/lib.rs"
}

function build {
cd contracts
cd "${BASH_SOURCE%/*}/../contracts"
anchor build
cd ..
cd $1
}
21 changes: 11 additions & 10 deletions scripts/setup-local.sh
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
#!/usr/bin/env bash

set -e
source ./scripts/lib.sh
set -euxo pipefail
source "${BASH_SOURCE%/*}/lib.sh"

ACCESS_CONTROLLER_PROGRAM_ID=$(<./contracts/artifacts/localnet/access_controller-keypair.pub)
OCR2_PROGRAM_ID=$(<./contracts/artifacts/localnet/ocr2-keypair.pub)
STORE_PROGRAM_ID=$(<./contracts/artifacts/localnet/store-keypair.pub)
ACCESS_CONTROLLER_PROGRAM_ID=$(<"${BASH_SOURCE%/*}/../contracts/artifacts/localnet/access_controller-keypair.pub")
OCR2_PROGRAM_ID=$(<"${BASH_SOURCE%/*}/../contracts/artifacts/localnet/ocr2-keypair.pub")
STORE_PROGRAM_ID=$(<"${BASH_SOURCE%/*}/../contracts/artifacts/localnet/store-keypair.pub")

modify_program $ACCESS_CONTROLLER_PROGRAM_ID $OCR2_PROGRAM_ID $STORE_PROGRAM_ID

# build artifacts
build
build ${PWD%/}

# copy build artifacts
mkdir -p ./gauntlet/packages/gauntlet-solana-contracts/artifacts/bin
cp ./contracts/target/deploy/*.so ./gauntlet/packages/gauntlet-solana-contracts/artifacts/bin
mkdir -p "${BASH_SOURCE%/*}/../gauntlet/packages/gauntlet-solana-contracts/artifacts/bin"
echo $PWD
cp ${BASH_SOURCE%/*}/../contracts/target/deploy/*.so "${BASH_SOURCE%/*}/../gauntlet/packages/gauntlet-solana-contracts/artifacts/bin"

# copy keypairs
mkdir -p ./gauntlet/packages/gauntlet-solana-contracts/artifacts/programId
mkdir -p "${BASH_SOURCE%/*}/../gauntlet/packages/gauntlet-solana-contracts/artifacts/programId"
programs=("access_controller" "store" "ocr2")
for t in ${programs[@]}; do
cp "./contracts/artifacts/localnet/$t-keypair.json" ./gauntlet/packages/gauntlet-solana-contracts/artifacts/programId/$t.json
cp "${BASH_SOURCE%/*}/../contracts/artifacts/localnet/$t-keypair.json" "${BASH_SOURCE%/*}/../gauntlet/packages/gauntlet-solana-contracts/artifacts/programId/$t.json"
done
9 changes: 4 additions & 5 deletions scripts/setup-staging.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
#!/usr/bin/env bash

# note call from repo root
set -e
source ./scripts/lib.sh
source ./gauntlet/packages/gauntlet-solana-contracts/networks/.env.staging
set -euxo pipefail
source "${BASH_SOURCE%/*}/lib.sh"
source "${BASH_SOURCE%/*}/../gauntlet/packages/gauntlet-solana-contracts/networks/.env.staging"

modify_program $PROGRAM_ID_ACCESS_CONTROLLER $PROGRAM_ID_OCR2 $PROGRAM_ID_STORE

# build artifacts
build
build ${PWD%/}

0 comments on commit 0cfea04

Please sign in to comment.