Can remove treasuryRewardCut from ForfeitHandler.sol #379
Labels
bug
Something isn't working
G (Gas Optimization)
sponsor confirmed
Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")
Handle
harleythedog
Vulnerability details
Impact
In ForfeitHandler.sol, there are two values
swingTraderRewardCut
andtreasuryRewardCut
, and these values always sum to 1000. Instead of having to go through all of the logic of setting these values independently and always ensuring that they sum to 1000, it would be simpler (and definitely save a lot of gas) if you simply removed everything related totreasuryRewardCut
and always just used1000-swingTraderRewardCut
in its place.This also is more similar to what is done in StabilizerNode.sol where
treasuryCut
is simply what is left over after other components have taken their cut.Proof of Concept
See ForfeitHandler.sol here: https://github.com/code-423n4/2021-11-malt/blob/main/src/contracts/ForfeitHandler.sol
Tools Used
Inspection
Recommended Mitigation Steps
Simplify logic and save gas by removing
treasuryRewardCut
.The text was updated successfully, but these errors were encountered: