pancakeswap / pancake-swap-interface-v1

:pancakes: Pancake trading interface V1
https://exchange.pancakeswap.finance
GNU General Public License v3.0
314 stars 951 forks source link

Error gas required exceeds allowance (30000000) or always failing transaction #73

Closed jjuniorc closed 3 years ago

jjuniorc commented 3 years ago

Bug Description My complete copy of Pancake Swap failed to create a new liquidity pool for any pair. It returns "gas required exceeds allowance (30000000) or always failing transaction".

Steps to Reproduce I made a full copy of Pancake environment, creating new Factory, Router and WBNB (for WETH parameter). So I made a clone of the interface project to adapt the contract addresses in the interface and in the sdk source. When I tried to create a new liquidity pool, it was necessary to approve the coin, but it was not possible to Create and Supply. At F12 (Developer Tools) has an error. It seems to occur at estimate function.

Expected Behavior I hope you guys could share some possible solutions to solve this problem.

Additional Context An additional info, I changed many part of the code /node_modules/@pancakeswap-libs/sdk to change Factory and Router addresses.

Selection_590

It seems to occur on estimate function: Selection_592

jjuniorc commented 3 years ago

I found the solution. I created the router contract without the correct INIT CODE HASH that comes from the Factory result. After reassembling the contract using it, everything works.

pkdcryptos commented 3 years ago

I found the solution. I created the router contract without the correct INIT CODE HASH that comes from the Factory result. After reassembling the contract using it, everything works.

Hi, can you please suggest what changes to do in the code ? Do we have to create router contract ourself and replace the default one in src/constants/index.ts : export const ROUTER_ADDRESS = '0x05fF2B0DB69458A0750badebc4f9e13aDd608C7F'

Apprciate your help. thanks

web3abhi commented 3 years ago

Hi, can you please suggest what changes to do in the code ? Do we have to create router contract ourself and replace the default one in src/constants/index.ts : export const ROUTER_ADDRESS = '0x05fF2B0DB69458A0750badebc4f9e13aDd608C7F'

You need to redeploy the router, when we deploy the factory it gives us an init code, you replace that in router contract and redeploy.

LesDrones commented 3 years ago

Hi, i'm having the same issue as a regular pancakeswap.finance user, i have bnb and eth on binance smartchain wallet.

Wallet doesnt open to approve swap

This is the only topic that talk about this problem on the web -.-

ronnyroeller commented 3 years ago

Same here. Swapping on pancakeswap.finance itself fails every time with (with BNB in wallet): image

tronics commented 3 years ago

Guys, I am stuck in this with being unable to remove MCBASE-CAKE CAKE-LP. Same problem cannot confirm and same error message. This is for days and no problem with other pairs.

Can I send a correct request to get this done maybe on the chrome developer console?

Thank you.

yehia67 commented 3 years ago

Guys, I am stuck in this with being unable to remove MCBASE-CAKE CAKE-LP. Same problem cannot confirm and same error message. This is for days and no problem with other pairs.

Can I send a correct request to get this done maybe on the chrome developer console?

Thank you.

Same here I am trying to add a Liquidity pool with BNB and BUSD. I applied @jjuniorc solution but still got the same error.

zikyfranky commented 3 years ago

I found the solution. I created the router contract without the correct INIT CODE HASH that comes from the Factory result. After reassembling the contract using it, everything works.

Thanks a lot, still feeling stupid for forgetting about this.

ThiruDevel commented 3 years ago

Hi, I have created a factory contract, get the init code hash from the factory, paste into the router contract, and deployed it. But when I swap the BNB to token always I am getting "Unexpected issue with estimating the gas. Please try again". What mistake did I make? Screen Shot 2021-04-03 at 8 22 26 PM

zikyfranky commented 3 years ago

Hi, I have created a factory contract, get the init code hash from the factory, paste into the router contract, and deployed it. But when I swap the BNB to token always I am getting "Unexpected issue with estimating the gas. Please try again". What mistake did I make? Screen Shot 2021-04-03 at 8 22 26 PM

Make sure you update the addresses(FACTORY and ROUTER) to YOUR OWN contracts.

jacobabiola commented 3 years ago

i am getting the same error even after adding the INIT_CODE_HASH before deploying the router contract. It fails after first attempt at creating a liquidity pool

sorrentinopasquale commented 3 years ago

Hi Guys, I have the same issue. Our token is stuck, it is only possible to trade with small amounts. If we increase the amount of tokens we get this error: "gas required exceeds allowance (41335035) or always failing transaction".

Trading is stuck, liquidity is stuck, remove liquidity is stuck. All of them working for small transactions like 0.10 $.

LukaASoban commented 3 years ago

Sorrento I also have this same issue. Was it due to deploying the router? I don't understand as it was working fine before and now it's not. Only small amounts could be sold as well till it stopped working completely.