-
Notifications
You must be signed in to change notification settings - Fork 101
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
1 parent
cdf9fb5
commit 2337f0e
Showing
19 changed files
with
1,238 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* Imports: Internal */ | ||
import { DeployFunction } from 'hardhat-deploy/dist/types' | ||
|
||
import { names } from '../src/address-names' | ||
import { hexStringEquals } from '@mantleio/core-utils' | ||
|
||
/* Imports: External */ | ||
|
||
const deployFn: DeployFunction = async (hre) => { | ||
const { deploy } = hre.deployments | ||
const { deployer } = await hre.getNamedAccounts() | ||
const owner = hre.deployConfig.bvmAddressManagerOwner | ||
|
||
if (hexStringEquals(deployer, owner)) { | ||
console.log("deployer ", deployer, "can not be owner ", owner) | ||
process.exit(1) | ||
} | ||
await deploy(names.unmanaged.Lib_AddressManager, { | ||
from: deployer, | ||
args: [], | ||
log: true, | ||
waitConfirmations: hre.deployConfig.numDeployConfirmations, | ||
}) | ||
} | ||
|
||
// This is kept during an upgrade. So no upgrade tag. | ||
deployFn.tags = ['Lib_AddressManager'] | ||
|
||
export default deployFn |
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,27 @@ | ||
/* Imports: External */ | ||
import { DeployFunction } from 'hardhat-deploy/dist/types' | ||
|
||
/* Imports: Internal */ | ||
import { | ||
deployAndVerifyAndThen, | ||
getContractFromArtifact, | ||
} from '../src/deploy-utils' | ||
import { names } from '../src/address-names' | ||
|
||
const deployFn: DeployFunction = async (hre) => { | ||
const Lib_AddressManager = await getContractFromArtifact( | ||
hre, | ||
names.unmanaged.Lib_AddressManager | ||
) | ||
|
||
await deployAndVerifyAndThen({ | ||
hre, | ||
name: names.managed.contracts.ChainStorageContainer_CTC_batches, | ||
contract: 'ChainStorageContainer', | ||
args: [Lib_AddressManager.address, 'CanonicalTransactionChain'], | ||
}) | ||
} | ||
|
||
deployFn.tags = ['ChainStorageContainer_ctc_batches', 'upgrade'] | ||
|
||
export default deployFn |
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,27 @@ | ||
/* Imports: External */ | ||
import { DeployFunction } from 'hardhat-deploy/dist/types' | ||
|
||
/* Imports: Internal */ | ||
import { | ||
deployAndVerifyAndThen, | ||
getContractFromArtifact, | ||
} from '../src/deploy-utils' | ||
import { names } from '../src/address-names' | ||
|
||
const deployFn: DeployFunction = async (hre) => { | ||
const Lib_AddressManager = await getContractFromArtifact( | ||
hre, | ||
names.unmanaged.Lib_AddressManager | ||
) | ||
|
||
await deployAndVerifyAndThen({ | ||
hre, | ||
name: names.managed.contracts.ChainStorageContainer_SCC_batches, | ||
contract: 'ChainStorageContainer', | ||
args: [Lib_AddressManager.address, 'StateCommitmentChain'], | ||
}) | ||
} | ||
|
||
deployFn.tags = ['ChainStorageContainer_scc_batches', 'upgrade'] | ||
|
||
export default deployFn |
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,31 @@ | ||
/* Imports: External */ | ||
import { DeployFunction } from 'hardhat-deploy/dist/types' | ||
|
||
/* Imports: Internal */ | ||
import { | ||
deployAndVerifyAndThen, | ||
getContractFromArtifact, | ||
} from '../src/deploy-utils' | ||
import { names } from '../src/address-names' | ||
|
||
const deployFn: DeployFunction = async (hre) => { | ||
const Lib_AddressManager = await getContractFromArtifact( | ||
hre, | ||
names.unmanaged.Lib_AddressManager | ||
) | ||
|
||
await deployAndVerifyAndThen({ | ||
hre, | ||
name: names.managed.contracts.CanonicalTransactionChain, | ||
args: [ | ||
Lib_AddressManager.address, | ||
hre.deployConfig.l2BlockGasLimit, | ||
hre.deployConfig.ctcL2GasDiscountDivisor, | ||
hre.deployConfig.ctcEnqueueGasCost, | ||
], | ||
}) | ||
} | ||
|
||
deployFn.tags = ['CanonicalTransactionChain', 'upgrade'] | ||
|
||
export default deployFn |
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,26 @@ | ||
/* Imports: External */ | ||
import { DeployFunction } from 'hardhat-deploy/dist/types' | ||
|
||
/* Imports: Internal */ | ||
import { | ||
deployAndVerifyAndThen, | ||
getContractFromArtifact, | ||
} from '../src/deploy-utils' | ||
import { names } from '../src/address-names' | ||
|
||
const deployFn: DeployFunction = async (hre) => { | ||
const Lib_AddressManager = await getContractFromArtifact( | ||
hre, | ||
names.unmanaged.Lib_AddressManager | ||
) | ||
|
||
await deployAndVerifyAndThen({ | ||
hre, | ||
name: names.managed.contracts.BondManager, | ||
args: [Lib_AddressManager.address], | ||
}) | ||
} | ||
|
||
deployFn.tags = ['BondManager', 'upgrade'] | ||
|
||
export default deployFn |
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,84 @@ | ||
/* Imports: External */ | ||
import { DeployFunction } from 'hardhat-deploy/dist/types' | ||
import { hexStringEquals, awaitCondition } from '@mantleio/core-utils' | ||
|
||
/* Imports: Internal */ | ||
import { | ||
deployAndVerifyAndThen, | ||
getContractFromArtifact, | ||
} from '../src/deploy-utils' | ||
import { names } from '../src/address-names' | ||
|
||
const deployFn: DeployFunction = async (hre) => { | ||
const Lib_AddressManager = await getContractFromArtifact( | ||
hre, | ||
names.unmanaged.Lib_AddressManager | ||
) | ||
|
||
await deployAndVerifyAndThen({ | ||
hre, | ||
name: names.managed.contracts.BVM_L1CrossDomainMessenger, | ||
contract: 'L1CrossDomainMessenger', | ||
args: [], | ||
postDeployAction: async (contract) => { | ||
// Theoretically it's not necessary to initialize this contract since it sits behind | ||
// a proxy. However, it's best practice to initialize it anyway just in case there's | ||
// some unknown security hole. It also prevents another user from appearing like an | ||
// official address because it managed to call the initialization function. | ||
console.log(`Initializing L1CrossDomainMessenger (implementation)...`) | ||
await contract.initialize(Lib_AddressManager.address) | ||
|
||
console.log(`Checking that contract was correctly initialized...`) | ||
await awaitCondition( | ||
async () => { | ||
return hexStringEquals( | ||
await contract.libAddressManager(), | ||
Lib_AddressManager.address | ||
) | ||
}, | ||
5000, | ||
100 | ||
) | ||
|
||
// Same thing as above, we want to transfer ownership of this contract to the owner of the | ||
// AddressManager. Not technically necessary but seems like the right thing to do. | ||
console.log( | ||
`set pauseowner of L1CrossDomainMessenger (implementation)...` | ||
) | ||
// set the pauseowner | ||
const pauseowner = hre.deployConfig.bvmCrossDomainPauseOwner | ||
await contract.setPauseOwner(pauseowner) | ||
console.log(`Checking that contract pause owner was correctly set...`) | ||
await awaitCondition( | ||
async () => { | ||
console.log(contract.getPauseOwner()) | ||
console.log(pauseowner) | ||
return hexStringEquals(await contract.getPauseOwner(), pauseowner) | ||
}, | ||
5000, | ||
100 | ||
) | ||
|
||
// Same thing as above, we want to transfer ownership of this contract to the owner of the | ||
// AddressManager. Not technically necessary but seems like the right thing to do. | ||
console.log( | ||
`Transferring ownership of L1CrossDomainMessenger (implementation)...` | ||
) | ||
const owner = hre.deployConfig.bvmAddressManagerOwner | ||
await contract.transferOwnership(owner) | ||
|
||
console.log(`Checking that contract owner was correctly set...`) | ||
await awaitCondition( | ||
async () => { | ||
return hexStringEquals(await contract.owner(), owner) | ||
}, | ||
5000, | ||
100 | ||
) | ||
}, | ||
}) | ||
} | ||
|
||
deployFn.tags = ['L1CrossDomainMessenger', 'upgrade'] | ||
|
||
export default deployFn |
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,29 @@ | ||
/* Imports: External */ | ||
import { DeployFunction } from 'hardhat-deploy/dist/types' | ||
|
||
/* Imports: Internal */ | ||
import { | ||
deployAndVerifyAndThen, | ||
getContractFromArtifact, | ||
} from '../src/deploy-utils' | ||
import { names } from '../src/address-names' | ||
|
||
const deployFn: DeployFunction = async (hre) => { | ||
const Lib_AddressManager = await getContractFromArtifact( | ||
hre, | ||
names.unmanaged.Lib_AddressManager | ||
) | ||
|
||
await deployAndVerifyAndThen({ | ||
hre, | ||
name: 'Proxy__BVM_L1CrossDomainMessenger', | ||
contract: 'Lib_ResolvedDelegateProxy', | ||
iface: 'L1CrossDomainMessenger', | ||
args: [Lib_AddressManager.address, 'BVM_L1CrossDomainMessenger'], | ||
}) | ||
} | ||
|
||
// This is kept during an upgrade. So no upgrade tag. | ||
deployFn.tags = ['Proxy__BVM_L1CrossDomainMessenger'] | ||
|
||
export default deployFn |
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,35 @@ | ||
/* Imports: External */ | ||
import { DeployFunction } from 'hardhat-deploy/dist/types' | ||
|
||
/* Imports: Internal */ | ||
import { | ||
deployAndVerifyAndThen, | ||
getContractFromArtifact, | ||
} from '../src/deploy-utils' | ||
import { names } from '../src/address-names' | ||
|
||
const deployFn: DeployFunction = async (hre) => { | ||
const Lib_AddressManager = await getContractFromArtifact( | ||
hre, | ||
names.unmanaged.Lib_AddressManager | ||
) | ||
const Proxy__BVM_L1CrossDomainMessenger = await getContractFromArtifact( | ||
hre, | ||
names.managed.contracts.Proxy__BVM_L1CrossDomainMessenger | ||
) | ||
|
||
await deployAndVerifyAndThen({ | ||
hre, | ||
name: names.managed.contracts.StateCommitmentChain, | ||
args: [ | ||
Lib_AddressManager.address, | ||
Proxy__BVM_L1CrossDomainMessenger.address, | ||
hre.deployConfig.sccFaultProofWindowSeconds, | ||
hre.deployConfig.sccSequencerPublishWindowSeconds, | ||
], | ||
}) | ||
} | ||
|
||
deployFn.tags = ['StateCommitmentChain', 'upgrade'] | ||
|
||
export default deployFn |
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,23 @@ | ||
/* Imports: External */ | ||
import { DeployFunction } from 'hardhat-deploy/dist/types' | ||
|
||
/* Imports: Internal */ | ||
import { deployAndVerifyAndThen } from '../src/deploy-utils' | ||
import { names } from '../src/address-names' | ||
|
||
const deployFn: DeployFunction = async (hre) => { | ||
const { deployer } = await hre.getNamedAccounts() | ||
|
||
await deployAndVerifyAndThen({ | ||
hre, | ||
name: names.managed.contracts.Proxy__BVM_L1StandardBridge, | ||
contract: 'L1ChugSplashProxy', | ||
iface: 'L1StandardBridge', | ||
args: [deployer], | ||
}) | ||
} | ||
|
||
// This is kept during an upgrade. So no upgrade tag. | ||
deployFn.tags = ['Proxy__BVM_L1StandardBridge'] | ||
|
||
export default deployFn |
Oops, something went wrong.