Skip to content

Commit

Permalink
build: add helper scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
ChiTimesChi committed Aug 2, 2024
1 parent 8324cb3 commit ff620c8
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 7 deletions.
33 changes: 33 additions & 0 deletions script/rfq/BrickFastBridgeRouter.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.17;

import {FastBridgeRouter} from "../../contracts/rfq/FastBridgeRouter.sol";

import {BasicSynapseScript} from "../templates/BasicSynapse.s.sol";

contract BrickFastBridgeRouter is BasicSynapseScript {
FastBridgeRouter public router;

function setUp() internal override {
super.setUp();
address payable routerDeployment = payable(getDeploymentAddress("FastBridgeRouter"));
router = FastBridgeRouter(routerDeployment);
}

function run() external {
// Setup the BasicSynapseScript
setUp();
vm.startBroadcast();
brickFastBridgeRouter();
vm.stopBroadcast();
}

function brickFastBridgeRouter() internal {
if (router.fastBridge() != address(0)) {
router.setFastBridge(address(0));
printLog(string.concat(unicode"✅ Fast bridge set to zero"));
} else {
printLog(string.concat(unicode"🟡 Skipping: Fast bridge is already set to zero"));
}
}
}
14 changes: 7 additions & 7 deletions script/rfq-run.sh → script/rfq/rfq-cmd.sh
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
#!/usr/bin/env bash
# This script runs an RFQ script for all chains with FastBridge deployment
# Usage: ./script/rfq-run.sh pathToScript <args...>
# - ./script/run.sh pathToScript chain <args...> will be run for all RFQ chains
# Usage: ./script/rfq-cmd.sh "<command>" <args..>
# - <command> chain <args...> will be run for all RFQ chains

# Colors
RED="\033[0;31m"
NC="\033[0m" # No Color

scriptFN=$1
command=$1
# Get the rest of the args
shift 1
# Check that all required args exist
if [ -z "$scriptFN" ]; then
echo -e "${RED}Usage: ./script/rfq-run.sh pathToScript <args...>${NC}"
if [ -z "$command" ]; then
echo -e "${RED}Usage: ./script/rfq-cmd.sh <command> <args...>${NC}"
exit 1
fi

Expand All @@ -22,8 +22,8 @@ fastBridgeDeployments=$(find ./deployments -name FastBridge.json)
chainNames=$(echo "$fastBridgeDeployments" | sed 's/.*\/\(.*\)\/FastBridge.json/\1/' | sort)
# Print the comma separated list of chain aliases, don't put a comma after the last one
chainNamesFormatted=$(echo "$chainNames" | sed ':a;N;$!ba;s/\n/, /g')
echo "Running script $scriptFN for chains: [$chainNamesFormatted]"
echo "Running $command for chains: [$chainNamesFormatted]"

for chainName in $chainNames; do
./script/run.sh "$scriptFN" "$chainName" "$@"
$command "$chainName" "$@"
done
19 changes: 19 additions & 0 deletions script/rfq/rfq-run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env bash
# This script runs an RFQ script for all chains with FastBridge deployment
# Usage: ./script/rfq-run.sh pathToScript <args...>
# - ./script/run.sh pathToScript chain <args...> will be run for all RFQ chains

# Colors
RED="\033[0;31m"
NC="\033[0m" # No Color

scriptFN=$1
# Get the rest of the args
shift 1
# Check that all required args exist
if [ -z "$scriptFN" ]; then
echo -e "${RED}Usage: ./script/rfq-run.sh pathToScript <args...>${NC}"
exit 1
fi

./script/rfq/rfq-cmd.sh "./script/run.sh $scriptFN" "$@"

0 comments on commit ff620c8

Please sign in to comment.