PatrickAlphaC / brownie_fund_me

26 stars 64 forks source link

Please Help ValueError: execution reverted: VM Exception while processing transaction: revert unable to run Fund_and_withdraw.py script #1560 #48

Open Deamonk1 opened 2 years ago

Deamonk1 commented 2 years ago

No response from the main repo issue #1560 I've seen some other people running into this but their fixes did not work for me.

Screen Shot 2022-06-29 at 3 21 44 AM Screen Shot 2022-06-29 at 3 36 59 AM

Hi please i ran into a problem while deploying Brownie Fund_and_withdraw.py script through ganache-local network already spent 3 days trying to find a quick solution. when i run brownie run scripts/deploy.py --network ganache-local. my script ran successfully but when i try interact with added Fund_and_withdraw.py script i got this error

Running 'scripts/fund_and_withdraw.py::main'... 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/fund_and_withdraw.py", line 22, in main fund_me() File "./scripts/fund_and_withdraw.py", line 8, in fund_me entrance_fee = fund_me.getEntranceFee() File "brownie/network/multicall.py", line 115, in _proxy_call result = ContractCall.call(args, *kwargs) # type: ignore File "brownie/network/contract.py", line 1902, in call return self.call(args, block_identifier=block_identifier, override=override) File "brownie/network/contract.py", line 1693, in call raise VirtualMachineError(e) from None File "brownie/exceptions.py", line 93, in init raise ValueError(str(exc)) from None ValueError: execution reverted: VM Exception while processing transaction: revert

I also checked ganache cli Logs here's the output :

eth_call[8:54:53 PM] > {[8:54:53 PM] > "jsonrpc": "2.0",[8:54:53 PM] > "method": "eth_call",[8:54:53 PM] > "params": [[8:54:53 PM] > {[8:54:53 PM] > "to": "0x8309ABC2528f652823Cad736d35B612fcF6aaBc6",[8:54:53 PM] > "data": "0x09bc33a7"[8:54:53 PM] > },[8:54:53 PM] > "latest"[8:54:53 PM] > ],[8:54:53 PM] > "id": 7[8:54:53 PM] > }[8:54:53 PM] < {[8:54:53 PM] < "id": 7,[8:54:53 PM] < "jsonrpc": "2.0",[8:54:53 PM] < "error": {[8:54:53 PM] < "message": "VM Exception while processing transaction: revert",[8:54:53 PM] < "code": -32000,[8:54:53 PM] < "data": {[8:54:53 PM] < "0x6656326ec950a3a1b1cfc3103cc1bfb427e74c8045c75e278525ac33a46868c4": {[8:54:53 PM] < "error": "revert",[8:54:53 PM] < "program_counter": 995,[8:54:53 PM] < "return": "0x"[8:54:53 PM] < },[8:54:53 PM] < "stack": "RuntimeError: VM Exception while processing transaction: revert\n at Function.RuntimeError.fromResults (/Applications/Ganache.app/Contents/Resources/static/node/node_modules/ganache-core/lib/utils/runtimeerror.js:94:13)\n at /Applications/Ganache.app/Contents/Resources/static/node/node_modules/ganache-core/lib/blockchain_double.js:568:26",[8:54:53 PM] < "name": "RuntimeError"[8:54:53 PM] < }

Please Any idea on how to solve this . Thanks in advance

milehighprofit commented 2 years ago
from brownie import FundMe, MockV3Aggregator, network, config
from scripts.helpfulscripts import (
    get_account,
    deploy_mocks,
    LOCAL_BLOCKCHAIN_ENVIROMENTS,
)

def deploy_fund_me():
    account = get_account()
    if network.show_active() not in LOCAL_BLOCKCHAIN_ENVIROMENTS:
        price_feed_address = config["networks"][network.show_active()][
            "eth_usd_price_feed"
        ]
    else:
        deploy_mocks()
        price_feed_address = MockV3Aggregator[-1].address

    fund_me = FundMe.deploy(
        price_feed_address,
        {"from": account},
        publish_source=config["networks"][network.show_active()].get("verify"),
    )
    print(f"Contract deployed to {fund_me.address}")
    return fund_me

def main():
    deploy_fund_me()

Have this as your deploy file and it should work for you:)

Deamonk1 commented 2 years ago

Thanks i have my deploy file edited now but i still get errors in the below lines Does this has a fix ?

(base) user@USERs-MacBook-Air brownie_fund_me % brownie run scripts/fund_and_withdraw.py --network ganache-local Brownie v1.19.0 - Python development framework for Ethereum

Python-dotenv could not parse statement starting at line 1 Python-dotenv could not parse statement starting at line 2 Python-dotenv could not parse statement starting at line 3 Python-dotenv could not parse statement starting at line 1 Python-dotenv could not parse statement starting at line 2 Python-dotenv could not parse statement starting at line 3 BrownieFundMeProject is the active project.

Running 'scripts/fund_and_withdraw.py::main'... 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/fund_and_withdraw.py", line 22, in main fund() File "./scripts/fund_and_withdraw.py", line 8, in fund entrance_fee = fund_me.getEntranceFee() File "brownie/network/multicall.py", line 115, in _proxy_call result = ContractCall.call(args, *kwargs) # type: ignore File "brownie/network/contract.py", line 1902, in call return self.call(args, block_identifier=block_identifier, override=override) File "brownie/network/contract.py", line 1693, in call raise VirtualMachineError(e) from None File "brownie/exceptions.py", line 93, in init raise ValueError(str(exc)) from None ValueError: execution reverted: VM Exception while processing transaction: revert (base) user@USERs-MacBook-Air brownie_fund_me %