Venus - Prime and Oracle Changes

CertiKFiles named in the report

Audit

Part of CertiK’s series

CertiK reviewed Venus Protocol (Venus - Prime and Oracle Changes) on 19 Dec 2023: 13 findings, 0 critical; 8 marked fixed, 5 open.

No open critical findings
Open the reportOpen Venus Protocol’s security record

Report hosted on skynet.certik.com.

Trustblock does not review code.

Findings13

Statuses are the security firm’s own, from its report.

SeverityOpenAcknowledgedFixed
Critical000
High100
Medium000
Low408
LowEmit Event Pattern InconsistencyFixed

Throughout the codebase when emitting events for addresses changing, the convention is to first emit the event with the old address being the current state of the variable and the new address being the input, and then afterwards setting the variable to the input.

LowLanguage Is Not ConsistentFixed

The `PrimeLiquidityProvider` contract now inherits `TimeManager` to allow the use of block numbers or timestamps. As such the language referring to block numbers should now reflect that it is a block number or possibly a timestamp.

LowNaming Convention InconsistencyFixed

Other external functions that have the `onlyAdmin` modifier do not include a leading underscore.

LowNot All External Facing Functions Are RepresentedFixed

The interface for `IPrime` does not include all external facing functions.

LowSpecific Imports Not Consistently UsedFixed

Many of the added files use specific imports, however, some import the entire file.

LowTypos and InconsistenciesFixed

### TimeManager.sol - Function `getBlockNumberOrTimestamp()` includes the following comment above its declaration: "This exists mainly for inheriting test contracts to stub this result." This contract and this function specifically will be used in production-level contracts. ### Prime.sol - The comment above error `InvalidTimestamp` misspells the word "invalid" as "invalud."

LowUnnecessary Check in `redeemVerify()`Fixed

The following check is made in the newly added `redeemVerify()` logic of the `Comptroller` contract for Isolated Pools: ```solidity if (redeemAmount == 0 && redeemTokens == 0) revert NoRedeemTokensOrAmount(); ``` This check requires one of `redeemAmount` or `redeemTokens` is nonzero. The check is unnecessary because the logic within the function `_redeemFresh()` of the Isolated Pools VToken contract ensures that either both values `redeemAmount` and `redeemTokens` are positive, or else the function call reverts (justification for this claim is outlined below). In particular, the check in `redeemVerify()` alone would not prevent the case where `redeemTokens` is 0 while `redeemAmount` is positive, which is the case prevented in the core pool's `redeemVerify()` function: ```solidity require(redeemTokens != 0 || redeemAmount == 0, "redeemTokens zero"); ``` The justification below also shows why the check done in the Core pool `redeemVerify()` function is unneeded for the Isolated Pool `redeemVerify()` function - namely, that there is never a case where `redeemTokens` is 0 while `redeemAmount` is positive. --- ### Justification The `_redeemFresh()` function of the Isolated Pools `VToken` contract ensures that `redeemAmount` and `redeemTokens` are either both positive, or the function reverts. The input parameters `redeemTokensIn` and `redeemAmountIn` provided by the user are required to be values where at least one is zero. **Case 1 `redeemTokensIn` is 0 and `redeemAmountIn` is positive.** Then `redeemTokens = div_(redeemAmountIn, exchangeRate)`. If `exchangeRate > redeemAmountIn`, then `redeemTokens` is 0. If that is true, then `redeemAmount = mul_ScalarTruncate(exchangeRate, redeemTokens); = 0` where the `redeemTokens` value of 0 is used, so the check that ```solidity if (redeemAmount == 0) { revert("redeemAmount is zero"); } ``` will cause a revert. If `redeemTokens` is set to a positive value, then either `redeemAmount` is positive or 0. If `redeemAmount` is 0, then a revert will occur for the same reason above, so necessarily, both values will be positive if used within the `redeemVerify()` function call at the end. **Case 2 `redeemAmountIn` is 0 and `redeemTokensIn` is positive.** Then `redeemTokens = redeemTokensIn > 0` and `redeemAmount = mul_ScalarTruncate(exchangeRate, redeemTokens)`. If `redeemAmount` is zero, then the check outlined above will cause a revert so that both values will be positive if used within the `redeemVerify()` function call at the end. **Case 3 both `redeemTokensIn` and `redeemAmountIn` are 0.** Then `redeemTokens = div_(redeemAmountIn, exchangeRate) = 0` and consequently `redeemAmount` will be 0 (like in case 1), causing a revert.

LowWrong String For Access Allowed CheckFixed

The input `comptroller` was added to the function `addMarket()`, which is controlled by the ACM. However, the input string for `_checkAccessAllowed()` does not include the new address parameter.

Contracts in scope

No deployed address is recorded for this audit.

The report names a repository or files. Open the report to see its scope.

Repository and files the report names (14)

  • contracts/oracles/BinanceOracle.sol
  • contracts/oracles/ChainlinkOracle.sol
  • contracts/Tokens/Prime/IPrime.sol
  • contracts/Utils/TimeManager.sol
  • contracts/Tokens/Prime/PrimeLiquidityProvider.sol
  • contracts/Tokens/Prime/PrimeStorage.sol
  • contracts/Tokens/VAI/VAIController.sol
  • contracts/ComptrollerStorage.sol
  • contracts/Tokens/Prime/Interfaces/IPrime.sol
  • contracts/Tokens/VAI/VAIControllerStorage.sol
  • contracts/oracles/ArbiChainlinkOracle.sol
  • contracts/Comptroller.sol
  • contracts/Tokens/Prime/Prime.sol
  • contracts/VToken.sol

Part of Venus Protocol’s security record

Venus Protocol
Audits67 audits by 7 firmsLast audit Sep 2025, by Quantstamp.
Critical findingsNo open critical findingsAcross the 67 reports, 4 critical findings were reported. Each is marked fixed by the firm that reported it.
IncidentIncident 12 May 2022Source: De.Fi incident database.
Open Venus Protocol’s security record

Security firm

CertiK

1,045 projects reviewed · 1,376 reports · latest May 2025

See CertiK’s audits

Something 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