[SOLVED]How can I inject Amount(value) to Metamask?

I have the following code where I can have my users mint with this contract.
It works fine on Remix, but this contract fails on my app.
The reason why it fails on my app is simple: Amount is not specified when Metamask pops up.

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.8;

import '@openzeppelin/contracts/token/ERC721/ERC721.sol';
import '@openzeppelin/contracts/access/Ownable.sol';

contract SimpleMintContract is ERC721, Ownable {
    uint256 public mintPrice = 0.01 ether;
    uint256 public totalSupply;
    uint256 public maxSupply;
    bool public isMintEnabled;
    mapping(address => uint256) public mintedWallets;

    constructor() payable ERC721('Simple Mint', 'SIMPLEMINT'){
        maxSupply = 20;

    function toggleIsMintedEnabled() external onlyOwner {
        isMintEnabled = !isMintEnabled;

    function setMaxSupply(uint256 maxSupply_) external onlyOwner {
        maxSupply = maxSupply_;

    function mint() external payable {
        require(isMintEnabled, 'minting not enabled');
        require(mintedWallets[msg.sender] < 5, 'exceeds max per wallet');
        require(msg.value == mintPrice, 'wrong value');
        require(maxSupply > totalSupply, 'sold out');

        uint256 tokenId = totalSupply;
        _safeMint(msg.sender, tokenId);

This is the screenshot on Remix. As you can see the amount is injected right.

On the other hand, this is what I get from my app. Amount is missing. So it fails.

I think I miss something very basic here. Could anyone point me to right direction?
Thank you.

Maybe, is this the answer? I though Solidity communicates with MetaMask directly, though.

when calling the function from your app, you need to include a msg value parameter along with other function options.

example options for Moralis.executeFunction

const options = {
  contractAddress: "0x00....",
  functionName: "functionName",
  abi: ABI,
  msgValue: Moralis.Units.ETH("1"),
  params: {
1 Like

Thank you so much!
It worked!