Skip to content

Commit 92612a2

Browse files
committed
Added comments to warn us about doing a split accounting update
1 parent 63470a9 commit 92612a2

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

contracts/contracts/token/OUSD.sol

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -473,10 +473,16 @@ contract OUSD is Initializable, InitializableERC20Detailed, Governable {
473473
// high resolution, and do not have to do any other bookkeeping
474474
nonRebasingCreditsPerToken[_account] = 1e27;
475475
} else {
476-
// Migrate an existing account:
477-
476+
// Migrate the existing account:
477+
// It is important that balanceOf not be called inside updating
478+
// account data, since it will give wrong answers if it does
479+
// not have all an account's data in a consistent state. This
480+
// isn't a problem in the current implimentation, since we only
481+
// need to update nonRebasingCreditsPerToken.
478482
// Set fixed credits per token for this account
479483
nonRebasingCreditsPerToken[_account] = _rebasingCreditsPerToken;
484+
485+
// Update global totals:
480486
// Update non rebasing supply
481487
nonRebasingSupply = nonRebasingSupply.add(balanceOf(_account));
482488
// Update credit tallies

0 commit comments

Comments
 (0)