RariCapital V2

QuantstampFiles named in the report

Quantstamp reviewed Rari Capital (RariCapital V2) on 20 Aug 2020: 41 findings, 0 critical; 18 marked fixed, 18 acknowledged, 5 open.

No open critical findings
Open the reportOpen Rari Capital’s security record

Report hosted on certificate.quantstamp.com.

Trustblock does not review code.

Findings41

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

SeverityOpenAcknowledgedFixed
Critical000
High003
Medium114
Low41711
MediumGas Usage / `for` Loop ConcernsOpen

Gas usage is a main concern for smart contract developers and users, since high gas costs may prevent users from wanting to use the smart contract. Even worse, some gas usage issues may prevent the contract from providing services entirely. For example, if a `for` loop requires too much gas to exit, then it may prevent the contract from functioning correctly entirely. The following instances have been found in the code base: 1. The nested `for`-loops inside `upgradeFundManager` could reach an out-of-gas error if the total number of pools for all currencies becomes large enough. This would prevent upgrades of `RariFundManager.sol`. 1. The nested `for`-loops inside `upgradeFundContoller` could reach an out-of-gas error if the total number of pools for all currencies becomes large enough. This would prevent upgrades of `RariFundController.sol`. 1. The loop inside `setFundManager` could reach an out-of-gas error if the number of supported currencies was too high. 1. The `withdrawAndExchange` function could reach an out-of-gas error if the number of `inputCurrenyCodes` was too high. 1. `getAllBalances` in `RariFundController` contains nested loops and a call to potentially expensive external functions inside the inner loop. 1. `marketSell0xOrdersFillOrKill` contains a loop with calls to to potentially expensive external functions and could reach an out-of-gas error if the number of orders was too high. 1. `checkLossRateLimit` contains a loop and could reach an out-of-gas error if the `_lossRateHistory` was too long. 1. `cachePoolBalances` contains nested loops and could reach an out-of-gas error if the number of supported currencies and number of pools was too high. 1. The loop inside `_withdrawFrom` could reach an out-of-gas error if the number of pools for a given currency code was too high. 1. The `exchangeAndDeposit` and the `withdrawAndExchange` functions in `RariFundProxy.sol` use `transfer()` instead of `call.value()` on L203 and L259, respectively. This might have issues when gas cost changes in the future. This has happened in the Istanbul hard fork, which increased the cost such that several existing smart contracts which were using `transfer()` broke due to out-of-gas errors. We anticipate that gas cost will continue to change in the future. 1. The `marketSell0xOrdersFillOrKill` function in `RariFundController.sol` uses `transfer()` instead of `call.value()` on L524. This might have issues when gas cost changes in the future. 1. The upgrade approach in `initNetDeposits()` might not be feasible if there are a significant number of users. Consider proxy storage approaches instead.

LowAllowance Double-Spend ExploitOpen

As it presently is constructed, the contract is vulnerable to the [allowance double-spend exploit](https://github.com/OpenZeppelin/openzeppelin-solidity/blob/b4f87bb8fc25fb07f73099701e39e167a3d36465/contracts/token/ERC20/ERC20.sol#L71-L78), as with other ERC20 tokens.

LowExperimental features should not be used on Mainnet deploymentsOpen

Until solidity `0.6.0`, the `ABIEncoderV2` feature is still technically in experimental state. Although there are no known security risks associated with it, these features should be used judiciously.

LowMissing input argument validationOpen

The following functions are missing validation of input arguments: 1. `upgradeFundController` does not validate the input parameter `newContract`, which could lead to sending all funds to any EOA. **Fixed** 1. `setFundManager` does not validate the input parameter `newContract`, which could lead to setting the fund manager to any EOA. 1. `setFundController` does not validate the input parameter `newContract`, which could lead to setting the fund controller to any EOA. 1. `authorizeFundManagerDataSource` does not validate the input parameter `authorizedFundManagerDataSource`, which could lead to setting a data source value of `0x0` for the fund manager. 1. `setFundToken` does not validate the input parameter `newContract`, which could lead to setting the token to any EOA. 1. `setFundProxy` does not validate the input parameter `newContract`, which could lead to setting the proxy to any EOA. 1. `setGsnTrustedSigner` does not validate the input parameter `newAddress`, which could lead to setting the fund manager to `0x0`. 1. `setInterestFeeRate()` should ensure that the rate is `<= 10**18`. **Fixed**

LowOff-by-one errorOpen

There is a recurring condition that appears in 6 methods inside the `RariFundToken` contract, namely: `if (address(rariGovernanceTokenDistributor) != address(0) && block.number > rariGovernanceTokenDistributor.distributionStartBlock())`, which appears in the following functions: `transfer`, `transferFrom`, `mint`, `burn`, `burnFrom`and ` fundManagerBurnFrom`. The second clause in the aforementioned condition is off-by-one, because it only allows claiming RGT one block after the distribution has started.

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

  • Account.sol
  • SoloMargin.sol
  • RariFundManager.sol
  • CompoundPoolController.sol
  • contracts/external/enzyme/ComptrollerLib.sol
  • RariFundProxy.sol
  • RariFundPriceConsumer.sol
  • IBasketManager.sol
  • IMasset.sol
  • contracts/external/dydx/lib/Account.sol
  • contracts/external/alpha/Bank.sol
  • RariGovernanceTokenVestingV2.sol
  • contracts/external/dydx/SoloMargin.sol
  • contracts/RariFundProxy.sol
  • MStablePoolController.sol
  • Actions.sol
  • RariGovernanceToken.sol
  • contracts/external/dydx/Operation.sol
  • Migrations.sol
  • contracts/external/compound/CEther.sol
  • RariGovernanceTokenVesting.sol
  • RariFundController.sol
  • Getters.sol
  • ZeroExExchangeController.sol
  • contracts/external/keeperdao/IKToken.sol
  • MStableExchangeController.sol
  • IVault.sol
  • contracts/lib/pools/DydxPoolController.sol
  • contracts/external/dydx/lib/Types.sol
  • IRariFundManager.sol
  • contracts/lib/pools/CompoundPoolController.sol
  • MassetStructs.sol
  • contracts/external/aave/AToken.sol
  • IBoostedSavingsVault.sol
  • contracts/lib/pools/AlphaPoolController.sol
  • contracts/RariFundController.sol
  • Types.sol
  • YVaultPoolController.sol
  • AToken.sol
  • contracts/external/keeperdao/ILiquidityPool.sol
  • contracts/external/aave/LendingPool.sol
  • contracts/Migrations.sol
  • contracts/lib/pools/EnzymePoolController.sol
  • contracts/lib/exchanges/ZeroExExchangeController.sol
  • RariGovernanceTokenDistributor.sol
  • IRariFundToken.sol
  • RariGovernanceTokenDistributorV2.sol
  • contracts/RariFundManager.sol
  • contracts/external/dydx/lib/Actions.sol
  • contracts/lib/pools/KeeperDaoPoolController.sol
  • contracts/lib/pools/AavePoolController.sol
  • contracts/interfaces/IRariGovernanceTokenDistributor.sol
  • LendingPool.sol
  • contracts/external/dydx/Getters.sol
  • ISavingsContract.sol
  • RariFundToken.sol
  • CErc20.sol
  • AavePoolController.sol
  • Operation.sol
  • DydxPoolController.sol
  • IRariGovernanceTokenDistributor.sol
  • RariGovernanceTokenUniswapDistributor.sol
  • contracts/RariFundToken.sol

Part of Rari Capital’s security record

Rari Capital
Audits3 audits by 1 firmLast audit Jul 2021, by Quantstamp.
Critical findingsNo open critical findingsAcross 3 reports.
IncidentIncident 7 May 2021Source: De.Fi incident database.
Open Rari Capital’s security record

Security firm

Quantstamp

236 projects reviewed · 332 reports · latest Oct 2026

See Quantstamp’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