# How to fix transfer function to work on Pancakeswap

**URL:** <https://forum.openzeppelin.com/t/how-to-fix-transfer-function-to-work-on-pancakeswap/27844>\
**Category:** Smart Contracts\
**Created:** [April 21, 2022, 2:32pm UTC](https://forum.openzeppelin.com/t/how-to-fix-transfer-function-to-work-on-pancakeswap/27844 "2022-04-21T14:32:50Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![TheMoonAlliance](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/themoonalliance/32/9073_2.png) [@TheMoonAlliance](https://forum.openzeppelin.com/u/TheMoonAlliance)\
**Post date:** [April 21, 2022, 2:32pm UTC](https://forum.openzeppelin.com/t/how-to-fix-transfer-function-to-work-on-pancakeswap/27844/1 "2022-04-21T14:32:50Z")

</div>

I added in transfer function a max transaction size calculated as a 1.5% from the total supply and to make this to autoupdate when totalSupply will decrease after burning.

This function works on remix and wallet to wallet, but does not work on pancakeswap, what do I need to change to make it work there too, I can add tokens as liquidity from main wallet, I can buy with any wallet, but I can not sell back to pancakeswap from other wallets, only the founder wallet working for selling back to pancakeswap.

```auto
function _transfer(
        address sender,
        address recipient,
        uint256 amount
    ) internal virtual override {
        
        if (sender == communityWallet || recipient == communityWallet || feeState == State.nofees) {
            super._transfer(sender, recipient, amount);
        } else {
                require(amount <= (totalSupply() * 15)/1000, "You are exceeding max transaction limit");
                  
                   
                if(totalSupply()<= _minSupply) {
                    
                uint burnAmount = amount / 100;           
                _burn(sender, burnAmount);

                uint treasuryAmount = amount / 100 ;
                uint fTransfer = amount - (burnAmount + treasuryAmount);
                
                super._transfer(sender, communityWallet, treasuryAmount);
                super._transfer(sender, recipient, fTransfer);

                } else {
                uint burnAmount = amount * burnFee/100;           
                _burn(sender, burnAmount);

                uint treasuryAmount = amount * operationFee/100 ;
                uint fTransfer = amount - (burnAmount + treasuryAmount);
                super._transfer(sender, communityWallet, treasuryAmount);
                super._transfer(sender, recipient, fTransfer);

                }
            

            }

     }   

```

Thanks for anybody who has time to help me with this !

---

<div class="post-metadata">

**Author:** ![Team\_X](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/team_x/32/10471_2.png) [@Team\_X](https://forum.openzeppelin.com/u/Team_X)\
**Post date:** [April 21, 2022, 2:40pm UTC](https://forum.openzeppelin.com/t/how-to-fix-transfer-function-to-work-on-pancakeswap/27844/2 "2022-04-21T14:40:05Z")

</div>

you can't devide 15 / 1000 because solidity does not allow any decimals
