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

Deploy scripts: load message bus address dynamically #2127

Merged
merged 2 commits into from
Nov 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
18 changes: 9 additions & 9 deletions contracts/deployment_scripts/testing/003_simple_withdrawal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,15 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
return;
const l2Network = hre;
const {deployer} = await hre.getNamedAccounts();

var mbusBase = await hre.ethers.getContractAt("MessageBus", "0x526c84529b2b8c11f57d93d3f5537aca3aecef9b");

const networkConfig : any = await hre.network.provider.request({method: 'net_config'});
console.log(`Network config = ${JSON.stringify(networkConfig, null, 2)}`);

const mgmtContractAddress = networkConfig.ManagementContractAddress;
const messageBusAddress = networkConfig.MessageBusAddress;
const l2MessageBusAddress = networkConfig.L2MessageBusAddress;

var mbusBase = await hre.ethers.getContractAt("MessageBus", l2MessageBusAddress);
const mbus = mbusBase.connect(await hre.ethers.provider.getSigner(deployer));
const tx = await mbus.getFunction("sendValueToL2").send(deployer, 1000, { value: 1000});
const receipt = await tx.wait()
Expand Down Expand Up @@ -96,13 +103,6 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
return
}


const networkConfig : any = await hre.network.provider.request({method: 'net_config'});
console.log(`Network config = ${JSON.stringify(networkConfig, null, 2)}`);

const mgmtContractAddress = networkConfig.ManagementContractAddress;
const messageBusAddress = networkConfig.MessageBusAddress;

const l1Accounts = await hre.companionNetworks.layer1.getNamedAccounts()
const fundTx = await hre.companionNetworks.layer1.deployments.rawTx({
from: l1Accounts.deployer,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {

console.log(` Using deployers for bridge interaction L1 address=${l1Accounts.deployer} L2 Address=${l2Accounts.deployer}`);

// Request the message bus address from the config endpoint
const networkConfig: any = await hre.network.provider.request({ method: 'net_config' });
if (!networkConfig || !networkConfig.L2MessageBusAddress) {
throw new Error("Failed to retrieve L2MessageBusAddress from network config");
}
const l2messageBusAddress = networkConfig.L2MessageBusAddress;
console.log(`Loaded message bus address = ${l2messageBusAddress}`);

// Tell the bridge to whitelist the address of HOC token. This generates a cross chain message.
let hocResult = await l1Network.deployments.execute("ObscuroBridge", {
from: l1Accounts.deployer,
Expand Down Expand Up @@ -95,7 +103,7 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
// Poll message submission
await new Promise(async (resolve, fail)=> {
setTimeout(fail, 30_000)
const messageBusContract = (await hre.ethers.getContractAt('MessageBus', '0x526c84529b2b8c11f57d93d3f5537aca3aecef9b'));
const messageBusContract = (await hre.ethers.getContractAt('MessageBus', l2messageBusAddress));
const gasLimit = await messageBusContract.getFunction('verifyMessageFinalized').estimateGas(messages[1], {
maxFeePerGas: 1000000001,
})
Expand Down
Loading