Reputation: 400
The bellow shows sample code for the Smart Contract Code
SPDX-License-Identifier: MIT
pragma solidity >=0.8.9;
import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
contract ERC20Test is ERC20Upgradeable, OwnableUpgradeable, AccessControlUpgradeable, UUPSUpgradeable {
function initialize() initializer public {
__ERC20_init("Test1", "TST1");
__Ownable_init();
__AccessControl_init();
_setupRole(DEFAULT_ADMIN_ROLE, msg.sender);
}
function _authorizeUpgrade(address newImplementation)
internal
onlyRole(DEFAULT_ADMIN_ROLE)
override
{}
}
Deployment script for the above smart contract
require("dotenv").config();
const hre = require("hardhat");
async function main() {
try {
const provider = new hre.ethers.providers.JsonRpcProvider(
process.env.PROVIDER_URL
);
const owner = new hre.ethers.Wallet(process.env.PRIVATE_KEY, provider);
const Token = await hre.ethers.getContractFactory("Test1", owner);
const token = await hre.upgrades.deployProxy(Token, ["Test1", "TST1"], {
txOverrides: { maxFeePerGas: 10e9 },
initializer: "initialize",
owner,
});
console.log("Test Address:", token);
} catch (err) {
console.error(err);
process.exit(1);
}
}
main()
.then(() => process.exit(0))
.catch((error) => {
console.error(error);
process.exit(1);
});
The error message we are getting
Timed out waiting for implementation contract deployment to address 0x... with transaction 0x...
When we navigate to the local Docker environment and inspect the logs, we observe that one contract is successfully deployed, while the deployment of the other contract remains pending for some time (around 1 minute). After this delay, the following error is displayed:
Upvotes: 0
Views: 151
Reputation: 400
Refer to this thread to get the answer. https://forum.openzeppelin.com/t/timed-out-waiting-for-existing-implementation/32861/11
Upvotes: 0