0

I am encounter missing argument error during run hardhat test .below is the script that trigger the error . My function MINT only have 1 argument to pass in and am passing number "1" into mint function .kindly advie

enter image description here

Test.script

 it("Should mint an ape", async () => {
    await FTPContract.setSaleState();
    const mintPrice = await FTPContract.MINT_PRICE();

    expect(
      await FTPContract.mint(1, {             <———  ************* passing number ‘1’
        value: mintPrice, })
    )
      console.log(`
      price: ${mintPrice}
     `);
  });

here my sol function mint :

function mint(uint numberOfTokens) public payable {     <——— *******Has 1 arguments
        uint256 ts = totalSupply();
        require(saleIsActive, "Sale must be active to mint tokens");
        require(numberOfTokens <= MAX_PUBLIC_MINT, "Exceeded max token purchase");
        require(ts + numberOfTokens <= MAX_SUPPLY, "Purchase would exceed max tokens");
    
        require(MINT_PRICE.mul(numberOfTokens) <= msg.value, "Ether value sent is not correct");

        for (uint i = 0; i < numberOfTokens; i++) {
             uint mintIndex = totalSupply(); /*follow BAYC mintape function*/
            if (totalSupply() < MAX_SUPPLY) {
            _safeMint(msg.sender, mintIndex);
         
           }
        }
1
  • Hi all , anyone can help to brief where went wrong ? much appreciate
    – brook18
    Mar 7, 2022 at 8:03

2 Answers 2

0

done . there was wrong argument pass in

1
  • 2
    Can you explain how you fix the test?
    – Ismael
    Mar 8, 2022 at 4:32
0

the setSaleState fucntion carry bolean value .so i chg to below.

await FTPContract.setSaleState('true');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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