Skip to content
This repository was archived by the owner on Nov 27, 2024. It is now read-only.
Open
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
8 changes: 8 additions & 0 deletions deployment/helpers/deployment-helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ const { ethers } = require('hardhat');
const gasPriceKeylessDeployment = '100'; // 100 gweis

async function deploySupernets2Deployer(deployerAddress, signer) {
const deployerNetwork = await signer.provider.getNetwork();
const chainId = deployerNetwork.chainId ? deployerNetwork.chainId : 0;
const Supernets2DeployerFactory = await ethers.getContractFactory('Supernets2Deployer', signer);

const deployTxSupernets2Deployer = (Supernets2DeployerFactory.getDeployTransaction(
Expand All @@ -22,6 +24,7 @@ async function deploySupernets2Deployer(deployerAddress, signer) {
gasLimit: gasLimit.toHexString(),
gasPrice: gasPrice.toHexString(),
data: deployTxSupernets2Deployer,
chainId,
};

const signature = {
Expand Down Expand Up @@ -57,6 +60,9 @@ async function deploySupernets2Deployer(deployerAddress, signer) {
}

async function create2Deployment(supernets2DeployerContract, salt, deployTransaction, dataCall, deployer, hardcodedGasLimit) {
const deployerNetwork = await deployer.provider.getNetwork();
const chainId = deployerNetwork.chainId ? deployerNetwork.chainId : 0;

// Encode deploy transaction
const hashInitCode = ethers.utils.solidityKeccak256(['bytes'], [deployTransaction]);

Expand All @@ -78,6 +84,7 @@ async function create2Deployment(supernets2DeployerContract, salt, deployTransac
dataCall,
);
populatedTransaction.gasLimit = ethers.BigNumber.from(hardcodedGasLimit);
populatedTransaction.chainId = chainId;
await (await deployer.sendTransaction(populatedTransaction)).wait();
} else {
await (await supernets2DeployerContract.deployDeterministicAndCall(amount, salt, deployTransaction, dataCall)).wait();
Expand All @@ -91,6 +98,7 @@ async function create2Deployment(supernets2DeployerContract, salt, deployTransac
deployTransaction,
);
populatedTransaction.gasLimit = ethers.BigNumber.from(hardcodedGasLimit);
populatedTransaction.chainId = chainId;
await (await deployer.sendTransaction(populatedTransaction)).wait();
} else {
await (await supernets2DeployerContract.deployDeterministic(amount, salt, deployTransaction)).wait();
Expand Down