-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
60 lines (50 loc) · 4.95 KB
/
Makefile
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# include .env file and export its env vars
# (-include to ignore error if it does not exist)
include .env
.PHONY: update build size inspect selectors test trace gas test-contract test-contract-gas trace-contract test-test trace-test clean snapshot anvil deploy
DEFAULT_ANVIL_KEY := 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
# Build & test
# deps
update :; forge update
build :; forge build
size :; forge build --sizes
# storage inspection
inspect :; forge inspect ${contract} storage-layout --pretty
# get the list of function selectors
selectors :; forge inspect ${contract} methods --pretty
# local tests without fork
test :; forge test --match-contract UnitTest -vvv
trace :; forge test --match-contract UnitTest -vvvv
gas :; forge test --match-contract UnitTest --gas-report
test-contract :; forge test -vvv --match-contract $(contract)
test-contract-gas :; forge test --gas-report --match-contract ${contract}
trace-contract :; forge test -vvvv --match-contract $(contract)
test-test :; forge test -vvv --match-test $(test)
trace-test :; forge test -vvvv --match-test $(test)
clean :; forge clean
snapshot :; forge snapshot
coverage :; forge coverage
anvil :; anvil -m 'test test test test test test test test test test test junk' --steps-tracing --block-time 1
# test with forks
# change ETH_RPC_URL to another one (e.g., FTM_RPC_URL) for different chains
FORK_URL := ${POLYGON_AMOY_RPC} #${SEPOLIA_ALCHEMY_RPC_URL}
test-fork :; source .env && forge test --match-contract EndToEndTest --rpc-url ${FORK_URL} -vvv
trace-fork :; source .env && forge test --match-contract EndToEndTest --rpc-url ${FORK_URL} -vvvv
test-contract-fork :; source .env && forge test --match-contract ExecuteEscrowHourlyEndToEndTest --rpc-url ${FORK_URL} -vvvv
# Deploy to local environment
deploy-registry-local :; forge script script/deploy/01_DeployRegistry.s.sol:DeployRegistryScript --rpc-url http://localhost:8545 --private-key $(DEPLOYER_PRIVATE_KEY) -vvvv
deploy-escrow-local :; forge script script/deploy/02_DeployEscrow.s.sol:DeployEscrowScript --rpc-url http://localhost:8545 --private-key $(DEPLOYER_PRIVATE_KEY) -vvvv
deploy-factory-local :; forge script script/deploy/03_DeployEscrowFactory.s.sol:DeployEscrowFactoryScript --rpc-url http://localhost:8545 --private-key $(DEPLOYER_PRIVATE_KEY) -vvvv
execute-escrow-local :; forge script script/execute/ExecuteEscrow.s.sol:ExecuteEscrowScript --rpc-url http://localhost:8545 --private-key $(DEPLOYER_PRIVATE_KEY) -vvvv
# Deploy to Ethereum Sepolia - Requires environment variables: SEPOLIA_ALCHEMY_RPC_URL, DEPLOYER_PRIVATE_KEY, ETHERSCAN_API_KEY
DEPLOY_URL := ${POLYGON_AMOY_RPC} #${SEPOLIA_ALCHEMY_RPC_URL}
SCAN_API_KEY := ${POLYGONSCAN_API_KEY} #${ETHERSCAN_API_KEY}
deploy-registry :; source .env && forge script script/deploy/01_DeployRegistry.s.sol:DeployRegistryScript --rpc-url ${DEPLOY_URL} --private-key ${DEPLOYER_PRIVATE_KEY} --broadcast --verify --etherscan-api-key ${SCAN_API_KEY} -vvvv
deploy-adminmanager :; source .env && forge script script/deploy/02_DeployAdminManager.s.sol:DeployAdminManagerScript --rpc-url ${DEPLOY_URL} --private-key ${DEPLOYER_PRIVATE_KEY} --broadcast --verify --etherscan-api-key ${SCAN_API_KEY} -vvvv
deploy-escrow :; source .env && forge script script/deploy/03_DeployEscrowFixedPrice.s.sol:DeployEscrowFixedPriceScript --rpc-url ${DEPLOY_URL} --private-key ${DEPLOYER_PRIVATE_KEY} --broadcast --verify --etherscan-api-key ${SCAN_API_KEY} --gas-price ${GAS_PRICE} --gas-limit ${GAS_LIMIT} -vvvv
deploy-milestone :; source .env && forge script script/deploy/04_DeployEscrowMilestone.s.sol:DeployEscrowMilestoneScript --rpc-url ${DEPLOY_URL} --private-key ${DEPLOYER_PRIVATE_KEY} --broadcast --verify --etherscan-api-key ${SCAN_API_KEY} --gas-price ${GAS_PRICE} --gas-limit ${GAS_LIMIT} -vvvv
deploy-hourly :; source .env && forge script script/deploy/05_DeployEscrowHourly.s.sol:DeployEscrowHourlyScript --rpc-url ${DEPLOY_URL} --private-key ${DEPLOYER_PRIVATE_KEY} --broadcast --verify --etherscan-api-key ${SCAN_API_KEY} --gas-price ${GAS_PRICE} --gas-limit ${GAS_LIMIT} -vvvv
deploy-factory :; source .env && forge script script/deploy/06_DeployEscrowFactory.s.sol:DeployEscrowFactoryScript --rpc-url ${DEPLOY_URL} --private-key ${DEPLOYER_PRIVATE_KEY} --broadcast --verify --etherscan-api-key ${SCAN_API_KEY} -vvvv
deploy-feemanager :; source .env && forge script script/deploy/07_DeployEscrowFeeManager.s.sol:DeployEscrowFeeManagerScript --rpc-url ${DEPLOY_URL} --private-key ${DEPLOYER_PRIVATE_KEY} --broadcast --verify --etherscan-api-key ${SCAN_API_KEY} -vvvv
deploy-recovery :; source .env && forge script script/deploy/08_DeployAccountRecovery.s.sol:DeployAccountRecoveryScript --rpc-url ${DEPLOY_URL} --private-key ${DEPLOYER_PRIVATE_KEY} --broadcast --verify --etherscan-api-key ${SCAN_API_KEY} -vvvv
execute-escrow :; source .env && forge script script/execute/ExecuteEscrow.s.sol:ExecuteEscrowScript --rpc-url ${DEPLOY_URL} --private-key ${DEPLOYER_PRIVATE_KEY} --broadcast --gas-price ${GAS_PRICE} --gas-limit ${GAS_LIMIT} -vvvv