Hi,
I am having issues interacting with my smart contracts through the Infura RPC using Hardhat tasks.
I was running some scripts/tasks that interact with smart contracts and everything was fine, I was able to retrieve information from the contract as well as change it’s state (mine NFTs, etc.).
All of a sudden something has changed and I dont know what happened or what I did.
The scripts just go idle whenever a transaction is sent to the blockchain (via Infura rpc).
Here is an excerpt from my hardhat.config.js:
goerli: {
accounts: [`0x${process.env.GOERLI_PRIVATE_KEY}`],
url: `https://goerli.infura.io/v3/${process.env.INFURA_PROJECT_ID}`,
},
The env variables are set with correct values.
Here is the hardhat task I am trying to execute, but it gets stuck when it tries to mint the reserve tokens:
task('mintReserve', 'testing')
.addParam('contractAddressParameter', 'The address of the contract',"", types.string)
.addParam('amount', 'Amount of tokens to be minted')
.setAction(async ({ contractAddressParameter, amount }) => {
let deployer;
[deployer] = await hre.ethers.getSigners();
let contractAddress;
if (!contractAddressParameter) {
contractAddress = process.env.CONTRACT_TESTNET;
} else {
contractAddress = contractAddressParameter;
}
// We get the contract to deploy
console.log(`Trying to mint ${amount} team reserve tokens in contract ${contractAddress} now`);
const contract = await hre.ethers.getContractAt("ContractName", contractAddress);
const tx = await contract.mintReserve(deployer.address, amount);
await tx.wait(); // <<<<< GETS STUCK HERE WAITING FOR TRANSACTION
console.log(`${amount} reserve token/s successfully minted`);
});
There is no error message at all.
In the block explorer nothing arrives.
When I run the script locally (in HARDHAT network), then it executes fine without any issues.
Does anyone have an idea where I could look for the error?