-
I have tried to increase wait time from 60 to 120 but always give me the same response 0x0000000000000000000000000000000000000000 ?? why ?? |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 20 replies
-
Hey @dash7ou I had the same problem, this happens because brownie is not taking the correct account it should, I don't know how advanced you are on the lottery project but I have some suggestion for you:
FORKED_LOCAL_ENVIRONMENTS = ["mainnet-fork", "mainnet-fork-fev"]
LOCAL_BLOCKCHAIN_ENVIRONMENTS = ["development", "ganache-local"]
def get_account(index=None, id=None):
# for specific account into the ganache-cli testnet accounts
if index:
return accounts[index]
# For specific account configured on brownie accounts
if id:
return accounts.load(id)
if (
network.show_active() in LOCAL_BLOCKCHAIN_ENVIRONMENTS
or network.show_active() in FORKED_LOCAL_ENVIRONMENTS
):
# for any of the local or forked environemnts return the account with index zero
return accounts[0]
# Default option, load from config file
return accounts.add(config["wallets"]["from_key"])
dependencies:
- smartcontractkit/[email protected]
- OpenZeppelin/[email protected]
compiler:
solc:
remappings:
- '@chainlink=smartcontractkit/[email protected]'
- '@openzeppelin=OpenZeppelin/[email protected]'
dotenv: .env
networks:
default: development
development:
keyhash: '0x2ed0feb3e7fd2022120aa84fab1945545a9f2ffc9076fd6156fa96eaff4c1311'
fee: 100000000000000000
rinkeby:
vrf_coordinator: '0xb3dCcb4Cf7a26f6cf6B120Cf5A73875B7BBc655B'
eth_usd_price_feed: '0x8A753747A1Fa494EC906cE90E9f37563A8AF630e'
link_token: '0x01BE23585060835E02B77ef475b0Cc51aA1e0709'
keyhash: '0x2ed0feb3e7fd2022120aa84fab1945545a9f2ffc9076fd6156fa96eaff4c1311'
fee: 100000000000000000
verify: True
mainnet-fork:
eth_usd_price_feed: '0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419'
wallets:
from_key: ${PRIVATE_KEY}
def end_lottery():
account = get_account()
lottery = Lottery[-1]
# fund de contract and end the lottery
tx = fund_with_link(lottery.address)
tx.wait(1)
ending_transaction = lottery.endLottery({"from": account})
ending_transaction.wait(1)
time.sleep(60)
print(f"{lottery.recentWinner()} is the winner!")
print("Lottery ended successfully") If you want to use your own test account don't forget to add Finally, deleting the build folder and compiling again always helps. Best regards. |
Beta Was this translation helpful? Give feedback.
-
@cromewar @PatrickAlphaC, I cloned the orginal repo for smartcontract-lottery and run it but give me the same result 0x0000000000000000000000000000000000000000 is the new winner! |
Beta Was this translation helpful? Give feedback.
-
Hey @dash7ou I managed to reproduce the error , it seems it happens when you deploy the contract using the development network, with ganache. However deploying the same contract on the rinkeby network works fine: I'm not sure why this is happening on the development network as |
Beta Was this translation helpful? Give feedback.
-
@PatrickAlphaC @cromewar
But now my question is how can I trust something like that, why there is no blocking until getting this response |
Beta Was this translation helpful? Give feedback.
@cromewar @PatrickAlphaC, I cloned the orginal repo for smartcontract-lottery and run it but give me the same result
0x0000000000000000000000000000000000000000 is the new winner!