Incorrect calculation of funding velocity for both positive and negative market skews.
The unary
function typically returns the negative of its input. So unary(SD_UNIT)
is equivalent to -1
in the context of SD59x18 numbers.
The intention seems to be to bound the proportionalSkew
between -1 and 1, but the current implementation bounds it between -1 and 1 for positive values, and between 1 and 1 for negative values.
This means that for any negative proportionalSkew
, the function will always return SD_UNIT
(which is 1 in SD59x18 format), leading to incorrect funding velocity calculations for markets with negative skew.
The lower bound should be negative one (-SD_UNIT
) instead of unary(SD_UNIT)
Incorrect funding velocity calculations for markets with negative skew.
Manual Review
SD59x18 proportionalSkewBounded = Math.min(Math.max(SD_UNIT.neg(), proportionalSkew), SD_UNIT);
OR
SD59x18 proportionalSkewBounded = Math.min(Math.max(unary(SD_UNIT), proportionalSkew), SD_UNIT);
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.