- Home
- Security Audits
- Velvet Capital
Web3 · Smart Contract Audit
Velvet Capital Security Audit
softstack completed a smart contract audit of Velvet Capital's Core v3 Contracts in July 2024, reporting 50 findings (2 high, 4 medium, 21 low and 23 informational), of which 47 were resolved or mitigated before the final report. The full report is published in the softstack public audit archive.
Key facts
- Client
- Velvet Capital
- Completed
- Languages
- Solidity
- Commit
849629b1aacf- Market cap
- $26M as of 2026-09-30
About the project
Velvet Capital runs an onchain trading terminal for spot trades, perpetual futures and yield strategies executed from a trader's own wallet. It routes through aggregated DEX liquidity on chains including Ethereum, Solana, Base, BNB Chain and Hyperliquid, with MEV protection. A social layer tracks wallets and an AI assistant supports token research. The company is backed by YZi Labs.
Case study
Scope
Source repositorygithub.com/Velvet-Capital/v3-contractComponents reviewed
1 module- See the published report for the file list
Findings
47 of 50 findings resolved before the final report.
| ID | Title | Severity | Status |
|---|---|---|---|
6.2.1 | Incorrect Parameter Order in Function Call In the call to the calculateProtocolAndManagementFeesToMint function, the parameters lastChargedProtocolFee and lastChargedManagementFee are swapped. | High | fixed |
6.2.2 | Incorrect updatedAt Value Retrieval In the latestRoundData function where the latest price data for a token pair is retrieved, the updatedAt value is expected to be the second to last value returned by the latestRoundData function from the AggregatorV2V3Interface. | High | fixed |
6.2.3 | Division by Zero in PortfolioCalculations Contract The PortolfioCalculations contract contains a function getUserAmountToDeposit that calculates the lowest amount possible to deposit to get the exact ratio of token amounts in a portfolio. | Medium | fixed |
6.2.4 | Incorrect Calculation Due to Mismatched Array Lengths in PortfolioCalculations Contract The PortfolioCalculations contract contains a function getUserAmountToDeposit that calculates the lowest amount possible to deposit to get the exact ratio of token amounts in a portfolio. | Medium | fixed |
6.2.5 | Division Before Multiplication in FeeCalculations and PortfolioCalculations Contracts The FeeCalculations and PortolfioCalculations contracts contain functions that perform a multiplication on the result of a division. | Medium | fixed |
6.2.6 | Potential Issue with UUPSUpgradeable in _upgrade Function Due to Outdated OpenZeppelin Library The _upgrade function in the PortfolioFactory contract uses the UUPSUpgradeable contract to upgrade proxies. | Medium | fixed |
6.2.7 | Division by Zero in PortfolioCalculations Contract The PortolfioCalculations contract contains a function getUserAmountToDeposit that calculates the lowest amount possible to deposit to get the exact ratio of token amounts in a portfolio. | Low | fixed |
6.2.8 | Use Ownable2Step for Safer Ownership Transfer in VelvetSafeModule The VelvetSafeModule contract currently uses the transferOwnership function from the Ownable contract, which transfers ownership in a single step. | Low | fixed |
6.2.9 | Potential Denial of Service (DoS) in whitelistUser Function Due to Lack of User Limit The whitelistUser function in the UserWhitelistManagement contract allows an arbitrary number of users to be whitelisted in a single transaction. | Low | fixed |
6.2.10 | Missing Event Emission in PriceOracleAbstract.updateOracleExpirationThreshold Function The PriceOracleAbstract contract contains a function updateOracleExpirationThreshold that updates the oracleExpirationThreshold state variable. However, this function does not emit an event when the state variable is updated. | Low | fixed |
6.2.11 | Deprecated Library Function Usage in AccessController The AccessController contract uses the deprecated _setupRole function from the OpenZeppelin AccessControl library. | Low | fixed |
6.2.12 | Incompatibility with Solidity 0.8.20 Due to PUSH0 Opcode The contracts are compiled with Solidity version 0.8.23, which defaults to targeting the Shanghai EVM version. This includes the new PUSH0 opcode introduced in Solidity 0.8.20. The PUSH0 | Low | fixed |
6.2.13 | Missing Storage Gap in TokenBalanceLibrary for Upgradeable Contracts The TokenBalanceLibrary contract does not include a storage gap, which is essential for maintaining storage compatibility in upgradeable contracts. | Low | acknowledged |
6.2.14 | Non-compliance with Solidity Function Order in TokenBalanceLibrary The TokenBalanceLibrary contract does not follow the recommended function order as specified in the Solidity style guide. | Low | fixed |
6.2.15 | Potential Division by Zero and Rounding Issues in calculateMintAmount and getDepositToVaultBalanceRatio Functions The calculateMintAmount and getDepositToVaultBalanceRatio functions in the contract perform divisions without checking for zero values in the input parameters. This can lead to the functions reverting when zero is passed as an argument. | Low | fixed |
6.2.16 | Inconsistent Handling of Deadlines in CooldownManager Contract The CooldownManager contract uses a timestamp comparison to enforce cooldown periods. According to EIP-2612, signatures used on exactly the deadline timestamp should be allowed. | Low | fixed |
6.2.17 | Public Functions Not Used Internally Should Be Marked as External In the codebase, several functions are marked as public but are not used internally within their respective contracts. According to best practices, functions that are not called internally should be marked as external instead of public. | Low | fixed |
6.2.18 | Events Missing indexed Fields in Multiple Contracts Several events across multiple contracts are missing indexed fields. Indexing event fields makes them more quickly accessible to off-chain tools that parse events. | Low | fixed |
6.2.19 | Empty Blocks in _authorizeUpgrade Functions Several _authorizeUpgrade functions across multiple contracts contain empty blocks. Empty blocks do not contribute to the functionality of the contract and can be removed to improve code readability and maintainability. | Low | fixed |
6.2.20 | Internal Functions Called Only Once Should Be Inlined Several internal functions across multiple contracts are called only once. Instead of separating the logic into a separate function, consider inlining the logic into the calling function. | Low | fixed |
6.2.21 | Unused Custom Errors in Multiple Contracts Several custom errors are defined but not used in the codebase. It is recommended to remove these unused custom errors to improve code readability and maintainability. Unused code can lead to confusion and potential errors in the future. | Low | fixed |
6.2.22 | Missing Event Emission in _updatePriceOracle Function OracleManagement contract The _updatePriceOracle function in the contract updates the priceOracle address but does not emit an event to log this change. | Low | fixed |
6.2.23 | Missing Check for Identical Protocol Fee in updateProtocolFee and updateProtocolStreamingFee Functions in ProtocolFeeManagement contract The updateProtocolFee and updateProtocolStreamingFee functions in the contract update the protocol fee and protocol streaming fee, respectively. However, these functions do not check if the new fee is the same as the current fee. | Low | fixed |
6.2.24 | Missing Check for Identical Treasury Address in updateVelvetTreasury Function in ProtocolTreasuryManagement contract The updateVelvetTreasury function in the contract updates the velvetTreasury address but does not check if the new address is the same as the current address. | Low | fixed |
6.2.25 | Missing Minimum Cooldown Period Check in setCoolDownPeriod Function The setCoolDownPeriod function in the SystemSettings contract allows the protocol owner to set a new cooldown period. However, there is no check to ensure that the new cooldown period is above a minimum acceptable value. | Low | fixed |
6.2.26 | Prevent Division by Zero in getDepositToVaultBalanceRatio function In the getDepositToVaultBalanceRatio function, division by zero can occur if tokenBalance is zero, which could lead to unexpected reverts. | Low | fixed |
6.2.27 | Missing Cooldown Period Check for Deposit The multiTokenDeposit function lacks a cooldown period check, which is present in the multiTokenWithdrawal function. | Low | acknowledged |
6.2.28 | Missing inheritance Some contracts are missing inheritance from their respective interfaces or base contracts. | Informational | fixed |
6.2.29 | Too Many Digits The contract FeeConfig contains a literal with too many digits, making it difficult to read and review. | Informational | fixed |
6.2.30 | Unused Imports Importing files that are not used in the contract likely indicates a mistake. These unused imports should be removed to avoid confusion and improve code clarity. | Informational | fixed |
6.2.31 | Non-compliance with Solidity Style Guide in AssetManagerCheck and OwnableCheck Contracts The AssetManagerCheck and OwnableCheck contracts does not follow the recommended ordering of elements as specified in the Solidity style guide. | Informational | fixed |
6.2.32 | Missing NatSpec Comments in enableSolverHandler Function The enableSolverHandler function in the SolverManagement contract lacks NatSpec comments, which are essential for providing clear documentation for both developers and end users. | Informational | fixed |
6.2.33 | Non-compliance with Solidity Naming Convention in MathUtils Library The MathUtils library contains internal functions that do not follow the Solidity style guide | Informational | fixed |
6.2.34 | Redundant Return Statement in getTokenBalancesOf Function The getTokenBalancesOf function in the TokenBalanceLibrary contract defines a named return variable vaultBalances. | Informational | fixed |
6.2.35 | Use Enums for Array Indices Instead of Numeric Literals in PortfolioCalculations Contract The PortolfioCalculations contract uses numeric literals to reference array indices, which can lead to errors and reduce code readability. | Informational | acknowledged |
6.2.36 | Potential Issues with abi.encodeWithSignature in GnosisDeployer Contract The GnosisDeployer contract uses abi.encodeWithSignature to encode function calls. This approach is prone to errors such as typos in the function signature and incorrect parameter types. | Informational | fixed |
6.2.37 | Use bytes.concat Instead of abi.encodePacked in GnosisDeployer Contract The GnosisDeployer contract uses abi.encodePacked for concatenating bytes. Solidity version 0.8.4 introduces bytes.concat, which is a safer and more efficient method for concatenating bytes. | Informational | fixed |
6.2.38 | Superfluous Initialization of Loop Variable in getTokenBalancesOf Function The getTokenBalancesOf function in the TokenBalanceLibrary contract initializes the loop variable i to zero explicitly. In Solidity, the default value for uninitialized variables is zero, making this explicit initialization redundant. | Informational | fixed |
6.2.39 | Optimization Opportunity in _disableInitializers Function The _disableInitializers function in the contract uses an older version of the OpenZeppelin library. | Informational | fixed |
6.2.40 | Typographical Error in Smart Contract File Name PortolfioCalculations.sol The smart contract file intended to be named PortfolioCalculations.sol is mistakenly titled PortolfioCalculations.sol. This typographical error in the file name could lead to several potential issues in a project. | Informational | fixed |
6.2.41 | Unnecessary Variable Usage in _updateWeights Function In the _updateWeights function, the _sellTokens array is assigned to the sellToken variable within the loop. However, the _sellTokens array is accessed directly again in the subsequent line. | Informational | fixed |
6.2.42 | Missing Function Parameters in NatSpec Documentation There are multiple functions missing documentation for their parameters in the NatSpec comments. This lack of documentation can lead to confusion for users and developers about the purpose and usage of the parameters. | Informational | fixed |
6.2.43 | Missing NatSpec Documentation for Interfaces Several contracts are missing NatSpec documentation for their functions. NatSpec comments are essential for providing clear, standardized documentation for functions, making them easier to understand and use. | Informational | fixed |
6.2.44 | Incorrect Documentation In the claimRewardTokens function, the NatSpec documentation for the rewardTokenBalanceAfter variable incorrectly states "all Tokens", which is misleading as it only fetches the balance of a specific token. | Informational | fixed |
6.2.45 | Inconsistent Implementation of updateTokens Function in IRebalancing and Rebalancing Contracts The updateTokens function in the IRebalancing interface is documented and implemented differently compared to the updateTokens function in the Rebalancing contract. | Informational | fixed |
6.2.46 | Duplicate NatSpec Documentation for getUserAmountToDeposit Function The getUserAmountToDeposit function has duplicate NatSpec documentation comments. This redundancy can clutter the code and potentially confuse developers and users. | Informational | fixed |
6.2.47 | Gas Optimization for setEmergencyPause Function The setEmergencyPause function can be optimized for gas efficiency. The _state parameter is always passed as true when calling setProtocolPause(_state) initially, and always passed as false when calling setProtocolPause(_state)… | Informational | fixed |
6.2.48 | Use of Constant ONE_ETH_IN_WEI for Gas Efficiency In the calculateMintAmount function, the value 10 ** 18 is used, which can be replaced by the constant ONE_ETH_IN_WEI defined above. Using a constant can save gas and make the code more readable and maintainable. | Informational | fixed |
6.2.49 | Unused Named Returns The functions getVaultValueInUSD and _burnWithdraw have unused named returns. Named returns can improve readability and gas consumption, but if not used consistently throughout the function, they may introduce confusion and redundancy. | Informational | fixed |
6.2.50 | Assignment of tokensLength Variable Earlier in initToken Function The initToken function checks the length of _tokens multiple times. Assigning the length to the tokensLength variable earlier can improve readability and efficiency by using this variable consistently throughout the function. | Informational | fixed |
About this engagement
A smart contract audit reviews on-chain code for flaws an attacker could exploit. Engineers trace how assets move through the contracts, check who can call privileged functions, and test the arithmetic, external calls and upgrade paths. Each finding is rated by severity, and fixes are re-checked before the final report.
How softstack runs smart contract auditsMethodology
Review process
Scoping and threat modelling
The commit hash is frozen and the attack surface is mapped: asset flows, trust assumptions, privileged roles and the external systems the code depends on.
Automated analysis
Static analysers sweep the full codebase to surface known weakness patterns, unreachable states and deviations from established conventions.
Manual code review
Independent engineers read the code line by line, concentrating on business logic, access control, arithmetic and the handling of external calls.
Adversarial testing
Property-based fuzzing and invariant tests attack the assumptions the protocol relies on, targeting states that ordinary unit tests never reach.
Reporting
Every finding is documented with a severity rating, its impact, the steps to reproduce it and a concrete remediation the team can act on.
Remediation verification
Submitted fixes are re-reviewed against the original finding, and the final report records the resolved state of each one.
Standards and references
- SWC RegistrySmart Contract Weakness Classification
- CWECommon Weakness Enumeration
FAQ
Velvet Capital was audited by softstack GmbH, a German Web3 security and software company based in Flensburg and certified to ISO/IEC 27001 by TÜV SÜD. softstack completed a smart contract audit for Velvet Capital in July 2024. The full report is linked on this page and published in the softstack public audit archive.
The review reported 50 findings: 2 high, 4 medium, 21 low and 23 informational. 47 of 50 were resolved or mitigated before the final report.
The review covered the code in github.com/Velvet-Capital/v3-contract at commit 849629b. The published report lists every file covered.
This report covers the code as reviewed in July 2024 at commit 849629b. Any code changed after that point is outside the reviewed scope.
Related audits
Browse all security auditsDisclaimer
This audit represents a point-in-time security assessment of the reviewed codebase and is intended for informational purposes only. While Softstack applies industry-standard security review methodologies, no audit can guarantee the absence of vulnerabilities, bugs, or other security risks. This report does not constitute financial, legal, regulatory, or investment advice, nor does it endorse the project, its business model, products, or services. Security is an ongoing process, and we strongly recommend conducting a new assessment following any material code changes or at least every 6 months to address newly emerging threats, vulnerabilities, and ecosystem developments.