forked from decentxyz/decent-bridge
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
135 lines (110 loc) · 4.33 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
include .env
.phony: deploy-chain
COMMON_PARAMS := --broadcast -vvvv
ifeq ($(MAINNET),true)
COMMON_PARAMS += --private-key=$(MAINNET_ACCOUNT) --verify --slow
else ifeq ($(TESTNET),true)
COMMON_PARAMS += --private-key=$(TESTNET_ACCOUNT) --verify --slow
else
COMMON_PARAMS += --unlocked --sender=$(TESTNET_ACCOUNT_ADDRESS)
endif
start-zora:
$(MAKE) start-forknet CHAINS=ZORA,OPTIMISM
start-chains:
@. .env && \
for chain in $(shell echo $(CHAINS) | tr ',' ' '); do \
rpc_var=$${chain}_RPC; \
port_var=FORK_$${chain}_PORT; \
pid_file=$${chain}_PID; \
echo "chain: $$chain"; \
echo "rpc_var: $$rpc_var"; \
rpc_url=$${!rpc_var}; \
port=$${!port_var}; \
echo "rpc_url: $$rpc_url"; \
echo "port: $$port"; \
anvil --auto-impersonate -f $$rpc_url -p $$port > $$chain.log 2>&1 & \
echo $$! > $$pid_file ; \
# Add your commands here using $$chain as the current value; \
done
stop-chains:
pkill -f anvil
ANVIL_PRIVATE_KEY := 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
give-money:
@. .env && \
for chain in $(shell echo $(CHAINS) | tr ',' ' '); do \
port_var=FORK_$${chain}_PORT; \
port=$${!port_var}; \
echo "chain: $$chain to: $$to amount: $$amount"; \
cast send $$to --rpc-url http://localhost:$$port --value "$$amount" --private-key $(ANVIL_PRIVATE_KEY);\
done
start-forknet:
$(MAKE) start-chains CHAINS=$(CHAINS);
sleep 2;
$(MAKE) give-money CHAINS=$(CHAINS) to=$(TESTNET_ACCOUNT_ADDRESS) amount="900 ether";
#copy-addresses:
# cp ./deployments/deployedAddresses.json ~/decentxyz/box-monorepo/apps/box-scenarios/assets/.
# cp ./deployments/deployedAddresses.json ~/decentxyz/box-monorepo/apps/box-api/src/getBoxAction/decentBridge/.
# cp ./deployments/deployedAddresses.json ~/decentxyz/energy-dashboard/constants/.
DECIMALS := 1000000000000000000 # for convenience
add-liquidity:
$(eval liquidity=$(shell echo "scale=10; $(amount) * $(DECIMALS)" | bc | sed 's/\..*//'))
liquidity=$(liquidity) \
forge script script/Scripts.s.sol:AddLiquidity $(COMMON_PARAMS)
remove-liquidity:
$(eval liquidity=$(shell echo "scale=10; $(amount) * $(DECIMALS)" | bc | sed 's/\..*//'))
liquidity=$(liquidity) \
forge script script/Scripts.s.sol:RemoveLiquidity $(COMMON_PARAMS)
bridge:
$(eval bridge_amount=$(shell echo "scale=10; $(amount) * $(DECIMALS)" | bc | sed 's/\..*//'))
bridge_amount=$(bridge_amount) \
forge script script/Scripts.s.sol:Bridge $(COMMON_PARAMS)
run-script:
forge script script/Scripts.s.sol:$(script) $(COMMON_PARAMS)
deploy-chain:
forge script script/Scripts.s.sol:Deploy $(COMMON_PARAMS)
wire-up:
forge script script/Scripts.s.sol:WireUp $(COMMON_PARAMS)
deploy-songcamp:
forge script script/partnerships/Songcamp.s.sol:Songcamp $(COMMON_PARAMS)
local-deploy:
# TODO: move this to a js script and make it a hella loop
$(MAKE) deploy-chain chain=zora
$(MAKE) deploy-chain chain=optimism
$(MAKE) wire-up src=zora dst=optimism
$(MAKE) wire-up src=optimism dst=zora
$(MAKE) add-liquidity chain=optimism amount=10
$(MAKE) add-liquidity chain=zora amount=10
$(MAKE) bridge amount=0.0069 src=optimism dst=zora
$(MAKE) bridge amount=0.0069 src=zora dst=optimism
wire-up-src-dst:
$(MAKE) wire-up src=$(src) dst=$(dst)
$(MAKE) wire-up src=$(dst) dst=$(src)
deploy-and-wire:
$(MAKE) deploy-chain chain=$(src)
$(MAKE) deploy-chain chain=$(dst)
$(MAKE) wire-up src=$(src) dst=$(dst)
$(MAKE) wire-up src=$(dst) dst=$(src)
$(MAKE) add-liquidity chain=$(src) amount=0.8
$(MAKE) add-liquidity chain=$(dst) amount=0.8
$(MAKE) bridge amount=0.0069 src=$(src) dst=$(dst)
$(MAKE) bridge amount=0.0069 src=$(dst) dst=$(src)
bridge-e2e:
$(MAKE) deploy-chain chain=$(src)
$(MAKE) deploy-chain chain=$(dst)
$(MAKE) wire-up src=$(src) dst=$(dst)
$(MAKE) wire-up src=$(dst) dst=$(src)
$(MAKE) add-liquidity chain=$(src) amount=0.01
$(MAKE) add-liquidity chain=$(dst) amount=0.01
$(MAKE) bridge amount=0.0069 src=$(src) dst=$(dst)
$(MAKE) bridge amount=0.0069 src=$(dst) dst=$(src)
##### whole lotta convenience scripts
watch-test:
forge test -vv --watch --match-path test/Counter.t.sol
install-solmate:
forge install transmissions11/solmate
install-openzeppelin:
forge install https://github.com/OpenZeppelin/openzeppelin-contracts
forge install https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable
setup-prettier:
pnpm init
pnpm add --save-dev prettier prettier-plugin-solidity