Why does my mint function throw an insufficent amount error?

Hi everyone,

I'm testing a smart contract on REMIX, everything works but the mint function provided throws an insufficient amount error even though I have enough ether in my account.

It seems like theirs no ether being sent out.
Any idea why this might be happening ?


 uint256 public cost = 0.02 ether;

 function mint(uint256 _mintAmount) public payable {
    require(!paused, "The contract is paused!");
    require(msg.value >= cost * _mintAmount, "Need to send 0.02 ether");

    _mintLoop(msg.sender, _mintAmount);
  • The contract is not paused
  • I have enough ether in my account

The entire contract | MINT FUNCTION LINE 55

Are you sure you are sending the amount of ether through the global variable msg.value

I thought web3 asked the provider automatically.
How can I make sure i'm sending it?

Theirs this value attribute but it won't let me enter 0.02

EDIT: I converted the ether to wei using this and it worked

Screen Shot 2022-02-01 at 8.54.30 AM

the provider does not ask you, one as a developer when creating the function with web3.js, has to pass the value as a parameter, if in value you put the amount of ether and it has to change from Gwi to ether

I was actually minting 2 tokens and forgot to double the amount sent
it works now by sending wei