Smart contract Roadblock - price increase trigger tax

Hi,

We’re designing a smart contract but struggling with a particular prompt.

What we need is the following -

A parameter of [price increase by 20% in 24 hr time-interval] which will trigger a buying tax rate of 35% rather than the normal 10 percent it is at.

The 24 hour interval is important.

How would you code such a function?

Im not a coding expert but my partner is but we need help to figure out the commands to put this into the contract.

If you could please help, you’d be a life saver!
Thank you.

Hi @Poi

The only reference for time in a solidity code can be read using the block number. So you can hard an future block number and use it for time comparison.

Example: On ETH chain new block appears appears after every 12 seconds. So you can calculate a run estimate of a future block number using this. Then hard code it in contract for comparison.