**Note:** Since the audit, the client rebranded "Marginly" to "Levva", hence the report refers to the protocol as Marginly. Marginly is a margin trading and derivatives platform that allows users to provide liquidity to the protocol while gaining interest, deposit collateral, open long/short positions, and liquidate unhealthy positions to ensure overall system health. In this audit, we reviewed the changes to the core contracts that were added since [our last audit report](https://github.com/eq-lab/marginly/blob/main/audit/Quantstamp-marginly-final-report.pdf) of the codebase and the code additions for the added oracles. The changes to the core contract mainly revolve around the feature of adding the possibility to flip an existing position within one transaction, which is achieved with the added `sellBaseForQuote()` and `sellQuoteForBase()` functions, as well as some changes to the `receivePosition()` function. Furthermore, in addition to the previously supported UniswapV3 oracle, AlgebraFinance, Pyth and Chainlink are now supported as possible sources for on-chain prices. The main finding of the audit revolves around an incorrect assumption in the Pyth and Chainlink integration that both base token and quote token share the same amount of decimals (MAR-2-1). Other, minor issues around the oracle integrations were identified in MAR-2-3, MAR-2-7 and MAR-2-10. Furthermore, the `receivePosition()` function is currently missing accounting for the deleveraging aspect of the protocol (MAR-2-2). The audit team continues to find the codebase to be of high quality and was also pleased to see that the test suite benchmarks having improved since the last audit to nearly perfect metrics. **Update Fix-Review** All issues have been either fixed or acknowledged. Tests have been added to validate the fixes. The Marginly team has been very communicative and conscientious in the audit and fix-review process.
Low | Medium | High | Critical | Total | |
---|---|---|---|---|---|
Not fixed | 2 | - | - | - | 2 |
Fixed | 4 | 3 | 1 | - | 8 |
Total | 6 | 3 | 1 | 0 | 10 |
# | File Name |
---|---|
1 | packages/periphery/contracts/oracles/** |
2 | packages/contracts/contracts/** |