I am trying to deploy a contract as per documentation https://hardhat.org/guides/deploying.html#deploying-your-contracts Below is how i am deploying it
hardhat.config.js
require("@nomiclabs/hardhat-ethers");
require("@openzeppelin/hardhat-upgrades");
const fs = require("fs");
module.exports = {
defaultNetwork: "hardhat",
networks: {local: {
url: "http://127.0.0.1:8545",
from: "0x46b01b2888929537269342ce9454ca33873e33a9" // want this contract owner
}},
solidity: "0.8.1",
};
deploy.js
const { ethers } = require("hardhat");
(async () => {
try {
let ContractFactory = await ethers.getContractFactory("SomeContract");
let contract = await ContractFactory.deploy();
console.log("Contract address:", contract.address);
console.log("Contract creation transaction:", contract.deployTransaction.hash);
}catch(err) {
console.log('Error deploying contract: ', err);
}
})();
Well, in this way hardhat will deploy contract by using first signer. This is what i dont want... I want to specify a particular Address as singer/owner of the contract.
Is there any way to achieve this other than iterating over all signers() & set the signer i wanted as owner. Any help would be much appreciated.