Part of CertiK’s series
CertiK reviewed Venus Protocol (Venus - Two Kinks Interest Rate) on 31 Jul 2024: 5 findings, 0 critical; 4 marked fixed, 1 open.
Report hosted on skynet.certik.com.
Trustblock does not review code.
Statuses are the security firm’s own, from its report.
| Severity | Open | Acknowledged | Fixed |
|---|---|---|---|
| Critical | 0 | 0 | 0 |
| High | 0 | 0 | 0 |
| Medium | 0 | 0 | 0 |
| Low | 1 | 0 | 4 |
The function `_max()` takes two `int256` as input and returns the larger of the two numbers. However, if they are both negative, then it will cast the greater negative number to a `uint256` causing it to return a large value. This function is only used internally and one of the inputs is always zero, so that these cases are not relevant to the current contract. However, if this function is adapted to be used in the future, then these cases may need to be considered and handled.
The `constructor()` does not perform the following checks: - It does not check that `kink1_<kink2_`. If `kink2_` is less than `kink1_` the curve will not have the desired shape. - It does not check that `kink1` is strictly greater than 0. This should be done if the intention is to always have three linear functions. If the intention is to allow two, we recommend considering creating a separate contract to handle this.
The comment at the start of the `TwoKinksInterestRateModel` contracts state " An interest rate model with two different steep increase each after a certain utilization threshold called **kink** is reached." However, the implementation does not just allow for steep increases, in general the implementation allows for the slope to be increased or decreased when each kink is reached. --- The comment above `getBorrowRate()` states that the return value is "scaled by 1e18" when all other comments instead use "scaled by EXP_SCALE" --- The comment above `JUMP_MULTIPLIER_PER_BLOCK` is not consistent with the comments for the `MULTIPLIER_2_PER_BLOCK` or `MULTIPLIER_PER_BLOCK`. It could be reworded to be "The multiplier of utilization rate per block that gives the slope 3 of the interest rate". --- The comments for the inputs `multiplierPerYear_` and `multiplier2PerYear_` in the `constructor()` state "The rate of increase". However, with the current implementation these can be negative values so that it can be the rate of increase or decrease. --- The comment for the input `baseRate2PerYear_` in the `constructor` states "The approximate target base APR after hitting `KINK_1`, as a mantissa (scaled by EXP_SCALE)". However the `baseRate2PerYear_` value represents a discontinuous increase in APR, as the calculation of the rate adds the rate from the previous interval.
In the function `_getBorrowRate()` the calculations `util - KINK_1` and `util - KINK_2` can be placed in unchecked blocks to save gas. This is because `util` is the output of the call to `utilizationRate` so that it will always be in the interval [0,1e18]. Then `util - KINK_1` is only executed if `util >= KINK_1` so that it cannot underflow. Similarly `util - KINK_2` is only executed if `util >= KINK_2` so that it cannot underflow. If the suggested check is made to ensure that `KINK_1 < KINK_2`, then in addition `KINK_2 - KINK_1` can also be placed in an unchecked block.
The report names a repository or files. Open the report to see its scope.
Repository and files the report names (3)
1,045 projects reviewed · 1,376 reports · latest May 2025
See CertiK’s auditsSomething wrong on this page? A missing report, a wrong date, a finding that was fixed since. Tell us and we check it against its source.
Tell us