-
Notifications
You must be signed in to change notification settings - Fork 7
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
19 additions
and
14 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
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 |
---|---|---|
|
@@ -3,10 +3,10 @@ guard-%: | |
|
||
define abigen | ||
echo "Generating bindings for $(1)" | ||
cp out/$(1).sol/$(1).$(3).json out/$(1).sol/$(1).json 2>/dev/null || true | ||
jq -r '.bytecode.object' out/$(1).sol/$(1).json > out/$(1).sol/$(1).bin | ||
jq -r '.abi' out/$(1).sol/$(1).json > out/$(1).sol/$(1).abi | ||
abigen --abi out/$(1).sol/$(1).abi --bin out/$(1).sol/$(1).bin --pkg bindings --type $(1) --out bindings/$(2).go | ||
cp contracts/out/$(1).sol/$(1).$(3).json contracts/out/$(1).sol/$(1).json 2>/dev/null || true | ||
jq -r '.bytecode.object' contracts/out/$(1).sol/$(1).json > contracts/out/$(1).sol/$(1).bin | ||
jq -r '.abi' contracts/out/$(1).sol/$(1).json > contracts/out/$(1).sol/$(1).abi | ||
abigen --abi contracts/out/$(1).sol/$(1).abi --bin contracts/out/$(1).sol/$(1).bin --pkg bindings --type $(1) --out bindings/$(2).go | ||
endef | ||
|
||
define verify | ||
|
@@ -17,18 +17,20 @@ define verify | |
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); \ | ||
namewithoutversion=$${name%.*.*.*}; \ | ||
constructor=$$(jq '.abi[] | select(.type=="constructor")' out/$$namewithoutversion.sol/$$name.json | jq -r '.inputs | map(.type) | join(",")'); \ | ||
constructor=$$(jq '.abi[] | select(.type=="constructor")' contracts/out/$$namewithoutversion.sol/$$name.json | jq -r '.inputs | map(.type) | join(",")'); \ | ||
echo; \ | ||
echo "Verifying $$namewithoutversion @ $$address using constructor($$constructor) $$arguments"; \ | ||
constructor_args=$$(cast abi-encode "constructor($$constructor)" $$arguments); \ | ||
forge verify-contract --compiler-version $$version --watch --verifier-url https://api-sepolia.basescan.org/api --constructor-args $$constructor_args $$address $$namewithoutversion ; \ | ||
cd contracts; \ | ||
forge verify-contract --compiler-version $$version --watch --verifier-url https://api-sepolia.basescan.org/api --constructor-args $$constructor_args $$address $$namewithoutversion; \ | ||
cd ..; \ | ||
done | ||
endef | ||
|
||
.PHONY: bindings | ||
bindings: | ||
go install github.com/ethereum/go-ethereum/cmd/[email protected] | ||
forge build | ||
cd contracts && forge build | ||
mkdir -p bindings | ||
@$(call abigen,"OutputOracle","output_oracle","0.8.15") | ||
@$(call abigen,"Portal","portal","0.8.15") | ||
|
@@ -39,26 +41,26 @@ bindings: | |
|
||
.PHONY: deploy-cert-manager | ||
deploy-cert-manager: guard-IMPL_SALT guard-DEPLOY_PRIVATE_KEY guard-RPC_URL | ||
@forge script DeployCertManager --rpc-url $(RPC_URL) \ | ||
@cd contracts && forge script DeployCertManager --rpc-url $(RPC_URL) \ | ||
--private-key $(DEPLOY_PRIVATE_KEY) --broadcast | ||
|
||
.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) \ | ||
@cd contracts && forge script DeploySystem --sig deploy --rpc-url $(RPC_URL) \ | ||
--private-key $(DEPLOY_PRIVATE_KEY) --broadcast | ||
|
||
.PHONY: deploy-deploy-chain | ||
deploy-deploy-chain: guard-IMPL_SALT guard-DEPLOY_PRIVATE_KEY guard-RPC_URL | ||
@forge script DeployDeployChain --rpc-url $(RPC_URL) \ | ||
@cd contracts && forge script DeployDeployChain --rpc-url $(RPC_URL) \ | ||
--private-key $(DEPLOY_PRIVATE_KEY) --broadcast | ||
|
||
.PHONY: testnet | ||
testnet: guard-L1_URL guard-DEPLOY_PRIVATE_KEY | ||
DEPLOY_CHAIN_ADDRESS=$${DEPLOY_CHAIN_ADDRESS:-$$(jq -r ".DeployChain" deployments/84532-deploy.json)} \ | ||
DEPLOY_CHAIN_ADDRESS=$${DEPLOY_CHAIN_ADDRESS:-$$(jq -r ".DeployChain" contracts/deployments/84532-deploy.json)} \ | ||
go run ./testnet | ||
|
||
.PHONY: verify | ||
verify: | ||
@$(call verify,"broadcast/DeployCertManager.s.sol/84532/run-1733890597.json","0.8.24") | ||
@$(call verify,"broadcast/DeploySystem.s.sol/84532/run-1733867021.json","0.8.15") | ||
@$(call verify,"broadcast/DeployDeployChain.s.sol/84532/run-1733884066.json","0.8.15") | ||
@$(call verify,"contracts/broadcast/DeployCertManager.s.sol/84532/run-1733890597.json","0.8.24") | ||
@$(call verify,"contracts/broadcast/DeploySystem.s.sol/84532/run-1733867021.json","0.8.15") | ||
@$(call verify,"contracts/broadcast/DeployDeployChain.s.sol/84532/run-1733884066.json","0.8.15") |