Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
22b9e77
added automation deployment
Sunnesoft Sep 12, 2025
2c056e4
fixed type conv issues
Sunnesoft Sep 12, 2025
b02a9ab
fixed deploy-fee-taker
Sunnesoft Sep 12, 2025
15f6e69
fixed rv6 address
Sunnesoft Sep 12, 2025
517a535
fixed ct3 address
Sunnesoft Sep 12, 2025
09572d0
fixed at address
Sunnesoft Sep 12, 2025
07e96b6
fixed create3 deploy args
Sunnesoft Sep 13, 2025
50c200b
fixed Makefile vars
Sunnesoft Sep 22, 2025
74d7bbe
fixed JSON.parse
Sunnesoft Sep 22, 2025
517fc12
fixed JSON.parse
Sunnesoft Sep 22, 2025
3aedc3c
added salt's management; simplified constants processing;
Sunnesoft Sep 25, 2025
bfee782
fixed linter issues
Sunnesoft Sep 25, 2025
d51e656
exlude json files from deployment processing
Sunnesoft Sep 25, 2025
998d8a7
removed default value for deployment method
Sunnesoft Sep 25, 2025
00200ec
fixed makefile upsert-constant double quotting
Sunnesoft Sep 25, 2025
dea67a4
fixed skipFiles
Sunnesoft Sep 25, 2025
b2f974e
moved constants to ./config
Sunnesoft Sep 25, 2025
a57134b
removed deploy from hardhat.config.js
Sunnesoft Sep 25, 2025
3690c38
fixed makefile paths
Sunnesoft Sep 25, 2025
8282d8f
refactored constants.js to read json directly by node
Sunnesoft Sep 25, 2025
31ef67c
Merge branch 'deploy/native-order' into feature/deployment-automation
Sunnesoft Sep 29, 2025
2cd2388
added native-order-factory to deployment automation
Sunnesoft Sep 29, 2025
d60ad18
fixed linter
Sunnesoft Sep 29, 2025
4d59766
fixed Makefile
Sunnesoft Sep 29, 2025
1896516
fixed == POSIX
Sunnesoft Oct 12, 2025
fbe6ae8
added print of salt in deployment script
Sunnesoft Oct 13, 2025
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
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ yarn-error.log
.coverage_contracts
.coverage_artifacts
.idea
.env
.env*
219 changes: 219 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,219 @@
# Conditionally include .env or .env.automation based on OPS_LAUNCH_MODE
ifeq ($(OPS_LAUNCH_MODE),auto)
-include .env.automation
else
-include .env
endif

CURRENT_DIR=$(shell pwd)

OPS_NETWORK_=$(shell echo "$(OPS_NETWORK)" | tr -d '\"')
OPS_CHAIN_ID_=$(shell echo "$(OPS_CHAIN_ID)" | tr -d '\"')
OPS_DEPLOYMENT_METHOD_=$(shell echo "$(OPS_DEPLOYMENT_METHOD)" | tr -d '\"')

FILE_DEPLOY_HELPERS=$(CURRENT_DIR)/deploy/deploy-helpers.js
FILE_DEPLOY_FEE_TAKER=$(CURRENT_DIR)/deploy/deploy-fee-taker.js
FILE_DEPLOY_LOP=$(CURRENT_DIR)/deploy/deploy.js

FILE_CREATE3_DEPLOYER=$(CURRENT_DIR)/deploy/constants/create3-deployer.js
FILE_ACCESS_TOKEN=$(CURRENT_DIR)/deploy/constants/access-token.js
FILE_ORDER_REGISTRATOR=$(CURRENT_DIR)/deploy/constants/order-registrator.js
FILE_ROUTER_V6=$(CURRENT_DIR)/deploy/constants/router-v6.js
FILE_WETH=$(CURRENT_DIR)/deploy/constants/weth.js

deploy-helpers:
@$(MAKE) OPS_CURRENT_DEP_FILE=$(FILE_DEPLOY_HELPERS) OPS_DEPLOYMENT_METHOD=$(if $(OPS_DEPLOYMENT_METHOD_),$(OPS_DEPLOYMENT_METHOD_),create3) OPS_LOP_HELPER_NAMES=$(OPS_LOP_HELPER_NAMES) validate-helpers deploy-skip-all deploy-noskip deploy-impl deploy-skip

deploy-lop:
@$(MAKE) OPS_CURRENT_DEP_FILE=$(FILE_DEPLOY_LOP) validate-lop deploy-skip-all deploy-noskip deploy-impl deploy-skip

deploy-fee-taker:
@$(MAKE) OPS_CURRENT_DEP_FILE=$(FILE_DEPLOY_FEE_TAKER) validate-fee-taker deploy-skip-all deploy-noskip deploy-impl deploy-skip

deploy-impl:
@{ \
yarn deploy $(OPS_NETWORK_) || exit 1; \
}

# Validation targets
validate-helpers:
@{ \
if [ -z "$(OPS_NETWORK_)" ]; then echo "OPS_NETWORK is not set!"; exit 1; fi; \
if [ -z "$(OPS_CHAIN_ID_)" ]; then echo "OPS_CHAIN_ID is not set!"; exit 1; fi; \
if [ -z "$(OPS_CREATE3_DEPLOYER_ADDRESS)" ] && [ "$(OPS_DEPLOYMENT_METHOD_)" = "create3" ]; then echo "OPS_CREATE3_DEPLOYER_ADDRESS is not set!"; exit 1; fi; \
if [ -z "$(MAINNET_RPC_URL)" ] && [ "$(OPS_NETWORK_)" = "hardhat" ]; then echo "MAINNET_RPC_URL is not set!"; exit 1; fi; \
if [ -z "$(OPS_WETH_ADDRESS)" ]; then echo "OPS_WETH_ADDRESS is not set!"; exit 1; fi; \
if [ -z "$(OPS_LOP_HELPER_NAMES)" ]; then echo "OPS_LOP_HELPER_NAMES is not set!"; exit 1; fi; \
$(MAKE) process-weth process-router-v6 process-order-registrator process-create3-deployer; \
}

validate-fee-taker:
@{ \
if [ -z "$(OPS_NETWORK_)" ]; then echo "OPS_NETWORK is not set!"; exit 1; fi; \
if [ -z "$(OPS_CHAIN_ID_)" ]; then echo "OPS_CHAIN_ID is not set!"; exit 1; fi; \
if [ -z "$(OPS_CREATE3_DEPLOYER_ADDRESS)" ] && [ "$(OPS_DEPLOYMENT_METHOD_)" = "create3" ]; then echo "OPS_CREATE3_DEPLOYER_ADDRESS is not set!"; exit 1; fi; \
if [ -z "$(MAINNET_RPC_URL)" ] && [ "$(OPS_NETWORK_)" = "hardhat" ]; then echo "MAINNET_RPC_URL is not set!"; exit 1; fi; \
if [ -z "$(OPS_WETH_ADDRESS)" ]; then echo "OPS_WETH_ADDRESS is not set!"; exit 1; fi; \
if [ -z "$(OPS_AGGREGATION_ROUTER_V6_ADDRESS)" ]; then echo "OPS_AGGREGATION_ROUTER_V6_ADDRESS is not set!"; exit 1; fi; \
if [ -z "$(OPS_ACCESS_TOKEN_ADDRESS)" ]; then echo "OPS_ACCESS_TOKEN_ADDRESS is not set!"; exit 1; fi; \
$(MAKE) process-weth process-router-v6 process-access-token process-create3-deployer; \
}

validate-lop:
@{ \
if [ -z "$(OPS_NETWORK_)" ]; then echo "OPS_NETWORK is not set!"; exit 1; fi; \
if [ -z "$(OPS_CHAIN_ID_)" ]; then echo "OPS_CHAIN_ID is not set!"; exit 1; fi; \
if [ -z "$(MAINNET_RPC_URL)" ] && [ "$(OPS_NETWORK_)" = "hardhat" ]; then echo "MAINNET_RPC_URL is not set!"; exit 1; fi; \
if [ -z "$(OPS_WETH_ADDRESS)" ]; then echo "OPS_WETH_ADDRESS is not set!"; exit 1; fi; \
$(MAKE) process-weth; \
}

# Process constant functions for new addresses
process-create3-deployer:
@{ \
if [ -n "$(OPS_CREATE3_DEPLOYER_ADDRESS)" ]; then \
$(MAKE) OPS_GEN_VAL='$(OPS_CREATE3_DEPLOYER_ADDRESS)' OPS_GEN_FILE=$(FILE_CREATE3_DEPLOYER) upsert-constant; \
fi; \
}

process-weth:
@$(MAKE) OPS_GEN_VAL='$(OPS_WETH_ADDRESS)' OPS_GEN_FILE=$(FILE_WETH) upsert-constant

process-router-v6:
@{ \
if [ -n "$(OPS_AGGREGATION_ROUTER_V6_ADDRESS)" ]; then \
$(MAKE) OPS_GEN_VAL='$(OPS_AGGREGATION_ROUTER_V6_ADDRESS)' OPS_GEN_FILE=$(FILE_ROUTER_V6) upsert-constant; \
fi; \
}

process-order-registrator:
@{ \
if [ -n "$(OPS_ORDER_REGISTRATOR_ADDRESS)" ]; then \
$(MAKE) OPS_GEN_VAL='$(OPS_ORDER_REGISTRATOR_ADDRESS)' OPS_GEN_FILE=$(FILE_ORDER_REGISTRATOR) upsert-constant; \
fi; \
}

process-access-token:
@$(MAKE) OPS_GEN_VAL='$(OPS_ACCESS_TOKEN_ADDRESS)' OPS_GEN_FILE=$(FILE_ACCESS_TOKEN) upsert-constant

upsert-constant:
@{ \
if [ -z "$(OPS_GEN_VAL)" ]; then \
echo "variable for file $(OPS_GEN_FILE) is not set!"; \
exit 1; \
fi; \
if grep -q "$(OPS_CHAIN_ID_)" $(OPS_GEN_FILE); then \
sed -i '' 's|$(OPS_CHAIN_ID_): .*|$(OPS_CHAIN_ID_): $(OPS_GEN_VAL),|' $(OPS_GEN_FILE); \
sed -i '' 's/"/'\''/g' $(OPS_GEN_FILE); \
else \
awk '1;/module.exports = {/{print " $(OPS_CHAIN_ID_): $(subst ",\",$(OPS_GEN_VAL)),"}' $(OPS_GEN_FILE) > tmp && sed -i '' 's/"/'\''/g' tmp && mv tmp $(OPS_GEN_FILE); \
fi \
}

deploy-skip-all:
@{ \
for secret in $(FILE_DEPLOY); do \
$(MAKE) OPS_CURRENT_DEP_FILE=$$secret deploy-skip; \
done \
}

deploy-skip:
@sed -i '' 's/module.exports.skip.*/module.exports.skip = async () => true;/g' $(OPS_CURRENT_DEP_FILE)

deploy-noskip:
@sed -i '' 's/module.exports.skip.*/module.exports.skip = async () => false;/g' $(OPS_CURRENT_DEP_FILE)

launch-hh-node:
@{ \
if [ -z "$(NODE_RPC)" ]; then \
echo "NODE_RPC is not set!"; \
exit 1; \
fi; \
echo "Launching Hardhat node with RPC: $(NODE_RPC)"; \
npx hardhat node --fork $(NODE_RPC) --vvvv --full-trace; \
}

install: install-utils install-dependencies

install-utils:
brew install yarn wget

install-dependencies:
yarn

clean:
@rm -Rf $(CURRENT_DIR)/deployments/$(OPS_NETWORK_)/*


# Get deployed contract addresses from deployment files
get:
@{ \
if [ -z "$(PARAMETER)" ]; then \
echo "Error: PARAMETER is not set. Usage: make get PARAMETER=OPS_FEE_TAKER_ADDRESS"; \
exit 1; \
fi; \
if [ -z "$(OPS_NETWORK_)" ]; then \
echo "Error: OPS_NETWORK_ is not set"; \
exit 1; \
fi; \
CONTRACT_FILE=""; \
case "$(PARAMETER)" in \
"OPS_FEE_TAKER_ADDRESS") CONTRACT_FILE="FeeTaker.json" ;; \
"OPS_LOP_ADDRESS") CONTRACT_FILE="LimitOrderProtocol.json" ;; \
"OPS_ORDER_REGISTRATOR_ADDRESS") CONTRACT_FILE="OrderRegistrator.json" ;; \
"OPS_SAFE_ORDER_BUILDER_ADDRESS") CONTRACT_FILE="SafeOrderBuilder.json" ;; \
"OPS_SERIES_NONCE_MANAGER_ADDRESS") CONTRACT_FILE="SeriesNonceManager.json" ;; \
"OPS_PRIORITY_FEE_LIMITER_ADDRESS") CONTRACT_FILE="PriorityFeeLimiter.json" ;; \
"OPS_CALLS_SIMULATOR_ADDRESS") CONTRACT_FILE="CallsSimulator.json" ;; \
*) echo "Error: Unknown parameter $(PARAMETER)"; exit 1 ;; \
esac; \
DEPLOYMENT_FILE="$(CURRENT_DIR)/deployments/$(OPS_NETWORK_)/$$CONTRACT_FILE"; \
if [ ! -f "$$DEPLOYMENT_FILE" ]; then \
echo "Error: Deployment file $$DEPLOYMENT_FILE not found"; \
exit 1; \
fi; \
ADDRESS=$$(cat "$$DEPLOYMENT_FILE" | grep '"address"' | head -1 | sed 's/.*"address": *"\([^"]*\)".*/\1/'); \
echo "$$ADDRESS"; \
}

help:
@echo "Available targets:"
@echo " install Install utilities and dependencies"
@echo " install-utils Install yarn and wget via brew"
@echo " install-dependencies Install JS dependencies via yarn"
@echo " clean Remove deployments for current network"
@echo " deploy-helpers Deploy helper contracts"
@echo " deploy-lop Deploy LimitOrderProtocol contract"
@echo " deploy-fee-taker Deploy FeeTaker contract"
@echo " deploy-impl Run deployment script for current file"
@echo " deploy-skip Set skip=true in deployment file"
@echo " deploy-noskip Set skip=false in deployment file"
@echo " deploy-skip-all Set skip=true for all deployment files"
@echo " launch-hh-node Launch Hardhat node with forked RPC"
@echo " get PARAMETER=... Get deployed contract address by parameter"
@echo " help Show this help message"
@echo ""
@echo "Validation targets:"
@echo " validate-helpers Validate environment for helpers deployment"
@echo " validate-fee-taker Validate environment for FeeTaker deployment"
@echo " validate-lop Validate environment for LOP deployment"
@echo ""
@echo "Process targets (update constants):"
@echo " process-create3-deployer"
@echo " process-weth"
@echo " process-router-v6"
@echo " process-order-registrator"
@echo " process-access-token"
@echo ""
@echo "Usage examples:"
@echo " make deploy-helpers OPS_NETWORK=mainnet OPS_CHAIN_ID=1"
@echo " make get PARAMETER=OPS_FEE_TAKER_ADDRESS OPS_NETWORK=mainnet"

.PHONY: \
install install-utils install-dependencies clean \
deploy-helpers deploy-lop deploy-fee-taker deploy-impl \
deploy-skip deploy-noskip deploy-skip-all launch-hh-node \
get help \
validate-helpers validate-fee-taker validate-lop \
process-create3-deployer process-weth process-router-v6 process-order-registrator process-access-token \
upsert-constant
20 changes: 20 additions & 0 deletions deploy/constants/access-token.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
module.exports = {
1: '0xAcce5500000f71A32B5E5514D1577E14b7aacC4a', // Mainnet
56: '0xAcce5500000f71A32B5E5514D1577E14b7aacC4a', // BSC
137: '0xAcce5500000f71A32B5E5514D1577E14b7aacC4a', // Matic
42161: '0xAcce5500000f71A32B5E5514D1577E14b7aacC4a', // Arbitrum
10: '0xAcce5500000f71A32B5E5514D1577E14b7aacC4a', // Optimistic
43114: '0xAcce5500000f71A32B5E5514D1577E14b7aacC4a', // Avalanche
100: '0xAcce5500000f71A32B5E5514D1577E14b7aacC4a', // xDAI
250: '0xAcce5500000f71A32B5E5514D1577E14b7aacC4a', // FTM
1313161554: '0xAcce5500000f71A32B5E5514D1577E14b7aacC4a', // Aurora
8217: '0xAcce5500000f71A32B5E5514D1577E14b7aacC4a', // Klaytn
8453: '0xAcce5500000f71A32B5E5514D1577E14b7aacC4a', // Base
59144: '0xAcce5500000f71A32B5E5514D1577E14b7aacC4a', // Linea
324: '0x4888651051B2Dc08Ac55Cd0f7D671e0FCba0DEED', // zksync
146: '0xAcce5500000f71A32B5E5514D1577E14b7aacC4a', // Sonic
130: '0xAcce5500000f71A32B5E5514D1577E14b7aacC4a', // Unichain
31337: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2',
Comment thread
Sunnesoft marked this conversation as resolved.
Outdated
};

module.exports.skip = async () => true;
19 changes: 19 additions & 0 deletions deploy/constants/create3-deployer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
module.exports = {
1: '0xD935a2bb926019E0ed6fb31fbD5b1Bbb7c05bf65', // Mainnet
56: '0xD935a2bb926019E0ed6fb31fbD5b1Bbb7c05bf65', // BSC
137: '0xD935a2bb926019E0ed6fb31fbD5b1Bbb7c05bf65', // Matic
42161: '0xD935a2bb926019E0ed6fb31fbD5b1Bbb7c05bf65', // Arbitrum
10: '0xD935a2bb926019E0ed6fb31fbD5b1Bbb7c05bf65', // Optimistic
43114: '0xD935a2bb926019E0ed6fb31fbD5b1Bbb7c05bf65', // Avalanche
100: '0xD935a2bb926019E0ed6fb31fbD5b1Bbb7c05bf65', // xDAI
250: '0xD935a2bb926019E0ed6fb31fbD5b1Bbb7c05bf65', // FTM
1313161554: '0xD935a2bb926019E0ed6fb31fbD5b1Bbb7c05bf65', // Aurora
8217: '0xD935a2bb926019E0ed6fb31fbD5b1Bbb7c05bf65', // Klaytn
8453: '0xD935a2bb926019E0ed6fb31fbD5b1Bbb7c05bf65', // Base
59144: '0xD935a2bb926019E0ed6fb31fbD5b1Bbb7c05bf65', // Linea
146: '0xD935a2bb926019E0ed6fb31fbD5b1Bbb7c05bf65', // Sonic
130: '0xD935a2bb926019E0ed6fb31fbD5b1Bbb7c05bf65', // Unichain
31337: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2',
Comment thread
Sunnesoft marked this conversation as resolved.
Outdated
};

module.exports.skip = async () => true;
15 changes: 15 additions & 0 deletions deploy/constants/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
const weth = require('./weth');
const routerV6 = require('./router-v6');
const accessToken = require('./access-token');
const create3Deployer = require('./create3-deployer');
const orderRegistrator = require('./order-registrator');

module.exports = {
WETH: weth,
ROUTER_V6: routerV6,
ACCESS_TOKEN: accessToken,
CREATE3_DEPLOYER: create3Deployer,
ORDER_REGISTRATOR: orderRegistrator,
};

module.exports.skip = async () => true;
5 changes: 5 additions & 0 deletions deploy/constants/order-registrator.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
31337: '0x0000000000000000000000000000000000000000',
};

module.exports.skip = async () => true;
20 changes: 20 additions & 0 deletions deploy/constants/router-v6.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
module.exports = {
1: '0x111111125421ca6dc452d289314280a0f8842a65', // Mainnet
56: '0x111111125421ca6dc452d289314280a0f8842a65', // BSC
137: '0x111111125421ca6dc452d289314280a0f8842a65', // Matic
42161: '0x111111125421ca6dc452d289314280a0f8842a65', // Arbitrum
10: '0x111111125421ca6dc452d289314280a0f8842a65', // Optimistic
43114: '0x111111125421ca6dc452d289314280a0f8842a65', // Avalanche
100: '0x111111125421ca6dc452d289314280a0f8842a65', // xDAI
250: '0x111111125421ca6dc452d289314280a0f8842a65', // FTM
1313161554: '0x111111125421ca6dc452d289314280a0f8842a65', // Aurora
8217: '0x111111125421ca6dc452d289314280a0f8842a65', // Klaytn
8453: '0x111111125421ca6dc452d289314280a0f8842a65', // Base
59144: '0x111111125421ca6dc452d289314280a0f8842a65', // Linea
146: '0x111111125421ca6dc452d289314280a0f8842a65', // Sonic
130: '0x111111125421ca6dc452d289314280a0f8842a65', // Unichain
31337: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2',
Comment thread
Sunnesoft marked this conversation as resolved.
Outdated
324: '0x6fd4383cB451173D5f9304F041C7BCBf27d561fF', // zksync
};

module.exports.skip = async () => true;
20 changes: 20 additions & 0 deletions deploy/constants/weth.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
module.exports = {
31337: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2',
1: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', // Mainnet
56: '0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c', // BSC
137: '0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270', // Matic
42161: '0x82aF49447D8a07e3bd95BD0d56f35241523fBab1', // Arbitrum
10: '0x4200000000000000000000000000000000000006', // Optimistic
43114: '0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7', // Avalanche
100: '0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d', // xDAI
250: '0x21be370D5312f44cB42ce377BC9b8a0cEF1A4C83', // FTM
1313161554: '0xC9BdeEd33CD01541e1eeD10f90519d2C06Fe3feB', // Aurora
8217: '0xe4f05A66Ec68B54A58B17c22107b02e0232cC817', // Klaytn
8453: '0x4200000000000000000000000000000000000006', // Base
59144: '0xe5D7C2a44FfDDf6b295A15c148167daaAf5Cf34f', // Linea
146: '0x039e2fB66102314Ce7b64Ce5Ce3E5183bc94aD38', // Sonic
130: '0x4200000000000000000000000000000000000006', // Unichain
324: '0x5AEa5775959fBC2557Cc8789bC1bf90A239D9a91', // zksync
};

module.exports.skip = async () => true;
39 changes: 0 additions & 39 deletions deploy/deploy-FeeTaker-zksync.js

This file was deleted.

Loading
Loading