Questions tagged [pancakeswap]

PancakeSwap is a Binance Smart Chain-based DEX launched by anonymous devs with a penchant for breakfast foods and rabbits. It looks a bit like Ethereum's SushiSwap (community governance, the ability to farm liquidity provider tokens), but also incorporates many other features that let you earn rewards.

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

swapExactTokensForTokens estimateGas fails with execution reverted

I'm trying to swap a pair not having wbnb on pancakeswap. For ex. BUSD -> LUNA. As far as the pair doesn't have wbnb I use swapExactTokensForTokens (meanwhile WBNB -> BUSD with ...
user avatar
0 votes
1 answer
9 views

Pancakeswap multihop how is it implemented

On Pancakeswap it uses multihop functionality when swapping a pair with no direct swap path. The v2 router does not support multihop and was wondering how PCS has this implemented? As an example on ...
user avatar
  • 101
0 votes
0 answers
6 views

Error when calling factory.methods.getPair with PancakePair (BSC)

After doublechecking all addresses over and over; I'm still running into this error trying to instantiate a contract for CELT_USDT: Error: Returned values aren't valid, did it run Out of Gas? You ...
user avatar
  • 1
0 votes
1 answer
22 views

Getting coin prices from pancakeswap using different LP's (BUSD, USDT)

Trying to obtain coin prices on the BSC with pancakefactory2 using other LPs besides BNB(BUSD, USDT). Right now this is my code and the prices its getting is off by 5-15%. Any ideas on whats wrong? ...
user avatar
0 votes
0 answers
47 views

Error: Transaction reverted: function returned an unexpected amount of data, Pancakeswap

I really need your guy's help as I'm stuck in this for a week. Actually, I'm implementing a swap function on pancakeswap, I'm following this documentation. I'm doing swapEthForExactTokens but getting ...
user avatar
0 votes
0 answers
35 views

Pancakeswap Flashswap contract failing

I am new to Solidity and wanted to create a smart contract that that does a flash swap on Pancakeswap (BSC) and then arbitrages a pool that is based on Balancer V2. When executing I get the following ...
user avatar
  • 101
-1 votes
0 answers
31 views

Instantly swap from token a to token b and viceversa

I've been working for a while on a project about DEFIs. What I'm trying to achieve is something similar to this here: https://bscscan.com/txs?a=0x4668c096bac44a50fe3490974bef9d854e6f26a1&p=1949 As ...
user avatar
0 votes
2 answers
16 views

Liquidity locking and ETH loose

When you provide liquidity to a liquidity pool, you add 2 different tokens and you get LP Token (liquidity pool tokens). You can recover your 2 tokens amount when you give back your LP Tokens, ...
user avatar
  • 574
0 votes
1 answer
32 views

Solidity function can't sell with slippage on Pancakeswap

I have a simple swap function in Solidity which can set custom slippage for the token amount. My problem is it doesn't work with tokens which has sell taxes. For instance, if a token has a 5% percent ...
user avatar
  • 63
0 votes
0 answers
20 views

Implementing custom taxes on pancake swap

I wanted to implement a custom tax for pancake swap. currently, iam using pancake swap testnet ones. iam stucking at these points. how to add custom tax for on swapping or at time of creating ...
user avatar
0 votes
1 answer
86 views

Add Liquidity failed: Internal JSON-RPC error

I am trying to add liquidity to pancake swap and keep getting the following error: Add Liquidity failed: Internal JSON-RPC error. Has anyone experienced this before, and if so can you help? We are ...
user avatar
0 votes
0 answers
38 views

Failed to sell tokens (probably scam but want to make sure)

I was writing a bot to monitor new liquidity pools that open up in pancakeswap and to test it I took already 4 of them and bought it. all of them I couldn't sell, not via code and also not manually. ...
user avatar
0 votes
0 answers
54 views

How to test out the flash loan arbitrage smart contract on BSC network?

I am in learning flash loan from PancakeSwap, I would like to know what is the better way to test out my flash loan arbitrage smart contract before deploying to BSC mainnet? If I enter all real world ...
user avatar
  • 1
0 votes
1 answer
92 views

Having trouble adding liquidity - JSON RPC Error

I've been having this error over and over again when trying to get liquidity into my token on Pancakeswap. I've reviewed everything and looks fine to me. Can any of you take a look and guide me on the ...
user avatar
0 votes
0 answers
20 views

BSC bot stops buying tokens after some time

I made a mostly profitable bot using node.js buying and selling shitcoins on BSC. However, sometimes the bot just stops buying. I use web3 to find relevant mined transactions (this part always works) ...
user avatar
  • 1
0 votes
0 answers
15 views

Can anyone explain the backend techinical logic of latest pancake limit swap mode?

Pancake has released a new 'limit swap' mode which is highly similar to cex in user experience: https://docs.pancakeswap.finance/products/pancakeswap-exchange/limit-orders/limit-orders-faq As I ...
user avatar
  • 1
0 votes
0 answers
42 views

What is swapTokensAtAmount do in Pancakeswap based token?

I was studying the tokens who are using pancakeswap methodology like Safemoon, Brise etc.They have this variable swapTokensAtAmount which I don't know what does it deal with.I couldn't able to find ...
user avatar
  • 1
0 votes
1 answer
21 views

WETH on Uniswap forks on other chains

I was wondering what WETH() does on Uniswap forks on other chains, for example if I want to create a liquidity pair on Pancakeswap it might be something like this: address lpPair = IPancakeFactory(...
user avatar
  • 1
0 votes
1 answer
32 views

How to differentiate between AddLiquidity and SwapEthForExactTokens on contract function execution?

We are trying to process a fee when tokens are "Sold" on PancakeSwap. For now "Sold" is when the user swaps their tokens for BNB. Initially our current logic would also charge a ...
user avatar
1 vote
1 answer
32 views

Why does the price of a crypto currency change while swapping on a dex?

I have been looking for an answer to this question for a while but haven't found a reasonable explanation yet. While attempting to swap ETH for USDT on quickswap , I noticed that I would need 3496.1 ...
user avatar
0 votes
0 answers
60 views

how to buy/sell bsc tokens on pancakeswap from a solidity smart contract?

I just start to learn solidity and I've finished a couple courses and I want some help to create my first working smart contract. The smart contract I want to build will buy and sell tokens on the ...
user avatar
0 votes
0 answers
37 views

How to know the current liquidity of a token in BNB using web3py

How can I know the current liquidity pool value in BNB, My idea to do this is get the total amount of tokens available in the pancakeswap reserve and then equate that amount to BNB. Any help to ...
user avatar
0 votes
0 answers
10 views

Latest Subgraph query

How to get the latest subgraph of pancakeswap ? I have tried with the below link but it is not working fine go to this link
user avatar
0 votes
0 answers
20 views

Get path for swapExactTokensForETHSupportingFeeOnTransferTokens sell transaction

When calling the swapExactTokensForETHSupportingFeeOnTransferTokens function of the PCS V2 router contract you have to give it a list of values for the path. But when I try to sell certain BEP20 ...
user avatar
0 votes
1 answer
60 views

How to buy specific amount of a token

I wrote a script that buys with the specified amount of BNB, but now I want to buy with the specific amount of the token I wish to buy. Here is my code def Buy(): #tokenAddress =input("\n ...
user avatar
0 votes
1 answer
62 views

How can I calculate gas fee when swapping tokens?

This is my code. const amountIn = ethers.utils.parseUnits('0.1', 'ether'); //ether is the measurement, not the coin const amounts = await router.getAmountsOut(amountIn, [buyToken, sellToken]); const ...
user avatar
1 vote
0 answers
93 views

How to use Vyper to call PancakeSwap contract

I'm writing a Vyper contract to call the swapExactTokensForTokens function of PancakeSwap, but when I try to deploy, I find it doesn't work. I don't know what happened. I really need help. This is my ...
user avatar
  • 11
0 votes
1 answer
112 views

Quickswap transaction always reverts when using swapExactTokensForTokens

pragma solidity 0.7.5; import "@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol"; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; contract Swap { ...
user avatar
0 votes
0 answers
142 views

How to modify my sniper bot (or front-run bot) to bring the profit?

The sniper bot will scan the mempool and find addliquidity method and then buy the token. The sniper bot can work but it always loss money because the following reason: Maybe the token have the very ...
user avatar
0 votes
1 answer
198 views

getAmountsIn - Error: Returned error: execution reverted: ds-math-sub-underflow

I am new to Ethereum and Solidity and have recently faced the following issue which I cannot understand. I am trying to use the UniswapV2 router in order to calculate the exchange rates between tokens....
user avatar
  • 3
0 votes
0 answers
196 views

Buying specific token on Binance testnet using python

I have written a script that works fine on bsc main network but when I am trying to buy the same on the testnet I get an error of transaction underpriced. from web3 import Web3 snipeBNBAmount = 0....
user avatar
0 votes
0 answers
135 views

How is this contract simulating write functions of another contract and getting new state values on the mainnet?

Contract: 0xdEdf20172b6dC39817026c125f52d4fad8E0f29b ABI: https://raw.githubusercontent.com/Trading-Tiger/Pancakeswap_BSC_Sniper_Bot/main/abis/BSC_Swapper.json Sample code: (https://github.com/Trading-...
user avatar
  • 213
1 vote
1 answer
199 views

Token amount calculation to set slippage for Pancakeswap tx

I have a simple code to calculates the needed token amount for the cases when I buy a token with 5% slippage. I just simply check how many tokens could I receive for the current price, get its 95% and ...
user avatar
  • 63
0 votes
0 answers
24 views

How to use removeLiquidity / removeLiquidityETH

I am unable to withdraw liquidity from the PancakeSwap frontend on BSC. I was testing this contract and it does not give me any reason for why would it fail Just says this. I need to try ...
user avatar
  • 1
0 votes
0 answers
31 views

How to get Buys and sells of a token on a Dex

Im trying to rebuild a simple app that gives me the latest buys or sells of a token on pancakeswap. Im using this code here and it kind of works: def handle_event(event): print(Web3.toJSON(...
user avatar
0 votes
0 answers
94 views

Call "uniswapV2Router.swapExactTokensForETH" inside "swapExactETHForTokens" result in "Pancake: TRANSFER_FAILED"

I deployed my token in Bsc Testnet. When I create a pool I have no errors, however, when i try to buy some token with Bnb, I got the following pic: The simplified token code below: function ...
user avatar
  • 1
0 votes
1 answer
97 views

Safemoon: why the condition from != uniswapV2Pair before swapAndLiquify

I'm playing with Safemoon (https://github.com/safemoonprotocol/Safemoon.sol/blob/main/Safemoon.sol) I cannot explain why the from != uniswapV2Pair condition before swapAndLiquify(contractTokenBalance)....
user avatar
  • 1
0 votes
0 answers
88 views

PancackeswapV2Router swapExactETHForTokensSupportingFeeOnTransferTokens: 'Pancake: TRANSFER_FAILED' when "from" equals to "pancackeSwapV2pair"

I have this simple contract: when the token are transferred from someone different from the owner, instead of making the transer, swap the reveiced tokens with Bnb. function _swapAsBnb(address from, ...
user avatar
  • 3
0 votes
0 answers
45 views

How to do Yield Farming in web3.js? (uniswap, sushiswap)

I'm trying to understand how to do Yield Farming in UniswapV3 SushiSwap. There's MasterChef(3) there which is used for Yield Farming, it's got function deposit(...), .add(), withdraw(...) among ...
user avatar
1 vote
1 answer
49 views

Must there be a "addLiquidityETH" txn for each token that is launched on PancakeSwap?

I'm trying to automatically detect when liquidity is added for a token. For that I scan through pending transactions. However, I've noticed that for some launches there seems to be no addLiquidityETH ...
user avatar
  • 11
0 votes
1 answer
96 views

Is there anyway of getting 100 test ethers in my metamask localhost wallet with Harhat?

last time, in truffle with ganache-cli, I fork the mainnet with the following command and tutorial... ganache-cli -f https://mainnet.infura.io/v3/my_infura_project_id -u ...
user avatar
0 votes
0 answers
69 views

Receiving "raise_solidity_error_on_revert" on BSC Testnet and PCS

I'm trying to test my sniper bot, therefore I want to run some operations on the bsc test net, interacting with pancakeswap. So, I first setup the correct addresses (at least in my opinion) from web3 ...
user avatar
  • 11
1 vote
1 answer
57 views

Pancakeswap trade fee - When is it taken ? (Liquidity pool don't show it)

I can't find how/when PancakeSwap take it 0.25% fee from trades, Nothing points to it taking any fees! What I tried: -Fetched my bnb balance. -Fetched Liquidity pool of a token. -Made a buy ...
user avatar
0 votes
0 answers
11 views

Total coins bought drop significantly after reaching my wallet

Please let me know if this is not the right place to ask this, just can't figure out at all what's going on here. Chain: BSC The coin in question : 0xaba5da7b9da3c62f5bc625e471305b43ad244f43 The issue:...
user avatar
1 vote
0 answers
21 views

Find biggest liquidity pool of token for swap on Pancakeswap

I am coding a bot can buy - sell token in Pancakeswap. I already found a way to do it. But problem is 1 token has many liquidity pool, and I don't know which is the biggest. Example: token Address: ...
user avatar
0 votes
1 answer
75 views

Erc20 staking but with variable reward rate [closed]

How would I go about implementing a staking contract similar to pancakeswap farms or synthetix staking rewards but with a reward rate which can be changed in the midst of staking duration? Where users ...
user avatar
0 votes
1 answer
30 views

Pancakeswap BNB Staking contract not pending balance on Polygon Mumbai

Im trying to port over Pancakeswap BNB Staking to Polygon. So Instead of BNB staking id like to support MATIC staking. I have WMATIC contract, reward token contract and BNB Staking from pancakeswap. ...
user avatar
1 vote
3 answers
241 views

calculates the CREATE2 address for a pair without making any external calls

I have the following code from the PancakeRouter code: function pairFor(address factory, address tokenA, address tokenB) internal pure returns (address pair) { (address token0, address token1) = ...
user avatar
  • 203
0 votes
0 answers
19 views

how to know how much amount of token to swap to to get certain price of token

how to know how much amount of token to swap to to get certain price of token in pancakeswap I want to how much token should I swap so that so that i get a certain price of token any calculation of ...
user avatar
0 votes
0 answers
20 views

I want to run Uniswap, Pancakeswap, Kyber nodes in my local machine

Instead of polling prices across multiple exchanges, I would like to run each of these nodes locally and fetch them in real time on a smaller machine like Rasberry Pi. I'm trying to find the best way ...
user avatar

1
2 3 4 5 6