SafeMoon fork problems with LP

Hello everyone,

First of all I’d like to thank you for providing this opportunity. Maybe there’s someone who will help me, and it wouldn’t be possible without this platform!

I’ve merged various forks from popular contracts, most notably SafeMoon, and launched my token through DXSale.

The Token has 4 basic functions: On every transaction, 5% is burnt, 5% is redistributed, and 5% is added to LP. Additionally, the maximum transaction is capped at 5000 Tokens (0.5% of supply)

There is an issue with the 5% going to the PancakeSwap LP, it’s not working for some reason, and I’m not sure why.

:computer: Environment

I followed DXSale’s guide on how to launch SafeMoon forks on their platform, which is this:

If you are yet another copy of SafeMoon please ensure that you do the following to finalize:

  1. setLiquidityFeePercent to 0
  2. setMaxTxPercent to 100
  3. setSwapAndLiquifyEnabled false
  4. setTaxFeePercent 0
  5. Learn to read and understand your own code
  6. Test your code on the test networks provided
  7. Call finalize
  8. setSwapAndLiquifyEnabled true
  9. setLiquidityFeePercent (To your lp tax fee amount)
  10. setTaxFeePercent (To your reflect fee amount)

The launch was successful (the 2nd time around) but I had to disable setSwapAndLiquifyEnabled. This means the 5% to LP is not activated.

I don’t have all the exact same functions but they are equivalent in what they do, simple variables changing the fee’s values, or the max transaction limit. The one that I do have in common is setSwapAndLiquifyEnabled, which also just changes a boolean from true to false. The part of the code that is relevant to the LP is an exact match with many other popular contracts.

The problem I’m facing is that as soon as setSwapAndLiquifyEnabled is set to true, no one can sell their tokens anymore.

PanCakeSwap error: The transaction cannot succeed due to error: TransferHelper: TRANSFER_FROM_FAILED. This is probably an issue with one of the tokens you are swapping.

I presume this is because of an error in the code, but I can’t understand how there’s an error if it’s exactly the same portion of code as other popular tokens, and as such, I believe it’s execution related.

You can see all the current variable values here

:1234: Code to reproduce

Any help is welcome. Thank you so much. :heart:

1 Like

Hey, welcome!


It seems like you created a deflationary token (burn a percentage on transfer), just like abcoathup mentioned before:

this can cause issues with use in other contracts such as:

Also I recommend looking at Points to consider when creating a fungible token (ERC20, ERC777)

A little complex to find out why it does not work.

1 Like

While I can’t say for certainty, when I did a diff on your code and safemoon it looks like you are excluding your custom dead address. This might mess something up in the RFI if/else logic in the _tokenTrasfer function.

I would do some testing and debug down starting from your _transfer function, which is where the swapAndLiquifyEnabled boolean is used. Use the hardhat testing, it makes it easy to trace where things go wrong using console.log.

Hope this can help or get you on the right track.


So, did you find any solution for setSwapAndLiquifyEnabled ?

did you initialize the liquidity pool of your token to BNB?

Problems is that you can`t see the reserves in LP. How can I fix this ?
TotalSupply (in Pancake LP) is 0

Hi there, I’m taking a look at your problem now, in the future please create new threads. Do not reply to old ones.

This is your contract, and for whatever reason you can no longer do swaps.

So you need to find your LP Pair and figure out what’s going on with that.

When I go to your LP Token Page, it looks like something is wrong

No balances are shown, it’s as if you didn’t create the initial liquidity.

Can you show me an event or a transaction where you created your LP tokens?

You must create liquidity before you can do swaps.

I made a guide for it over here. Can't add liquidity on PancakeSwap with burnable ERC20 token - #8 by LSparkzwz

(How did you found our contract?)
I don’t know how is possible but someone remove our liquidity today.

The liquidity was here: