首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >您如何在Uniswap函数uniswap.get_price_input()中设置费用?

您如何在Uniswap函数uniswap.get_price_input()中设置费用?
EN

Ethereum用户
提问于 2021-11-23 20:43:52
回答 1查看 685关注 0票数 1

我正在成功地使用uniswap.get_price_input(eth,dai,10**18)来获得ETH/DAI对的价格。此外,在我的终端中,我还收到了“免费设置,假设为0.3%”的消息。

我想删除该消息,并将费用设置为.3%,但会收到各种错误,这取决于我的尝试。

尝试1

代码语言:javascript
复制
>>>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

代码语言:javascript
复制
>>>uniswap.get_price_input(eth, dai, 10**18, int(.3))


>>>raise ContractLogicError('execution reverted')
>>>web3.exceptions.ContractLogicError: execution reverted

尝试3

代码语言:javascript
复制
>>>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

你是如何确定费用的?

EN

回答 1

Ethereum用户

回答已采纳

发布于 2021-11-23 20:54:08

从0.3到int将返回0。

如果您检查功能原型,默认费用0.3%将作为3000传递,因此您应该使用该值。

票数 1
EN
页面原文内容由Ethereum提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://ethereum.stackexchange.com/questions/114153

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档