Skip to content

Commit

Permalink
Better name
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielVF committed Nov 4, 2024
1 parent a2bb64f commit 4be8bdd
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/token/OUSD.sol
Original file line number Diff line number Diff line change
Expand Up @@ -435,16 +435,16 @@ contract OUSD is Governable {
function _isNonRebasingAccount(address _account) internal returns (bool) {
bool isContract = _account.code.length > 0;
if (isContract && rebaseState[_account] == RebaseOptions.NotSet) {
_ensureRebasingMigration(_account);
_ensureNonRebasingMigration(_account);
}
return nonRebasingCreditsPerToken[_account] > 0;
}

/**
* @dev Ensures internal account for rebasing and non-rebasing credits and
* supply is updated following deployment of frozen yield change.
* @dev If this is the first time a contract has been seen, migrate it to
* non-rebasing accounting.
*/
function _ensureRebasingMigration(address _account) internal {
function _ensureNonRebasingMigration(address _account) internal {
if (nonRebasingCreditsPerToken[_account] != 0) {
return; // Account is already non-rebasing
}
Expand Down Expand Up @@ -497,6 +497,7 @@ contract OUSD is Governable {

function _rebaseOptIn(address _account) internal {
require(_isNonRebasingAccount(_account), "Account has not opted out");
require(rebaseState[msg.sender] != RebaseOptions.YieldDelegationTarget, "Cannot opt in while yield delegating");

uint256 balance = balanceOf(msg.sender);

Expand All @@ -514,6 +515,7 @@ contract OUSD is Governable {

function rebaseOptOut() public nonReentrant {
require(!_isNonRebasingAccount(msg.sender), "Account has not opted in");
require(rebaseState[msg.sender] != RebaseOptions.YieldDelegationSource, "Cannot opt out while receiving yield");

uint256 oldCredits = _creditBalances[msg.sender];
uint256 balance = balanceOf(msg.sender);
Expand Down

0 comments on commit 4be8bdd

Please sign in to comment.