diff --git a/README.md b/README.md index 4e5732d..3a7a8b0 100644 --- a/README.md +++ b/README.md @@ -15,22 +15,19 @@ 1. prepare your env_file ``` - ETHERSCAN_ARBITRUM_KEY=... - ETHERSCAN_PANGOLIN_KEY=... - PRIVATE_KEY=0x... + # this is the private key you used to deploy oracle and relayer contracts + PRIVATE_KEY=... ``` 2. run command: ```bash docker run --rm \ - --env-file /path/to/env_file - -it ghcr.io/dcdao/oracle-relayer:v0.1.0 \ - "" \ - "" # this is the address you used to run ormpipe + --env-file /path/to/env_file \ + -it ghcr.io/dcdao/oracle-relayer:v0.1.x \ + "" # this is the address you used to send transaction in ormpipe ``` Note: -1. `DEPLOY_ADDRESS` is the address of `PRIVATE_KEY`. -2. `YOUR_RELAYER_ADDRESS` should have enough gas fee on all chains. Currently, `arbitrum-goerli` and `pangolin` are supported. +* `PRIVATE_KEY` should have enough gas fee on all chains. Currently, `arbitrum-goerli` and `pangolin` are supported. diff --git a/bin/run.sh b/bin/run.sh index f27678c..e767d26 100755 --- a/bin/run.sh +++ b/bin/run.sh @@ -1,24 +1,26 @@ #!/bin/bash # how to use: -# source ./bin/run.sh +# source ./bin/run.sh set -eo pipefail # 检查参数数量 -if [ "$#" -ne 2 ]; then - echo "Usage: $0 " - exit 1 +if [ "$#" -ne 1 ]; then + echo "Usage: $0 " + exit 1 fi -DEPLOY_ADDRESS=$1 -RELAYER_ADDRESS=$2 +DEPLOY_ADDRESS=$(cast wallet address $PRIVATE_KEY) +RELAY_ADDRESS=$1 # 编译 forge build # 调用salt.sh并将结果存储到一个变量中 -echo "Generate oracle and relayer address..." +echo "++++++++++++++++++++++++++++++++++++++++++++++++" +echo "+ Generate oracle and relayer addresses." +echo "++++++++++++++++++++++++++++++++++++++++++++++++" OUTPUT=$(./bin/salt.sh $DEPLOY_ADDRESS) # 使用正则表达式解析结果 @@ -28,11 +30,15 @@ RELAYER_ADDR=$(echo "$OUTPUT" | grep "Relayer:" -A 1 | grep "Address:" | awk '{p RELAYER_SALT=$(echo "$OUTPUT" | grep "Relayer:" -A 2 | grep "Salt:" | awk '{print $2}') # 打印结果 -echo " Oracle Address : $ORACLE_ADDR" -echo " Oracle Salt : $ORACLE_SALT" -echo " Relayer Address : $RELAYER_ADDR" -echo " Relayer Salt : $RELAYER_SALT" +echo "Oracle Address : $ORACLE_ADDR" +echo "Oracle Salt : $ORACLE_SALT" +echo "Relayer Address : $RELAYER_ADDR" +echo "Relayer Salt : $RELAYER_SALT" +echo "" +echo "++++++++++++++++++++++++++++++++++++++++++++++++" +echo "+ Modify Deploy.s.sol and deploy.c.json." +echo "++++++++++++++++++++++++++++++++++++++++++++++++" # 替换Deploy.s.sol文件中的内容 sed -i "s/address immutable ORACLE_ADDR = .*/address immutable ORACLE_ADDR = $ORACLE_ADDR;/g" ./script/Deploy.s.sol sed -i "s/bytes32 immutable ORACLE_SALT = .*/bytes32 immutable ORACLE_SALT = $ORACLE_SALT;/g" ./script/Deploy.s.sol @@ -44,19 +50,27 @@ echo "File Deploy.s.sol has been modified successfully." # 替换deploy.c.json文件中的内容 sed -i 's/"DAO":.*/"DAO": "'$DEPLOY_ADDRESS'",/' ./script/input/43/deploy.c.json sed -i 's/"DEPLOYER":.*/"DEPLOYER": "'$DEPLOY_ADDRESS'",/' ./script/input/43/deploy.c.json -sed -i 's/"ORACLE_OPERATOR":.*/"ORACLE_OPERATOR": "'$RELAYER_ADDRESS'",/' ./script/input/43/deploy.c.json -sed -i 's/"RELAYER_OPERATOR":.*/"RELAYER_OPERATOR": "'$RELAYER_ADDRESS'"/' ./script/input/43/deploy.c.json +sed -i 's/"ORACLE_OPERATOR":.*/"ORACLE_OPERATOR": "'$RELAY_ADDRESS'",/' ./script/input/43/deploy.c.json +sed -i 's/"RELAYER_OPERATOR":.*/"RELAYER_OPERATOR": "'$RELAY_ADDRESS'"/' ./script/input/43/deploy.c.json sed -i 's/"DAO":.*/"DAO": "'$DEPLOY_ADDRESS'",/' ./script/input/421613/deploy.c.json sed -i 's/"DEPLOYER":.*/"DEPLOYER": "'$DEPLOY_ADDRESS'",/' ./script/input/421613/deploy.c.json -sed -i 's/"ORACLE_OPERATOR":.*/"ORACLE_OPERATOR": "'$RELAYER_ADDRESS'",/' ./script/input/421613/deploy.c.json -sed -i 's/"RELAYER_OPERATOR":.*/"RELAYER_OPERATOR": "'$RELAYER_ADDRESS'"/' ./script/input/421613/deploy.c.json +sed -i 's/"ORACLE_OPERATOR":.*/"ORACLE_OPERATOR": "'$RELAY_ADDRESS'",/' ./script/input/421613/deploy.c.json +sed -i 's/"RELAYER_OPERATOR":.*/"RELAYER_OPERATOR": "'$RELAY_ADDRESS'"/' ./script/input/421613/deploy.c.json echo "File deploy.c.json has been modified successfully." # 部署 -echo "Deploying..." +echo "" +echo "++++++++++++++++++++++++++++++++++++++++++++++++" +echo "+ Deploy: arbitrum oracle and relayer contracts." +echo "++++++++++++++++++++++++++++++++++++++++++++++++" forge script ./script/Deploy.s.sol:DeployScript --private-key $PRIVATE_KEY --chain-id 421613 --broadcast --verify + +echo "" +echo "++++++++++++++++++++++++++++++++++++++++++++++++" +echo "+ Deploy: pangolin oracle and relayer contracts." +echo "++++++++++++++++++++++++++++++++++++++++++++++++" forge script ./script/Deploy.s.sol:DeployScript --private-key $PRIVATE_KEY --chain-id 43 --broadcast --verify echo "Deployed successfully."