Worried about inflation? Introducing GreyHats Dollar (GHD), the world's first currency with deflation built-in! Backed by GREY tokens, GHD will automatically deflate at a rate of 3% every year.
To solve the challenge, the player needs to obtain more than 50,000 GHD. Initially, we can exchange 1000 GREY for GHD, which is recorded in the form of share. Over time, the same proportion of shares will correspond to a reduced amount of GHD due to deflation
/** * @notice Updates the conversion rate between GHD and the underlying asset. */modifierupdate{conversionRate=_conversionRate();lastUpdated=block.timestamp;_;}functionbalanceOf(addressuser)publicviewreturns(uint256){return_sharesToGHD(shares[user],_conversionRate(),false);}
Interestingly, during the token transfer, the data used to update account shares is calculated based on the cached old data. Since the data of to account is updated after from account, if a transfer is made to oneself, the account shares will increase :D