Closed sherlock-admin3 closed 5 months ago
1 comment(s) were left on this issue during the judging contest.
WangAudit commented:
BaseLeverageExecutor doesn't inherit ILeverageExecutor. If we look at Market.sol (this is where we declare leverageExecutor) it's ILeverageExecutor type. And this interface indeed has assetId as an input parameter -> BaseLeverageExecutor will not be called here cause
BaseLeverageExecutor
doesn't inheritILeverageExecutor
GiuseppeDeLaZara
high
LeverageExecutor
is not working insideBBLeverage
andSGLeverage
Summary
The
buyCollateral
andsellCollateral
functions inside theBBLeverage
andSGLeverage
contracts are non-functional as there is no implementation ofgetCollateral
andgetAsset
in the currentLeverageExecutor
interface.Vulnerability Detail
BBLeverage::buyCollateral
andSGLeverage::buyCollateral
are callingLeverageExecutor::getCollateral
.BBLeverage::sellCollateral
andSGLeverage::buyCollateral
are callingLeverageExecutor::getAsset
.However, these functions have completely different interfaces inside all the implementations of
BaseLeverageExecutor
, e.g.AssetToSGLPLeverageExecutor
,AssetTotsDaiLeverageExecutor
,SimpleLeverageExecutor
.It seems in the previous versions of Tapioca
leverageExecutor
had the interface that is now expected byBBLeverage
andSGLeverage
. This was probably introduced during the migration to new leverageExecutor.Neverthless, the current
buyCollateral
andsellCollateral
functions are non-functional as there is no implementation ofgetCollateral
andgetAsset
in the currentLeverageExecutor
interface.Impact
The
buyCollateral
andsellCollateral
function inside theBBLeverage
andSGLeverage
contracts are non-functional as there is no implementation ofgetCollateral
andgetAsset
in the currentLeverageExecutor
interface. As this is a core functionality of the leverage contracts, it is a high-severity issue.Code Snippet
Tool used
Manual Review
Recommendation
Change the logic inside the
BBLeverage
andSGLeverage
contracts to use the correct interface ofLeverageExecutor
forgetAsset
andgetCollateral
functions, and pass the correct arguments to these functions.Duplicate of #115