0rtis / dfktools

Interact with the contracts of DefiKingdoms
MIT License
127 stars 95 forks source link

Quest cannot be started: "Error execution reverted: level not found" #26

Closed checkso closed 2 years ago

checkso commented 2 years ago

level = 1 questV2.start_quest(quest_contract, my_heroes_id, attempts, level, private_key, w3.eth.getTransactionCount(account_address), gas_price_gwei, tx_timeout)

What is the level? Tried it with the current level of the hero, but this didn't work and currently I don't know what I need to enter there.

Error Message is always: "Error execution reverted: level not found"

checkso commented 2 years ago

Ok, still not sure what exactly the level value is for, but it is a step further now.

Sadly a new issue:

quest.start_quest(quest_contract, my_heroes_id[0], attempts, level, private_key, w3.eth.getTransactionCount(account_address), gas_price_gwei, tx_timeout)
  File "/home/pat/environments/dfk/bot/dfk/quests/quest_v2.py", line 11, in start_quest
    return quest_core_v2.start_quest(quest_address, hero_ids, attempts, level, private_key, nonce, gas_price_gwei,
  File "/home/pat/environments/dfk/bot/dfk/quests/quest_core_v2.py", line 77, in start_quest
    tx = contract.functions.startQuest(hero_ids, quest_address, attempts, level).buildTransaction(
  File "/home/pat/environments/dfk/lib/python3.8/site-packages/web3/contract.py", line 878, in __call__
    clone._set_function_info()
  File "/home/pat/environments/dfk/lib/python3.8/site-packages/web3/contract.py", line 883, in _set_function_info
    self.abi = find_matching_fn_abi(
  File "/home/pat/environments/dfk/lib/python3.8/site-packages/web3/_utils/contracts.py", line 163, in find_matching_fn_abi
    raise ValidationError(message)
web3.exceptions.ValidationError: 
Could not identify the intended function with name `startQuest`, positional argument(s) of type `(<class 'int'>, <class 'str'>, <class 'int'>, <class 'int'>)` and keyword argument(s) of type `{}`.
Found 1 function(s) with the name `startQuest`: ['startQuest(uint256[],address,uint8,uint8)']
Function invocation failed due to no matching argument types.

Additional information: Fishing quest:

private_key = "xxx"
gas_price_gwei = 15
tx_timeout = 30
attempts = 3
level = 1
quest_contract = fishing.QUEST_CONTRACT_ADDRESS_V2
w3 = Web3(Web3.HTTPProvider(rpc_server))
my_heroes_id = [1]
account_address = w3.eth.account.privateKeyToAccount(private_key).address
quest.start_quest(quest_contract, my_heroes_id[0], attempts, level, private_key, w3.eth.getTransactionCount(account_address), gas_price_gwei, tx_timeout)
checkso commented 2 years ago

ok, so I guess in the start_quest function it must be my_heroes_id and not my_heroes_id[0] . So back to original error: "web3.exceptions.ContractLogicError: execution reverted: level not found"

Traceback (most recent call last):
  File "test2.py", line 41, in <module>
    questV2.start_quest(quest_contract, my_heroes_id, attempts, level, private_key, w3.eth.getTransactionCount(account_address), gas_price_gwei, tx_timeout)
  File "/home/pat/environments/dfk/bot/dfk/quests/quest_v2.py", line 11, in start_quest
    return quest_core_v2.start_quest(quest_address, hero_ids, attempts, level, private_key, nonce, gas_price_gwei,
  File "/home/pat/environments/dfk/bot/dfk/quests/quest_core_v2.py", line 77, in start_quest
    tx = contract.functions.startQuest(hero_ids, quest_address, attempts, level).buildTransaction(
  File "/home/pat/environments/dfk/lib/python3.8/site-packages/web3/contract.py", line 1079, in buildTransaction
    return build_transaction_for_function(
  File "/home/pat/environments/dfk/lib/python3.8/site-packages/web3/contract.py", line 1648, in build_transaction_for_function
    prepared_transaction = fill_transaction_defaults(web3, prepared_transaction)
  File "cytoolz/functoolz.pyx", line 250, in cytoolz.functoolz.curry.__call__
  File "/home/pat/environments/dfk/lib/python3.8/site-packages/web3/_utils/transactions.py", line 114, in fill_transaction_defaults
    default_val = default_getter(web3, transaction)
  File "/home/pat/environments/dfk/lib/python3.8/site-packages/web3/_utils/transactions.py", line 60, in <lambda>
    'gas': lambda web3, tx: web3.eth.estimate_gas(tx),
  File "/home/pat/environments/dfk/lib/python3.8/site-packages/web3/eth.py", line 855, in estimate_gas
    return self._estimate_gas(transaction, block_identifier)
  File "/home/pat/environments/dfk/lib/python3.8/site-packages/web3/module.py", line 57, in caller
    result = w3.manager.request_blocking(method_str,
  File "/home/pat/environments/dfk/lib/python3.8/site-packages/web3/manager.py", line 198, in request_blocking
    return self.formatted_response(response,
  File "/home/pat/environments/dfk/lib/python3.8/site-packages/web3/manager.py", line 170, in formatted_response
    apply_error_formatters(error_formatters, response)
  File "/home/pat/environments/dfk/lib/python3.8/site-packages/web3/manager.py", line 70, in apply_error_formatters
    formatted_resp = pipe(response, error_formatters)
  File "cytoolz/functoolz.pyx", line 667, in cytoolz.functoolz.pipe
  File "cytoolz/functoolz.pyx", line 642, in cytoolz.functoolz.c_pipe
  File "/home/pat/environments/dfk/lib/python3.8/site-packages/web3/_utils/method_formatters.py", line 576, in raise_solidity_error_on_revert
    raise ContractLogicError(response['error']['message'])
web3.exceptions.ContractLogicError: execution reverted: level not found
checkso commented 2 years ago

setting level to 0 solved the issue.

cowza commented 2 years ago

Yeah I think this referred to the level of the profession quest not the hero.