LoginSignup
2
0

More than 5 years have passed since last update.

Ethereum: Web3.pyで関数実行時に Could not identify the intended function with name `xxx` エラーが出る場合

Last updated at Posted at 2018-05-08

以下のようなコードを実行する際に、表題のエラーが吐かれる場合があります。

tx_hash=token.functions.mint(
    web3.toChecksumAddress(target['address']),
    target['token_amount']
).transact({'from': web3.toChecksumAddress('0x7ad8f90cfa071c8420e3f09fe0e413d0c47502e6')})

引数の形外なので、この場合、Decimalをintに変換してやればエラーは消えます。

tx_hash=token.functions.mint(
    web3.toChecksumAddress(target['address']),
    int(target['token_amount'])
).transact({'from': web3.toChecksumAddress('0x7ad8f90cfa071c8420e3f09fe0e413d0c47502e6')})

吐かれたエラー

  "errorMessage": "\nCould not identify the intended function with name `mint`, positional argument(s) of type `(<class 'str'>, <class 'decimal.Decimal'>)` and keyword argument(s) of type `{}`.\nFound 1 function(s) with the name `mint`: ['mint(address,uint256)']\nFunction invocation failed due to improper argument encoding.",

環境

Python 3.6.1
AWS Lambda

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0