Skip to content
This repository has been archived by the owner on Oct 22, 2023. It is now read-only.

PawelK - No deadline parameter in createCommitment function #82

Closed
sherlock-admin opened this issue Apr 22, 2023 · 0 comments
Closed

PawelK - No deadline parameter in createCommitment function #82

sherlock-admin opened this issue Apr 22, 2023 · 0 comments
Labels
Non-Reward This issue will not receive a payout

Comments

@sherlock-admin
Copy link
Contributor

sherlock-admin commented Apr 22, 2023

PawelK

medium

No deadline parameter in createCommitment function

Summary

No deadline parameter in createCommitment function

Vulnerability Detail

The createCommitment function doesn't contain deadline parameter. If the lender would create commitment a function, and forget about it or would be blocked to send the function via griefing attack, or any other reason, he might not call deleteCommitment function and might get a not favorable deal, because of the volatile market conditions.

Impact

Unfavorable loan for the lender.

Code Snippet

struct Commitment {
        uint256 maxPrincipal;
        uint32 expiration;
        uint32 maxDuration;
        uint16 minInterestRate;
        address collateralTokenAddress;
        uint256 collateralTokenId;
        uint256 maxPrincipalPerCollateralAmount;
        CommitmentCollateralType collateralTokenType;
        address lender;
        uint256 marketId;
        address principalTokenAddress;
        uint256 deadline; // add new parameter
    }

Tool used

Manual Review

Recommendation

Add deadline field to createCommitment, and if the acceptCommitment function would be called after it, it should revert.
You could also add that if the lender sets deadline to 0, then it lasts until canceled.
It should be up to the lender to decide what risk of market change condition he is willing to take, and set according to the deadline for the commitment.

Duplicate of #187

@github-actions github-actions bot closed this as completed May 1, 2023
@github-actions github-actions bot added Medium A valid Medium severity issue Duplicate A valid issue that is a duplicate of an issue with `Has Duplicates` label labels May 1, 2023
@sherlock-admin sherlock-admin added the Reward A payout will be made for this issue label May 20, 2023
@sherlock-admin sherlock-admin added Non-Reward This issue will not receive a payout and removed Medium A valid Medium severity issue Duplicate A valid issue that is a duplicate of an issue with `Has Duplicates` label Reward A payout will be made for this issue labels Jun 12, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Non-Reward This issue will not receive a payout
Projects
None yet
Development

No branches or pull requests

1 participant