[英]Cant swap USDC for USDT with UniswapV2Router02
I am trying to swap some USDC(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48)
token for USDT(0xdAC17F958D2ee523a2206206994597C13D831ec7)
token using UniswapV2Router02
at address 0xd9e1cE17f2641f24aE83637ab66a2cca9C378B9F
(this is the Sushiswap's router on Ethereum mainnet) I am trying to swap some
USDC(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48)
token for USDT(0xdAC17F958D2ee523a2206206994597C13D831ec7)
token using UniswapV2Router02
at address 0xd9e1cE17f2641f24aE83637ab66a2cca9C378B9F
(this is the Sushiswap's router on Ethereum mainnet)
Since I both USDC
and USDT
have 6 digits precision as amountIn
to the swapExactTokensForTokens
method I am passing number 3000 * 10 ** 6
(must be equal to $3000).由于我的
USDC
和USDT
都具有 6 位精度作为amountIn
方法的swapExactTokensForTokens
,我传递了数字3000 * 10 ** 6
(必须等于 $3000)。 As amountOutMin
I am passing 2850 * 10 ** 6
(must be equal to $2850, which is -5% from the amountIn
. In my opinion this is prety enough slippage tolerance)作为
amountOutMin
我正在传递2850 * 10 ** 6
(必须等于 $2850,这是amountIn
的 -5% 。在我看来,这是足够的滑点容忍度)
Everything looks right?一切看起来都对吗? Yes but no: Everythime I ma trying to run this code:
是但不是:每次我都想运行这段代码:
UniswapV2Router(0xd9e1cE17f2641f24aE83637ab66a2cca9C378B9F) // Sushiswap router on ETH mainnet
.swapExactTokensForTokens(3000 * 10 ** 6, // 3000 USDC
2850 * 10 ** 6, // 2850 USDT
[
"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", // USDC address on ETH mainnet
"0xdAC17F958D2ee523a2206206994597C13D831ec7" // USDT address on ETH mainnet
],
msg.sender,
<some deadline>);
I am getting the following error:我收到以下错误:
Revert message: UniswapV2Router: INSUFFICIENT_OUTPUT_AMOUNT
Please help what I am missing?请帮助我缺少什么?
EDIT: I am using truffle
and I have forked ETH mainnet编辑:我正在使用
truffle
并且我已经分叉了 ETH 主网
EDIT 2: The amount UniswapV2Router
is trying to return is 1327704386 ~ 1327 USDT
which is ~60%
slippage but in the liquidity pair there are assets for $2,036,392,078,752.44
编辑 2:
UniswapV2Router
试图返回的金额为1327704386 ~ 1327 USDT
,滑点~60%
,但在流动性对中有$2,036,392,078,752.44
的资产
It happened so thath the Sushiswap's USDC/USDT pool has only 5k
in liquidity and everything with my code is right.事情发生了, Sushiswap 的 USDC/USDT 池只有
5k
的流动性,而我的代码的一切都是正确的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.