Closed sherlock-admin2 closed 9 months ago
Low severity based on sherlock rules, liquidityOf()
is a view function not used anywhere else in the protocol.
- Incorrect values in View functions are by default considered low.
The protocol team fixed this issue in PR/commit https://github.com/arcadia-finance/lending-v2/pull/140.
Fix looks good. The interest rate of the treasury is now cached to make sure liquidityOf returns properly for the treasury
The Lead Senior Watson signed off on the fix.
FastTiger
high
Did not set a value to the
interestWeight
variable in theLendingPool.sol#setTreasuryWeights
function.Summary
Because the value is not set to the
interestWeight
variable in theLendingPool.sol#setTreasuryWeights
function, ifowner_
istreasury
andlastSyncedTimestamp != block.timestamp
in theLendingPool.sol#liquidityOf
function, the return value is It is inaccurate.Vulnerability Detail
The
LendingPool.sol#setTreasuryWeights
function is as follows.As you can see on the right, the
LendingPool.sol#setTreasuryWeights
function does not set a value fortreasury
in theinterestWeight
variable. And theLendingPool.sol#liquidityOf
function is as follows.In
L646
, whenowner_=treasury
,interestWeight[owner_]=0
, sointerest=0
is established. In other words, theLendingPool.sol#liquidityOf
function does not accurately return the liquidity of the treasury.Impact
Treasury liquidity cannot be obtained accurately.
Code Snippet
https://github.com/sherlock-audit/2023-12-arcadia/blob/main/lending-v2/src/LendingPool.sol#L289C1-L295C6 https://github.com/sherlock-audit/2023-12-arcadia/blob/main/lending-v2/src/LendingPool.sol#L640C5-L653C6
Tool used
Manual Review
Recommendation
Modify the
LendingPool.sol#setTreasuryWeights
function as follows.