Questions tagged [uniswap]

Uniswap is a decentralized finance protocol that is used to exchange cryptocurrencies.

Filter by
Sorted by
Tagged with
2
votes
1answer
105 views

How does uniswap process so many transactions on the clogged ethereum network?

According to info.uniswap.org, the number of uniswap transactions in the last 24 hours was 136,383. This amounts to approximately 136383 / 24 / 60 / 4 = 24 transactions per block. It appears that with ...
2
votes
1answer
523 views

Uniswap ETH to Tokens to ETH swap function

UniswapV2Router02.sol has 2 interesting functions which i'd love to combine swapExactETHForTokens and swapExactTokensForETH. Basic idea is arbitrage from ETH to tokens and back to ETH. As far I ...
2
votes
1answer
380 views

What is the sequence of events when a transaction is made on Uniswap?

I elect to swap 100 UNI for 700 USDC on UniSwap, but with a low gas fee. In 1 hour, the price of 1 UNI has dropped significantly. would the pending transaction still swap for 700 USDC (as long as ...
2
votes
1answer
232 views

How to keep the token price in uniswap the same with the centralized exchange

Consider I have a custom Erc20 Token which already lists in CEX(centralized exchange like huobi). Then I add liquidity to Uniswap to make it tradable with initial exchange price. However this token is ...
2
votes
2answers
135 views

Trying to make sense of Uniswap v3 fees (feeGrowthInside0LastX128, feeGrowthGlobal0X128)

I'm trying to figure out the uncollected fees for my Uniswap v3 position programmatically. If I interpret the v3 whitepaper correctly it should be liquidity multiplied by the difference of ...
2
votes
1answer
153 views

Question about the best Uniswap path

How the best path is calculated ? Is it a fonction in the smart contract or on the website ? Because I checked the function swapExactETHForTokens and the path need to be set by the function caller. ...
2
votes
1answer
131 views

How to distinguish buy and sell?

I'm building a smart contract to learn solidity and I'm wondering how I can distinguish buy and sell functionalities. I want the contract to do different functionalities on a buy and other ...
2
votes
1answer
693 views

uniswap solidity contract: swapExactTokensForTokens Failed in my own smart contract

I am using sushiswap to transfer weth to dai. Everything goes fine when I use web3.js to call swapExactTokensForTokens directory. However, thing goes wrong when I try to include the ...
2
votes
1answer
196 views

Why is “modifier lock()” needed in UniswapV2Pair smart contract?

In UniswapV2Pair.sol(https://github.com/Uniswap/uniswap-v2-core/blob/master/contracts/UniswapV2Pair.sol), modifier lock() seems to be used to get lock and release lock. And it is used in almost all ...
2
votes
1answer
52 views

How can Uniswap instance ERC20 tokens without importing code?

I was checking Uniswap contracts github repo and I don't understand exactly how can they dynamically use any ERC20 tokens without importing the code or having the ERC20 token smart contract address. I ...
2
votes
1answer
200 views

How to calculate the price after trade on Uniswap?

I would like to get the price of a token after a swap. For example the price is now $1, and I would like to see how much will be the price after my swap. Is the execution price what I need in this ...
2
votes
1answer
924 views

Swap Smart Contrat Ether with Uniswap

Is it possible to call Uniswap from a smart contrat and make a swap with smart contract ether, and not from the message sender ether ? (and send back the swapped token to the owner) I tried like this ...
2
votes
0answers
24 views

Uniswap path generation

The uniswap contract has a function called swapTokensForExactTokens. One of the arguments to this function is an array of addresses called "path" which is the route that the transfer will ...
2
votes
0answers
270 views

Uniswap JS SDK returns invalid pair address for two ERC20 tokens in hardhat network

I create two ERC20 tokens, deploy them with hardhat on hardhat network, then create Uniswap pair, then retrieve its address with SDK's Fetcher and with my contract. Fetcher returns different address ...
2
votes
0answers
348 views

Uniswap v3 liquidity

Now that uniswap and pancakeswap are migrated to the new v3 core system, do I need to change my liquidity code somehow? Right now I have this code with the old v2 routers, factory and pair codes to ...
2
votes
0answers
50 views

trouble understanding the usage and calculation of INIT_HASH and precompiled contracts

I am working with pancakeswap and I was following a tutorial which just said that we need to calculated the INIT_HASH and that we can follow this link enter link description here for guidance. The ...
2
votes
1answer
314 views

Uniswap Router deployment error: “UniswapV2Router02” — Cannot create instance of UniswapV2Router02; no code at address 0xxxxxxxxx

I am trying to fork Uniswap and deploy on Ropsten testnet for educational and testing purposes. From what I gathered, it seems that we need to first deploy the UniswapV2Factory contract, followed by ...
2
votes
0answers
209 views

Uniswap addLiquidity Error: “revert TransferHelper: TRANSFER_FROM_FAILED”

I'm having issues with the addLiquidity() call failing due to what likely seems to be an approval issue and producing the following error code: Internal JSON-RPC error. { "message": "VM ...
2
votes
0answers
36 views

Retrieve deposited number of Uniswap LP tokens from smart contract

I’m doing yield farming on a smart contract and I try to find out the total amount of my deposits. I know that I can follow the ERC20 tx on etherscan, but I would like to find an easier way. Under ...
2
votes
0answers
147 views

GraphQl Query to get Uniswap OHLC data through The Graph

I tried searching through whole doc of The Graph but couldn't get a way to get OHLC data of Uniswap pair swaps. Where can I find such a query. Is this even possible? Thanks
2
votes
1answer
901 views

How to know the amount of ETH in the liquidity pool

I'm currently trying to find a way to know the amount of ETH inside the liquidity pool. That would be by using Uniswap V2. A pair would be ETH/Some other ERC20 token. My idea was about using ...
2
votes
0answers
2k views

Failed transaction (Error encountered during contract execution) on Uniswap Router02?

I wish to send a transaction for a Uniswap swap with a path of 3 tokens: [weth, dai, chainlink]. The transaction is mined, but fails, and the error message is not enough for me to debug: fail: ...
2
votes
0answers
1k views

Frontrunning Uniswap horror story transactions

From the Ethereum is a Dark Forest post, the rescue plan was: Deploy a Getter contract which, when called by its owner, would make the burn call ONLY if activated, and otherwise revert. Deploy a ...
2
votes
1answer
12k views

How can I disconnect a Metamask wallet from Uniswap?

As soon as I go in Uniswap, it already loads the Metamask wallet that was used previously... but I do not want to use that Metamask wallet, I want to use a different Metamask wallet. How my I do this, ...
1
vote
2answers
255 views

understanding the Swap function in pancakeSwap Pair contract

Hi i am trying to understand the reasoning behind the swap function of a pancake pair on the pancakeSwap DEX and the checks it does. this is the function : require(amount0Out > 0 || amount1Out > ...
1
vote
1answer
365 views

How does uniswap creator take profit?

I wonder why someone develop a dex like uniswap, sushiswap etc. Why should I create one? How do I make profit by paying domain name, servers etc.? I've read docs and whitepapers. There's a fee, but ...
1
vote
3answers
658 views

Incorrect Uniswap Liquidity Calculations. What could be wrong?

Looking though a uniswap address: https://info.uniswap.org/account/0xd62317c76E626D53C900088Fb07539b829B564B2 This address shows that it added $30k+ worth of liquidity, and none of it is removed. Why ...
1
vote
1answer
59 views

What is the logic by which tokens are ordered when creating a new Uniswap V2 pair?

When creating a new pair contract via the UniswapV2Factory contract, the order in which tokens get assigned in storage (that is, the token0 and token1 vars) cannot be arbitrarily set by the caller: (...
1
vote
1answer
476 views

In DEFI does each token-pair produce its own LP token?

In DEFI does each token-pair produce its own LP token? Let us say I am in uniswap does each token pair produce its own LP pair when you provide liquidity or is it just one LP token regardless of the ...
1
vote
1answer
316 views

Unary operator - cannot be applied to type uint256

I was trying to compile the mulDiv function, part of the uniswap-v3-core code base, but I am getting the following error: Unary operator - cannot be applied to type uint256 This is the line where it ...
1
vote
1answer
513 views

Pancakeswap (sushi swap fork) swapping tokens reverts

function swapTokenForToken(uint256 amountIn, address tokenIn, address tokenOut, uint256 amountOutMin) public payable returns (uint256){ address[] memory path = new address[](2); path[...
1
vote
1answer
224 views

Uniswap: How do I distinguish between selling tokens and providing liquidity?

I want to implement different behavior in the transfer function of an ERC20 token if the transaction is swapping the token for ETH on Uniswap. The straight forward approach is, to check whether the ...
1
vote
1answer
59 views

How can we fetch the current market price to our DEX?

We are fixing the price at the time of creating pair for our token with BNB by adding liquidity. If the Price of the BNB/BUSD. How can we fetch the current market price and update in our DEX? Is there ...
1
vote
2answers
777 views

Is there a way to convert Binance pegged tokens into Ethereum based tokens?

This is confusing me a lot. Basically if you have a metamask wallet and have some BNB there, and you use PancakeSwap for example, even if you convert the BNB into ETH or BTC, it won't be the real ...
1
vote
2answers
390 views

Can I avoid impermanent loss if I only as a LP of BETH/ETH pair in binance?

Can I avoid impermanent loss if I only stake ETH as a LP of BETH/ETH in Binance? Is BETH's price stable? If I don't want to hold any crypto assets except ETH,what are the best DEFI options to improve ...
1
vote
1answer
698 views

How to set a custom gwei / gas price on uniswap/sdk Javascript using ethers.js module?

Im building an app to do trades on uniswap using ethers module. ive created contracts and imported the router and the factory contracts using this code: const factory = new ethers.Contract( ...
1
vote
2answers
2k views

Failed to add liquidity in pancakeswap

I am trying to make a few transactions on binance test net using a script in solidity and truffle which is a clone of PANCAKESWAP. I was able to successfully compile and execute the script once. When ...
1
vote
1answer
735 views

Uniswap | Remove Liquidity

Once you add liquidity to the Uniswap, you need to provide ETH and an equal amount of ERC20 token [1]. So in total, you deposited (ETH + ERC20 amount). Once you remove the liquidity, do you remove ...
1
vote
1answer
1k views

Why is it so much cheaper to buy/sell/convert on CoinBase than Coinbase Wallet or Uniswap?

I just recently started using Coinbase Wallet (which I will from now on refer to as just Wallet) and connected it to Uniswap to be able to buy some Celsius. I have some various coins on Coinbase (not ...
1
vote
1answer
490 views

What programming languages was Uniswap's open-source code written in?

Uniswap is a decentralized exchange that is actually a decentralized app where people can trade ERC-20 tokens without a middleman. Uniswap's code is open-source: https://github.com/Uniswap Was the ...
1
vote
1answer
398 views

Instantiating a smart contract in Uniswap using assembly and create2

I am studying Uniswap source code and there is something I do not understand in this file: https://github.com/Uniswap/uniswap-v2-core/blob/master/contracts/UniswapV2Factory.sol: This factory can ...
1
vote
1answer
2k views

How can you get the price of token on Uniswap using solidity?

I'm trying to create a function that takes a token address as the parameter and returns the price of the token. I saw another post that mentioned the Uniswap SDK, but that used javascript. I'm ...
1
vote
1answer
267 views

how to send a transaction using sdk uniswap.org

i am trying to create and send a transaction to https://app.uniswap.org using SDK https://uniswap.org/docs/v2/smart-contracts/router02/ uniswap has two functions (swapExactTokensForETH and ...
1
vote
1answer
547 views

Swap token to ether through Uni-V2 yields Fail with error 'TransferHelper: ETH_TRANSFER_FAILED'

I have two interfaces: interface IUniswap { function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline) external payable /*DELETE MAYBE*/ returns (uint[] ...
1
vote
1answer
1k views

How to find out if a token takes a fee on transfer?

I'm trying to find out if there is a way programmatically (using web3) to check if a token takes a fee on transfer, such as the ones that require the swapExactETHForTokensSupportingFeeOnTransferTokens ...
1
vote
1answer
1k views

What is Uniswap's AmountoutMin(uint256)?

I want to use the Uniswap router contract to buy a token. However, I got confused by the amountoutmin(unit256) in the swapExactETHForTokensSupportingFeeOnTransferTokens of uniswap. I read the unswap ...
1
vote
1answer
3k views

Adding Uniswap liquidity via javascript and truffle?

I am trying to add a liquidity to Uniswap on the Ropsten network using truffle and javascript. I am connecting to the addLiquidityETH function as described here in the Uniswap documentation: https://...
1
vote
1answer
22 views

What's the point of UNI token?

From what I've seen it is totally useless? I was hoping they use it at least for some functioning or something but it seems to me it is just used to enable flow of money to authors of Uniswap.
1
vote
2answers
72 views

Can anyone tell me the names of known uniswap v2 forks?

im compiling a list and i need to know the names of as many uniswap v2 forks. Only ones that exist on the ethereum mainnet. i know of sushiswap, sakeswap and defiswap
1
vote
1answer
46 views

Why is UniswapV2Factory not implementing IUniswapV2Factory 'getPair' function?

Sorry newb here. https://etherscan.io/address/0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f#code Why is there no function called 'getPair' even though IUniswapV2Factory declares it? Thanks in advance.

1
2
3 4 5
9