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