Skip to content

Commit

Permalink
Added new scripts.
Browse files Browse the repository at this point in the history
  • Loading branch information
StefanIliev545 committed Sep 21, 2023
1 parent 4f92616 commit f1fe428
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions contracts/deployment_scripts/funding/layer1/001_fund_accounts.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import {HardhatRuntimeEnvironment} from 'hardhat/types';
import {DeployFunction} from 'hardhat-deploy/types';


const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const layer1 = hre.companionNetworks.layer1;

const {deployer} = await hre.getNamedAccounts();
const l1Accs = await layer1.getNamedAccounts();

const messageBusAddress = process.env.MESSAGE_BUS_ADDRESS || "0x3FA8A7A039519602eBA00D443a14C0eb2358359a"

const messageBus = (await hre.ethers.getContractFactory('MessageBus')).attach(messageBusAddress)
const prefundAmount = hre.ethers.utils.parseEther("0.05");
const tx = await messageBus.populateTransaction.sendValueToL2(deployer, prefundAmount, {
value: prefundAmount
});


console.log(`Sending ${prefundAmount} to ${deployer}`);

const receipt = await layer1.deployments.rawTx({
from: l1Accs.deployer,
to: messageBusAddress,
value: prefundAmount,
data: tx.data,
log: true,
waitConfirmations: 1,
});
if (receipt.events?.length === 0) {
console.log(`Account prefunding status = FAILURE NO CROSS CHAIN EVENT`);
} else {
console.log(`Account prefunding status = ${receipt.status}`);
}
};

export default func;
func.tags = ['GasPrefunding', 'GasPrefunding_deploy'];
// No dependencies

0 comments on commit f1fe428

Please sign in to comment.