【问题标题】:swapExactETHForTokensSupportingFeeOnTransferTokens Function invocation failed due to no matching argument typesswapExactETHForTokensSupportingFeeOnTransferTokens 由于没有匹配的参数类型,函数调用失败
【发布时间】:2021-10-16 05:07:49
【问题描述】:

使用 web3.py 将参数传递给合约函数时出现错误。我想我传递了可读的数据。错误:

Could not identify the intended function with name `swapExactETHForTokensSupportingFeeOnTransferTokens`, positional argument(s) of type `(<class 'int'>, <class 'list'>, <class 'str'>, <class 'int'>)` and keyword argument(s) of type `{}`.
Found 1 function(s) with the name `swapExactETHForTokensSupportingFeeOnTransferTokens`: ['swapExactETHForTokensSupportingFeeOnTransferTokens(uint256,address[],address,uint256)']
Function invocation failed due to no matching argument types.

函数调用:

 tx_info = pancake.functions.swapExactETHForTokensSupportingFeeOnTransferTokens(int(how_many_tokens_can_buy()*(10**getinfo()[-1])*(1-slippages)), [checksum(wbnb), checksum(tokencontract)], walletadr, int(time.time()) + 10 * 60). \
            buildTransaction(
            {
                'from': walletadr,
                'value': web3.toWei(howmuchbnb, 'ether'),
                'gas': gaslimit,
                'gasPrice': web3.toWei(gasprice, 'Gwei'),
                'nonce': web3.eth.get_transaction_count(walletadr),
            }
        )

【问题讨论】:

    标签: python smartcontracts web3py


    【解决方案1】:

    您可以尝试使用括号,例如:

    ...,(int(time.time()) + 10 * 60)).buildTransaction(...
    

    这就是我能告诉你的全部,因为这(也许)只是一个选角问题

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-09-25
      • 2017-05-08
      • 2015-09-21
      相关资源
      最近更新 更多