How can we burn certain percent of token each year? Or in an interval of a time?

Hi, I am new to solidity. I created a contract which will do the following during transaction:
4% send to one contract
1% send to liquidity pool
4% distributed to holder
5% burn

  1. I want my token to be burned , for example 5% burn from total supply each year.
    How can I implement this function?

  2. And another function I want to develop is :
    Mint only 80% token during token creation and mint rest 20% token during some special conditions(for example mint and reward to player after they achieve some level)

1 Like

Hey @madlab
take in mind contracts need an interaction to trigger any line of code.
This means that if you don't have any interaction for a long period, the timeschedule could not be respected.
You could use a script that is always running instead.

I see that you have reflection, so I assume that you want a normal burn (send tokens to burn address) without changing the total supply. If this is the case you can simply use the logic used in the 5% burn fee and add it in a separated function. Then using timestamp you can always check the current time and , in case a year is passed, you trigger this new function and burn tokens.
I suggest to add this check in the transfer function due to is the most triggered function in a token contract.

Thank you for the support. Do you have idea for second question?

It is more complex, not easy to explain with words
Also I suggest to avoid reflection + mint