Accrued yields not collected from YT for YT holders in tranche redeem and tranche withdraw.
Summary
The redeem and withdraw functions in the tranche contract are used to withdraw underlying and burn PT at maturity. The function is expected to collect accrued yields from YT if the users hold YT as specified in yield-stripping-system.md #67. However, this functionality is omitted in the function.
User calls redeem or withdraw with a principalAmount or an underlyingAmount, a to address and a from address. from's PT is successfully burnt and a underlying value is successfully transferred to to. However, accrued yields from YT is not collected if to or from are YT holders.
Impact
Accrued yields from YT would not be collected for the Addresses when the redeem/withdraw functions are called.
Solidity_ATL_Team_1
medium
Accrued yields not collected from YT for YT holders in tranche
redeem
and tranchewithdraw
.Summary
The
redeem
andwithdraw
functions in the tranche contract are used to withdraw underlying and burn PT at maturity. The function is expected to collect accrued yields from YT if the users hold YT as specified in yield-stripping-system.md #67. However, this functionality is omitted in the function.Vulnerability Detail
https://github.com/sherlock-audit/2024-01-napier/blob/6313f34110b0d12677b389f0ecb3197038211e12/napier-v1/src/Tranche.sol#L298 and https://github.com/sherlock-audit/2024-01-napier/blob/6313f34110b0d12677b389f0ecb3197038211e12/napier-v1/src/Tranche.sol#L328
User calls
redeem
orwithdraw
with aprincipalAmount
or anunderlyingAmount
, ato
address and afrom
address.from
's PT is successfully burnt and a underlying value is successfully transferred toto
. However, accrued yields from YT is not collected ifto
orfrom
are YT holders.Impact
Accrued yields from YT would not be collected for the Addresses when the
redeem
/withdraw
functions are called.Code Snippet
https://github.com/sherlock-audit/2024-01-napier/blob/6313f34110b0d12677b389f0ecb3197038211e12/napier-v1/src/Tranche.sol#L298
https://github.com/sherlock-audit/2024-01-napier/blob/6313f34110b0d12677b389f0ecb3197038211e12/napier-v1/src/Tranche.sol#L328
Tool used
Manual Review
Recommendation
Add:
from https://github.com/sherlock-audit/2024-01-napier/blob/6313f34110b0d12677b389f0ecb3197038211e12/napier-v1/src/Tranche.sol#L305 and https://github.com/sherlock-audit/2024-01-napier/blob/6313f34110b0d12677b389f0ecb3197038211e12/napier-v1/src/Tranche.sol#L335 to the
redeem
andwithdraw
functions respectively.Duplicate of #45