GaugeController::addGauge
when adding gauges, gives the typeWeight
as 0 value by default. This might cause problems if the admin forgets, or is not fast enough to call setTypeWeight
function to set the type weight. Becuase, type weights of a gauge is used in _calculateReward
function’s typeShare
calculation, and it end up returning the calculated rewards as 0 always.
Why? Because, here:
if type weight of a gauge is zero, typeShare will return 0 as anything divided to 0 returns 0, which will end up the return statement return zero, as since typeShare is zero now, anything multiplied by it is zero, and then divided to it is zero.
In the case described, where the admin is not quick enough or forgets to set the weight to an applicable value, rewards will always be calculated as zero.
You could consider setting the weight to 1 at creation to avoid erroneous mistakes.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.