Back to case studies

Canonic Smart Contract Audit

8 min read
Canonic Smart Contract Audit by FailSafe

Audit Overview

Client

Canonic

Blockchain

MegaETH (L2)

Service

Smart Contract Security Audit

Audit Period

January 18 – February 4, 2026

Scope

MAOB, CLP Vault, OracleAdapter

Repository

github.com/0xnerdz/canonic-contracts

About Canonic

Canonic is a Midpoint Anchored Order Book (MAOB) DeFi protocol deployed on MegaETH, a high-performance Layer 2. The protocol enables on-chain limit order trading with prices anchored to discrete basis-point rungs around an oracle-provided midprice. This is accompanied by a Concentrated Liquidity Provider (CLP) vault for automated market making, giving liquidity providers a structured way to deploy capital across the order book.

The MAOB architecture is a novel approach to on-chain trading—rather than a traditional AMM curve, it uses discrete price rungs that sit at fixed basis-point intervals from the oracle midprice. This design offers tighter spreads and more capital-efficient liquidity provisioning, but it also introduces unique security considerations around oracle trust, rung-level economics, and pause state management that required thorough analysis.

Summary of Findings

Our review identified eight security findings across the contract suite: seven medium and one low severity. Six findings have been resolved, and two were acknowledged as intended design or known limitations.

SeverityTotalResolvedAcknowledged
Medium761
Low11
Total862
Canonic - FailSafe Security Audit Report

Key Findings

Malicious Oracle Feed Configuration

MediumResolved

A privileged attack vector requiring a compromised OracleAdapter owner (e.g., leaked private key, phishing, insider threat). The owner could immediately replace legitimate price feeds with a malicious contract via setFeedAdvanced() —with no timelock delay and no validation that the new feed returns reasonable prices. A compromised key could reprice the entire MAOB order book and drain 100% of protocol TVL in as few as two transactions.

Resolution: Implemented a timelock controller wrapping OpenZeppelin's TimelockController requiring a delay for all admin actions. A pauseGuardian role can pause instantly for emergencies, but only the timelock can unpause—preventing guardian abuse.

Dust Rung Griefing

MediumResolved

A creative asymmetric griefing vector. If minQuoteMaker is configured too low, an attacker can spam tiny dust orders across all 64 rungs with a single transaction. Every subsequent taker must iterate through each dusty rung, performing expensive Fenwick tree updates (~50–100k gas each)—causing 10–20x gas amplification on every legitimate trade. The attacker spends $1,000 in gas but causes $10,000+ in aggregate damage to protocol users.

Resolution: Added a new minQuotePerRung parameter to all taker functions. Rungs with liquidity below this threshold are automatically skipped, removing the gas amplification burden from takers and making dust attacks economically ineffective.

Withdrawal Fee Dilution

MediumResolved

A subtle order-of-operations flaw in the CLP vault's withdrawal fee mechanism. Fee shares are burned before calculating the payout, but the payout uses the post-burn supply as its denominator—allowing withdrawing users to recapture a portion of their own burned fee. The effective fee follows Nominal Fee x (1 - userShareOfPool), meaning a whale owning 99% of a vault pays an effective fee of just 0.1% instead of the configured 10%.

Resolution: Introduced a netShares variable to track shares after fee deduction. Payout is now calculated using the original supply as the denominator, ensuring the effective fee rate matches the configured withdrawalFeeBps regardless of pool share.

Asymmetric Pause State

MediumResolved

The MAOB contract had independent pause controls for makers and takers, enabling problematic asymmetric states with no time bounds or reason codes. The most dangerous combination—“takers paused, makers active”—allows the order book to be reshaped without market clearing, creating conditions where insiders could seed favorable orders before execution resumes. It also breaks standard market maker patterns where atomic cancel-and-replace transactions would partially fail, leaving stale orders executable by takers.

Resolution: Replaced the two boolean flags with a constrained MarketState enum: Active, Halted (both paused), and UnwindOnly (makers paused, takers active with 1-hour auto-expiry). The dangerous “takers paused, makers active” combination is explicitly excluded. Reason codes are required for all state transitions.


Canonic's Security Posture

The Canonic team demonstrated a strong commitment to security throughout the engagement. Of the eight findings identified, six were resolved with high-quality fixes, while two were thoughtfully acknowledged as intended design decisions with reasonable operational mitigations in place.

Particularly noteworthy was the team's approach to the oracle feed finding—rather than a minimal fix, they implemented a comprehensive timelock governance model with a dedicated pause guardian role, demonstrating defense-in-depth thinking. The constrained emergency state machine for pause functionality also went beyond our recommendation, showing mature security architecture.

As Canonic prepares for launch on MegaETH, the protocol is in a strong position with all medium-severity findings resolved and a governance architecture that provides appropriate safeguards for admin operations.

FailSafe's Closing Remarks

Canonic's MAOB architecture represents a novel approach to on-chain order book design, and the audit reflected the complexity of building something new. The findings spanned oracle trust boundaries, economic incentive alignment, gas economics, and governance state management—a breadth that speaks to the depth of our review process.

We look forward to continuing our partnership with Canonic as they launch on MegaETH and evolve their protocol. Security is not a one-time event but an ongoing discipline, and FailSafe is committed to being a long-term security partner for the team.

Looking for an Elite Audit?

Whether you're building a novel DeFi protocol, an order book, or a liquidity vault system, our team combines deep technical expertise with real-world attack simulation to uncover the vulnerabilities that matter.

Contact Our Security Team

Ready to Secure Your Protocol?

Get in touch with our security experts for a comprehensive audit.

Learn About Smart Contract Audits