Open code423n4 opened 1 year ago
The suggested duplicate of #33 is correct.
Picodes marked the issue as primary issue
0xScotch marked the issue as sponsor confirmed
Picodes marked the issue as satisfactory
Picodes marked the issue as selected for report
Lines of code
https://github.com/code-423n4/2023-02-malt/blob/700f9b468f9cf8c9c5cffaa1eba1b8dea40503f9/contracts/StabilityPod/SwingTraderManager.sol#L252-L256
Vulnerability details
Impact
Contract
SwingTraderManager
has atotalProfit
variable. It keeps track of total profit swing traders maded duringsellMalt()
. However, the logic for accounting it is wrong so it will not have the correct value. As the results, it can affect other contracts that integrating withSwingTraderManager
and use thistotalProfit
variable.Proof of Concept
https://github.com/code-423n4/2023-02-malt/blob/700f9b468f9cf8c9c5cffaa1eba1b8dea40503f9/contracts/StabilityPod/SwingTraderManager.sol#L252-L258
Function
sellMalt()
has a dust check before returning result.totalProfit
should be updated before this check as it return the value immediately without updatingtotalProfit
.Tools Used
Manual Review
Recommended Mitigation Steps
Updating
totalProfit
before the dust check in functionsellMalt()
.