Skip to content

Normalizing by decimal delta between asset and vault#123

Open
alcueca wants to merge 2 commits intoroycoprotocol:mainfrom
alcueca:decimal-normalization
Open

Normalizing by decimal delta between asset and vault#123
alcueca wants to merge 2 commits intoroycoprotocol:mainfrom
alcueca:decimal-normalization

Conversation

@alcueca
Copy link
Collaborator

@alcueca alcueca commented Nov 11, 2024

Not as elegant as normalizing by assets, but hopefully safer.

If the vault has a higher decimal count that its asset, we use the difference as a scalar to:

  1. Normalize the rate up when accumulating rewards per token
  2. Rewards down when accumulating rewards per user.

I haven't included the tweak to only pull rewards that are expected to be distributed.

Normalizing the rate up shouldn't overflow, because we upcast from u96 to u256.

There would be some rounding down of user rewards when accumulating them, I do not know the actual impact.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant