People who code: we want your input. Take the Survey

Questions tagged [uniswap]

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

Filter by
Sorted by
Tagged with
0
votes
0answers
2 views

Calculating Simple APR of a Uniswap Pool with GraphQL

Sorry, I am just having a bit of a logic error in understanding how to calculate the APR of a Uniswap Liquidity Pool. I can reliably send requests to https://thegraph.com/explorer/subgraph/uniswap/...
1
vote
0answers
9 views

Why we sort tokens in uniswap functions?

function sortTokens(address tokenA, address tokenB) internal pure returns (address token0, address token1) { require(tokenA != tokenB, 'UniswapV2Library: IDENTICAL_ADDRESSES'); (token0, token1)...
2
votes
1answer
1k views

How to query Uniswap api in order to get the pair ID of a chosen token?

I am using the Uniswap v2 api subgraph but I am running into a bit of an issue that I cannot resolve. Basically I want to query the api to get the latest token swaps of a chosen token and Eth. Using ...
1
vote
0answers
23 views

Timestamp of when address received a token

Trying to find a way or documentation in obtaining the timestamp of when an address received the token in a smart contract. I have read many reflection based contracts that apply different levels of ...
1
vote
2answers
153 views

UniSwap V3 API : How to track **unclaimed fees** programmatically?

I have invested in UniSwap-V3 Liquidity Pool. And how to track unclaimed fees programmatically? I plan to have server-backend API fetch data to track unclaimed fees ($27.92 in picture) I have tried ...
0
votes
0answers
7 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.
0
votes
0answers
35 views

How are tokens priced when traded in quantities on Uniswap?

I’m new to cryptocurrency and have gone through the entire documentation for Uniswap, but unfortunately still can’t seem to find an answer to this question. I’ll describe my question in this ...
0
votes
1answer
14 views

How do I fork the Uniswap V2 interface and make changes? [closed]

I am already done forking the smart contracts of the Uniswap, I am looking at forking the interface and then linking it up with the smart contract, is there a guide or way I can do this, I can't seem ...
1
vote
2answers
153 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 ...
0
votes
1answer
455 views

Uniswap fork: remove liquidity error

I am trying to fork uniswap. And I have a problem when liquidity is removed. Problem in UniswapERC20. I don't know what's wrong. Step by step (repeatedly for Rinkeby and Ropsten): Copy Uniswap ...
1
vote
2answers
36 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
0answers
12 views

what is math for uniswap calculates the amountout and amountin why 997 and 1000

function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) internal pure returns (uint amountOut) {//the amount of user,amount in pool,output token amount in pool require(amountIn > ...
0
votes
1answer
45 views

Issues with Uniswap V2 addLiquidityETH()

I've been learning how Solidity and Uniswap works. I found a smart contract that appeals to me enough to want to use it to learn more Solidity with. https://etherscan.io/address/...
0
votes
0answers
10 views

How to associate Transfer events with a Swap event?

Let's take this Transaction as an example. Here we have events: 287 Transfer 289 Transfer 291 Swap We can associate those two Transfer events with Swap event by looking at the sequence of events and ...
0
votes
0answers
36 views

Calculation of Uniswap Pair address

I want to know the address of an Uniswap pair contract with Solidity, even if the pair doesn't exist yet. I can't use the function getPair of the factory contract because it return 0 when the pair ...
1
vote
0answers
31 views

Ethers js estimateGas() without needing ETH in account

I am trying to estimate the gas used for a uniswap transaction. I am able to perform this on the Kovan testnet however when I try and run the same script on the mainnet it raises an error, "Error:...
1
vote
2answers
113 views

How to understand the Swap event payload?

I am trying to wrap my head around pancakeswap Swap event (which should be equivalent to uniswap). Here is an example transaction: 0xd809e359a4037eb5e2617769b93f8b7fa1e708c37019b02933e1845e33c99884 ...
0
votes
0answers
9 views

Getting the balance of a token in wallet - decimal issue

Im trying to get the balance of a certain token from a wallet address in order to then swap out those tokens. The problem i have is that the code returns the tokens where the decimal point is out ...
0
votes
0answers
28 views

Calculating Gas of A Uniswap Exchange With Web3js

I am trying to calculate the gas that a contract will use prior to executing it. I realize that it is not possible to get a 100% exact value but I would still like to calculate an estimate. I am new ...
0
votes
1answer
102 views

Flash loan price manipulation

I am quite new to flash loan and I don't fully understand it. I've been reading on flash loan attacks lately and notice often times it involves a huge dump on Uniswap to skew the price of a coin. I am ...
1
vote
0answers
22 views

Failing Token to Token Swap Contract Using Uniswap

So I've been struggling to get a working swap contract that swaps an exact token for a token via uniswap. I have multiple versions at this point, as I've tried several different approaches. After ...
0
votes
1answer
22 views

Why did Uniswap abandon Vyper?

Uniswap V1 was coded in Vyper. They switched to Solidity for the V2. Why is it so? Was vyper lacking functionalities that would have made impossible to code Uniswap V2 with it?
1
vote
0answers
5 views

What's effective rate when one of the reserves is 0?

In this transaction, ECT/WBNB reserves were: reserve0: 0 reserve1: 316227766034 given that WBNB/ECT rate is calculated by dividing reserve1/reserve0, what does it make the spot price of the token?
1
vote
1answer
117 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
0answers
19 views

pros/cons for creating own custom contract router

I have seen some people (bots?) using custom routers/contracts for trading and tried to google this why someone wants to use custom router instead uniswap/pancakeswap. I wonder if someone here knows ...
1
vote
1answer
3k views

Uniswap/Pancakeswap SWAP swapExactTokensForTokens / swapExactETHForTokens FAILED (Sniping Bot)

I'm a beginner and for the past few days I have tried to recreate this tutorial: https://www.youtube.com/watch?v=a5at-FEyITQ At first I tried to implement it on PancakeSwap, but got a Transaction ...
0
votes
0answers
15 views

Uniswap V3's Position NFTS “positions()” returning irregular results for tokensOwed

I'm messing around with web3py and I ran into something that I haven't been able to understand; when I call positions() on a tokenid, I get odd results for the tokensOwed values. The results don't ...
1
vote
1answer
972 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 ...
0
votes
2answers
56 views

How can I swap a token across different liquidity pools in a single transaction?

im pretty new to solidity, and i was wondering how you can 1 ERC token by another across different liquidity pools. Example: I have 1 DAI and I change it for eth in the ETH-DAI Uniswap pool then I ...
0
votes
0answers
4 views

ethereum uniswap to PoolTogether [closed]

I have ethereum on uniswap and I made a purchase of pools together and the operation was canceled and I need to receive the ethereums sent
0
votes
1answer
431 views

Invalid BigNumber Value Uniswap and Ethers JS

Hey guys I am using the Uniswap Javascript SDK and Ethers JS to make a swap but I am getting this Error: invalid BigNumber value (argument="value", value=[-626648004,3158], code=...
0
votes
0answers
9 views

I can't change votes in the transfer of votes for governance. In one , user's vote does not change while mint? Why could it be? [closed]

When I run the moveDelegates function within the transfer function in my contract on uniswap, the votes of the spender account are deducted, but the votes of the recipient account are reset. So what's ...
0
votes
1answer
30 views

Why include UniSwapRouterV2 in Erc20 Contract?

Many ERC20 coins like SafeMoon include UniSwapRouterV2 in their contract. What are the benefits of this? Is it ok not to include a router? e.g. SafeMoon's Router code: interface IUniswapV2Router01 { ...
0
votes
1answer
29k views

TRANSFER_FROM_FAILED error when trying to swap BCLNC tokens for ETH on Uniswap

I'm attempting to swap BCLNC tokens for ETH on Uniswap, but I get the following error: The transaction cannot succeed due to error: TransferHelper: TRANSFER_FROM_FAILED. This is probably an issue ...
1
vote
1answer
30 views

How my tx become a flashbots / private transaction?

I did swap on Uniswap today, and realized that my tx is frontrunned and it become a flashbots / private transaction. Here is the tx https://etherscan.io/tx/...
1
vote
1answer
851 views

How did this address steal my Ethereum ERC-20 Tokens using Uniswap? 0x2b5b060d57b1333c9b2739e9c15b039726dd51ec

I was using my Trust wallet on my mobile and tried to do a swap from ETH to an ERC20 token but realized a day after that it got drained to this account: https://etherscan.io/address/...
0
votes
1answer
35 views

Why do we need to deploy a smart contract to swap tokens on Uniswap?

I didn't get why do we need to deploy a smart contract to call a router function? Why not just send a transaction to the router via web3 or ethers?
0
votes
1answer
16 views

calculating the daily rewards for liquidity provider in Uniswap

I am integrating the uni swap contracts and want to understand how could I calculate the daily rewards for the liquidity provide. I understand that I could get the pairAddress.balanceOf(msg.sender) ...
6
votes
1answer
322 views

Computing the Uniswap V3 pair price from Q64.96 number

I am trying to compute a Uniswap v3 pool prize. I can get the square root price of Q64.96 number as uint160 (e.g., 1234217676608908277512433764 - value of DAI/ETH pool (price at that time around 1 ETH ...
2
votes
2answers
103 views

Calculate deposit amount when adding to a liquidity pool in Uniswap v3

Suppose: The price of an A/B token pair is price_now The user wants to provide liquidity in the range price_low to price_high such that price_low < price_now < price_high The user supplies X ...
1
vote
0answers
24 views

Gas Estimation Error - Swap Contract

I'm working on developing a contract that automatically performs a swap and have been having an issue with the swap function. I finally got the contract deployed on Kovan, but have been getting the ...
0
votes
1answer
37 views

What's the relationship between LP reserves and Swap rate?

This transaction transaction describes Swap event: amount0_in=14067900000000 amount1_out=393017164305296368 This means that the effective trade rate is: trade_rate=round(amount1_out/amount0_in)=27,...
2
votes
1answer
48 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 ...
3
votes
1answer
25 views

How to understand the constant product formula?

Let's use this transaction as an example. Here 1 BUSD was transferred to Zombie / BUSD LP in exchange for 172054109197 Zombie tokens. (3511308350 (2%) Zombie tokens were burned as part of the ...
0
votes
0answers
10 views

How to calculate new reserve values after a Swap?

Let's use this transaction as an example. Here 1 BUSD was transferred to Zombie / BUSD LP in exchange for 172054109197 Zombie tokens. (3511308350 (2%) Zombie tokens were burned as part of the ...
0
votes
0answers
11 views

Hardhat not catching exception from external contracts on forknet

I am testing a function that involves a buying transaction on PancakeSwap. This involves a series of internal function calls which is not shown here for simplicity sake. here is my test snippet: ...
0
votes
1answer
49 views

How to convert WETH back to ETH (solidity)

I am trying to convert back WETH into ETH (actually BNB on BSC). I am doing the following: function allToBNB() public{ WETH.transfer(address(this), WETH.balanceOf(address(this))); }` ...
0
votes
2answers
71 views

Call swapExactETHForTokens from contract and pay with contract balance

I am starting to learn solidity so this is probably a very basic question, but I couldn't find enough clarification only. My goal is to purchase a token on PancakeSwap/UniSwap using the ETH balance of ...
0
votes
2answers
870 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
0answers
25 views

Fail with error 'UniswapV2Library: ZERO_ADDRESS' when trying to implement a swap

I am trying to implement a Ropsten Testnet swap via contract. This contract swaps Testnet DAI for a token I have created. Liquidity is added and swapping via the UI works. IUniswapV2Router02 private ...

1
2 3 4 5
7