我正在成功地使用uniswap.get_price_input(eth,dai,10**18)来获得ETH/DAI对的价格。此外,在我的终端中,我还收到了“免费设置,假设为0.3%”的消息。
我想删除该消息,并将费用设置为.3%,但会收到各种错误,这取决于我的尝试。
尝试1
>>>uniswap.get_price_input(eth, dai, 10**18, .3)
>>>Could not identify the intended function with name `quoteExactInputSingle`, positional argument(s) of type `(<class 'str'>, <class 'str'>, <class 'float'>, <class 'int'>, <class 'int'>)` and keyword argument(s) of type `{}`.
Found 1 function(s) with the name `quoteExactInputSingle`: ['quoteExactInputSingle(address,address,uint24,uint256,uint160)']
Function invocation failed due to no matching argument types.企图2
>>>uniswap.get_price_input(eth, dai, 10**18, int(.3))
>>>raise ContractLogicError('execution reverted')
>>>web3.exceptions.ContractLogicError: execution reverted尝试3
>>>uniswap.get_price_input(eth, dai, 10**18, fee=.3)
>>>Could not identify the intended function with name `quoteExactInputSingle`, positional argument(s) of type `(<class 'str'>, <class 'str'>, <class 'float'>, <class 'int'>, <class 'int'>)` and keyword argument(s) of type `{}`.
Found 1 function(s) with the name `quoteExactInputSingle`: ['quoteExactInputSingle(address,address,uint24,uint256,uint160)']
Function invocation failed due to no matching argument types.参考: get_price_input(token0: Union地址,ChecksumAddress,token1: Union地址,ChecksumAddress,qty: int,fee:可选整型=无,路由:可选[List[Union地址,ChecksumAddress]]= None )→int
你是如何确定费用的?
发布于 2021-11-23 20:54:08
从0.3到int将返回0。
如果您检查功能原型,默认费用0.3%将作为3000传递,因此您应该使用该值。
https://ethereum.stackexchange.com/questions/114153
复制相似问题