Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VirtualMachineError: revert at Lottery.endLottery confirmed (reverted) #6

Open
dibakarsutradhar opened this issue May 22, 2022 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@dibakarsutradhar
Copy link
Owner

Error -

Transaction sent: 0xe97361a7db515a30e3feac79b1e14d6e16abd3132949b17a82fbb83cd87bc619
  Gas price: 0.0 gwei   Gas limit: 12000000   Nonce: 7
  Lottery.endLottery confirmed (reverted)   Block: 8   Gas used: 11813033 (98.44%)

  File "brownie/_cli/run.py", line 49, in main
    return_value, frame = run(
  File "brownie/project/scripts.py", line 103, in run
    return_value = f_locals[method_name](*args, **kwargs)
  File "./scripts/deploy_lottery.py", line 55, in main
    end_lottery()
  File "./scripts/deploy_lottery.py", line 45, in end_lottery
    ending_tx = lottery.endLottery({"from": account})
  File "brownie/network/contract.py", line 1693, in __call__
    return self.transact(*args)
  File "brownie/network/contract.py", line 1566, in transact
    return tx["from"].transfer(
  File "brownie/network/account.py", line 680, in transfer
    receipt._raise_if_reverted(exc)
  File "brownie/network/transaction.py", line 420, in _raise_if_reverted
    raise exc._with_attr(
VirtualMachineError: revert
Trace step -1, program counter 2469:
  File "/Users/dibakar/.brownie/packages/smartcontractkit/[email protected]/contracts/src/v0.6/VRFConsumerBase.sol", line 161, in VRFConsumerBase.requestRandomness:    
    function requestRandomness(bytes32 _keyHash, uint256 _fee)
      internal returns (bytes32 requestId)
    {
      LINK.transferAndCall(vrfCoordinator, _fee, abi.encode(_keyHash, USER_SEED_PLACEHOLDER));
      // This is the seed passed to VRFCoordinator. The oracle will mix this with
      // the hash of the block containing this request to obtain the seed/input
      // which is finally passed to the VRF cryptographic machinery.
Terminating local RPC client..

end_lottery() deploy script -

def end_lottery():
    account = get_account()
    lottery = Lottery[-1]
    # fund the contract
    # then end the lottery
    tx = fund_with_link(lottery.address)
    tx.wait(1)
    ending_tx = lottery.endLottery({"from": account})
    ending_tx.wait(1)
    time.sleep(180)
    print(f"{lottery.recentWinner()} is the new winner!")

endLottery() Smart Contract -

function endLottery() public onlyOwner {
        lottery_state = LOTTERY_STATE.CALCULATING_WINNER;
        bytes32 requestId = requestRandomness(keyhash, fee);
        emit RequestedRandomness(requestId);
    }
@dibakarsutradhar dibakarsutradhar added the bug Something isn't working label May 22, 2022
@dibakarsutradhar dibakarsutradhar self-assigned this May 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Development

No branches or pull requests

1 participant