1
def addCustomerAndFundsub(_subId, _cunsumerContract):
    account = get_account()
    if network.show_active() in LOCAL_BLOCKCHIAN_ENVIROMENTS:
        VRF_contract = VRFCoordinatorV2Mock[-1]
    else:
        VRF_contract = Contract(
            config["networks"][network.show_active()]["vrf_coordinator"]
        )
    add_tx = VRF_contract.addConsumer(_subId, _cunsumerContract, {"from": account})
    add_tx.wait(1)
    print("Add customer successful !")
    amount = config["networks"][network.show_active()]["amount"]
    fund_vrf_txn = VRF_contract.fundSubscription(_subId, amount, {"from": account})
    fund_vrf_txn.wait(1)
    print("Add and Fund successful")strong text

amount in config : amount : 1000000000000000000
addConsumer() work fine untill fundSubscription() showing error :

File ".\scripts\helpful_scipts.py", line 102, in addCustomerAndFundsub fund_vrf_txn = VRF_contract.fundSubscription(_subId, amount, {"from": account}) File "D:\python3_10\lib\site-packages\brownie\network\contract.py", line 1864, in call return self.transact(*args) File "D:\python3_10\lib\site-packages\brownie\network\contract.py", line 1737, in transact return tx["from"].transfer( File "D:\python3_10\lib\site-packages\brownie\network\account.py", line 644, in transfer receipt, exc = self._make_transaction( File "D:\python3_10\lib\site-packages\brownie\network\account.py", line 727, in _make_transaction raise VirtualMachineError(e) from None File "D:\python3_10\lib\site-packages\brownie\exceptions.py", line 93, in init raise ValueError(str(exc)) from None ValueError: Gas estimation failed: 'execution reverted'. This transaction will likely revert. If you wish to broadcast, you must set the gas limit manually.

My wallet have 0.7 sepolia ETH and 19 Link

1 Answer 1

0

The error Gas estimation failed: 'execution reverted'. is quite a general error, the reason for the issue could be:

  • your input does not match function parameters
  • you do not have permission to call a function

Looks like you are trying to manage VRF subscription in your script instead of using the Chainlink app. Please check if the VRFCoordinator contract address is correct in your script.

Please check the sample contract here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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