我知道在 SushiSwap 中,可以通过紧密合约读取 getAmountsOut 来获取代币的价格,然后通过 etherjs 库将其发送到 from 。 https://etherscan.io/address/0xd9e1ce17f2641f24ae83637ab66a2cca9c378b9f#readContract
可以对 Uniswap V3 的 v3 版本做同样的事情吗? https://docs.uniswap.org/protocol/introduction
或者还有其他方法吗?
您可以从以下位置使用 getOutputAmount: 池 - getOutputAmount
我对js不熟悉。是否有对 getOutputAmount 函数中发生的情况的解释?我看到 inputAmount 和 sqrtPriceLimitX96 是必需的,但是接下来会发生什么样的操作?