0

I am building a mint DAPP on the fantom blockchain. However, when I call the mint function, it returns an error: (execution reverted: Invalid payment amount)

My React app communicates well with the smart contract since I can call the read functions and display them. What I don't understand is that in the ABI and in the code the function takes 2 parameters. And in the smart contract it takes 3.

mint price: 20 ftm amount : user choice, by default 1 stake (bool) : false

Here are all the screenshots to understand my code and smart contract : https://i.stack.imgur.com/xjBtI.jpg

thank you very much !

1 Answer 1

0

The method is paypable. This is a Solidity identifier that indicates that you can send the native coin (e.g. ETH or BNB or FMT) along with the contract call. Therefore the blockexplorer shows an extra field to specify the amount.

Line 66 in your referenced contract checks if the correct value was sent along.

More info: https://docs.soliditylang.org/en/latest/cheatsheet.html?highlight=Payable#modifiers

1
  • const mintTxn = await contract.mint(qty, false, {value: ethers.utils.parseEther(nftPrice)}); Yes i add the price with parseEther function and now it works !
    – Wopzi
    Jan 24, 2022 at 10:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.