invalid BigNumber value (argument="value", value=undefined, code=INVALID_ARGUMENT, version=bignumber/5.7.0)

40 Views Asked by At

I am trying to access the VRFCoordinatorMockV2.sol contract provided by chainlink. I have successfully deployed the mock contract on the local hardhat network and have used it's one method. The issue is with the "fundSubscription" method.

Relevant code: 01-deploy-raffle.js

const FUND_AMOUNT = ethers.parseInt("1")

const transactionReceipt = await transactionResponse.wait()
subscriptionId = transactionReceipt.logs[0].args.subId
console.log(subscriptionId)
console.log(FUND_AMOUNT)
await vrfCoordinatorV2MockContract.fundSubscription(subscriptionId, FUND_AMOUNT)

Relevant output:

1n
1000000000000000000n
An unexpected error occurred:

Error: ERROR processing /home/nimish/hh-fcc/hardhat-smartcontract-lottery/deploy/01-deploy-raffle.js:
Error: invalid BigNumber value (argument="value", value=undefined, code=INVALID_ARGUMENT, version=bignumber/5.7.0)

Relevant contract method:

function fundSubscription(uint64 _subId, uint96 _amount) public {
    if (s_subscriptions[_subId].owner == address(0)) {
      revert InvalidSubscription();
    }
    uint96 oldBalance = s_subscriptions[_subId].balance;
    s_subscriptions[_subId].balance += _amount;
    emit SubscriptionFunded(_subId, oldBalance, oldBalance + _amount);
  }

Relevant information:

  • The supporting mock is deployed correctly
  • Can access the deployed mock evident from the createSubscription() method and it's output

Interacting with a Mock Smart Contract on the local hardhat network. The Mock is provided by chainlink, it's fundSubscription() method is not working.

1

There are 1 best solutions below

0
nimish On

Solved There was some inconsistencies in my ```helper-hardhat-config.js`` file.