Reputation: 1136
Error message is:
Prior to running my test I set the ether balance to 10 ether:
await this.token.deployed();
await hre.network.provider.request({ method: 'hardhat_setBalance', params: [this.signers.admin.address, ethers.utils.parseEther('10').toHexString()] });
I mint setting a a gas limit so I don't get the Unable to estimate gas error:
const myFirstMint = await this.token.safeMint(this.signers.admin.address, {
gasLimit: 250000,
});
await myFirstMint.wait();
Anyone knows what more I can do?
Upvotes: 0
Views: 432
Reputation: 43591
Smart contracts are for security reasons not able to just pull ETH from a wallet - you need to explicitly state how much you want to send while creating the transaction.
ethersjs use the overrides parameter where you can also specify the amount of wei sent along with the transaction. Example below shows sending 1 ETH (which is 1e18 wei).
const myFirstMint = await this.token.safeMint(this.signers.admin.address, {
gasLimit: 250000,
value: ethers.utils.parseEther("1.0"),
});
await myFirstMint.wait();
Upvotes: 0