Skip to main content

All Questions

Filter by
Sorted by
Tagged with
24 votes
3 answers
25k views

How to infer token price from ethereum blockchain UniSwap data?

I would like (if possible) to infer a token price from the blockchain using UniSwap data. After reading the following article, I understood that it is feasible: https://blocklytics.org/blog/uniswap-...
Timothée HENRY's user avatar
9 votes
3 answers
7k views

Convert an eth key to a geth key

I need to convert my eth key to a geth key. eth put the key in %appdata%\roaming\Web3\keys, and I see it as a .json file. If I move that to the %appdata%\roaming\Ethereum\keystore directory, geth ...
feebel's user avatar
  • 93
23 votes
8 answers
29k views

Computing the Uniswap V3 pair price from Q64.96 number

I am trying to compute a Uniswap V3 pool token price in Solidity. I can get the square root price of Q64.96 number as uint160 (e.g., 1234217676608908277512433764 - value of DAI/ETH pool (price at that ...
pipip's user avatar
  • 331
11 votes
6 answers
18k views

UniswapV2 addLiquidity revert ds-math-sub-underflow

I'm trying to use Uniswapv2Router with Truffle and Ganache, but haven't been able to identify what I'm doing wrong. I'm using addLiquidty method as follows: await uniswapV2Router02.addLiquidity(token0....
SergioGaitan's user avatar
8 votes
1 answer
24k views

How do fronrunning and sniper bots work?

If you ever traded in defi, you probably have seen coins getting sniped at the very second of their launch and drastically inflating the prices. I assume these bots are written in js, ad using web3 ...
Itsjonie's user avatar
  • 259
7 votes
1 answer
10k views

ETH sent to ETC address

I accidentally sent ALL my ETH on ETC address :( 6 months of mining gone :( I sent from one exchange to fresh address on another exchange, but on ETC ... Is there ANY way to track those coins? I'm ...
bojan pavkovic's user avatar
4 votes
1 answer
649 views

Can geth and eth share the same accounts and blockchain?

It appears when I have multiple ethereum clients installed, that they all have their own data, accounts and even their own copy of the blockchain. Is it possible to share accounts and the blockchain ...
q9f's user avatar
  • 33k
0 votes
2 answers
2k views

Beware of "Uniswap Front Running Bot" Scam [duplicate]

Hi everyone sorry for my english i used translator . I have a big problem on a contract I created under remix frontrunning uniswap solidity 6.6 on injectedWeb3 with my métamask wallet. But when I want ...
Alex Boury's user avatar
4 votes
1 answer
4k views

Decode Uniswap Universal Router transaction in ethers.js

Uniswap has recently rolled out a new Universal router (blog here: https://docs.uniswap.org/contracts/universal-router/technical-reference) I've decoded a transaction using the Uniswap ABI and ...
Abraham P's user avatar
  • 103
4 votes
1 answer
5k views

How can I import geth accounts into eth?

I had two accounts under ~/.ethereum/keystore when I used geth a while ago. I got a new PC, recompiled only the C++ version and I can't see my two accounts in eth. web3.admin.eth.allAccounts() ...
euri10's user avatar
  • 4,640
2 votes
4 answers
11k views

Understand price impact and liquidity in pancakeswap

I am trying to understand how the price impact and liquidity was calculated in uniswap or pancakeswap through the router contract? UNI Router: https://etherscan.io/address/...
Aadhavan G S's user avatar
1 vote
1 answer
8k views

I sent My ETC to my ETH address

I've sent a mistake ETC from ETH address from poloniex. How do i do now. This is my transaction (this is a fresh address) http://gastracker.io/tx/...
Luan Nguyen's user avatar
0 votes
3 answers
1k views

Layer2: Revert Execution Error when Calling exactInputSingle in Uniswap V3

Hello Stack Overflow Community, I am working on swapping tokens in a base layer2 network using Uniswap V3 and ethers.js. I have successfully approved the transaction using the approve function, but ...
Ghassane Aboughazaouat's user avatar
10 votes
1 answer
4k views

Uniswap V2 calculate quantity tradable at target execution price in Solidity?

Let's say the instantaneous price of ETH/USDT pair is 2000. If I trade a lot of ETH for USDT, there could be a lot of slippage, and my trade might fulfill at an average execution price of 1950 USDT ...
David Callanan's user avatar
7 votes
5 answers
5k 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 ...
vlad.london's user avatar
7 votes
4 answers
3k views

Detect if destination is a Uniswap V3 Pool

Is there a way for a contract to check a destination address to see if it's a Uniswap V3 pool?
Rob Hitchens's user avatar
  • 55.6k
7 votes
1 answer
12k views

How to get a token pair's uniswap trade history?

What I am trying to do is this :- Given an pair (say DAI/ETH pair), i want to display the latest 10-15 trades (buy, sell, add to pool and remove from pool) and also display a graph of price for that ...
Hokkyokusei's user avatar
6 votes
2 answers
10k views

How to install eth on debian? (symbol lookup error)

I installed from the ubuntu ppa and got this error. ➜ ~ eth eth: symbol lookup error: eth: undefined symbol: _ZN3dev3eth14EthashGPUMiner14s_numInstancesE What can I do / check? I'm on debian ...
euri10's user avatar
  • 4,640
5 votes
1 answer
2k views

How to import Aave and Uniswap contracts from a 0.8.x Solidity contract

So I have some smart contracts with version pragmas set to 0.8.0, my Truffle config's solc is set to 0.8.2 and everything compiles except for some imported contracts from Aave and Uniswap. This is ...
Brendon Rofe's user avatar
5 votes
1 answer
13k views

The ERC-20 Token Transfer might have Failed (ErrCode: unable to locate corresponding Transfer event log), check with sender

EtherScan.io is showing error: The ERC-20 Token Transfer might have Failed (ErrCode: unable to locate corresponding Transfer event log), check with sender. Transactions are successful but users are ...
Dar Dev's user avatar
  • 51
4 votes
3 answers
1k 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 ...
daQuincy's user avatar
4 votes
1 answer
1k views

Double Flash Loan

Looking into Flash Loans, is it possible to take out TWO at once (aave/dydx/uniswap)? How would you go about doing this? Here is what I'm thinking of, but it seems too complicated: Contract 1 takes a ...
superuser's user avatar
  • 143
4 votes
1 answer
5k views

How to decode uniswap v3 Router 2 transaction

I am trying to parse uniswap transaction and extract "summary" like what Etherscan does when showing transaction (like this one) below: Transaction Action: Swap 2,937.943845 USDC For 1....
Tofig Hasanov's user avatar
3 votes
1 answer
2k views

What token address do I use if I want to sell an ERC20 token on a different exchange? Its original address or its address on the other exchange

I really need help with this one to avoid logic errors. I am on the Kovan testnet. I bought 4 units of DAI token on Uniswap exchange(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D) for 0.111 Ether and ...
gbenroscience's user avatar
3 votes
1 answer
371 views

cpp-ethereum build error

I have cloned the cpp-ethereum in Linux (centOS) from git as follows as suggested in cpp-ethereum-develop cmake error git clone https://github.com/ethereum/cpp-ethereum cd cpp-ethereum git ...
userven's user avatar
  • 81
3 votes
1 answer
2k views

Beware of FrontBot Scamming! [duplicate]

I was messing around YouTube and bumped into this video: https://www.youtube.com/watch?v=W5X5WdCVL3M&t=411s Followed up all the things and gave a dumbass look into the code, nothing seemed ...
Egemen's user avatar
  • 31
3 votes
1 answer
3k views

Why does Uniswap V2 use `_safeTransfer` to transfer tokens?

I'm looking into Uniswap V2 code and found that it uses _safeTransfer function to transfer ERC20 tokens in the Pair contract. function _safeTransfer(address token, address to, uint value) private {...
ywat's user avatar
  • 217
3 votes
5 answers
5k 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 ...
riseres's user avatar
  • 133
2 votes
2 answers
476 views

Why immutable contracts [closed]

I'm a seasoned engineer, but quite new to blockchain technologies. I'm trying to grasp the "why" and the real "value" of immutable contracts. Never seen or heard of pieces of software being ...
ehanoc's user avatar
  • 167
1 vote
1 answer
668 views

ETH-Brownie How can I import from github when the version number includes letters and numbers?

Normally you can import npm style via a brownie-config.yaml file like so: dependencies: - uniswap/[email protected] compiler: solc: remappings: - 'uniswap=uniswap/[email protected]....
Pickinanameainteasy's user avatar
1 vote
1 answer
6k views

Uniswap V3, calculate volume to reach target price

Given a pool with one or more liquidity positions, is there an efficient algo to compute the swap volume required to hit a target price? For example, consider a stable token with algorithmic ...
Rob Hitchens's user avatar
  • 55.6k
1 vote
1 answer
4k views

Fork uniswap including interfcae

I am trying to fork uniswap. I have successfully deployed uniswap-core and uniswap-periphery on my local machine (ganache).For this, I could get many tutorials and articles. But could not find a ...
Amalnath Sathyan's user avatar
1 vote
1 answer
334 views

cpp-ethereum-develop cmake error [duplicate]

I have downloaded "cpp-ethereum-develop" zip file from github and unzipped it. While executing "cmake eth" It gives the following error. Unknown CMake command "eth_simple_add_executable". CMake ...
userven's user avatar
  • 81
0 votes
2 answers
1k views

How to make an action to send record to my database?

I want all transaction of the tokens send to my database through smart contract. For example, A send 10Token to B, it will show on blockchain, but I also want a function which smart contract will let ...
Alan Li's user avatar
0 votes
2 answers
3k views

How to get the virtual and real reserves from a Uniswap V3 pair?

I need help with math of Uniswap V3 virtual and real reserves. Need to find the true reserves of a pair. Example: let's say we have this DAI/WETH pair: 0x60594a405d53811d3BC4766596EFD80fd545A270 ...
Chenky's user avatar
  • 21
11 votes
1 answer
4k views

Sign raw transaction offline with C++ on arduino

I'm exploring the IoT side of the EVM. I've programmed Arduinos and ESP8266s to interact with a Geth JSON RPC. I'm trying to be minimalistic and avoid NodeJS on the Geth JSON server side. Currently ...
GusGorman402's user avatar
11 votes
4 answers
18k views

ethminer Failed to submit hashrate

I keep getting an error: ethminer Failed to submit hashrate :( I am very new to this whole mining thing, and just want to learn more. I am using: Geth Version: 1.5.0-unstable ethminer version 1.2.7 ...
doart3's user avatar
  • 133
8 votes
4 answers
11k views

Warning: Contract code size exceeds 24576 bytes

I'm using hardhat and when trying to compile the code it shows me a warning containing @uniswap/v2-periphery/contracts/UniswapV2Router02.sol:12:1: Warning: Contract code size exceeds 24576 bytes (a ...
Yaya's user avatar
  • 109
7 votes
3 answers
3k views

Is there any c++ library for signing transactions?

I am working on light wallet in c++, and I am looking for a c++ library for signing transactions. I mean something where i will pass transaction and private key and it will return signed transaction ...
ADV's user avatar
  • 101
6 votes
2 answers
1k views

Uniswap v2 whitepaper: how is formula for "total fees computed since last time fees were collected" derived?

This above screenshot come from uniswap v2 white paper page5 , how is this equation derived ? (To make the question more searchable, here is the quote in text form) The total collected fees can be ...
Jiaming Li's user avatar
6 votes
2 answers
3k views

Ethereum Merkle Patricia Trie (Extension node)

I do not have time to look through the source code right now. My questions is: In Ethereum, when is the decision to replace part of a given path with an Extension-node made? I suppose the sole idea ...
Vega4's user avatar
  • 323
6 votes
1 answer
934 views

Ethereum Merkle Patricia Trie and Hashes

In Ethereum, there's a hash of all of the 3 tries in each block. Out of curiosity. The docs state that the functionality is supposed to just provide a mapping between 160bit keys and values. I find ...
Vega4's user avatar
  • 323
6 votes
3 answers
25k views

Swap tokens back to ether on Uniswap V2 Router 02 (Sell tokens)

I am trying to do the reverse action of what I did in this question: Basically sell/swap some arbitrary token and receive ether on Uniswap V2 using IUniswapV2Router02. Here is what I have done: ...
gbenroscience's user avatar
6 votes
1 answer
52k views

How to manually approve a token for swap on Uniswap (direct contract interaction)

I want to approve token spending on Uniswap for a token I don't own. Uniswap UI won't let me do that (instead it displays a gray out button "insufficient balance"). Seems the only option ...
Pm Rivière's user avatar
6 votes
3 answers
5k views

Uniswap V3 version of V2's getAmountsIn/getAmountsOut?

In V2, you could call the router contract with getAmountsIn or getAmountsOut, to see how much of a token you would get from swapping x amount of a token, or how many tokens you would have to swap to ...
Nicholas Young's user avatar
6 votes
4 answers
7k views

Uniswap addLiquidity function transaction revert

I try addLiquidity function but I result get transaction revert. I set deadline = block.timestamp and I use remix. Why transaction is revert? I found the problem line and specified it in code. I think ...
Erzo's user avatar
  • 353
5 votes
1 answer
5k views

@uniswap SDK -- how do I figure out the best route for a SWAP? How do do multihop with SDK?

I'm calling UNISWAP SDK to price a trade on pair like USDC, PAX and getting significantly worse results than the UX: const sourceToken = new Token(ChainId.MAINNET, source_token_address, ...
nxstock-trader's user avatar
5 votes
1 answer
4k views

Unary operator minus (-) cannot be applied to type uint256

While trying to compile the mulDiv function part of the uniswap-v3-core code base, I got the following error: Unary operator - cannot be applied to type uint256 This is the line that causes the ...
Paul Razvan Berg's user avatar
5 votes
1 answer
2k views

How does Uniswap v3's logarithm library (TickMath.sol) work?

I want to calculate logarithm of a non-standard base at low gas cost. First thought is to use change of base rule with log2() fixed point methods mentioned in this thread. However Uniswap v3 core has ...
secretshardul's user avatar
4 votes
1 answer
501 views

Is possible to transfer data between nodes using cpp-ethereum's whisper protocol?

Right now I am working on developing a standalone application in C++ using libraries of cpp-ethereum, I was looking at the source code for cpp-ethereum and an idea stuck into my mind that wouldn't it ...
Shirish Patel's user avatar