Tax Rewards (T): Income generated from transaction fees (stability fee) in a during the epoch.
Total Staked Luna (SL): Total Luna that has been staked by users and bonded by their delegated validators.
Tax Reward Per Unit Luna: T/SL
Consider R to be the current Tax Rate, and I to be the MiningIncrement parameter.
1- Calculate the rolling average Y of Tax Rewards per unit Luna over the last year.
2- Calculate the rolling average M of Tax Rewards per unit Luna over the last month.
3- If M = 0, there was no tax revenue in the last month. The Tax Rate should thus be set to the maximum permitted by the Tax Policy.
4-Otherwise, the new Tax Rate is , (I * R * Y) / M
Of course both 3 and 4 are subject to the rules of pc.Clamp()