Skip to content

feat: 98% safety rate multiplier in Earner rate model#195

Merged
toninorair merged 6 commits intomainfrom
feat/earner-model-with-98%-rate-multiplier
Jun 4, 2025
Merged

feat: 98% safety rate multiplier in Earner rate model#195
toninorair merged 6 commits intomainfrom
feat/earner-model-with-98%-rate-multiplier

Conversation

@toninorair
Copy link
Copy Markdown
Collaborator

@toninorair toninorair commented Nov 5, 2024

In addition to the actual switch from 90% to 98% multiplier, a public getter function getExtraSafeEarnerRate was introduced.

It will be used by M0 colleagues to predict/query an expected rate based on totalEarningSupply, totalActiveOwedM, minterRate without knowing extra details about the rate multiplier.

uint256 safeEarnerRate_ = getSafeEarnerRate(totalActiveOwedM_, totalEarningSupply_, minterRate_);
uint256 extraSafeEarnerRate_ = (safeEarnerRate_ * RATE_MULTIPLIER) / ONE;

return (extraSafeEarnerRate_ > type(uint32).max) ? type(uint32).max : uint32(extraSafeEarnerRate_);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could use bound32() from UIntMath:

Suggested change
return (extraSafeEarnerRate_ > type(uint32).max) ? type(uint32).max : uint32(extraSafeEarnerRate_);
return UIntMath.bound32(extraSafeEarnerRate_);

@github-actions
Copy link
Copy Markdown

github-actions bot commented Jun 4, 2025

LCOV of commit 1b218f1 during Forge Coverage #613

Summary coverage rate:
  lines......: 98.5% (541 of 549 lines)
  functions..: 96.3% (129 of 134 functions)
  branches...: no data found

Files changed coverage rate:
                                     |Lines       |Functions  |Branches    
  Filename                           |Rate     Num|Rate    Num|Rate     Num
  =========================================================================
  src/rateModels/EarnerRateModel.sol |21.7%     23| 0.0%     3|    -      0

@toninorair toninorair merged commit 8fa79de into main Jun 4, 2025
6 checks passed
@toninorair toninorair deleted the feat/earner-model-with-98%-rate-multiplier branch June 4, 2025 14:34
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.

2 participants