Skip to content
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

Carson/nucleus deployments integration #25

Merged
merged 7 commits into from
Sep 30, 2024
Merged
Show file tree
Hide file tree
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
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,6 @@
[submodule "lib/createx"]
path = lib/createx
url = https://github.com/pcaversaccio/createx
[submodule "nucleus-deployments"]
path = nucleus-deployments
url = [email protected]:Ion-Protocol/nucleus-deployments.git
24 changes: 23 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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}'
Expand All @@ -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
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
7 changes: 7 additions & 0 deletions deployment-config/out-template.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"boringVault": "",
"manager": "",
"accountant": "",
"teller": "",
"rolesAuthority": ""
}
1 change: 1 addition & 0 deletions nucleus-deployments
Submodule nucleus-deployments added at 3aaf20
14 changes: 13 additions & 1 deletion script/deploy/deployAll.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand All @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion test/LiveDeploy.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Loading