Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup OUSD rebasing/nonrebasing accounting changes #1239

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion contracts/contracts/token/OUSD.sol
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,8 @@ contract OUSD is Initializable, InitializableERC20Detailed, Governable {
function rebaseOptIn() public nonReentrant {
require(_isNonRebasingAccount(msg.sender), "Account has not opted out");

uint256 oldBalance = balanceOf(msg.sender);
DanielVF marked this conversation as resolved.
Show resolved Hide resolved

// Precalculate new credits, so that we avoid internal calls when
// atomicly updating account.
// Convert balance into the same amount at the current exchange rate
Expand All @@ -522,7 +524,7 @@ contract OUSD is Initializable, InitializableERC20Detailed, Governable {

// Update global totals:
// Decrease non rebasing supply
nonRebasingSupply = nonRebasingSupply.sub(balanceOf(msg.sender));
nonRebasingSupply = nonRebasingSupply.sub(oldBalance);
// Increase rebasing credits, totalSupply remains unchanged so no
// adjustment necessary
_rebasingCredits = _rebasingCredits.add(_creditBalances[msg.sender]);
DanielVF marked this conversation as resolved.
Show resolved Hide resolved
Expand Down