Auto Renewal of Harvest Blocks

Harvest blocks for standard LavaCake forks have to be manually updated, which could potentially lead to human error, or just negligence by the developers, which would lead to catastrophic events like not being able to harvest. However, MagmaCake Finance has successfully managed to automate this process, and the best part about it is that it is done right in the MasterChef contract, which means anybody can go and verify that the code is safe! Here's how the standard LavaCake fork work. They have a variable called startBlockHarvest, which dictates when the harvest would be unlocked for farmers to be able to harvest. Every week, the developers would have to manually update the startBlockHarvest to the coming week's harvest unlock time. As you can already tell, this can lead to an array of issues for farmers, as it heavily depends on the developer's actions. At MagmaCake Finance, we added in a conditional within the contract to check if the current harvesting period is over. If it is over, we would then automatically calculate the next startBlockHarvest, and update it accordingly! Sounds sweet right? We'll be attaching the screenshots of the code below for further exploration.

Last updated