-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
30 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,35 @@ | ||
guard-%: | ||
@ if [ "${${*}}" = "" ]; then echo "Environment variable $* not set" && exit 1; fi | ||
|
||
.PHONY: bindings | ||
bindings: | ||
go install github.com/ethereum/go-ethereum/cmd/[email protected] | ||
forge clean && forge build --extra-output-files abi | ||
mkdir -p bindings | ||
abigen --abi out/OutputOracle.sol/OutputOracle.abi.json --pkg bindings --type OutputOracle --out bindings/output_oracle.go | ||
abigen --abi out/Portal.sol/Portal.abi.json --pkg bindings --type Portal --out bindings/portal.go | ||
abigen --abi out/DeployChain.sol/DeployChain.abi.json --pkg bindings --type DeployChain --out bindings/deploy_chain.go | ||
|
||
.PHONY: deploy | ||
deploy: guard-IMPL_SALT guard-DEPLOY_CONFIG_PATH guard-DEPLOY_PRIVATE_KEY guard-RPC_URL | ||
@forge script DeploySystem --sig deploy --rpc-url $(RPC_URL) \ | ||
--private-key $(DEPLOY_PRIVATE_KEY) --broadcast | ||
|
||
.PHONY: testnet guard-L1_URL guard-DEPLOY_PRIVATE_KEY | ||
testnet: | ||
DEPLOY_CHAIN_ADDRESS=${DEPLOY_CHAIN_ADDRESS:-$(jq -r ".DeployChain" deployments/84532-deploy.json)} \ | ||
go run ./testnet | ||
|
||
.PHONY: verify | ||
verify: | ||
deploy=broadcast/DeploySystem.s.sol/84532/deploy-latest.json; \ | ||
addresses=$$(jq -r '.transactions[] | select(.transactionType=="CREATE" or .transactionType=="CREATE2") | .contractAddress' $$deploy); \ | ||
for address in $$addresses; do \ | ||
name=$$(jq -r --arg address "$$address" '.transactions[] | select((.transactionType=="CREATE" or .transactionType=="CREATE2") and .contractAddress==$$address) | .contractName' $$deploy); \ | ||
arguments=$$(jq -r --arg address "$$address" '.transactions[] | select((.transactionType=="CREATE" or .transactionType=="CREATE2") and .contractAddress==$$address) | .arguments // [] | join(" ")' $$deploy); \ | ||
constructor=$$(jq '.[] | select(.type=="constructor")' out/$$name.sol/$$name.abi.json | jq -r '.inputs | map(.type) | join(",")'); \ | ||
echo "Verifying $$name @ $$address using constructor($$constructor) $$arguments"; \ | ||
constructor_args=$$(cast abi-encode "constructor($$constructor)" $$arguments); \ | ||
forge verify-contract --watch --verifier-url https://api-sepolia.basescan.org/api --constructor-args $$constructor_args $$address $$name ; \ | ||
done | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters