Skip to content
This repository has been archived by the owner on Apr 28, 2024. It is now read-only.

Bauer - If the token id has been burned, the borrower will not be able to repay the loan #70

Closed
sherlock-admin2 opened this issue Oct 23, 2023 · 0 comments
Labels
Duplicate A valid issue that is a duplicate of an issue with `Has Duplicates` label High A valid High severity issue Reward A payout will be made for this issue

Comments

@sherlock-admin2
Copy link
Contributor

sherlock-admin2 commented Oct 23, 2023

Bauer

medium

If the token id has been burned, the borrower will not be able to repay the loan

Summary

When a lender has burned the token ID, rendering the protocol incapable of increasing liquidity.

Vulnerability Detail

During the repay process, the protocol will call the increaseLiquidity function of underlyingPositionManager contract with IncreaseLiquidityParams struct as argument.

 function _increaseLiquidity(
        address saleToken,
        address holdToken,
        LoanInfo memory loan,
        uint256 amount0,
        uint256 amount1
    ) private {
        // increase if not equal to zero to avoid rounding down the amount of restored liquidity.
        if (amount0 > 0) ++amount0;
        if (amount1 > 0) ++amount1;
        // Call the increaseLiquidity function of underlyingPositionManager contract
        // with IncreaseLiquidityParams struct as argument
        (uint128 restoredLiquidity, , ) = underlyingPositionManager.increaseLiquidity(
            INonfungiblePositionManager.IncreaseLiquidityParams({
                tokenId: loan.tokenId,
                amount0Desired: amount0,
                amount1Desired: amount1,
                amount0Min: 0,
                amount1Min: 0,
                deadline: block.timestamp
            })
        );

However,If the lender has already burned the token ID, the protocol will be unable to increase liquidity, resulting in the borrower being unable to repay their loan, causing bad debt in the protocol.

Impact

The borrowers will be unable to repay their loan, causing bad debt in the protocol.

Code Snippet

https://github.com/sherlock-audit/2023-10-real-wagmi/blob/main/wagmi-leverage/contracts/abstract/LiquidityManager.sol#L386-L407

Tool used

Manual Review

Recommendation

To address this issue, the protocol should implement a mechanism to verify the availability and validity of token IDs before attempting to increase liquidity. This could involve a check to ensure that the token ID is still valid and not "burned" or otherwise unusable.

Duplicate of #78

@github-actions github-actions bot added High A valid High severity issue Duplicate A valid issue that is a duplicate of an issue with `Has Duplicates` label labels Oct 26, 2023
@sherlock-admin2 sherlock-admin2 changed the title Colossal Tan Hyena - If the token id has been burned, the borrower will not be able to repay the loan Bauer - If the token id has been burned, the borrower will not be able to repay the loan Oct 30, 2023
@sherlock-admin2 sherlock-admin2 added the Reward A payout will be made for this issue label Oct 30, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Duplicate A valid issue that is a duplicate of an issue with `Has Duplicates` label High A valid High severity issue Reward A payout will be made for this issue
Projects
None yet
Development

No branches or pull requests

1 participant