Closed github-actions[bot] closed 1 year ago
@clems4ev3r This is an invalid concern. Premium accrues not after expiration but every time there is a payment to the lending pool. We are also planning to change that to continuous accrual as discussed in #294. Also, accruing premium on each buyProtection will be expensive as discussed in #288
@vnadoda, agreed this is invalid
Closing based on the above comments
141345
medium
Should Accrue Premium at the beginning of protection
Summary
The accruing of premium is after the expiry of protection, this mechanism could lead to buyers' loss when the payout amount is low. And also could lead to inconsistent payout amounts when the lending default at different time. If accruing premium at the beginning of the protection, buyers will be better protected and the protection logic and mechanism will be more consistent.
Vulnerability Detail
Currently, accruing of premium only happens after the protection is expired.
And the accrued amount will be added to
totalSTokenUnderlying
.totalSTokenUnderlying
is used as the source of payout for defaulted lending pools.However, the deferral of accruing premium will make the total available payout amount smaller. The issue could arise when the payout fund is not enough. The un-accrued premium could have been used to cover buyers' loss, but the accounting just not yet include this part.
Imagine, some lending pool have late payment since day 1 of the protection, when the status changed to
Defaulted
, the protection might not expire. So the premium will not be used to cover this default. And if at the same time the protection pool has low balance of underlying, the buyers could suffer more loss.Accruing after expiration will also introduce inconsistency for the payout mechanism. Continue with the above example, if the late payment occurred at the last day of the protection, when the status changed to
Defaulted
, the premium is included in thetotalSTokenUnderlying
for payout. The payout amounts will be higher, the difference is the premium for this specific premium.Impact
The buyers could suffer some loss due to insufficient fund of payout. The protection will give inconsistent results with different lending pool defaults time.
Code Snippet
https://github.com/sherlock-audit/2023-02-carapace/blob/main/contracts/core//pool/ProtectionPool.sol#L987-L1002
https://github.com/sherlock-audit/2023-02-carapace/blob/main/contracts/core//pool/ProtectionPool.sol#L230-L234
Tool used
Manual Review
Recommendation
Accrue Premium at the beginning of the the protection, and this amount can be used towards this protection for sure. And the protection payout results will be consistent with different time of defaulted lending.