diff --git a/.gitmodules b/.gitmodules index 193938f..e05ddde 100644 --- a/.gitmodules +++ b/.gitmodules @@ -16,3 +16,6 @@ [submodule "lib/createx"] path = lib/createx url = https://github.com/pcaversaccio/createx +[submodule "nucleus-deployments"] + path = nucleus-deployments + url = git@github.com:Ion-Protocol/nucleus-deployments.git diff --git a/Makefile b/Makefile index 216a343..e99f473 100644 --- a/Makefile +++ b/Makefile @@ -14,19 +14,25 @@ checkL2: deployL1: @echo "Setting environment variable LIVE_DEPLOY_READ_FILE_NAME to $(file)" + cp ./deployment-config/out-template.json ./deployment-config/out.json @export LIVE_DEPLOY_READ_FILE_NAME=$(file) && forge script script/deploy/deployAll.s.sol --sig "run(string)" $(file) --fork-url=${L1_RPC_URL} deployL2: @echo "Setting environment variable LIVE_DEPLOY_READ_FILE_NAME to $(file)" + cp ./deployment-config/out-template.json ./deployment-config/out.json @export LIVE_DEPLOY_READ_FILE_NAME=$(file) && forge script script/deploy/deployAll.s.sol --sig "run(string)" $(file) --fork-url=${L2_RPC_URL} live-deployL1: @echo "Setting environment variable LIVE_DEPLOY_READ_FILE_NAME to $(file)" + cp ./deployment-config/out-template.json ./deployment-config/out.json @export LIVE_DEPLOY_READ_FILE_NAME=$(file) && forge script script/deploy/deployAll.s.sol --sig "run(string)" $(file) --fork-url=${L1_RPC_URL} --private-key=$(PRIVATE_KEY) --broadcast --slow --verify + mv ./deployment-config/out.json ./deployment-config/outL1.json live-deployL2: @echo "Setting environment variable LIVE_DEPLOY_READ_FILE_NAME to $(file)" + cp ./deployment-config/out-template.json ./deployment-config/out.json @export LIVE_DEPLOY_READ_FILE_NAME=$(file) && forge script script/deploy/deployAll.s.sol --sig "run(string)" $(file) --fork-url=${L2_RPC_URL} --private-key=$(PRIVATE_KEY) --broadcast --slow --verify + mv ./deployment-config/out.json ./deployment-config/outL2.json prettier: prettier --write '**/*.{md,yml,yaml,ts,js}' @@ -44,4 +50,20 @@ deploy-createx-l1: forge script script/DeployCustomCreatex.s.sol --rpc-url ${L1_RPC_URL} --private-key ${PRIVATE_KEY} --slow --no-metadata deploy-createx-l2: - forge script script/DeployCustomCreatex.s.sol --rpc-url ${L2_RPC_URL} --private-key ${PRIVATE_KEY} --slow --no-metadata \ No newline at end of file + forge script script/DeployCustomCreatex.s.sol --rpc-url ${L2_RPC_URL} --private-key ${PRIVATE_KEY} --slow --no-metadata + +check-configs: + bun lzConfigCheck.cjs + +chain1 := $(shell cast chain-id -r $(L1_RPC_URL)) +chain2 := $(shell cast chain-id -r $(L2_RPC_URL)) +symbol := $(shell cat deployment-config/$(fileL1) | jq -r ".boringVault.boringVaultSymbol") +post-deploy: + mkdir -p ./nucleus-deployments/$(symbol) + mv ./deployment-config/outL1.json ./nucleus-deployments/$(symbol)/L1Out.json + mv ./deployment-config/outL2.json ./nucleus-deployments/$(symbol)/L2Out.json + cp ./broadcast/deployAll.s.sol/$(chain1)/run-latest.json ./nucleus-deployments/$(symbol)/L1.json + cp ./broadcast/deployAll.s.sol/$(chain2)/run-latest.json ./nucleus-deployments/$(symbol)/L2.json + cp ./deployment-config/$(fileL1) ./nucleus-deployments/$(symbol)/L1Config.json + cp ./deployment-config/$(fileL2) ./nucleus-deployments/$(symbol)/L2Config.json + cd nucleus-deployments && git checkout -b $(symbol) && git add . && git commit -m "$(symbol) deployment" && git push origin $(symbol) && git checkout main diff --git a/deployment-config/out-template.json b/deployment-config/out-template.json new file mode 100644 index 0000000..3428148 --- /dev/null +++ b/deployment-config/out-template.json @@ -0,0 +1,7 @@ +{ + "boringVault": "", + "manager": "", + "accountant": "", + "teller": "", + "rolesAuthority": "" +} \ No newline at end of file diff --git a/nucleus-deployments b/nucleus-deployments new file mode 160000 index 0000000..3aaf20c --- /dev/null +++ b/nucleus-deployments @@ -0,0 +1 @@ +Subproject commit 3aaf20cb21a5074b0749c3041fff9bfeb40b036c diff --git a/script/deploy/deployAll.s.sol b/script/deploy/deployAll.s.sol index 1db7134..c9d0bfe 100644 --- a/script/deploy/deployAll.s.sol +++ b/script/deploy/deployAll.s.sol @@ -22,7 +22,7 @@ import { SetAuthorityAndTransferOwnerships } from "./single/08_SetAuthorityAndTr import { ConfigReader, IAuthority } from "../ConfigReader.s.sol"; import { console } from "forge-std/console.sol"; -string constant OUTPUT_JSON_PATH = "/deployment-config/out.json"; +string constant OUTPUT_JSON_PATH = "./deployment-config/out.json"; error INVALID_TELLER_CONTRACT_NAME(); @@ -47,11 +47,23 @@ error INVALID_TELLER_CONTRACT_NAME(); */ contract DeployAll is BaseScript { using StdJson for string; + using Strings for address; ConfigReader.Config mainConfig; + // skips the json writing + function runLiveTest(string memory deployFile) public { + deploy(ConfigReader.toConfig(vm.readFile(string.concat(CONFIG_PATH_ROOT, deployFile)), getChainConfigFile())); + } + function run(string memory deployFile) public { deploy(ConfigReader.toConfig(vm.readFile(string.concat(CONFIG_PATH_ROOT, deployFile)), getChainConfigFile())); + // write everything to an out file + mainConfig.boringVault.toHexString().write(OUTPUT_JSON_PATH, ".boringVault"); + mainConfig.manager.toHexString().write(OUTPUT_JSON_PATH, ".manager"); + mainConfig.accountant.toHexString().write(OUTPUT_JSON_PATH, ".accountant"); + mainConfig.teller.toHexString().write(OUTPUT_JSON_PATH, ".teller"); + mainConfig.rolesAuthority.toHexString().write(OUTPUT_JSON_PATH, ".rolesAuthority"); } function deploy(ConfigReader.Config memory config) public override returns (address) { diff --git a/test/LiveDeploy.t.sol b/test/LiveDeploy.t.sol index fe768ca..d9a07c7 100644 --- a/test/LiveDeploy.t.sol +++ b/test/LiveDeploy.t.sol @@ -73,7 +73,7 @@ contract LiveDeploy is ForkTest, DeployAll { // Run the deployment scripts - run(FILE_NAME); + runLiveTest(FILE_NAME); // check for if all rate providers are deployed, if not error for (uint256 i; i < mainConfig.assets.length; ++i) {