CertiK reviewed Derify protocol (Derify Protocol v2) on 7 Dec 2023: 18 findings, 0 critical; 3 marked fixed, 6 acknowledged, 9 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 | 3 | 1 |
| Medium | 0 | 3 | 2 |
| Low | 9 | 0 | 0 |
In the above-mentioned contract, the address is used, however, this address is never set up which will lead to call failure as a result.
Calling a user provided address is dangerous, especially in a public function with no access control restriction. An attacker could deploy a malicious contract and use the vulnerable function to trigger a call to the malicious contract, potentially stealing user funds or causing other serious damages.
The withdraw function can be call by anyone to drain the WETH of the contract and send to any address. However, the funds were stored in the main contract. If this contract is deployed by itself, this is an issue.
The below functions do not perform any checks to ensure that the amount parameter is greater than zero. If a user calls the functions with an amount of zero, it will add unnecessary data to the storage. - function `stakingDrf()` - function `depositBondToBank()`
The `template` is serving as the underlying entity to interact with out-of-scope smart contracts. And the project relies on the correctness of swapping tokens to cover the cost of the gas used by the executor. The scope of the audit treats those out-of-scope contracts, programs as black boxes and assumes their functional correctness. However, in the real world, they can be compromised and may lead to lost or stolen assets. ```solidity address template = IDerifyExchangeModule(exchangeModule).getMarginTokenPriceFeedTemplate(protocol, marginToken); (bool success, bytes memory d) = template.delegatecall( abi.encodeWithSignature( "swapGas(uint256,address,address,address,address)", _adjustMarginTokenAmount(gasFeeAmount), protocol, marginToken, tokenWBNB, _msgSender() ) ```
--- ```solidity=80 uint256 amountVestedPerDay = amount / vestingDurationInDays; ``` The expression `amount / vestingDurationInDays` may divide by zero. Its divisor has has estimated interval [0, 9125]. --- ```solidity=299 uint256 amountVestedPerDay = grant.amount / uint256(grant.vestingDuration); ``` The expression `grant.amount / uint256(grant.vestingDuration)` may divide by zero. Its divisor has has estimated interval [0, 65535]. --- ```solidity=237 uint256 newAddedPeriodBlocks = amount / brokerValidUnitNumber; ``` The expression `amount / brokerValidUnitNumber` may divide by zero. Its divisor has has estimated interval [0, 115792089237316195423570985008687907853269984665640564039457584007913129639935]. --- ```solidity=17 margin = size * spotPrice / SPOT_PRICE_DECIMAL * CONTRACT_DECIMAL / leverage; ``` The expression `size * spotPrice / SPOT_PRICE_DECIMAL` may divide by zero. Its divisor has has estimated interval [0, 115792089237316195423570985008687907853269984665640564039457584007913129639935].
The `index` parameter in the `deleteOrderedLimitPositions()` function is redundant. The salt in the `createDerivative()` function is redundant.
When the user positions reaches the liquidation threshold, the user positions is liquidated and the order information is cleared, but the user information is not, which is not consistent with the logic of line 378. ```solidity=377 // remove trader IDerifyExchange(exchange).removeTrader(liquidateTraders[j]); ```
The linked variables assigned in the constructor can be declared as `immutable`. Immutable state variables can be assigned during contract creation but will remain constant throughout the lifetime of a deployed contract. A big advantage of immutable variables is that reading them is significantly cheaper than reading from regular state variables since they will not be stored in storage.
The report names a repository or files. Open the report to see its scope.
Repository and files the report names (17)
1,044 projects reviewed · 1,375 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