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.
What's new in this PR?
It seems that YieldToken::mint hasn't been updated yet to follow the new conversion logic.
It seems that YieldToken::redeem hasn't done yieldBuffer check like withdraw yet.
Just to be safer, would it make sense to properly implement the rounding direction that you added in ComponentToken comments to the inherited contracts like AggregateToken? It would be better to do this in YieldToken as well just to be safe.
For the synchronous redeem in ComponentToken, it seems that the convertToAssets should be called before calling _burn because otherwise it will incorrectly inflate the shares value if the overridden convertToAssets depends on totalSupply.
the same issue applies to the synchronous ComponentToken::deposit as well, where transferring the asset should happen after the calculation. In general, we suggest that for actions that might change the value of totalSupply or totalAssets in ERC4626, all calculations should be done before making those changes. Thanks all!
For the asynchronous redeem logic in YieldToken, how will you handle the _notifyRedeem conversion rate to be precise?
For example, we observed that when users call requestRedeem, the shares will be burned first, which means that the conversion rate in the on-chain side will be inflated until the request is executed (either via withdraw or redeem).
Similarly, this applies to future contracts that want to inherit ComponentToken with async features enabled and has dependencies on totalSupply during the conversion logic.