How to fix this issue

What is the error from that?

It says compiler error, stack too deep

What is the difference between that div(100) and that / 100 syntax?

what version of solidity are you using?

you could try using structs and arrays to reduce the stack, i personally seen this error when trying to input too many function parameters.

have you tried doing what the compiler suggested?

I am using this version of solidity Version 0.8.17

why are you using safe math?

I thought it’s necessary to use it ? Or is it not?

I haven’t tried using struct

no, you dont need it in solidity 8+

it has it built in, so you double safe mathing, if that makes sense

I am still learning solidity on my free time. Any help to fix that?

Oh okay, that’s a great one then, I am still learning

I really need a tutor :joy: don’t know if you are chance to do that for me

you can try removing the unnecessary stuff, cleaning it up, and reducing the stack.

and/or

try what the compiler suggest

unless anyone else has any more suggestions

1 Like

I’m really active on the discord smart contract help section.

My screen is kinda broken on my laptop and is flickering atm,

I still try to help out when i can

1 Like

you dont need this section in the beginning of the function,

uint256 RewardsFee;
uint256 deadFees;
uint256 marketingFees;
uint256 liquidityFee;
uint256 devFees;
uint256 CharityFees;

you can declare the type when you give the variable a value.

1 Like

Thanks for the great review I love that

try not to save unnecessary variables in the stack, or unnecessary variables in general,

reuse what you can

like this:

 RewardsFee = sellRewardsFee;
            deadFees = sellDeadFees;
            marketingFees = sellMarketingFees;
            liquidityFee = sellLiquidityFee;
            devFees = sellDevFee;
            CharityFees = sellCharityFees;

whats the point of resaving these global variables locally?

1 Like

Hello my friend thanks for the help, it works now
Also i have some problem with connecting my wallet to metamask and trustwallet

Whats the issue or error message?