Hot answers tagged

3

I noticed that swapping some tokens in Uniswap to exactly the same amount of ETH, at the same time, has much higher gas fees than other tokens. Why is this? Aren't the swap transactions identical for all tokens? Some token transfer() function has more instructions (if clauses) than others. Plus it also depends on if the Ethereum Virtual Machine storage can ...


2

It sounds like you're facing one of two problems - either you're using a local dev chain and haven't deployed a Uniswap to it, or you're using a testing fork of a chain, and haven't told your test suite where to lookf for it. You probably have code in your tests for deploying the notSafeMoon contracts using something like const tokenArtifacts = await ethers....


2

This has been a pain for me for a long time. You basically have to compare the liquidity of the different pairs and run the Uniswap formula for calculating the price. Y * I / (X + I) I is your input amount of source tokens X is the balance of the pool in the source token Y is the balance of the pool in the target token In the end, the process we came up to ...


2

They override the transfer function and do different logic on them.


1

The mistake was to set the deadline outside the function that calls swapExactETHForTokens, so it was set according to the time the contract was deployed. If a time variable needs to be used according to actual parameters at run time, then it is necessary to declare it or set it at the time of use. Silly mistake, but important after all.


1

Always check price and slippage before signing a swap. Check price, because it might be off. (For example, someone might have bought a huge amount just before you, causing the price to rise too high.) Check slippage, because there might not be enough liquidity in the pool.


1

From the trace of the transaction you can see it calls CALLVALUE before calling REVERT. [46] 1235 CALLVALUE 777090 2 1 [47] 1236 DUP1 777088 3 1 [48] 1237 ISZERO 777085 3 1 [49] 1238 PUSH2 777082 3 1 [50] 1241 JUMPI 777079 10 1 [51] 1242 PUSH1 777069 3 1 [52] 1244 DUP1 ...


1

It is leftover ETH that was returned to your wallet as a change. For more detail, you chose to swap by specifying the exact output amount (Doge Reload), so the web calculated the ETH input needed (~0.092 ETH) which was a little more than actual use (~0.089 ETH). So the router returned ~0.002 ETH. Read more: https://uniswap.org/docs/v2/smart-contracts/...


1

insufficient input amount means the router contract didn't receive the expected amount of your inbound token (WETH) do you have enough eth in your calling address to support the call?


1

You did not approve USDT to the router address before attempting the swap. The USDT contract uses assert instead of revert or throw to cancel the transaction because of the lack of approval. Using assert will consume all the gas left. It's bad practice by Tether to use assert, but it's probably because their contract is really old. EDIT: Also, the USDT ...


1

In the future, if you wanted to cancel a pending transaction you need to frontrun your own transaction by posting some other transaction with the same nonce. It can be the same transaction, or it can be a different, unrelated transaction. The important thing is that you need to use the same nonce, but a higher gas price. The idea is that by posting a more ...


1

Is there a way to provide liquidity to Uniswap-like contracts without initial funds on one side of the trade? No. Because by definition, this would not be liquidity. For example, if I create my own token called Token, I believe this token should be worth one dollar each. have one thousand tokens, but I don't have one thousand dollars. You cannot do such ...


1

There is a bunch of functions on the smart contract that explains how to use the liquidity field: In Uniswap V3 core repository, in Position.sol line 60: // calculate accumulated fees uint128 tokensOwed0 = uint128( FullMath.mulDiv( feeGrowthInside0X128 - _self.feeGrowthInside0LastX128, _self.liquidity, ...


1

It seems to be a problem with the deadline, maybe the timestamp you are running the function on your computer is higher than the time you are setting as deadline. Print the block.timestamp to know its value and get an idea of the possible error.


1

try below. The functions of ExactETH vs Tokens are different. const tx = await router.swapExactETHForTokensSupportingFeeOnTransferTokens( 0, path, to, Date.now() + 1000 * 60 * 10, { 'value': amountIn, 'gasLimit': 2140790, 'gasPrice': utils.parseUnits('10', 'gwei') } );


Only top voted, non community-wiki answers of a minimum length are eligible