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

Contract deployers: configure signer for address publishing #1676

Merged
merged 3 commits into from
Feb 13, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
35 changes: 25 additions & 10 deletions contracts/deployment_scripts/bridge/001_deploy_bridge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,20 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {

// get management contract and write the L1 bridge address to it
const mgmtContract = (await hre.ethers.getContractFactory('ManagementContract')).attach(mgmtContractAddress)
const recordL1AddressTx = await mgmtContract.SetImportantContractAddress("L1Bridge", layer1BridgeDeployment.address);
const receipt = await recordL1AddressTx.wait();
if (receipt.status !== 1) {
console.log("Failed to set L1BridgeAddress in management contract");
const recordL1AddressTx = await mgmtContract.populateTransaction.SetImportantContractAddress("L1Bridge", layer1BridgeDeployment.address);

const receipt = await hre.companionNetworks.layer1.deployments.rawTx({
from: accountsL1.deployer,
to: mgmtContractAddress,
data: recordL1AddressTx.data,
log: true,
waitConfirmations: 1,
});
if (receipt.events?.length === 0) {
console.log(`Failed to set L1BridgeAddress=${layer1BridgeDeployment.address} on management contract.`);
} else {
console.log(`L1BridgeAddress=${layer1BridgeDeployment.address}`);
}
console.log(`L1BridgeAddress=${layer1BridgeDeployment.address}`)

// We get the Cross chain messenger deployment on the layer 2 network.
const messengerL2 = await deployments.get("CrossChainMessenger");
Expand All @@ -69,12 +77,19 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
log: true,
}, "setRemoteBridge", layer2BridgeDeployment.address);

const recordL2AddressTx = await mgmtContract.SetImportantContractAddress("L2Bridge", layer2BridgeDeployment.address);
const receipt2 = await recordL2AddressTx.wait();
if (receipt2.status !== 1) {
console.log("Failed to set L2BridgeAddress in management contract");
const recordL2AddressTx = await mgmtContract.populateTransaction.SetImportantContractAddress("L2Bridge", layer2BridgeDeployment.address);
const receipt2 = await hre.companionNetworks.layer1.deployments.rawTx({
from: accountsL1.deployer,
to: mgmtContractAddress,
data: recordL2AddressTx.data,
log: true,
waitConfirmations: 1,
});
if (receipt2.events?.length === 0) {
console.log(`Failed to set L2BridgeAddress=${layer2BridgeDeployment.address} on management contract.`);
} else {
console.log(`L2BridgeAddress=${layer2BridgeDeployment.address}`);
}
console.log(`L2BridgeAddress=${layer2BridgeDeployment.address}`)
console.log(` Bridge deployed with from L1 address=${accountsL1.deployer} L2 Address=${accountsL2.deployer}`);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,19 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {

// get management contract and write the cross chain messenger address to it
const mgmtContract = (await hre.ethers.getContractFactory('ManagementContract')).attach(mgmtContractAddress)
const tx = await mgmtContract.SetImportantContractAddress("L1CrossChainMessenger", crossChainDeployment.address);
const receipt = await tx.wait();
if (receipt.status !== 1) {
console.log("Failed to set L1CrossChainMessenger in management contract");
const tx = await mgmtContract.populateTransaction.SetImportantContractAddress("L1CrossChainMessenger", crossChainDeployment.address);
const receipt = await hre.companionNetworks.layer1.deployments.rawTx({
from: deployer,
to: mgmtContractAddress,
data: tx.data,
log: true,
waitConfirmations: 1,
});
if (receipt.events?.length === 0) {
console.log(`Failed to set L1CrossChainMessenger=${crossChainDeployment.address} on management contract.`);
} else {
console.log(`L1CrossChainMessenger=${crossChainDeployment.address}`);
}
console.log(`L1CrossChainMessenger=${crossChainDeployment.address}`);
};

export default func;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,19 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
});
// get L1 management contract and write the cross chain messenger address to it
const mgmtContract = (await hre.ethers.getContractFactory('ManagementContract')).attach(mgmtContractAddress);
const tx = await mgmtContract.SetImportantContractAddress("L2CrossChainMessenger", crossChainDeployment.address);
const receipt = await tx.wait();
if (receipt.status !== 1) {
console.log("Failed to set L2CrossChainMessenger in management contract");
const tx = await mgmtContract.populateTransaction.SetImportantContractAddress("L2CrossChainMessenger", crossChainDeployment.address);
const receipt = await companionNetworks.layer1.deployments.rawTx({
from: deployer,
to: mgmtContractAddress,
data: tx.data,
log: true,
waitConfirmations: 1,
});
if (receipt.events?.length === 0) {
console.log(`Failed to set L2CrossChainMessenger=${crossChainDeployment.address} on management contract.`);
} else {
console.log(`L2CrossChainMessenger=${crossChainDeployment.address}`);
}
console.log(`L2CrossChainMessenger=${crossChainDeployment.address}`);
};

export default func;
Expand Down
Loading