Notice then, that rather than scaling the weekly by treating the relation between teamRate and PRECISION as a ratio, we instead decrease the PRECISION of the calculation, inadvertently amplifying the evaluated ratio.
Let's imagine the teamRate is 5% and the weekly emissions were 1 ether. Instead of calculating 0.05 ether, instead we determine:
Welcome to Chisel! Type `!help` to show available commands.
➜ uint256 x = 1 ether * 50
➜ uint256 y = 1000 - 50
➜ x / y
Type: uint256
├ Hex: 0x00000000000000000000000000000000000000000000000000bafc24672035e5
├ Hex (full word): 0x00000000000000000000000000000000000000000000000000bafc24672035e5
└ Decimal: 52631578947368421
This is a relative overpayment of 5.2%.
Impact
Medium, the MAX_TEAM RATE invariant is not respected.
Aggregated across multiple gauges, this would result in unexpected dilution of _flow.
Active Lace Hippo
Low/Info
Minter
Calculates Team Emissions IncorrectlySummary
The
Minter
contract unintentionally amplifies the_teamEmissions
in excess of the declared amount.Vulnerability Detail
The
Minter
contract exports the functionupdate_period()
, which is responsible formint(address,uint256)
ing the_flow
token at a throttled pre-defined rate:Specifically, the weekly
_teamEmissions
are calculated as follows:Notice then, that rather than scaling the
weekly
by treating the relation betweenteamRate
andPRECISION
as a ratio, we instead decrease thePRECISION
of the calculation, inadvertently amplifying the evaluated ratio.Let's imagine the
teamRate
is5%
and theweekly
emissions were1 ether
. Instead of calculating0.05 ether
, instead we determine:This is a relative overpayment of 5.2%.
Impact
Medium, the
MAX_TEAM RATE
invariant is not respected.Aggregated across multiple gauges, this would result in unexpected dilution of
_flow
.Code Snippet
https://github.com/sherlock-audit/2024-06-velocimeter/blob/63818925987a5115a80eff4bd12578146a844cfd/v4-contracts/contracts/Minter.sol#L119C13-L120C40
Tool used
Manual Review, Chisel
Recommendation
Correct the calculation: