Last updated 7 months ago
M^0 Project
Legal
Copyright 2024 M^0 Foundation
startEarning()startEarning() startEarning()
Callable only by minterminterminter on the Approved TTG earnersearnersearners List.
Allows a user to start earning yield on their M balance. balanceOfuserbalanceOf_{user}balanceOfuser will be rewritten to store principalOfEarningSupplyMToken,earnerprincipalOfEarningSupply_{MToken, earner}principalOfEarningSupplyMToken,earner
Calculates principalOfEarningSupplyMToken,earner=balanceOfMToken,earner/indexnowprincipalOfEarningSupply_{MToken, earner} = balanceOf_{MToken, earner} / index_{now}principalOfEarningSupplyMToken,earner=balanceOfMToken,earner/indexnow
Saves totalPrincipalOfEarningSupply+=principalOfEarningSupplyMToken,earnertotalPrincipalOfEarningSupply +=principalOfEarningSupply_{MToken, earner} totalPrincipalOfEarningSupply+=principalOfEarningSupplyMToken,earner
Saves totalNonEarningSupply−=balanceOfMToken,earnertotalNonEarningSupply -= balanceOf_{MToken, earner}totalNonEarningSupply−=balanceOfMToken,earner
Saves balanceOfMToken,earner=principalOfEarningSupplyMToken,earnerbalanceOf_{MToken, earner} = principalOfEarningSupply_{MToken, earner}balanceOfMToken,earner=principalOfEarningSupplyMToken,earner
Sets isEarningMToken,earner=trueisEarning_{MToken, earner}=trueisEarningMToken,earner=true
Calls updateIndexupdateIndexupdateIndex.