Skip to content

Update Makefile #292

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 29 additions & 19 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,21 +1,26 @@
# Define project directories based on network and date
PROJECT_DIR = $(network)/$(shell date +'%Y-%m-%d')-$(task)
DEPLOY_DIR = $(network)/$(shell date +'%Y-%m-%d')-deploy
INCIDENT_DIR = $(network)/$(shell date +'%Y-%m-%d')-$(incident)
GAS_INCREASE_DIR = $(network)/$(shell date +'%Y-%m-%d')-increase-gas-limit
FAULT_PROOF_UPGRADE_DIR = $(network)/$(shell date +'%Y-%m-%d')-upgrade-fault-proofs
SAFE_MANAGEMENT_DIR = $(network)/$(shell date +'%Y-%m-%d')-safe-swap-owner

# Template directories
TEMPLATE_GENERIC = setup-templates/template-generic
TEMPLATE_DEPLOY = setup-templates/template-deploy
TEMPLATE_INCIDENT = setup-templates/template-incident
TEMPLATE_GAS_INCREASE = setup-templates/template-gas-increase
TEMPLATE_UPGRADE_FAULT_PROOFS = setup-templates/template-upgrade-fault-proofs
TEMPLATE_SAFE_MANAGEMENT = setup-templates/template-safe-management

ifndef $(GOPATH)
# Ensure GOPATH is set
ifndef GOPATH
GOPATH=$(shell go env GOPATH)
export GOPATH
endif

# Install Foundry
.PHONY: install-foundry
install-foundry:
curl -L https://foundry.paradigm.xyz | bash
Expand All @@ -24,24 +29,27 @@ install-foundry:
##
# Project Setup
##

# Run `make setup-task network=<network> task=<task>`
setup-task:
rm -rf $(TEMPLATE_GENERIC)/cache $(TEMPLATE_GENERIC)/lib $(TEMPLATE_GENERIC)/out
rm -rf $(TEMPLATE_GENERIC)/{cache,lib,out}
cp -r $(TEMPLATE_GENERIC) $(PROJECT_DIR)

# Run `make setup-deploy network=<network>`
setup-deploy:
rm -rf $(TEMPLATE_DEPLOY)/cache $(TEMPLATE_DEPLOY)/lib $(TEMPLATE_DEPLOY)/out
mkdir -p $(network) && cp -r $(TEMPLATE_DEPLOY) $(DEPLOY_DIR)
rm -rf $(TEMPLATE_DEPLOY)/{cache,lib,out}
mkdir -p $(network)
cp -r $(TEMPLATE_DEPLOY) $(DEPLOY_DIR)

# Run `make setup-incident network=<network> incident=<incident-name>`
setup-incident:
rm -rf $(TEMPLATE_INCIDENT)/cache $(TEMPLATE_INCIDENT)/lib $(TEMPLATE_INCIDENT)/out
mkdir -p $(network) && cp -r $(TEMPLATE_INCIDENT) $(INCIDENT_DIR)
rm -rf $(TEMPLATE_INCIDENT)/{cache,lib,out}
mkdir -p $(network)
cp -r $(TEMPLATE_INCIDENT) $(INCIDENT_DIR)

# Run `make setup-gas-increase network=<network>`
setup-gas-increase:
rm -rf $(TEMPLATE_GAS_INCREASE)/cache $(TEMPLATE_GAS_INCREASE)/lib $(TEMPLATE_GAS_INCREASE)/out
rm -rf $(TEMPLATE_GAS_INCREASE)/{cache,lib,out}
cp -r $(TEMPLATE_GAS_INCREASE) $(GAS_INCREASE_DIR)

# Run `make setup-upgrade-fault-proofs network=<network>`
Expand All @@ -50,12 +58,13 @@ setup-upgrade-fault-proofs:

# Run `make setup-safe-management network=<network>`
setup-safe-management:
rm -rf $(TEMPLATE_SAFE_MANAGEMENT)/cache $(TEMPLATE_SAFE_MANAGEMENT)/lib $(TEMPLATE_SAFE_MANAGEMENT)/out
rm -rf $(TEMPLATE_SAFE_MANAGEMENT)/{cache,lib,out}
cp -r $(TEMPLATE_SAFE_MANAGEMENT) $(SAFE_MANAGEMENT_DIR)

##
# Solidity Setup
##

.PHONY: deps
deps: install-eip712sign clean-lib forge-deps checkout-op-commit checkout-base-contracts-commit

Expand All @@ -69,7 +78,8 @@ clean-lib:

.PHONY: forge-deps
forge-deps:
forge install --no-git github.com/foundry-rs/forge-std \
forge install --no-git \
github.com/foundry-rs/forge-std \
github.com/OpenZeppelin/[email protected] \
github.com/OpenZeppelin/[email protected] \
github.com/rari-capital/solmate@8f9b23f8838670afda0fd8983f2c41e8037ae6bc \
Expand All @@ -82,26 +92,26 @@ checkout-op-commit:
[ -n "$(OP_COMMIT)" ] || (echo "OP_COMMIT must be set in .env" && exit 1)
rm -rf lib/optimism
mkdir -p lib/optimism
cd lib/optimism; \
git init; \
git remote add origin https://github.com/ethereum-optimism/optimism.git; \
git fetch --depth=1 origin $(OP_COMMIT); \
git reset --hard FETCH_HEAD
cd lib/optimism && git init && git remote add origin https://github.com/ethereum-optimism/optimism.git
git -C lib/optimism fetch --depth=1 origin $(OP_COMMIT)
git -C lib/optimism reset --hard FETCH_HEAD

.PHONY: checkout-base-contracts-commit
checkout-base-contracts-commit:
[ -n "$(BASE_CONTRACTS_COMMIT)" ] || (echo "BASE_CONTRACTS_COMMIT must be set in .env" && exit 1)
rm -rf lib/base-contracts
mkdir -p lib/base-contracts
cd lib/base-contracts; \
git init; \
git remote add origin https://github.com/base/contracts.git; \
git fetch --depth=1 origin $(BASE_CONTRACTS_COMMIT); \
git reset --hard FETCH_HEAD

cd lib/base-contracts && \
git init && \
git remote add origin https://github.com/base-org/contracts.git && \
git fetch --depth=1 origin $(BASE_CONTRACTS_COMMIT) && \
git reset --hard FETCH_HEAD

##
# Solidity Testing
##

.PHONY: solidity-test
solidity-test:
forge test --ffi -vvv