Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue by Open Zeppelin team:
Multiple instances of redundant code were identified in the OUSD contract:
The initialize function cannot be executed since the contract was already initialized in previous versions. To avoid unnecessarily increasing code size, consider removing the function or commenting it out for future reference.
In the delegateYield function, checking both the yieldFrom/yieldTo mappings and the rebaseState mapping is redundant, as the first check will only pass if the second passes, and vice versa. Consider removing the first check, as it involves more storage reads than the second one.
In the undelegateYield function, there is no need to set the credit balance of the delegation source, as it was already set to their balance within delegateYield.
Consider removing these redundancies to enhance the clarity and efficiency of the codebase.
Origin comment:
initialize
function for any future fresh token contract deploys that would extendOUSD.sol
delegateYield
function and have intentionally written in that way in the spirit of code readability and defensive programming. The exaggeration of verbosity is in place to prevent any current or future changes that could introduce an error in this critical part.undelegateYield
has been removed