Skip to content

Commit

Permalink
Cleanup ensure rebasing migration (fix)
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielVF committed Nov 4, 2024
1 parent 50b0406 commit 9cc8faa
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
src = "src"
out = "out"
libs = ["lib"]
evm_version = "london"

# See more config options https://github.com/foundry-rs/foundry/blob/master/crates/config/README.md#all-options
6 changes: 3 additions & 3 deletions src/token/OUSD.sol
Original file line number Diff line number Diff line change
Expand Up @@ -488,10 +488,10 @@ contract OUSD is Governable {
return; // Account is already non-rebasing
}
uint256 oldCredits = _creditBalances[_account];
uint256 balance = credits * _rebasingCreditsPerToken;
uint256 balance = balanceOf(_account);

// Local
rebaseState[account] = RebaseOptions.OptOut;
rebaseState[_account] = RebaseOptions.OptOut;
_creditBalances[_account] = balance;
nonRebasingCreditsPerToken[_account] = 1e18;

Expand All @@ -505,7 +505,7 @@ contract OUSD is Governable {
function _balanceToRebasingCredits(uint256 balance) internal view returns (uint256) {
// Rounds up, because we need to ensure that accounts allways have
// at least the balance that they should have.
// Note this should always be used on an absolute account balance,
// Note this should always be used on an absolute account value,
// not on a possibly negative diff, because then the rounding would be wrong.
return ((balance) * _rebasingCreditsPerToken + 1e18 - 1) / 1e18;
}
Expand Down

0 comments on commit 9cc8faa

Please sign in to comment.