-
Notifications
You must be signed in to change notification settings - Fork 37
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
fix(mintYieldFee): check for partial collateralization (c4-issue-435) #13
fix(mintYieldFee): check for partial collateralization (c4-issue-435) #13
Conversation
@@ -1,312 +1,313 @@ | |||
TN: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This shouldn't be committed
✂️
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The repo is not configured properly but we need to display the coverage in PRs: https://github.com/zgosalvez/github-actions-report-lcov
src/Vault.sol
Outdated
_withdrawableAssets = _withdrawableAssets - (_withdrawableAssets - _totalSupplyToAssets); | ||
// If the Vault is collateralized, yield is excluded from the withdrawable amount | ||
// and users can only withdraw the amount of underlying assets they deposited. | ||
// Otherwise, any unclaimed yield is included and shared proportionally amongst depositors. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment needs to be updated I think
The additional assets are not shared proportionally, AFAIK
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is once the Vault is undercollateralized since _withdrawableAssets
won't be equal to _depositedAssets
, so any underlying assets withdrawable from the YieldVault will be available and the exchange will be computed using the following formula:
return _withdrawableAssets.mulDiv(_assetUnit, _totalSupplyAmount, Math.Rounding.Down);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a language thing; there is no yield if it's undercollateralized
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed wording in this commit: 81fe36a
1017a67
to
8097392
Compare
fix(sponsor): remove receiver param
fixes c4 issue 353
revert if yield fee is set to 100%
Issue: code-423n4/2023-07-pooltogether-findings#435