Timed minting

Hi. Any ideas on how to create an automated/timed minting.
For example Mint a certain amount of tokens every month or year?

Decentralized

The decentralized version of it could it be an open-to-anybody function that grants a reward to whoever calls it. This function should check that at least N seconds/days have elapsed.
The reward is to give an incentive to call the function (otherwise they’ll be losing due to paying gas). An intermediate solution si to have the call give no reward and have an Autotask calling it, just like below.

Centralized

If centralization serves your needs (many times does!) I’m writing a blog post about it. Short version with Defender is to:

  1. grant minting privileges to a Relay
  2. create an Autotask that runs on the schedule you define
  3. the autotask calls mint in your token contract

I was thinking on creating a timed minting function into the contract. Here is a example i found:

function checkInflation() returns (bool success)
{
if(year >= 5) {
return false;
}
else if (now >= deploymentTime + 31557600) { //31557600 seconds per year
uint256 supplyIncrease = (supply*25) / 100;
mintToken(0x8E73AEF2448068d4e31F86Aa08279465339fF601, supplyIncrease);
year+=1; // increase the current year count
supply += supplyIncrease; // increase supply count
deploymentTime += 31557600; // increase the time since deployment
return true;
}
else {
return false;
}
}

Could this work?