How can I vary the amount of ETH/BNB needed to send the same amount of Token as the days change?

Hello guys.

I would like to create a smart contract where whoever sends currency receives X tokens in exchange.
My idea is that the smart contract must always send a fixed amount of tokens, but the amount of BNB/ETH needed to receive the tokens must be proportionate to the day of the month.

Example :
Day 1 = send 30 eth you get 30 tokens
Day 2 = send 29 eth you get 30 tokens
Day 3 = send 28 eth you get 30 tokens
Day 4 = send 27 eth you get 30 tokens

How can I vary the amount of ETH/BNB needed to send the same amount of Token as the days change?

Hi, welcome! :wave:

I think you can set a start time as the DAY 1, so later, if (time - start time) / 24 hours = 3, this means has passed three days, so it is DAY 4, snd it needs 30 - 3 = 27 eth

1 Like