This is the test that it is failing due to the lack of balance
const { expect } = require('chai');
describe("TestBirds", function () {
it ("Should return correct name, URI, owner and beneficiary", async function () {
const [owner, addr1] = await hre.ethers.getSigners()
provider = ethers.provider
const TestBirdsContract = await hre.ethers.getContractFactory("TestBirds")
const testBirdsContractDeployed = await TestBirdsContract.deploy(
"TestBirds",
"XXXX",
"https://test.url/",
owner.address,
owner.address)
console.log(await provider.getBalance(owner.address));
await testBirdsContractDeployed.deployed()
await testBirdsContractDeployed.mintPublic(owner.address)
expect(await testBirdsContractDeployed.name()).to.equal("TestBirds")
expect(await testBirdsContractDeployed.tokenURI(0), "https://test.url/0")
expect(await testBirdsContractDeployed.ownerOf(0)).to.equal(owner.address)
})
})
The balance looks ok on the console log, but test fails on minting
TestBirds
BigNumber { value: "10000000000000000000000" }
1) Should return correct name, URI, owner and beneficiary
0 passing (788ms)
1 failing
1) TestBirds
Should return correct name, URI, owner and beneficiary:
Error: VM Exception while processing transaction: reverted with reason string 'Seller: Costs 2500000000 GWei'
at TestBirds.onlyOwner (@openzeppelin/contracts/access/Ownable.sol:43)
at TestBirds._purchase (@divergencetech/ethier/contracts/sales/Seller.sol:229)
at TestBirds._purchase (@divergencetech/ethier/contracts/sales/Seller.sol:216)
at TestBirds.mintPublic (contracts/TestBirds.sol:85)
at HardhatNode._mineBlockWithPendingTxs (node_modules/hardhat/src/internal/hardhat-network/provider/node.ts:1650:23)
at HardhatNode.mineBlock (node_modules/hardhat/src/internal/hardhat-network/provider/node.ts:459:16)
at EthModule._sendTransactionAndReturnHash (node_modules/hardhat/src/internal/hardhat-network/provider/modules/eth.ts:1496:18)
at HardhatNetworkProvider.request (node_modules/hardhat/src/internal/hardhat-network/provider/provider.ts:117:18)
at EthersProviderWrapper.send (node_modules/@nomiclabs/hardhat-ethers/src/internal/ethers-provider-wrapper.ts:13:20)
I have more than 2500000000 GWei on my balance, so I am not sure which is the problem.
Thanks
You are currently not paying for your mint. You need to actively send the minting fee along the contract call transaction.
await testBirdsContractDeployed.mintPublic(owner.address, {
value: ethers.utils.parseEther("2.5"),
});