smartcontractkit / full-blockchain-solidity-course-py

Ultimate Solidity, Blockchain, and Smart Contract - Beginner to Expert Full Course | Python Edition
MIT License
10.67k stars 2.89k forks source link

Lesson 7 : Please help my end lottery function keeps getting reverted, #1844

Open limbo0 opened 1 year ago

limbo0 commented 1 year ago

Brownie v1.19.3 - Python development framework for Ethereum

SmartcontractLotteryProject is the active project.

Launching 'ganache-cli --accounts 10 --hardfork istanbul --gasLimit 12000000 --mnemonic brownie --port 8545'...

Running 'scripts/deploy.py::main'... deploying mocks ... deploying MockV3Aggregator... Transaction sent: 0x922f9955acc77e74494aa0ffe312e3493e8ec12657e14dd78caf42cd06f5895e Gas price: 0.0 gwei Gas limit: 12000000 Nonce: 0 MockV3Aggregator.constructor confirmed Block: 1 Gas used: 435435 (3.63%) MockV3Aggregator deployed at: 0x3194cBDC3dbcd3E11a07892e7bA5c3394048Cc87

deploying LinkToken... Transaction sent: 0x689b2322bc923c1e3c142d8b2963f995bdbebabe728c3f308c714f9ba79968ca Gas price: 0.0 gwei Gas limit: 12000000 Nonce: 1 LinkToken.constructor confirmed Block: 2 Gas used: 669124 (5.58%) LinkToken deployed at: 0x602C71e4DAC47a042Ee7f46E0aee17F94A3bA0B6

deploying VRFCoordinatorMock... Transaction sent: 0x3044d86fca91d7af9ab1f04ee0440c70f49d285987029798d3e7d27f3c6c4b37 Gas price: 0.0 gwei Gas limit: 12000000 Nonce: 2 VRFCoordinatorMock.constructor confirmed Block: 3 Gas used: 298504 (2.49%) VRFCoordinatorMock deployed at: 0xE7eD6747FaC5360f88a2EFC03E00d25789F69291

All mocks deployed ! Transaction sent: 0xf5a93faa6763aa8bd8e7c3ba58eb8b35b2eb341c9ed148e9d8ed7b16511edd73 Gas price: 0.0 gwei Gas limit: 12000000 Nonce: 3 Lottery.constructor confirmed Block: 4 Gas used: 862486 (7.19%) Lottery deployed at: 0x6951b5Bd815043E3F842c1b026b0Fa888Cc2DD85

deployed lottery! Transaction sent: 0x1f3629b4ccc88f7e9e8b4f9d7d7a0e3328610fafa9346bd79152467364540969 Gas price: 0.0 gwei Gas limit: 12000000 Nonce: 4 Lottery.startLottery confirmed Block: 5 Gas used: 28836 (0.24%)

Lottery.startLottery confirmed Block: 5 Gas used: 28836 (0.24%)

lottery has been started ! Transaction sent: 0x4779b635ea80279c8b219c530faa1e3c7e903f068ef85bc8431fdd563d536001 Gas price: 0.0 gwei Gas limit: 12000000 Nonce: 5 Lottery.Enter confirmed Block: 6 Gas used: 70729 (0.59%)

Lottery.Enter confirmed Block: 6 Gas used: 70729 (0.59%)

you have entered the lottery ! Transaction sent: 0xe930a3aa6106d132e9479441011d896ee16f7f7c6a5feffcf02436337497410a Gas price: 0.0 gwei Gas limit: 12000000 Nonce: 6 LinkToken.transfer confirmed Block: 7 Gas used: 51398 (0.43%)

LinkToken.transfer confirmed Block: 7 Gas used: 51398 (0.43%)

funded with link ! LinkToken.transfer confirmed Block: 7 Gas used: 51398 (0.43%)

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

File "brownie/_cli/run.py", line 51, in main return_value, frame = run( File "brownie/project/scripts.py", line 110, in run return_value = f_locals[method_name](*args, *kwargs) File "./scripts/deploy.py", line 54, in main end_lottery() File "./scripts/deploy.py", line 44, in end_lottery ending_txn = lottery.endLottery({"from": account}) File "brownie/network/contract.py", line 1864, in call return self.transact(args) File "brownie/network/contract.py", line 1737, in transact return tx["from"].transfer( File "brownie/network/account.py", line 682, in transfer receipt._raise_if_reverted(exc) File "brownie/network/transaction.py", line 446, in _raise_if_reverted raise exc._with_attr( VirtualMachineError: revert Trace step -1, program counter 1879: File "/Users/serizawalimboo/.brownie/packages/smartcontractkit/chainlink-brownie-contracts@0.6.1/contracts/src/v0.8/VRFConsumerBase.sol", line 153, in VRFConsumerBase.requestRandomness:

cromewar commented 1 year ago

Please check out the latest implementation using VRF2: https://github.com/smartcontractkit/full-blockchain-solidity-course-py/discussions/1791