-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathenable-transfers.sh
More file actions
executable file
·29 lines (22 loc) · 1.21 KB
/
enable-transfers.sh
File metadata and controls
executable file
·29 lines (22 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/env bash
# enables transfers between one chain and another, and maps
# the token address between the two chains
set -euo pipefail
if [ "$#" -ne "2" ]; then
echo "Usage: $0 <src-chain-id> <dest-chain-id>"
exit 1
fi
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PRIVATE_KEY="0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80"
# this export is a weird quirk that forge needs
export PRIVATE_KEY="$PRIVATE_KEY"
RPC_URL=http://127.0.0.1:$1
RUSD_ADDRESS=$(jq -r '.transactions | .[] | select(.contractName=="ERC20FaucetToken") | .contractAddress' $SCRIPT_DIR/onlyswaps-solidity/broadcast/DeployAllContracts.s.sol/$1/run-latest.json)
ROUTER_ADDRESS=$(jq -r '.transactions | .[] | select(.contractName=="UUPSProxy") | .contractAddress' $SCRIPT_DIR/onlyswaps-solidity/broadcast/DeployAllContracts.s.sol/$1/run-latest.json | head -n1)
export ROUTER_SRC_ADDRESS="$ROUTER_ADDRESS"
export ERC20_SRC_ADDRESS="$RUSD_ADDRESS"
export ERC20_DST_ADDRESS="$RUSD_ADDRESS"
export DST_CHAIN_ID="$2"
pushd onlyswaps-solidity
echo "[+] configuring Router for $1"
forge script script/onlyswaps/utils/ConfigureRouterScript.s.sol:ConfigureRouterScript --broadcast --rpc-url $RPC_URL --private-key $PRIVATE_KEY --force