How to convert charityAmount to BNB?

Hi,

I’ve been trying to do coding on SafeMoon fork with charityWallet function. In this function, 5% of each transaction being sent out to the charity wallet as token, but I’d like them to be converted into BNB and sent out to the charity wallet afterwards.

Sample transaction:

“0x29e92c85689735234b0a3826527153cffaa63cec” is the charity wallet.

Contract:

i can help you check this

3 Likes

How does it work? Couldn’t understand.

It takes an amount of tokens and swap using swapandliquify function
then send to charity wallet