PatrickAlphaC / hardhat-fund-me-fcc

82 stars 184 forks source link

Receiving an `code=UNSUPPORTED_OPERATION` Error while writing the FundMe.Staging.test.js #147

Closed NazoBeyli closed 1 year ago

NazoBeyli commented 1 year ago

Hello Patrick, Hello FreeCodeCampTeam, while learning how to code, i received that strange error [Error: cannot override "wertgesendet" (operation="overrides", overrides=["wertgesendet"], code=UNSUPPORTED_OPERATION, version=contracts/5.5.0)]

this is the code of yours with a few changes and a bit in german language:

developmentChains.includes(network.name)
    ? describe.skip
    : describe("FundMe", async function() {
          let deployer
          let fundme
          const wertgesendet = ethers.utils.parseEther("0.1")

          beforeEach(async function() {
              deployer = (await getNamedAccounts()).deployer
              fundme = await ethers.getContract("BitteSpenden", deployer)
          })
          it("erlaubt leute zu spenden und abzuheben", async function() {
              await fundme.spenden({ wertgesendet })
              await fundme.abzuheben()
              const endBalance = await fundme.provider.getBalance(
                  fundme.address
              )
              assert.equal(endBalance.toString(), "0")
          })
      })

spenden = fundme BitteSpenden= name of the fundme-contract abzuheben= withdraw

i guess the error is in this part:

 it("erlaubt leute zu spenden und abzuheben", async function() {
              await fundme.spenden({ wertgesendet })
              await fundme.abzuheben()
              const endBalance = await fundme.provider.getBalance(
                  fundme.address
              )

the error message looks like this: Error: cannot override "wertgesendet" (operation="overrides", overrides=["wertgesendet"], code=UNSUPPORTED_OPERATION, version=contracts/5.5.0)

i would love to solve the issue and thank you or whoever can help me with this problem. 15 min. thinkering couldnt help me :)

btw: thanks for all the effort of yours 💯

PatrickAlphaC commented 1 year ago

Can you:

  1. Make this a discusson on the full repo? https://github.com/smartcontractkit/full-blockchain-solidity-course-js/
  2. Follow this section for formatting questions? https://www.youtube.com/watch?t=19846&v=gyMwXuJrbJQ&feature=youtu.be