Skip to content

Commit 958070b

Browse files
committed
Use before change balance, as before
1 parent ab9da6a commit 958070b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

contracts/contracts/token/OUSD.sol

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -504,6 +504,8 @@ contract OUSD is Initializable, InitializableERC20Detailed, Governable {
504504
function rebaseOptIn() public nonReentrant {
505505
require(_isNonRebasingAccount(msg.sender), "Account has not opted out");
506506

507+
uint256 oldBalance = balanceOf(msg.sender);
508+
507509
// Precalculate new credits, so that we avoid internal calls when
508510
// atomicly updating account.
509511
// Convert balance into the same amount at the current exchange rate
@@ -522,7 +524,7 @@ contract OUSD is Initializable, InitializableERC20Detailed, Governable {
522524

523525
// Update global totals:
524526
// Decrease non rebasing supply
525-
nonRebasingSupply = nonRebasingSupply.sub(balanceOf(msg.sender));
527+
nonRebasingSupply = nonRebasingSupply.sub(oldBalance);
526528
// Increase rebasing credits, totalSupply remains unchanged so no
527529
// adjustment necessary
528530
_rebasingCredits = _rebasingCredits.add(_creditBalances[msg.sender]);

0 commit comments

Comments
 (0)