Skip to content

Commit

Permalink
feat: all steps to deploy a new chain
Browse files Browse the repository at this point in the history
  • Loading branch information
0xtekgrinder committed Jun 13, 2024
1 parent b8fde5d commit 4b83dcc
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion scripts/DeployChain.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,15 @@ contract DeployChain is Script, CommonUtils {
uint256 chainId = vm.envUint("CHAIN_ID");

/** TODO complete */
bool mock = vm.envOr("MOCK", false);
address timelock = vm.envOr("TIMELOCK", _chainToContract(chainId, ContractType.Timelock));
address governor = vm.envOr("GOVERNOR", _chainToContract(chainId, ContractType.GovernorMultisig));
address guardian = vm.envOr("GUARDIAN", _chainToContract(chainId, ContractType.GuardianMultisig));
/** END complete */

uint256 deployerPrivateKey = vm.deriveKey(vm.envString("MNEMONIC_MAINNET"), "m/44'/60'/0'/0/", 0);
vm.startBroadcast(deployerPrivateKey);
address deployer = vm.addr(deployerPrivateKey);

ProxyAdmin proxyAdmin = new ProxyAdmin();
console.log("ProxyAdmin deployed at", address(proxyAdmin));
Expand All @@ -30,12 +33,16 @@ contract DeployChain is Script, CommonUtils {
_deployUpgradeable(
address(proxyAdmin),
address(coreBorrowImpl),
abi.encodeWithSelector(CoreBorrow.initialize.selector, governor, guardian)
abi.encodeWithSelector(CoreBorrow.initialize.selector, mock ? deployer : governor, guardian)
)
)
);
console.log("CoreBorrow Proxy deployed at", address(coreBorrowProxy));

coreBorrowProxy.addGovernor(timelock);

proxyAdmin.changeOwner(governor);

vm.serializeAddress("", "coreBorrow", address(coreBorrowProxy));
vm.serializeAddress("", "guardian", guardian);
vm.serializeAddress("", "governor", governor);
Expand Down

0 comments on commit 4b83dcc

Please sign in to comment.