pancake为什么路径通过getAmountsOut能查出来兑换数量,但是实际swap会提示错误

如图,不懂为什么getAmountsOut都能显示兑换数量,为什么还会显示execution reverted: Pancake: K错误呢 滑点设置过10%,甚至直接设置为0

image.png image.png

请先 登录 后评论

最佳答案 2022-06-06 09:49

getAmountsOut 不是考虑 token 实现, 而只是通过 k = x * y公式进行计算。

swap 则需要调用 token的 transfer进行真实的转账, 如果token 转了 100, 接受者实际收到 80, 就会提示 K 错误。

你可以使用router 里,有专门针对扣费的SupportingFee 接口。

请先 登录 后评论

其它 1 个回答

Jeack
请先 登录 后评论