Skip to main content

Questions tagged [swaps]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
1 answer
44 views

How to make my own wrapped token for native token like WETH, WMATIC?

I want to make my own WMATIC in amoy testnet for marketplace trade. In more details, I want to suggest with WMATIC in marketplace our team had made. I know how to deploy ERC20 name WMATIC, and I want ...
rrrrssss's user avatar
0 votes
1 answer
13 views

`safeTransferFrom` fails although the contract has enough allowance

I'm creating a contract that calls to another contract to perform a swap. Here is the code for the function that does the work: function swap( IERC20 baseToken, IERC20 quoteToken, ...
Margaret Nguyen's user avatar
0 votes
1 answer
25 views

transaction reverted when calling swapExactETHForToken on uniswapRouter02

currently, I'm trying to swap eth for an erc20 token and the transaction gets reverted every time, not quite sure what I'm missing, i pre-approved some allowance for the router02 to spend on my behalf,...
yahdielo's user avatar
0 votes
1 answer
44 views

Transaction execution reverted on swapExactTokensForETH

I hope somebody can help I am trying to sell a token via Uniswap V2 Router02 (Token CA: 0x4ed4E862860beD51a9570b96d89aF5E1B0Efefed) (This token is a legit one, there is no scam here), I have ...
duyanhhz's user avatar
1 vote
0 answers
25 views

How to foundry test a function which uses 1Inch Swapping functionality?

I'm working on a protocol's Adapter contract. The Adapter contract have a function, which let users sell their PortalEnergy (assume tokens) to get ETH. They use 1Inch Swapping functionality to get ...
DevABDee's user avatar
  • 473
0 votes
1 answer
43 views

Large price discrepancy between swapExactTokensForTokens and official swap

I am testing performing swaps using solidity ^0.8.24 smart contracts with hardhat on Polygon and Quickswap exchange. But I am getting relatively large price discrepancies between my swap and one ...
SolTester's user avatar
0 votes
0 answers
35 views

Fail to swap USDT to WETH in curve pool

I want to swap my USDT to WETH in curve pool: [USDT, wBTC, WETH]. // SPDX-License-Identifier: UNLICENSED pragma solidity =0.8.10; import "forge-std/Test.sol"; contract ContractTest is Test ...
LEVI_104's user avatar
1 vote
0 answers
35 views

Optimism Swap problem in Web3.py

Error in code when trying to swap from Optimism to usdt or usdc via Web3.py library I have code that swap successfully to Arbitrum, Polygon but error in Optimism. I am using MetaAggregationRouterV2 ...
patifon's user avatar
  • 11
0 votes
1 answer
116 views

What has happened to these ETH swaps in Trust Wallet?

A friend of mine was trying to swap USDT to ETH in Trust Wallet. First he swapped 150 USDT, which was subtracted from his USDT balance, but no ETH was added. Second time, we tried to swap only 1 USDT ...
asmani's user avatar
  • 103
0 votes
1 answer
21 views

Forking Swap from bsc on goerli, max input of native token 0

I'm trying to fork cheeseswap from bsc onto goerli. I've also tried to fork another swap from another network onto goerli and have the same issue. I Change all the chainid numbers, rpcs, factory, ...
Bobo From Florida's user avatar
0 votes
0 answers
23 views

What are the correct units and parameters for generating swap calldata using the 1inch API?

I using the 1inch API to build a dex and am struggling to execute a swap correctly. I believe the problem may have to due with when to use WEI and when to use the actual number of tokens I am desiring ...
user23470409's user avatar
0 votes
0 answers
27 views

Can anyone figure out how this guy does arbitrage?

The owner of this tx record is constantly arbitraging for small amounts. It does these directly via pair. So it's not using a router. In my own testing I have always found that the amount of output is ...
Jack Suelman's user avatar
1 vote
1 answer
42 views

I'm having trouble sending token1 to a pair address and receiving token0

I am trying to make a swap directly via the pair address without a router. I'm trying to get token0 by sending token1. The amount of token0 I will receive does not matter, but when I run the node.js ...
Jack Suelman's user avatar
0 votes
0 answers
58 views

1 inch has Solidity interfaces for smart contract interactions?

As of my last knowledge 1inch provides a set of APIs for interacting with its services, but it may not have a direct Solidity interface for smart contract interactions. Instead, developers typically ...
user103592's user avatar
0 votes
1 answer
151 views

Trouble making UniV2 swap on Sepolia with web3py

I'm using the below code to try and make a swap on Sepolia. I've got ETH in my wallet and have found a token that has had liquidity added. Depending what I set the minOutput to I get 'Fail with error '...
stooks's user avatar
  • 11
1 vote
0 answers
29 views

Is NFT swap possible on cross chains?

I have done a bit of research on this, and I have found only the same chain NFT swap but I want to know the different chain swapping b/w two users, Please provide some links or guidance to achieve NFT ...
Vinit_2311's user avatar
0 votes
0 answers
150 views

How to swap tonkens in pancakeSwap using nodeJS

I need to write a script to swap tokens in PancakeSwap using NodeJS. I'm new to web3 development, so maybe I'm misunderstanding some of what I'm seeing in the various docs. I know PancakeSwap doesn't ...
Oleh's user avatar
  • 1
0 votes
0 answers
74 views

Uniswap V3 SwapMath.computeSwapStep doesn't give same results as quoterContract.callStatic.quoteExactInputSingle

When I use the @uniswap/v3-sdk SwapMath.computeSwapStep I get a different result from quoterContract.callStatic.quoteExactInputSingle.. it's also off from the result I get from the UI at https://app....
Julia Burlingham's user avatar
0 votes
1 answer
3k views

Uniswap - swap between Sepolia and my own erc-20 token

I am working on a React-Native crypto application for fun, and I am trying to swap my Sepolia native token with my erc-20 token that I recently deployed on remix ide on the sepolia network using ...
Scott's user avatar
  • 15
2 votes
0 answers
27 views

Uniswap/PancakeSwap automatically manage tokens with different amount of decimals (swap)?

I'm getting number results that do not make sense for me, when executing swap functions with USDT (in Uniswap V2 and PancakeSwap V2), and I noticed that USDT Token has only 6 decimals, instead of 18 (...
Alexander Herranz's user avatar
1 vote
1 answer
382 views

Old ERC-20 TRX Tokens Swap Issue

I tried the instructions given here to swap my old (pre-2018 swap) TRX tokens based on the Ethereum network to the MainNet ones. I sent the tokens to the smart contract address mentioned in the ...
Ali's user avatar
  • 11
0 votes
0 answers
30 views

Uniswap V3 contract: how to detect source and destination coin

I am working to an information parser and stuck with Uniswap V3 smart contract behaviour. first case: Swap 2,093,700 WPLS For 0.1129 ETH https://etherscan.io/tx/...
Oleg Saushkin OcMaRUS's user avatar
0 votes
1 answer
14 views

BPT value underlying

In Balancer, and the type of pools that work with yield tokens like Stable WETH-rETH, when getRate() gets called for the value of BPT, which output is in WETH,... ...does that BPT's value comes with ...
dNyrM's user avatar
  • 928
0 votes
1 answer
100 views

minAmountOut onchain

When I use, for example, the Uniswap front-end to do a swap and I select my desired slippage, where is Uniswap calculating the minAmountOut variable that goes into the swap and takes into account this ...
dNyrM's user avatar
  • 928
0 votes
2 answers
190 views

Batch Token Swap using 0x

I'm trying to make a telegram bot that sells all the tokens available on a wallet using Ox API. In order to automate the process with only command, I'm okay with adding the private key to the script. ...
Liju Thomas's user avatar
0 votes
1 answer
207 views

Custom V3 router (Is it a Universal router)

I came accross a concept i have no idea about. The concept of custom router. As per my research may be Uniswap V3 is offering Universal router. Is it possible to deploy instance of universal router as ...
Malik Mehmood's user avatar
1 vote
1 answer
244 views

Using web3.py to filter previous transactions by swap, returns empty array

I am using the web3 python package to filter transactions using the transfer function. The issue is no matter what I try to do, w3.filter.get_all_entries() returns an empty array. Any ideas as to why ...
stooks's user avatar
  • 11
0 votes
0 answers
23 views

Facing ZIPPO_CONTEXT_INVALID error while fetching price or calling any other api on mumbai testnet

I am trying to call this endpoint on mumbai testnet using 0x protocol and getting the error . { "code": 100, "reason": "Validation Failed", "validationErrors": [...
ShisukeUrahara's user avatar
1 vote
0 answers
105 views

Reverted when adding another logic in Uniswap swap functions

I have been learning how to use Uniswap V2 recently and am trying to add logic on top of the original code. I want to have a fee of 1% on each swap transaction using the input token. I was ...
rasyidred's user avatar
0 votes
0 answers
41 views

Why a Uniswap/PancakeSwap emits same event multiple times

does someone know why Uniswap/PancakeSwap pairs occasionally emit the same Swap event multiple times? There is it an example on dexscreener on WBNB/USDT: I happen to also catch it in my script that I ...
Melardev's user avatar
  • 101
1 vote
0 answers
29 views

What is the easiest way to swap any 2 tokens on Uniswap?

I would like to swap any 2 tokens, which could either have a UniswapV2 pool, UniswapV3 pool or that do not have a pool in common. From my understanding, I would need to find a route from token1 to ...
Nal Luksic's user avatar
  • 1,187
0 votes
1 answer
61 views

Pancakeswap swap fails with INSUFFICIENT_OUTPUT_AMOUNT error

I'm trying to make a swap on the Binance testnet using Pancakeswap. I keep getting an INSUFFICIENT_OUTPUT_AMOUNT error and I have no idea why. Here is my code: const ethers = require('ethers'); const ...
Sayaki's user avatar
  • 139
0 votes
1 answer
175 views

How to identify ERC 20 swaps using ehterscan API

Hi I would want to identify ERC 20 swaps for a certain ETH address using etherscan API. At their site method column shows if it's a swap. But the json of the response doesn't include a method field, ...
Javier M's user avatar
1 vote
0 answers
24 views

Uniswap: Why is there an intermediary when swapping?

I am trying to understand why sometimes when a wallet buys a token the Uniswap pool sends the token through an intermediary address before it gets sent to the buyer. Here's an example of such ...
Martin's user avatar
  • 11
1 vote
0 answers
81 views

Stargate swap error

I'm trying to swap calling stargate protocol function. But there is en undifined error when executing. Don't know where to find solution. Please help me chain_id = 111 rpc = 'https://arb1.arbitrum.io/...
MyakishevM's user avatar
0 votes
1 answer
1k views

How to calculate swap-price from a Uniswap v2 swap event when both amount0In and amount1In are set?

Consider the following swap event as listed here: amount0In :4003282810462813624841310246 amount1In :947647544007674247 amount0Out :729688943313804828976594873545 amount1Out :0 To calculate the swap ...
Geert-Jan's user avatar
  • 169
0 votes
0 answers
23 views

Unable to do swap via swapExactTokensForETHSupportingFeeOnTransferTokens

What seems to be the issue in this code I am unable to swap tried everything: function transferFrom(address sender, address recipient, uint256 amount) public { require(sender != address(0), ...
Hammas Ali's user avatar
0 votes
1 answer
140 views

Need help in flash loan arbitrage project

I am creating a flash loan arbitrage project, where i am using uniswap v3 for first swap, do i need to add code for adding liquidity too? I wrote code just for swap. I know without liquidity we can't ...
Hacek 's user avatar
  • 677
2 votes
2 answers
475 views

different Output Amount in uniswap v3 in impact factor calculation

I try to simulate uniswap v3 swapping, but when I calculate the amount of swapping,it is different with the real transaction transaction, my source is : https://uniswapv3book.com/docs/milestone_2/...
Payam Safaei's user avatar
1 vote
1 answer
106 views

0x swap api gas is doubled when adding feeRecipient and buyTokenPercentageFee

I would like to collect fees on trade using 0x API. But the gas in the quote response is doubled or more when adding feeRecipient and buyTokenPercentageFee which doubles the gas price users are paying....
mtx dev's user avatar
  • 11
1 vote
1 answer
24 views

Send token only if the first transaction was successful solidity (SWAP),

I'm learning how to do swaps with solidity and I have 2 questions: Should I verify the allowance of both wallets that will do the swap with the respective token? Also, should I verify the balance, or ...
Arturo Martinez's user avatar
1 vote
1 answer
1k views

Uniswap V2 Swap Directly Through Router Contract Not Working

I'm trying to make some swaps with Uniswap V2 pools, but I've run into some UI bugs using the Uniswap site (its a janky pair with a low volume token involved, the Metamask confirmation window never ...
thejoj's user avatar
  • 11
3 votes
2 answers
1k views

What exact rights I'm giving to Uniswap when accepting "Allow the Uniswap Protocol to use your XXX"

When trying for the first time to swap between 2 tokens with a given ETH wallet you get the message "Allow the Uniswap Protocol to use your XXX" (XXX is whatever token): Clicking in the (?) ...
Mariano Ruiz's user avatar
1 vote
1 answer
1k views

How to calculate "sqrtPriceLimitX96" in production?

I have the following code to swap tokenA with tokenB using the Uniswap V3 exactInputSingle function: // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/...
Mr.Snow's user avatar
  • 25
0 votes
0 answers
380 views

How to calculate Uniswap V3 single swap parameters in production smart contract?

I have the following code to swap tokenA with tokenB using the Uniswap V3 exactInputSingle function: // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/...
Mr.Snow's user avatar
  • 25
0 votes
1 answer
150 views

Transaction using SwapExactEthforTokens is being sandwiched by bots

I am using a smart contract to buy scam free token.But buy transaction is being sandwiched by some bot. In our swapexactethfortokens we are providing calculated AmountOutMin value so i think slippage ...
K Silmana's user avatar
0 votes
1 answer
1k views

Error: invalid BigNumber value (argument="value", value=undefined during a exactOutputSingle swap

I'm facing a problem who's driving me crazy I'm trying to create a swap with this code : my_tx = await routerV3.exactOutputSingle({ tokenIn: '0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6', ...
Tsar Buig's user avatar
0 votes
1 answer
239 views

How to use Metamask input data to swap

I want to use MetaMask swap function automatically with code, but MetaMask don't provide ABI, then I have to use contract input data information to write swap function code, but I don't know the ...
Jeff's user avatar
  • 1
0 votes
1 answer
467 views

"execution reverted: ERC20: call failed"

I try to call the swap function in X bridge but it is not working mysteriously. so contract X (which is the bridge) is calling a handler inside internally and the transfer method is happening there. I ...
Helia Marami's user avatar
1 vote
1 answer
100 views

How to handle two solidity events with asyncio python

Im trying to get every Swap event happens on Uniswap and Sushiswap using python and do stuff based on these Swaps i know how to do it but with one exchange, it means that only one event in time . from ...
noro meb's user avatar
  • 368