HardhatDeFi
15,000 USDC
View results
Submission Details
Severity: low
Invalid

Ineficient state call in `AaveDIVAWrapperCore:_createContingentPool`

Description:

The function AaveDIVAWrapperCore:_createContingentPool perfom inneficient sRead opcode.

It is getting at the begining of the function the _wToken

address _wToken = _collateralTokenToWToken[_poolParams.collateralToken];

and then, calling creaeContingetPool, it's getting this value from state again, but could just use wToken

bytes32 _poolId = IDIVA(_diva).createContingentPool(
IDIVA.PoolParams({
referenceAsset: _poolParams.referenceAsset,
expiryTime: _poolParams.expiryTime,
floor: _poolParams.floor,
inflection: _poolParams.inflection,
cap: _poolParams.cap,
gradient: _poolParams.gradient,
collateralAmount: _poolParams.collateralAmount,
@> collateralToken: _collateralTokenToWToken[_poolParams.collateralToken], // Using the address of the wToken here
dataProvider: _poolParams.dataProvider,
capacity: _poolParams.capacity,
longRecipient: _poolParams.longRecipient,
shortRecipient: _poolParams.shortRecipient,
permissionedERC721Token: _poolParams.permissionedERC721Token
})
);

Recomended Mitigation:

bytes32 _poolId = IDIVA(_diva).createContingentPool(
IDIVA.PoolParams({
referenceAsset: _poolParams.referenceAsset,
expiryTime: _poolParams.expiryTime,
floor: _poolParams.floor,
inflection: _poolParams.inflection,
cap: _poolParams.cap,
gradient: _poolParams.gradient,
collateralAmount: _poolParams.collateralAmount,
- collateralToken: _collateralTokenToWToken[_poolParams.collateralToken], // Using the address of the wToken here
+ collateralToken: _wToken, // Using the address of the wToken here
dataProvider: _poolParams.dataProvider,
capacity: _poolParams.capacity,
longRecipient: _poolParams.longRecipient,
shortRecipient: _poolParams.shortRecipient,
permissionedERC721Token: _poolParams.permissionedERC721Token
})
);
Updates

Lead Judging Commences

bube Lead Judge 6 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.