sherlock-audit / 2023-05-perennial-judging

12 stars 9 forks source link

josephdara - resolveShortfall fails when contract is paused #241

Closed sherlock-admin closed 1 year ago

sherlock-admin commented 1 year ago

josephdara

medium

resolveShortfall fails when contract is paused

Summary

resolveShortfall fails when contract is paused

Vulnerability Detail

resolveShortfall is an emergency function that is used to re-capitalize an insolvent market by the product owner or an insurance fund but this function cannot be called when contract is paused. Even though it might be required to save users or the protocol in dire situations

Impact


    /**
     * @notice Injects additional collateral into a product to resolve shortfall
     * @dev Shortfall is a measure of settled insolvency in the market
     *      This hook can be used by the product owner or an insurance fund to re-capitalize an insolvent market
     * @param product Product to resolve shortfall for
     * @param amount Amount of shortfall to resolve
     */
     //@audit-issue shortfall should be resolvable while contract is paused
    function resolveShortfall(IProduct product, UFixed18 amount) external isProduct(product) notPaused {
        _products[product].resolve(amount);
        token.pull(msg.sender, amount);

        emit ShortfallResolution(product, amount);
    }

Product Owner cannot recapitalize the market if briefly paused for recapitalization

Code Snippet

https://github.com/sherlock-audit/2023-05-perennial/blob/main/perennial-mono/packages/perennial/contracts/collateral/Collateral.sol#L236-L241

Tool used

Manual Review

Recommendation

Enable resolveShortfall to work while contract is paused