aavegotchi / aavegotchi-realm-diamond

23 stars 9 forks source link

[Audit Report] [N2] [Low] Design logic error #16

Closed orionstardust closed 2 years ago

orionstardust commented 2 years ago

Description

In the InstallationFacet contract, the reduceCraftTime and reduceUpgradeTime function are compared the input data _amount with the blockLeft and burn the glmr tokens through the burnFrom function with two different situations. But in both cases are subtract the input _amount at last.

https://github.com/aavegotchi/aavegotchi-realm-diamond/blob/cee38d37307c49dc41cdb737a962d5d313c1cd4f/contracts/InstallationDiamond/facets/InstallationFacet.sol#L245

https://github.com/aavegotchi/aavegotchi-realm-diamond/blob/cee38d37307c49dc41cdb737a962d5d313c1cd4f/contracts/InstallationDiamond/facets/InstallationFacet.sol#L395

Solution

It is recommended to separate the two cases to burn different tokens in the corresponding cases.