sherlock-audit / 2023-01-ajna-judging

1 stars 0 forks source link

james_wu - There is no way of partial LP transfer #157

Closed github-actions[bot] closed 1 year ago

github-actions[bot] commented 1 year ago

james_wu

medium

There is no way of partial LP transfer

Summary

approveLpOwnership and transferLPs are used to transfer position to other address. but in transferLPs(), we can only transfer whole position and don't have a way to transfer partially.

Vulnerability Detail

Impact

Lack of such important function could result less protocol users in numbers.

Code Snippet

https://github.com/sherlock-audit/2023-01-ajna/blob/main/contracts/src/libraries/external/LenderActions.sol#L500-L558

// move lp tokens to the new owner address
Lender storage newLender = bucket.lenders[newOwner_];

newLender.lps += transferAmount;

newLender.depositTime = Maths.max(lenderDepositTime, newLender.depositTime);

// reset owner lp balance for this index
delete bucket.lenders[owner_];

Tool used

Manual Review

Recommendation

There should be method that transfer LPs partially