Venus - VAI Peg

CertiKFiles named in the report

Audit

Part of CertiK’s series

CertiK reviewed Venus Protocol (Venus - VAI Peg) on 24 May 2023: 14 findings, 1 critical; 12 marked fixed, 2 open.

1 critical finding, fixed
Open the reportOpen Venus Protocol’s security record

Report hosted on skynet.certik.com.

Trustblock does not review code.

Findings14

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

SeverityOpenAcknowledgedFixed
Critical001
High200
Medium002
Low009
CriticalNo Approval Given For `safeTransferFrom()`Fixed

In the function `swapVAIForStable()`, `safeTransferFrom()` is used to transfer the `stableTknAmountUSD` from `address(this)` to the `receiver`. However, the contract does not give approval to itself, so that this will cause a revert preventing `swapVAIForStable()` from being called successfully.

Medium`swapVAIForStable()` Does Not Meet SpecificationFixed

The function `swapVAIForStable()` is supposed to swap VAI for the input `stableTknAmount` of stable Token. However, it swaps VAI for the `stableTknAmountUSD` instead. This does not meet the specification outlined in this proposal: [https://community.venus.io/t/proposal-deploy-the-vai-peg-stability-module-and-supply-liquidity-to-pancakeswap-for-the-vai-usdt-pair/3461](https://community.venus.io/t/proposal-deploy-the-vai-peg-stability-module-and-supply-liquidity-to-pancakeswap-for-the-vai-usdt-pair/3461).

MediumPossible To Be Unable To Repay Or Liquidate BorroFixed

When VAI is swapped for stable tokens, if `vaiMinted` is zero it will burn VAI that has been borrowed. This can cause the total amount of VAI in circulation to be less than the amount of VAI borrowed, which can make it impossible to repay or liquidate all the borrows. Note that this is possible because if USDT is over peg more VAI is burned than USDT is transferred out and if USDT is under peg less VAI is minted than USDT is transferred in.

Low`ReentrancyGuardUpgradeable` Is Not InitializedFixed

Contract `PegStability` extends ReentrancyGuardUpgradeable, while `__ReentrancyGuard_init()` is not called in the initialize function. Generally, the initializer function of an upgradeable contract should always call all the initializer functions of the contracts that it extends.

LowAssumption On Same DecimalsFixed

Note that on BSC all tokens USDT, USDC, and VAI have 18 decimals so there is no issue with the logic. However, if stable tokens with other decimals are used, then the logic must be adjusted to account for the difference in decimals.

LowComparison to Boolean ConstantFixed

Boolean constants can be used directly and do not need to be compared to true or false. ```solidity=85 require(isPaused == false, "Contract is paused."); ``` --- ```solidity=247 require(isPaused == false, "PSM is already paused."); ``` --- ```solidity=259 require(isPaused == true, "PSM is not paused."); ```

LowFee Amount Not Checked In InitializerFixed

The input `feeIn_` and `feeOut_` of `initialize()` function are not checked to be less than `1000`.

LowIncorrect Old Price OracleFixed

In the function `setPriceOracle()`, the `oldPriceOracleAddress` is set to be the input `priceOracle_`. However, it should be the current `priceOracle`.

LowInefficient Event ParameterFixed

The event `VaiMintCapChanged` uses the storage variable `vaiMintCap`. However, gas can be saved by using `vaiMintCap_`.

LowPossible Underflow RevertFixed

As VAI can also be minted by borrowing against assets, there is more VAI in circulation than the value stored in `vaiMinted`. If a user attempts to call `swapVAIForStable()` so that the `stableTknAmountUSD` is greater than `vaiMinted` and `vaiMinted` is nonzero, then the call will revert with a non-descriptive error.

Show 2 more
LowTypos And InconsistenciesFixed

In the function `swapVAIForStable`, "enough" is misspelled as "enought". The error message "Amount must be greater than zero" does not use a period as all other error messages do.

LowUnchecked Blocks Can Optimize ContractFixed

In the function `swapStableForVAI`, the check ```solidity require(vaiMinted + actualTransferAmtInUSD <= vaiMintCap, "VAI mint cap reached."); ```` is preformed before incrementing `vaiMinted` by the `actualTransferAmtInUSD`. As the check adds `vaiMinted` and `actualTransferAmtInUSD` it already checks for overflow. Thus it does not need to be checked when incrementing.

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 (1)

  • contracts/PegStability/PegStability.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