Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
token-2022: Add scaled amount extension (#7511)
* token-2022: Add scaled amount extension #### Problem The interest-bearing extension is useful for tokens that accrue in value constantly, but many "rebasing" tokens on other blockchains employ a different method of updating the number of tokens in accounts. Rather than setting a rate and allowing the number to change automatically over time, they set a scaling factor for the tokens by hand. #### Summary of changes Add a new `ScaledUiAmount` extension to token-2022 for doing just that. This is essentially a simplified version of the interest-bearing extension, where someone just sets a scaling value into the mint directly. The scale has no impact on the operation of the token, just on the output of `amount_to_ui_amount` and `ui_amount_to_amount`. * Add timestamp, rename to "multiplier" * Update token/program-2022/src/extension/scaled_ui_amount/mod.rs Co-authored-by: samkim-crypto <[email protected]> * Address feedback --------- Co-authored-by: samkim-crypto <[email protected]>
- Loading branch information