Skip to content

Commit

Permalink
feat(plg): move predeploys from core
Browse files Browse the repository at this point in the history
Moves predeploy deployment functions from core to plugins. Makes more
sense because the deployments are hardhat specific.
  • Loading branch information
smartcontracts committed Nov 5, 2022
1 parent 7891768 commit 1b88270
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 57 deletions.
6 changes: 6 additions & 0 deletions .changeset/thick-feet-jump.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@chugsplash/core': patch
'@chugsplash/plugins': patch
---

Moves predeploy deployment from core to plugins
1 change: 0 additions & 1 deletion packages/core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@ export * from './actions'
export * from './config'
export * from './languages'
export * from './utils'
export * from './predeploys'
10 changes: 8 additions & 2 deletions packages/plugins/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,21 @@
"@eth-optimism/core-utils": "^0.9.1",
"@ethereumjs/common": "^3.0.1",
"@ethereumjs/vm": "^6.2.0",
"@nomiclabs/hardhat-ethers": "^2.2.1",
"cli-progress": "^3.11.2",
"dotenv": "^16.0.3",
"ethers": "^5.6.9",
"hardhat": "^2.10.0",
"ipfs-http-client": "56.0.3",
"ipfs-only-hash": "^4.0.0",
"node-fetch": "^2.6.7",
"ora": "^5.4.1",
"semver": "^7.3.7"
},
"devDependencies": {
"@nomiclabs/hardhat-ethers": "^2.2.1",
"hardhat": "^2.10.0"
},
"peerDependencies": {
"hardhat": "^2",
"@nomiclabs/hardhat-ethers": "^2"
}
}
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
import { Contract, ethers, Signer } from 'ethers'
import 'hardhat-deploy'
import { HardhatRuntimeEnvironment } from 'hardhat/types'
import {
OWNER_BOND_AMOUNT,
EXECUTOR_BOND_AMOUNT,
EXECUTION_LOCK_TIME,
EXECUTOR_PAYMENT_PERCENTAGE,
CHUGSPLASH_REGISTRY_PROXY_ADDRESS,
PROXY_UPDATER_ADDRESS,
ProxyUpdaterABI,
ProxyUpdaterArtifact,
ChugSplashRegistryABI,
ChugSplashRegistryArtifact,
ChugSplashManagerABI,
ChugSplashManagerArtifact,
DefaultAdapterABI,
Expand All @@ -19,11 +15,10 @@ import {
ChugSplashBootLoaderArtifact,
DEFAULT_ADAPTER_ADDRESS,
} from '@chugsplash/contracts'

import { getChugSplashRegistry } from './utils'
import { getChugSplashRegistry } from '@chugsplash/core'

export const deployChugSplashPredeploys = async (
hre,
hre: HardhatRuntimeEnvironment,
deployer: ethers.Signer
) => {
const chugsplashOwnerAddress = '0x1A3DAA6F487A480c1aD312b90FD0244871940b66'
Expand Down Expand Up @@ -132,49 +127,6 @@ export const deployChugSplashManagerImplementation = async (
return address
}

export const deployProxyUpdater = async (hre, deployerAddress: string) => {
const { deploy } = await hre.deployments.deterministic('ProxyUpdater', {
salt: hre.ethers.utils.solidityKeccak256(['string'], ['ProxyUpdater']),
from: deployerAddress,
contract: {
abi: ProxyUpdaterABI,
bytecode: ProxyUpdaterArtifact.bytecode,
},
args: [],
log: true,
})
await deploy()
}

export const deployChugSplashRegistry = async (
hre,
deployerAddress: string
) => {
const ProxyUpdater = await hre.deployments.get('ProxyUpdater')

const { deploy } = await hre.deployments.deterministic('ChugSplashRegistry', {
salt: hre.ethers.utils.solidityKeccak256(
['string'],
['ChugSplashRegistry']
),
from: deployerAddress,
contract: {
abi: ChugSplashRegistryABI,
bytecode: ChugSplashRegistryArtifact.bytecode,
},
args: [
ProxyUpdater.address,
OWNER_BOND_AMOUNT,
EXECUTOR_BOND_AMOUNT,
EXECUTION_LOCK_TIME,
EXECUTOR_PAYMENT_PERCENTAGE,
],
log: true,
})

await deploy()
}

export const deployDefaultAdapter = async (hre, deployerAddress: string) => {
const { deploy } = await hre.deployments.deterministic('DefaultAdapter', {
salt: hre.ethers.utils.solidityKeccak256(['string'], ['DefaultAdapter']),
Expand Down
7 changes: 4 additions & 3 deletions packages/plugins/src/hardhat/tasks.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import * as path from 'path'
import * as fs from 'fs'

import '@nomiclabs/hardhat-ethers'
import { ethers } from 'ethers'
import { subtask, task, types } from 'hardhat/config'
import { SolcBuild } from 'hardhat/types'
Expand All @@ -26,9 +25,7 @@ import {
ChugSplashBundleStatus,
loadChugSplashConfig,
writeSnapshotId,
deployChugSplashPredeploys,
registerChugSplashProject,
chugsplashContractsAreDeployedAndInitialized,
getChugSplashRegistry,
parseContractReferences,
} from '@chugsplash/core'
Expand All @@ -44,6 +41,10 @@ import {
getStorageLayout,
} from './artifacts'
import { deployContracts } from './deployments'
import {
chugsplashContractsAreDeployedAndInitialized,
deployChugSplashPredeploys,
} from './predeploys'

// Load environment variables from .env
dotenv.config()
Expand Down

0 comments on commit 1b88270

Please sign in to comment.