Its been 3 days since i am regretting that I have built my project on Hardhat. I am using erc1967 proxy with proxyadmin to run my logic contract, Everything is running fine on the local Ganache chain but I am getting an error while I am deploying on the Rinkeby.
Error: cannot estimate gas; transaction may fail or may require manual gas limit
Here is my deployment script.
const hre = require("hardhat");
async function main() {
// We get the contract to deploy
// const Greeter = await ethers.getContractFactory("Greeter");
[account_one, account_two, account_three] = await hre.ethers.getSigners();
const initializeData = Buffer.from('');
const TransparentUpgradeableProxy = await hre.ethers.getContractFactory('TransparentUpgradeableProxy');
const ProxyAdmin = await hre.ethers.getContractFactory('ProxyAdmin');
const Reputation = await hre.ethers.getContractFactory("Reputation");
const Posts = await hre.ethers.getContractFactory("Posts");
const proxyAdmin = await ProxyAdmin.deploy()
console.log("proxyadmin deployed to:", proxyAdmin.address);
const reputation = await Reputation.deploy();
console.log("Reputation deployed to:", reputation.address);
const reputationProxy = await TransparentUpgradeableProxy.deploy(reputation.address, proxyAdmin.address, initializeData)
console.log("Reputation Proxy deployed at: posts contract", reputationProxy.address);
const posts = await Posts.deploy();
await posts.initialize(reputationProxy.address, 5, 130000000, 10)
// const postsProxyAdmin = await ProxyAdmin.deploy()
// console.log("proxyadmin deployed to:", postsProxyAdmin.address);
console.log("Posts deployed to:", posts.address);
const postsProxy = await TransparentUpgradeableProxy.deploy(posts.address, proxyAdmin.address, initializeData)
console.log("Posts Proxy deployed at: posts contract", postsProxy.address);
const reputationProxyContract = await Reputation.attach(reputationProxy.address);
await reputationProxyContract.initialize(postsProxy.address);
const executor = await reputationProxyContract.getExecutor()
// await reputation.transferOwnership(postsProxy.address);
// console.log("Ownership transffered: posts contract");
console.log("Executor is ", executor)
// reputationOwner = await reputationProxy.owner.call();
// console.log("New owner of reputation contract is", reputationOwner);
}
main()
.then(() => process.exit(0))
.catch(error => {
console.error(error);
process.exit(1);
});
The blogs i have read suggested that i should manually set the gas while sending the transaction. I have researching on how to do it but Hardhat being an obsolete project doesn’t have any documentation on it . Please help me here.