How to test extra parameters in Remix

payableremixremix-tests

I tried to use Remix to test a Smart Contract:

/********************************************************************
* Make bids with ETH or an ERC20 Token specified by the NFT seller.*
* Additionally, a buyer can pay the asking price to conclude a sale*
* of an NFT.                                                      *
********************************************************************/

function makeBid(
    address _nftContractAddress,
    uint256 _tokenId,
    address _erc20Token,
    uint128 _tokenAmount
)
    external
    payable
    auctionOngoing(_nftContractAddress, _tokenId)
    onlyApplicableBuyer(_nftContractAddress, _tokenId)
{
    _makeBid(_nftContractAddress, _tokenId, _erc20Token, _tokenAmount);
}

This is my JavaScript test:

await nftAuction
    .connect(user2)
    .makeBid(erc721.address, tokenId, zeroAddress, zeroERC20Tokens, {
        value: minPrice,
    });

These are my parameters for the function makeBid:

"0xD4Fc541236927...",1,"0x0000000000000000000000000000000000000000",0, {value:100,}

remix

The last one is an extra parameter, because the function is Payable and accept Ether transfers, it works well in Hardhat test, so I tried in Remix to input this line same as above and got this error from console "code=INVALID_ARGUMENT".

What's the right syntax to try this on Remix?

Best Answer

If you want to call payable function and send ether with the transaction in remix IDE, then you need to use those 2 provided input fields. The given amount is not related to the gas fees. Your contract must check the sent amount of ether with msg.value

Send-ether

Related Topic