Skip to content

Commit 1b29fba

Browse files
committed
Switch back to old verison, since it will also be perfectly accurate
1 parent f5a55a3 commit 1b29fba

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

contracts/contracts/token/OUSD.sol

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -475,23 +475,22 @@ contract OUSD is Initializable, InitializableERC20Detailed, Governable {
475475
// high resolution, and do not have to do any other bookkeeping
476476
nonRebasingCreditsPerToken[_account] = 1e27;
477477
} else {
478-
// Get old values, so we can use them unaffected by changes
479-
uint256 oldBalance = balanceOf(_account);
478+
// This does not change, but if it did, we want want to
479+
// use the before changes value.
480480
uint256 oldCredits = _creditBalances[_account];
481481

482482
// Atomicly update account information:
483483
// It is important that balanceOf not be called inside updating
484484
// account data, since it will give wrong answers if it does
485485
// not have all an account's data in a consistent state.
486-
nonRebasingCreditsPerToken[_account] = 1e27;
487-
// difference between the 1e18 balance and the new 1e27 resolution
488-
_creditBalances[_account] = oldBalance * 1e9;
489-
490-
// Verify perfect acccount accounting update
491-
require(oldBalance == balanceOf(_account), "Balances do not match");
486+
//
487+
// By setting a per account nonRebasingCreditsPerToken,
488+
// this account will no longer follow with the global
489+
// rebasing credits per token.
490+
nonRebasingCreditsPerToken[_account] = _rebasingCreditsPerToken;
492491

493492
// Update global totals:
494-
nonRebasingSupply = nonRebasingSupply.add(oldBalance);
493+
nonRebasingSupply = nonRebasingSupply.add(balanceOf(_account));
495494
_rebasingCredits = _rebasingCredits.sub(oldCredits);
496495
}
497496
}

0 commit comments

Comments
 (0)