可以使用uniswap v3方式合约读取来获取价格Token吗?

问题描述 投票:0回答:2

我知道在 SushiSwap 中,可以通过紧密合约读取 getAmountsOut 来获取代币的价格,然后通过 etherjs 库将其发送到 from 。 https://etherscan.io/address/0xd9e1ce17f2641f24ae83637ab66a2cca9c378b9f#readContract

可以对 Uniswap V3 的 v3 版本做同样的事情吗? https://docs.uniswap.org/protocol/introduction

或者还有其他方法吗?

solidity ethers.js
2个回答
2
投票

您可以从以下位置使用 getOutputAmount: 池 - getOutputAmount

使用示例: https://github.com/Uniswap/v3-sdk/issues/78


0
投票

我对js不熟悉。是否有对 getOutputAmount 函数中发生的情况的解释?我看到 inputAmount 和 sqrtPriceLimitX96 是必需的,但是接下来会发生什么样的操作?

© www.soinside.com 2019 - 2024. All rights reserved.