-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
311 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
import { ethers } from 'hardhat' | ||
import '@nomiclabs/hardhat-ethers' | ||
import { deployAllContracts, deployBlobVerifierL1 } from '../deploymentUtils' | ||
import { createRollup } from '../rollupCreation' | ||
import { promises as fs } from 'fs' | ||
import { BigNumber } from 'ethers' | ||
import { RollupAdminLogic__factory } from '../../build/types' | ||
|
||
async function main() { | ||
/// read env vars needed for deployment | ||
let childChainName = process.env.CHILD_CHAIN_NAME as string | ||
if (!childChainName) { | ||
throw new Error('CHILD_CHAIN_NAME not set') | ||
} | ||
|
||
let deployerPrivKey = process.env.DEPLOYER_PRIVKEY as string | ||
if (!deployerPrivKey) { | ||
throw new Error('DEPLOYER_PRIVKEY not set') | ||
} | ||
|
||
let parentChainRpc = process.env.PARENT_CHAIN_RPC as string | ||
if (!parentChainRpc) { | ||
throw new Error('PARENT_CHAIN_RPC not set') | ||
} | ||
|
||
if (!process.env.PARENT_CHAIN_ID) { | ||
throw new Error('PARENT_CHAIN_ID not set') | ||
} | ||
|
||
const deployerWallet = new ethers.Wallet( | ||
deployerPrivKey, | ||
new ethers.providers.JsonRpcProvider(parentChainRpc) | ||
) | ||
|
||
/// get fee token address, if undefined use address(0) to have ETH as fee token | ||
let feeToken = process.env.FEE_TOKEN_ADDRESS as string | ||
if (!feeToken) { | ||
feeToken = ethers.constants.AddressZero | ||
} | ||
console.log('Fee token address:', feeToken) | ||
|
||
const rollupCreatorAddress = process.env.ROLLUP_CREATOR as string | ||
if (!rollupCreatorAddress) { | ||
throw new Error('ROLLUP_CREATOR not set') | ||
} | ||
const rollupCreatorFac = await ethers.getContractFactory('RollupCreator') | ||
const rollupCreator = rollupCreatorFac.attach(rollupCreatorAddress) | ||
|
||
const eigenDARollupManager = process.env.EIGENDA_ROLLUP_MANAGER as string | ||
if (!eigenDARollupManager) { | ||
throw new Error('EIGENDA_ROLLUP_MANAGER not set') | ||
} | ||
|
||
/// Create rollup | ||
const chainId = (await deployerWallet.provider.getNetwork()).chainId | ||
console.log( | ||
'Create rollup on top of chain', | ||
chainId, | ||
'using RollupCreator', | ||
rollupCreator.address | ||
) | ||
const result = await createRollup( | ||
deployerWallet, | ||
true, | ||
rollupCreator.address, | ||
feeToken, | ||
eigenDARollupManager, | ||
) | ||
|
||
if (!result) { | ||
throw new Error('Rollup creation failed') | ||
} | ||
|
||
const { rollupCreationResult, chainInfo } = result | ||
|
||
/// store deployment address | ||
// chain deployment info | ||
const chainDeploymentInfo = | ||
process.env.CHAIN_DEPLOYMENT_INFO !== undefined | ||
? process.env.CHAIN_DEPLOYMENT_INFO | ||
: 'deploy.json' | ||
await fs.writeFile( | ||
chainDeploymentInfo, | ||
JSON.stringify(rollupCreationResult, null, 2), | ||
'utf8' | ||
) | ||
|
||
// child chain info | ||
chainInfo['chain-name'] = childChainName | ||
const childChainInfo = | ||
process.env.CHILD_CHAIN_INFO !== undefined | ||
? process.env.CHILD_CHAIN_INFO | ||
: 'l2_chain_info.json' | ||
await fs.writeFile( | ||
childChainInfo, | ||
JSON.stringify([chainInfo], null, 2), | ||
'utf8' | ||
) | ||
} | ||
|
||
main() | ||
.then(() => process.exit(0)) | ||
.catch((error: Error) => { | ||
console.error(error) | ||
process.exit(1) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import { ethers } from 'hardhat' | ||
import '@nomiclabs/hardhat-ethers' | ||
import { deployBlobVerifierL1 } from '../deploymentUtils' | ||
import { promises as fs } from 'fs' | ||
|
||
|
||
async function main() { | ||
/// read env vars needed for deployment | ||
let childChainName = process.env.CHILD_CHAIN_NAME as string | ||
if (!childChainName) { | ||
throw new Error('CHILD_CHAIN_NAME not set') | ||
} | ||
|
||
let deployerPrivKey = process.env.DEPLOYER_PRIVKEY as string | ||
if (!deployerPrivKey) { | ||
throw new Error('DEPLOYER_PRIVKEY not set') | ||
} | ||
|
||
let parentChainRpc = process.env.PARENT_CHAIN_RPC as string | ||
if (!parentChainRpc) { | ||
throw new Error('PARENT_CHAIN_RPC not set') | ||
} | ||
|
||
let eigenDAServiceManagerAddress = process.env.EIGENDA_SERVICE_MANAGER_ADDRESS as string | ||
if (!eigenDAServiceManagerAddress) { | ||
throw new Error('EIGENDA_SERVICE_MANAGER_ADDRESS not set') | ||
} | ||
|
||
if (!process.env.PARENT_CHAIN_ID) { | ||
throw new Error('PARENT_CHAIN_ID not set') | ||
} | ||
|
||
const deployerWallet = new ethers.Wallet( | ||
deployerPrivKey, | ||
new ethers.providers.JsonRpcProvider(parentChainRpc) | ||
) | ||
|
||
// deploy templates and rollup creator | ||
const blobVerifierL1 = await deployBlobVerifierL1('EigenDABlobVerifierL1', deployerWallet, [eigenDAServiceManagerAddress], true) | ||
console.log('BlobVerifierL1 deployed at', blobVerifierL1.address) | ||
|
||
/// store deployment address | ||
// chain deployment info | ||
const verifierDeploymentInfo = 'blob_verifier_l1_deploy.json' | ||
await fs.writeFile( | ||
verifierDeploymentInfo, | ||
JSON.stringify(blobVerifierL1.address, null, 2), | ||
'utf8' | ||
) | ||
} | ||
|
||
main() | ||
.then(() => process.exit(0)) | ||
.catch((error: Error) => { | ||
console.error(error) | ||
process.exit(1) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
import { ethers } from 'hardhat' | ||
import '@nomiclabs/hardhat-ethers' | ||
import { deployAllContracts, deployBlobVerifierL1 } from '../deploymentUtils' | ||
import { createRollup } from '../rollupCreation' | ||
import { promises as fs } from 'fs' | ||
import { BigNumber } from 'ethers' | ||
import { RollupAdminLogic__factory } from '../../build/types' | ||
|
||
async function main() { | ||
/// read env vars needed for deployment | ||
let childChainName = process.env.CHILD_CHAIN_NAME as string | ||
if (!childChainName) { | ||
throw new Error('CHILD_CHAIN_NAME not set') | ||
} | ||
|
||
let deployerPrivKey = process.env.DEPLOYER_PRIVKEY as string | ||
if (!deployerPrivKey) { | ||
throw new Error('DEPLOYER_PRIVKEY not set') | ||
} | ||
|
||
let parentChainRpc = process.env.PARENT_CHAIN_RPC as string | ||
if (!parentChainRpc) { | ||
throw new Error('PARENT_CHAIN_RPC not set') | ||
} | ||
|
||
if (!process.env.PARENT_CHAIN_ID) { | ||
throw new Error('PARENT_CHAIN_ID not set') | ||
} | ||
|
||
const deployerWallet = new ethers.Wallet( | ||
deployerPrivKey, | ||
new ethers.providers.JsonRpcProvider(parentChainRpc) | ||
) | ||
|
||
const maxDataSize = | ||
process.env.MAX_DATA_SIZE !== undefined | ||
? ethers.BigNumber.from(process.env.MAX_DATA_SIZE) | ||
: ethers.BigNumber.from(117964) | ||
|
||
/// get fee token address, if undefined use address(0) to have ETH as fee token | ||
let feeToken = process.env.FEE_TOKEN_ADDRESS as string | ||
if (!feeToken) { | ||
feeToken = ethers.constants.AddressZero | ||
} | ||
console.log('Fee token address:', feeToken) | ||
|
||
// deploy templates and rollup creator | ||
console.log('Deploy RollupCreator') | ||
|
||
const contracts = await deployAllContracts(deployerWallet, maxDataSize, false) | ||
|
||
console.log('Set templates on the Rollup Creator') | ||
await ( | ||
await contracts.rollupCreator.setTemplates( | ||
contracts.bridgeCreator.address, | ||
contracts.osp.address, | ||
contracts.challengeManager.address, | ||
contracts.rollupAdmin.address, | ||
contracts.rollupUser.address, | ||
contracts.upgradeExecutor.address, | ||
contracts.validatorUtils.address, | ||
contracts.validatorWalletCreator.address, | ||
contracts.deployHelper.address, | ||
{ gasLimit: BigNumber.from('300000') } | ||
) | ||
).wait() | ||
|
||
console.log('Rollup creator is ready for rollup creation') | ||
|
||
/// store deployment address | ||
// chain deployment info | ||
const chainDeploymentInfo = | ||
process.env.CHAIN_DEPLOYMENT_INFO !== undefined | ||
? process.env.CHAIN_DEPLOYMENT_INFO | ||
: 'rollupCreatorContracts.json' | ||
await fs.writeFile( | ||
chainDeploymentInfo, | ||
JSON.stringify(contracts, null, 2), | ||
'utf8' | ||
) | ||
} | ||
|
||
main() | ||
.then(() => process.exit(0)) | ||
.catch((error: Error) => { | ||
console.error(error) | ||
process.exit(1) | ||
}) |