Skip to content

Commit

Permalink
Add a simple script to do the deployment itself
Browse files Browse the repository at this point in the history
  • Loading branch information
hayesgm committed Mar 16, 2024
1 parent 375ccef commit 3b70f75
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 2 deletions.
2 changes: 1 addition & 1 deletion foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ out = 'out'
libs = ['lib']
fs_permissions = [
{ access = "read", path = "./out"},
{ access = "read", path = "./release"}
{ access = "read", path = "./.release-tmp"}
]

# See more config options https://github.com/foundry-rs/foundry/tree/master/config
2 changes: 1 addition & 1 deletion script/Sleuth.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ contract Deploy is Script {
function setUp() public {}

function run() public returns (address) {
bytes memory sleuthCreationCode = vm.getCode("release/Sleuth.json");
bytes memory sleuthCreationCode = vm.getCode("./.release-tmp/Sleuth.json");
CodeJar codeJar = CodeJar(vm.envAddress("CODE_JAR"));
address expectedSleuthAddress = vm.envAddress("SLEUTH_ADDRESS");
address sleuthAddress = codeJar.saveCode(sleuthCreationCode);
Expand Down
36 changes: 36 additions & 0 deletions script/deploy-release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/bash

set -eo pipefail

tag="$1"

if [ -z "$tag" ]; then
echo "usage script/deploy-release.sh <tag>"
exit 1
fi

rm -rf .release-tmp
mkdir .release-tmp

curl -L "https://github.com/compound-finance/sleuth/releases/download/$tag/Sleuth.json" -o ./.release-tmp/Sleuth.json
curl -L "https://github.com/compound-finance/sleuth/releases/download/$tag/contracts.json" -o ./.release-tmp/contracts.json

if [ -z "$RPC_URL" ]; then
echo "Missing RPC_URL env var"
exit 1
fi

if ! command -v jq &> /dev/null; then
echo "jq could not be found"
exit 1
fi

export SLEUTH_ADDRESS="$(cat ./.release-tmp/contracts.json | jq -r '.sleuth')"
export CODE_JAR="$(cat ./.release-tmp/contracts.json | jq -r '.codeJar')"

forge script \
--rpc-url="$RPC_URL" \
script/Sleuth.s.sol:Deploy \
$@

# TODO: Verify

0 comments on commit 3b70f75

Please sign in to comment.