Add functions "Swapandliquifiy" to smart contract

Hello all and thanks for all helpful contribution to this forum.
I’m working to a version of smart contract that will run on BSC: i’m basically working with two different contracts, that i’ve successfully forked and both works well.
One contract have reflection and burn functions where a % tax that will be split in two: a % of total tax is burned every TX reducing supply, the other % of total tax is redistributed to holders.
The other contract doesn’t have burn and redistribute functions but have the “swapandliquify” function, and i would like to add this function to my version of smart contract.
Can i simply copy and paste the desired function on my version of smart contract? I think the answer is no :smiley: at least not without some tweakings…
There’s anyone that can point me on the right direction on how to add this function or is willing to provide some help?
Thanks for any reply and support!

1 Like

paste your contract here let me take a look

https://docs.soliditylang.org/en/v0.8.4/resources.html

2 Likes

Hi, welcome! :wave:

Sorry, I am not familiar with the BSC-Chain, maybe you should ask for help in their forum: Home | Binance Chain Forum

I think function1 can work well in the contractA, and function2 can work well in the contractB, but when you try to combine these two functions in a new contractC, the situation becomes a little complex, cause in this case, these two functions may generate some magic result, so you need to test to find more.

2 Likes

Yes, in fact i didn’t even tried to add the “Function 2” in the “Contract A” because i suspected it could not have worked that way.

I will add both contracts on Github and repost it here, that way let’s see if someone could directly contribute to merging both with a PR.
Thanks

I’ve deployed the contract on BSC testnet and here’s the Github

basically what i would like to do is:

  • add another LP tax
  • add the function “Swap and liquifiy” that sell half of the LP from the previous tax and add to liquidity the remaining half plus the BNB earned from the sale.

There’s a token that i used that have this function, also if manually (and would be fine for me to call the function manually):

You think is possible to add that S&L function to the reflective contract?
Thanks anyone for reply