Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

831
Views
Frontend interaction with smart contract method Error: non-payable method cannot override value

trying to call a mint method in a smart contract deployed here: https://rinkeby.etherscan.io/address/0x86C31eA7a0D8996db3cB9da52F3386DA6029a387#code

  function mintTo(address recipient) public payable returns (uint256) {
    uint256 tokenId = currentTokenId.current();
    require(tokenId < TOTAL_SUPPLY, "Max supply reached");
    require(!_exists(tokenId), "ERC721: token already minted");
    // require(count > 0 && count <= 10, "You can mint between 1 and 10 at once");
    require(msg.value == MINT_PRICE, "Transaction value did not equal the mint price");

    currentTokenId.increment();
    uint256 newItemId = currentTokenId.current();
    _safeMint(recipient, newItemId);
    return newItemId;
  }

Frontend code:

    const provider = new ethers.providers.Web3Provider(ethereum)
    const signer = provider.getSigner()
    const nftContract = new ethers.Contract(
      nftContractAddress,
      NFT.abi,
      signer
    )

    const options = { value: ethers.utils.parseEther("0.00420") }

    let nftTx = await nftContract.mintTo(currentAccount, options)

error:

Error minting character Error: non-payable method cannot override value (operation="overrides.value", value={"type":"BigNumber","hex":"0x0eebe0b40e8000"}, code=UNSUPPORTED_OPERATION, version=contracts/5.6.2)
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

so ... after hours of searching, I realised that I was referencing a different contract. the above code works, it was just weird that the method was non-payable even though the last deploy included a payable mintTo method.

:|

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!