0

I wrote a ERC721 contract with a mint function that requires you send 0.x ETH when you call the mint function.

How do I call this function with 0.x ETH? I am still writing the unit test for this. If the mint function does not check for msg.value, I can just call the mint function like contract.mint(), but when my mint function does require msg.value, I can't find a way to add ETH to my call.

Thanks!

2 Answers 2

0

Nvm. You need to pass the override permission in the function call. Missed this in the documentation.

0

mint() needs to be modified by payable.

contract.mint({value:ethers.BigNumber.from("100")})

Your Answer

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

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