0

I created the contract and trying to connect to ethereum mainnet using "erc20token-sdk-python" library. When I am trying to send tokens from one address to another it is showing "ValueError: No matching functions found". What am I doing wrong?

import erc20token
import json
contract_abi = '[{"constant": "True","inputs": [],"name": "name","outputs": [{"name": "","type": "string"}],"payable": "False","type": "function"},{"constant": "True","inputs": [],"name": "decimals","outputs": [{"name": "","type": "uint8"}],"payable": "False","type": "function"},{"constant": "True","inputs": [{"name": "_owner","type": "address"}],"name": "balanceOf","outputs": [{"name": "balance","type": "uint256"}],"payable": "False","type": "function"},{"constant": "True","inputs": [],"name": "symbol","outputs": [{"name": "","type": "string"}],"payable": "False","type": "function"}]'

token_sdk = erc20token.SDK(provider_endpoint_uri='https://mainnet.infura.io/12345678',
                           private_key='private_key_here',
                           contract_address='0x818fc6c2ec5986bc6e2cbf00939d90556ab12ce5', 
                           contract_abi=json.loads(contract_abi),
                           gas_price=40, gas_limit=50000)
tx_id = token_sdk.send_tokens('address', 10)
print(tx_id)

Error logs:

  tx_id = token_sdk.send_tokens('0xbeb6f3FBA63E462fDA138c67b4ADbAd416859b8f', 10)
  File "/root/anaconda3/lib/python3.6/site-packages/erc20token/sdk.py", line 296, in send_tokens
    hex_data = self.token_contract._encode_transaction_data('transfer', args=(address, self.web3.toWei(amount, 'ether')))
  File "/root/anaconda3/lib/python3.6/site-packages/eth_utils/string.py", line 85, in inner
    return force_obj_to_text(fn(*args, **kwargs))
  File "/root/anaconda3/lib/python3.6/site-packages/web3/contract.py", line 734, in _encode_transaction_data
    fn_name, args, kwargs,
  File "/root/anaconda3/lib/python3.6/site-packages/web3/contract.py", line 663, in _get_function_info
    fn_abi = cls._find_matching_fn_abi(fn_name, args, kwargs)
  File "/root/anaconda3/lib/python3.6/site-packages/web3/contract.py", line 627, in _find_matching_fn_abi
    raise ValueError("No matching functions found")
ValueError: No matching functions found
1

1 Answer 1

1

The ABI you're using seems to be missing the transfer function.

You can find the full ABI for the contract you're using here: https://etherscan.io/address/0x818fc6c2ec5986bc6e2cbf00939d90556ab12ce5#code.

6
  • Thanks a lot. It worked. Will ABI be same for all the erc20tokens or will there be different ABI's for each erc20token?
    – merklexy
    Jan 22, 2018 at 11:38
  • Some part of the ABI has to be the same to conform to the ERC20 standard, but outside of that there could be differences. If you're just calling transfer (via send_tokens in Python), you should be fine to reuse the same ABI for every token.
    – user19510
    Jan 22, 2018 at 11:42
  • Thaks, Got it. I want to test these transactions in testnet before deploying it to the production. How to do the testing and how can I see the transactions in the test etherscan? Could you please provide me docs so that I can follow those docs?
    – merklexy
    Jan 22, 2018 at 11:45
  • If you use a public test network, like Ropsten, then you can see those transactions on Etherscan: ropsten.etherscan.io.
    – user19510
    Jan 22, 2018 at 11:46
  • I used that in the provider_endpoint_uri='ropsten.etherscan.io' in my code but giving "erc20token.exceptions.SdkConfigurationError: cannot connect to provider endpoint"
    – merklexy
    Jan 22, 2018 at 11:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.