0

使用 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),
            }
        )
4

1 回答 1

0

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

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

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

于 2022-01-09T09:23:00.543 回答