Contract-Deployment
現在加油策略不起作用
當我在合約部署中使用 GasNowStrategy(“fast”) 時,出現錯誤:
from brownie.network.gas.strategies import GasNowStrategy def main(): dev = accounts.add(config["wallets"]["from_key"]) print(dev) print(network.show_active()) deployed_contract = Bbum.deploy( {"from": dev, "gas_price": GasNowStrategy("fast")} )
這裡有什麼問題?
錯誤:
File "C:\Users\Omer\AppData\Local\Programs\Python\Python310\lib\site-packages\eth_brownie-1.17.2-py3.10.egg\brownie\_cli\run.py", line 51, in main return_value, frame = run( File "C:\Users\Omer\AppData\Local\Programs\Python\Python310\lib\site-packages\eth_brownie-1.17.2-py3.10.egg\brownie\project\scripts.py", line 103, in run return_value = f_locals[method_name](*args, **kwargs) File ".\scripts\deployERC.py", line 9, in main deployed_contract = Bbum.deploy({"from": dev, "gas_price": GasNowStrategy("fast")}) File "C:\Users\Omer\AppData\Local\Programs\Python\Python310\lib\site-packages\eth_brownie-1.17.2-py3.10.egg\brownie\network\contract.py", line 531, in __call__ return tx["from"].deploy( File "C:\Users\Omer\AppData\Local\Programs\Python\Python310\lib\site-packages\eth_brownie-1.17.2-py3.10.egg\brownie\network\account.py", line 510, in deploy receipt, exc = self._make_transaction( File "C:\Users\Omer\AppData\Local\Programs\Python\Python310\lib\site-packages\eth_brownie-1.17.2-py3.10.egg\brownie\network\account.py", line 727, in _make_transaction raise VirtualMachineError(e) from None File "C:\Users\Omer\AppData\Local\Programs\Python\Python310\lib\site-packages\eth_brownie-1.17.2-py3.10.egg\brownie\exceptions.py", line 93, in __init__ raise ValueError(str(exc)) from None ValueError: Expecting value: line 1 column 1 (char 0)
所以,我了解到GasNowStrategy已經關閉,可能與國內監管政策有關。因此,如果有人遇到此問題,請更改為其他氣體策略。
我正在進行個人修復,但您將不得不在新腳本下模擬_fetch_gasnow 和 network.gas.bases 中的策略,以便您可以更改端點。