Skip to main content

๐Ÿ“ˆ Section 5: CEDEX โ€” Centralized-Decentralized Exchange


๐Ÿ“ˆ The OTCM trading interface โ€” a purpose-built Centralized-Decentralized Exchange combining Web2 order matching with Web3 settlement finality, natively supporting SPL Token-2022 Transfer Hooks.


๐Ÿ“ˆ SECTION 5: CEDEX โ€” CENTRALIZED-DECENTRALIZED EXCHANGE

๐Ÿ’ก 5.1 ๐Ÿš€ Architectural Innovation

SPLCEDEX Token-2022(Centralized-Decentralized TransferExchange) Hooks representrepresents a fundamental architecturalreimagining innovationof indecentralized blockchain-basedexchange architecture, purpose-built from inception for trading tokenized securities infrastructure, enabling execution of arbitrary smart contract code during token transfers on the Solana blockchain. This capability transforms compliance from a discretionary administrative function into an immutable, mathematically-enforced property of the token itself.

OTCM Protocol leverages Transfer Hooks to implementwithin federal securities law requirementsframeworks. Unlike existing DEX platforms that were designed for permissionless cryptocurrency trading and subsequently face irreconcilable conflicts with securities regulation, CEDEX implements compliance verification as non-discretionarya smartfoundational contractarchitectural code,constraint rather than retrofitted functionality.

This section provides comprehensive technical documentation of CEDEX's architectural innovations, explaining why existing DEX solutions cannot serve the tokenized securities market and how CEDEX's compliance-first design creates categorical advantages for institutional adoption.

๐Ÿ”น 5.1.1 The DEX Incompatibility Problem

Standard decentralized exchangesโ€”including market leaders Raydium, Orca, Jupiter, and Meteoraโ€”were architected around three foundational design principles that create irreconcilable conflict with securities law compliance:

Principle 1: Computational Minimalism

Traditional DEXs optimize for maximum throughput by minimizing computational overhead per transaction. Every additional instruction reduces theoretical TPS capacity, creating astrong paradigmarchitectural wherepressure regulatoryagainst compliance verification. A typical Raydium swap executes in approximately 200,000 compute units; adding six Transfer Hook verifications would increase this to 800,000+ compute units, fundamentally changing the economic model.

Principle 2: Compliance Agnosticism

DEX protocols intentionally refuse implementation of securities-specific procedures such as KYC verification, accreditation checking, OFAC screening, and investor qualification. This design choice reflects ideological commitment to permissionless trading and practical recognition that compliance creates liability exposure for protocol developers.

Principle 3: Economic Incentive Misalignment

Traditional DEX economics depend on maximizing trading volume with minimal friction. Compliance verification introduces friction (latency), complexity (integration requirements), and cost (oracle fees). These factors directly reduce profitability under existing DEX business models, creating structural resistance to compliance implementation.

๐Ÿ’ก Critical Insight

The incompatibility between existing DEXs and securities compliance is not a mattertechnical limitation that can be solved with additional development. It represents a fundamental architectural conflict where the design goals of corporatepermissionless policytrading butand ofregulated cryptographicsecurities certainty.trading Everyare mutually exclusive.

๐Ÿ”น 5.1.2 Why Existing DEXs Cannot Support ST22 transfer triggers sequential execution of six independent verification hooks, completing comprehensive compliance verification before transaction settlement.


5.1.1 ๐Ÿ“‹ SPL Token-2022 Standard OverviewTokens

SPLBeyond Token-2022philosophical (alsodesign knownconflicts, asexisting TokenDEX Extensionscodebases Program)face isconcrete Solana'stechnical next-generationbarriers preventing ST22 token standard, introducing programmable extensions that enable sophisticated token functionality impossible with the original SPL Token Program:support:

ExtensionDEX Platform

CapabilityToken-2022 Support

OTCMTransfer UsageHook Support

๐Ÿช

Transfer HookRaydium

ExecutePartial custom(basic logictransfers ononly)

None everyโ€” hooks disabled

Orca

Limited (whitelist)

None โ€” not implemented

Jupiter

Aggregates underlying DEXs

None โ€” inherits limitations

Meteora

Basic support

None โ€” bypassed

CEDEX

Full native support

Full โ€” 6 hooks per transfer

The core technical issue: existing DEX codebases were written before SPL Token-2022 existed. Their smart contracts interact directly with the original SPL Token Program, which lacks Transfer Hook extensions. Retrofitting Transfer Hook support would require complete protocol rewritesโ€”a multi-year effort that these protocols have no economic incentive to undertake.

โš ๏ธ Critical Limitation

If ST22 tokens were traded on existing DEXs (assuming technical compatibility), Transfer Hooks would be bypassed during swaps. This would disable all 42 security controls, complianceincluding verification

๐Ÿ”‘custody

Permanentverification, Delegate

IrrevocableOFAC transferscreening, authority

Protocol-leveland recoveryAML capability

๐Ÿ”’

Confidential Transfers

Zero-knowledge encrypted amounts

Future: Privacy-preserving compliance

๐Ÿ’ต

Transfer Fee

Protocol-level fee collection

5% fee distribution automation

๐Ÿ“‹

Metadata Pointer

On-chain token metadata

Security details, issuer info, CUSIP

๐ŸŽซ

Non-Transferable

Soulbound token capability

Compliance NFTs, investor credentials


5.1.2 โš™๏ธ Transfer Hook Extension Mechanism

The Transfer Hook extension enables token mints to specify a program that must be invoked during every token transfer. This mechanism operates atchecksโ€”making the Solana runtime level, making it impossible to transfer tokens withoutnon-compliant executing the hook program:securities.

rust

๐Ÿ”น

// Transfer Hook Extension Data Structure
pub struct TransferHook {
    /// The program ID that implements the transfer hook
    pub program_id: Pubkey,
    /// Optional: Authority that can update the hook program
    pub authority: Option<Pubkey>,
}

// When a transfer occurs, Solana runtime automatically:
// 1. Checks if mint has TransferHook extension
// 2. If yes, invokes the specified program_id with transfer context
// 3. If hook returns error, ENTIRE transaction reverts
// 4. If hook succeeds, transfer completes

// โš ๏ธ This is MANDATORY - there is no way to bypass the hook
// The token literally cannot move without hook approval

5.1.3 ๐Ÿ“œThe Compliance-as-CodeCEDEX Design Philosophy

OTCM'sCEDEX Transferinverts Hooktraditional implementationDEX embodiesdesign priorities. Rather than implementing compliance verification as bolted-on functionality to existing trading infrastructure, CEDEX implements compliance verification as the foundational architectural constraint shaping every element of trading system design.

"We didn't add compliance to a DEX. We built a compliance engine that happens to execute trades."

"Compliance-as-Code"This philosophical inversion creates three categorical advantages:

philosophy:
  • Compliance regulatoryIntegration requirementsat areDesign translatedPhase: intoVerification deterministiclogic integrates at system design phase rather than being retrofitted. Every smart contract logic that executes identicallyinstruction, every time,data withoutstructure, humanevery discretion,execution administrativepath override,was ordesigned interpretation variability.

    "Traditionalwith compliance asks:verification 'Didas youa followfirst-class therequirement.

  • Optimized rules?'Smart OTCM'sContract TransferArchitecture: HooksSmart ask:contract 'Canarchitecture youoptimizes mathematicallyfor provecompliance compliance?'execution from inception. Compute budget allocation, account structure, and instruction ordering all prioritize successful compliance verification over raw trading speed.
  • Aligned Economic Incentives: Economic incentive structure aligns operator profitability with successful compliance implementation. CEDEX generates revenue from compliant trades; non-compliant trades generate zero revenue because they cannot execute.

๐Ÿ”น 5.1.4 Compliance-First vs Compliance-Retrofitted

The answerdistinction isbetween alwayscompliance-first verifiableand on-chain."compliance-retrofitted architecture has profound implications for system reliability, security, and regulatory acceptance:

Aspect

โŒCompliance-First Traditional Compliance(CEDEX)

โœ… Transfer Hook ComplianceCompliance-Retrofitted

โš–๏ธVerification

EnforcementTiming

Policy-based,Before discretionaryexecution (blocking)

Code-based,After deterministicexecution (non-blocking)

๐Ÿ”“Non-Compliant

Override CapabilityTrades

AdminCannot canexecute bypass(impossible)

NoExecute bypassthen possibleflag for review

๐Ÿ“Regulatory

Audit TrailPosture

MutablePreventive logs, editablecontrol

ImmutableDetective blockchain recordcontrol

โœ…Audit

VerificationTrail

RequiresEvery trusttrade inverified operatoron-chain

CryptographicallyOff-chain verifiablelogs (mutable)

๐Ÿ”„System

ConsistencyComplexity

VariesIntegrated by(single analyst/daysystem)

100%Fragmented identical(multiple executionsystems)

โฑ๏ธFailure

TimingMode

Post-trade reviewFail-safe (T+n)no trade)

Pre-Fail-open (trade blocking (T-0)executes)


4.2

5.1.4Custom โš–๏ธAMM Regulatory Advantages

Architecture

TransferCEDEX Hookimplements executiona providesmodified regulatoryAutomated advantagesMarket unattainableMaker through(AMM) traditionalarchitecture complianceengineered procedures:

Advantage

Description

๐Ÿ“‹

Immutable Audit Trails

Every compliance check is recorded on-chain with cryptographic proof of execution timestamp, inputs, and outcomes

๐ŸŽฏ

Zero Discretion

Compliance decisions are algorithmicโ€”no analyst judgment, no selective enforcement, no regulatory arbitrage

โšก

Real-Time Enforcement

Non-compliant transfers are blocked before execution, not flaggedspecifically for review after the fact

๐Ÿ”

Cryptographic Proof

Regulators can independently verify any historical compliance decision by replaying on-chain data

๐ŸŒ

Continuous Operation

24/7/365 enforcement with no business hours, holidays, or staffing gaps

๐Ÿ’ก SEC Modernization Alignment: OTCM's Transfer Hook architectureintegration. alignsUnlike withtraditional SECAMMs Chairthat Gensler'sexecute statedtoken goalswaps ofas 'bringingatomic cryptooperations, CEDEX separates compliance verification from trading execution into compliance'distinct andarchitectural thelayers, SECenabling Crypto Task Force's exploration of blockchain-nativeasynchronous compliance mechanisms.

checking
without

5.2 ๐Ÿ”„ Transfer Hook Execution Flow

This section details the precise execution sequence when an ST22 token transfer is initiated, fromblocking user action through final settlement.interaction.


๐Ÿ”น

5.2.1 ๐ŸชDual-Layer HookExecution Invocation SequenceModel

WhenThe adual-layer userexecution initiatesmodel anrepresents ST22CEDEX's transfer,core thearchitectural followinginnovation: sequencesegregating executes:compliance verification from trading execution while maintaining atomic transaction guarantees.

// Dual-Layer Architecture Diagram
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                   ๐ŸชCEDEX ST22 TRANSFER HOOKDUAL-LAYER EXECUTION SEQUENCEMODEL                      โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
๐Ÿ‘ค

User InitiatesRequest

Transfer
โ”‚
โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚              โ˜€๏ธCOMPLIANCE SOLANAVERIFICATION RUNTIME: Detects TransferHook extension on ST22 mintLAYER                         โ”‚
โ”‚  Invokesโ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  OTCMโ”‚
Transferโ”‚  โ”‚  Asynchronous Execution (2,000-3,000ms)                      โ”‚  โ”‚
โ”‚  โ”‚                                                              โ”‚  โ”‚
โ”‚  โ”‚  Hook Program1: Custody โ”€โ”€โ–บ Hook 2: OFAC โ”€โ”€โ–บ Hook 3: AML            โ”‚  โ”‚
โ”‚  โ”‚  Hook 4: KYC โ”€โ”€โ–บ Hook 5: Price Impact โ”€โ”€โ–บ Hook 6: LP Ratio   โ”‚  โ”‚
โ”‚  โ”‚                                                              โ”‚  โ”‚
โ”‚  โ”‚  Result: VERIFIED | REJECTED (with transfererror contextcode)               โ”‚  โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
โ”‚
โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                ๐Ÿ”TRADING HOOKEXECUTION 1: CUSTODY VERIFICATIONLAYER                             โ”‚
โ”‚  โฑ๏ธ (100-150ms)โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”‚
โ”‚  Queryโ”‚  EmpireSynchronous StockExecution Transfer(400-600ms)                           โ†’โ”‚  Verifyโ”‚
1:1โ”‚  backingโ”‚                                                              โ†’โ”‚  Errorโ”‚
6001โ”‚  โ”‚  1. Receive verification confirmation                        โ”‚  โ”‚
โ”‚  โ”‚  2. Calculate CPMM output amount                             โ”‚  โ”‚
โ”‚  โ”‚  3. Update pool reserves atomically                          โ”‚  โ”‚
โ”‚  โ”‚  4. Execute token transfer                                   โ”‚  โ”‚
โ”‚  โ”‚  5. Distribute fees                                          โ”‚  โ”‚
โ”‚  โ”‚                                                              โ”‚  โ”‚
โ”‚  โ”‚  Result: EXECUTED | REVERTED                                 โ”‚  โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ”‚
โœ…โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
PASS

๐Ÿ”น โ–ผ5.2.2 Compliance Verification Layer

The Compliance Verification Layer executes during every ST22 token transfer, implementing OTCM's six Transfer Hooks in sequential order. This layer operates asynchronously from the user's perspectiveโ€”verification completion occurs independently of user action, enabling a responsive interface despite comprehensive compliance checking.

Verification Flow

// Compliance Verification Data Structure (Rust)

pub struct ComplianceVerification {

pub transfer_id: Pubkey, // Unique transfer identifier

pub sender: Pubkey, // Source wallet

pub recipient: Pubkey, // Destination wallet

pub token_mint: Pubkey, // ST22 token address

pub amount: u64, // Transfer amount

pub verification_start: i64, // Unix timestamp

pub hook_results: [HookResult; 6], // Results from each hook

pub final_status: VerificationStatus,

}

pub enum VerificationStatus {

Pending, // Verification in progress

Verified, // All hooks passed

Rejected { // At least one hook failed

hook_number: u8,

error_code: u16,

reason: String,

},

}

Hook Execution Sequence

Each Transfer Hook executes in strict sequence, with failure at any point causing immediate transaction reversion:

Order

Hook Name

Oracle Source

Latency

Fail Action

1

Custody Verification

Empire Stock API

100-150ms

Revert 6001

2

OFAC Screening

SDN List Oracle

200-500ms

Revert 6002

3

AML Analytics

Chainalysis/TRM

300-400ms

Revert 6003

4

Redemption Eligibility

KYC Registry

50-100ms

Revert 6004

5

Price Impact Limit

TWAP Oracle

50-100ms

Revert 6006

6

Liquidity Ratio

Pool State

50-100ms

Revert 6007

๐Ÿ”น 5.2.3 Trading Execution Layer

The Trading Execution Layer receives verified tokens and executes trades only upon successful completion of all compliance verification. This layer implements the Constant Product Market Maker (CPMM) formula for price discovery and liquidity provision.

CPMM Core Formula

CEDEX implements the constant product formula (x ร— y = k) where x represents SOL reserves, y represents ST22 token reserves, and k is the invariant constant:

// CPMM Swap Calculation (Rust)
pub fn calculate_swap_output(

input_amount: u64,

input_reserve: u64,

output_reserve: u64,

fee_bps: u16, // Basis points (500 = 5%)

) -> Result<SwapResult> {

// Apply fee to input
let fee_multiplier = 10000 - fee_bps as u64;
let input_with_fee = input_amount

.checked_mul(fee_multiplier)

.ok_or(SwapError::Overflow)?;

// Calculate output using constant product formula
// output = (input_with_fee ร— output_reserve) / (input_reserve ร— 10000 + input_with_fee)
let numerator = input_with_fee

.checked_mul(output_reserve)

.ok_or(SwapError::Overflow)?;

let denominator = input_reserve

.checked_mul(10000)

.ok_or(SwapError::Overflow)?

.checked_add(input_with_fee)

.ok_or(SwapError::Overflow)?;

let output_amount = numerator / denominator;
let fee_amount = input_amount - (input_amount * fee_multiplier / 10000);
Ok(SwapResult {

output_amount,

fee_amount,

new_input_reserve: input_reserve + input_amount,

new_output_reserve: output_reserve - output_amount,

})

}

๐Ÿ”น 5.2.4 Layer Synchronization Protocol

The two layers synchronize through a handoff protocol ensuring atomic execution guarantees:

  • Verification Request: User initiates swap, generating unique transfer_id
  • Parallel Processing: UI displays "Verifying compliance..." while hooks execute
  • Verification Complete: All hooks pass, verification_status set to VERIFIED
  • Execution Authorization: Trading layer receives signed verification confirmation
  • Atomic Swap: CPMM calculation and token transfer execute in single transaction
  • Settlement: Transaction finalizes after 32 Solana blocks (~13 seconds) ๐Ÿ’ก Atomicity Guarantee

If verification completes but execution fails (e.g., slippage exceeded), the entire transaction reverts. Users never face situations where compliance verification succeeds but tokens transfer incorrectly.

๐Ÿ—๏ธ 5.2 Dual-Layer Execution Architecture

๐Ÿ”น 5.2.1 Dual-Layer Execution Model

CEDEX implements a dual-layer architecture combining a centralized order management system with decentralized on-chain settlement. The centralized layer handles order matching, price discovery, and user interface at sub-100ms latency. The decentralized layer handles actual asset custody, transfer execution, and Transfer Hook enforcement on Solana. This architecture delivers Web2-grade user experience with Web3-grade settlement finality.

Layer

Function

Technology

Centralized OMS

Order matching, price feeds, UI

OTCM matching engine + REST API

Compliance Verification

KYC/AML status, accreditation check

Layer 2 Transfer Hook pre-check

Decentralized Settlement

Asset transfer, Transfer Hook execution, finality

Solana + SPL Token-2022

๐Ÿ”น 5.2.2 Compliance Verification Layer

Before any trade executes on-chain, CEDEX runs a pre-flight compliance check against the investor's current verification status. This check queries the Issuers Portal compliance state in real-time. Traders with lapsed KYC, expired accreditation, or flagged AML status are blocked at the order entry stage โ€” before any on-chain transaction is attempted โ€” preventing failed transactions and wasted gas.

๐Ÿ”น 5.2.3 Trading Execution Layer

Approved orders are submitted to the Solana network as signed transactions. The SPL Token-2022 Transfer Hook extensions execute atomically with settlement โ€” there is no separation between trade execution and compliance enforcement. If any of the 42 Transfer Hook controls reject the transaction, it reverts entirely with a specific error code enabling rapid diagnosis.

๐Ÿ”น 5.2.4 Layer Synchronization Protocol

The centralized OMS maintains a real-time synchronized view of on-chain state through OTCM's dedicated Helius RPC node cluster. Order book updates reflect confirmed on-chain settlements within 400ms (one Solana block). This synchronization ensures no price discrepancy between displayed quotes and executable on-chain prices during normal network conditions.

๐Ÿ“‰ 5.3 Bonding Curve Bootstrap Phase

Upon deployment, each new ST22 token initially trades on a bonding curve rather than the permanent CPMM-based AMM. This bootstrap phase serves critical functions: enabling initial price discovery in a controlled environment, preventing flash crashes and wash trading during early trading, and providing favorable entry prices for early community participants.

๐Ÿ”น 5.4.1 Initial Price Discovery Mechanism

The bonding curve creates a mathematically predictable relationship between token supply and price, eliminating the need for external price oracles during the bootstrap phase. As tokens are purchased, the price increases along a predetermined curve; as tokens are sold, the price decreases.

// Bonding Curve Price Discovery
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                    ๐ŸšซBONDING HOOK 2: OFAC SCREENING                     โ”‚
โ”‚                         โฑ๏ธ (200-500ms)                           โ”‚
โ”‚  Check SDN List โ†’ Address clustering โ†’ Error 6002                โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                             โ”‚ โœ… PASS
                             โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                    ๐Ÿ•ต๏ธ HOOK 3: AML ANALYTICS                      โ”‚
โ”‚                         โฑ๏ธ (300-400ms)                           โ”‚
โ”‚  ML risk scoring โ†’ 200+ features โ†’ Error 6003                    โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                             โ”‚ โœ… PASS
                             โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                    ๐Ÿชช HOOK 4: REDEMPTION ELIGIBILITY             โ”‚
โ”‚                         โฑ๏ธ (50-100ms)                            โ”‚
โ”‚  KYC status โ†’ Accreditation โ†’ 72hr cooling โ†’ Error 6004          โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                             โ”‚ โœ… PASS
                             โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                    ๐Ÿ“‰ HOOK 5:CURVE PRICE IMPACT LIMIT                 โ”‚
โ”‚                         โฑ๏ธ (50-100ms)                            โ”‚
โ”‚  Calculate impact โ†’ Compare TWAP โ†’ 2% threshold โ†’ Error 6006     โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                             โ”‚ โœ… PASS
                             โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                    ๐Ÿ’ง HOOK 6: LIQUIDITY SUFFICIENCY              โ”‚
โ”‚                         โฑ๏ธ (50-100ms)                            โ”‚
โ”‚  Check LP ratio โ†’ 150% minimum โ†’ Error 6007                      โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                             โ”‚ โœ… PASS
                             โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                    โœ… ALL HOOKS PASSED                           โ”‚
โ”‚              Transfer executes, transaction commits              โ”‚
โ”‚                 Settlement: ~13 seconds (32 blocks)DISCOVERY                        โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Price

5.2.2 ๐Ÿ“Š Sequential vs Parallel Execution

OTCM implements sequential hook execution rather than parallel for critical security reasons:

Mode

โœ… Advantage

โš ๏ธ Trade-off

๐Ÿ”„

Sequentialโ”‚ (OTCM)

EarlyUSD) exitโ”‚ onโ•ญโ”€โ”€โ”€โ”€โ”€โ”€ failure,Graduation deterministicโ”‚ order,โ•ญโ”€โ”€โ•ฏ simplerThreshold debugging

Higher$0.15โ”‚ latencyโ•ญโ”€โ”€โ•ฏ (750-1,350ms$250K total)

โšกMC)

Parallel

Lowerโ”‚ latencyโ•ญโ”€โ”€โ•ฏ (~500ms$0.10โ”‚ total)

Non-deterministic,โ•ญโ”€โ”€โ•ฏ raceโ”‚ conditions,โ•ญโ”€โ”€โ•ฏ wasted$0.05โ”‚ computeโ•ญโ”€โ”€โ•ฏ onโ”‚ earlyโ•ญโ”€โ”€โ•ฏ failures

$0.01โ”‚_____________________โ•ญโ”€โ”€โ”€โ•ฏ

Sequentialโ”‚ executionโ•ญโ”€โ”€โ•ฏ ensures$0.001โ”‚______________โ•ญโ”€โ”€โ”€โ•ฏ that if Hook 1 (Custody Verification) fails, Hooks 2-6 never executeโ€”saving oracle costs and compute resources. It also provides deterministic error reporting: users always know which specific hook rejected their transaction.


5.2.3 โš›๏ธ Atomic Transaction Guarantees

Solana's account model provides atomic transaction guarantees: if any hook fails, the entire transaction reverts as if it never occurred. There is no intermediate state where tokens have transferred but compliance verification is incomplete.

โ”Œโ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–บ

Tokens Issued (millions)

โ”‚โ—„โ”€โ”€ Early Buyers โ”€โ”€โ–บโ”‚โ—„โ”€โ”€โ”€โ”€ Growth Phase โ”€โ”€โ”€โ”€โ–บโ”‚โ—„โ”€ Graduation โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”โ–บ โ”‚
โš›๏ธ

๐Ÿ”น ATOMIC5.4.2 EXECUTIONLinear GUARANTEEBonding โ”‚Curve โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜Mathematics

CEDEX implements a linear bonding curve formula providing predictable price appreciation as token adoption increases:

// Bonding Curve Price Formula
// ScenarioLinear A:Bonding AllCurve hooksFormula
pass

P(n) โœ…= initialPrice + (priceGradient ร— tokensIssued)

// Parameters:
// Result:initialPrice Transaction= commits,$0.001 tokensper move,token state(starting updatesprice)
// ScenariopriceGradient B:= Hook0.001% 3per (AML)token rejects due to risk score โŒsold
// Result:Example ENTIRE transaction revertscalculations:
// โ€ขAt No0 tokens movedsold:      P = $0.001 + (0.00001 ร— 0) = $0.001
// โ€ขAt No1M feestokens chargedsold:     P = $0.001 + (0.00001 ร— 1,000,000) = $0.011
// โ€ขAt No10M statetokens changessold:    P = $0.001 + (0.00001 ร— 10,000,000) = $0.101
// โ€ขAt Error25M returnedtokens tosold:    user:P 6003= $0.001 + (AML_RISK_EXCEEDED)0.00001 ร— 25,000,000) = $0.251

Implementation

// Bonding Curve Implementation (Rust)

pub struct BondingCurve {

pub token_mint: Pubkey,

pub initial_price: u64, // โš ๏ธIn Therelamports is(0.001 NOSOL partial= execution1,000,000 statelamports)

pub price_gradient: u64, // ThisPrice isincrease guaranteedper bytoken Solana(in runtime,lamports)

not

pub OTCMtokens_issued: codeu64, // Current tokens in circulation

pub sol_reserve: u64, // SOL collected from purchases

pub is_graduated: bool, // Whether curve has graduated

pub graduation_timestamp: Option<i64>,

}

impl BondingCurve {

pub fn current_price(&self) -> u64 {

self.initial_price + (self.price_gradient * self.tokens_issued / 1_000_000)

}

pub fn buy_tokens(&mut self, sol_amount: u64) -> Result<u64> {
// Calculate tokens receivable at current price
let current_price = self.current_price();
let tokens = sol_amount * 1_000_000_000 / current_price; // 9 decimals
// Update state

self.tokens_issued += tokens;

self.sol_reserve += sol_amount;

Ok(tokens)

}

}

๐Ÿ”น 5.2.43.3 โฑ๏ธGraduation ExecutionCriteria

Timing

ST22 Diagramtokens graduate from bonding curve to permanent CPMM trading upon satisfying either of two criteria:

HookCriterion

โฑ๏ธ Min (ms)Threshold

โฑ๏ธ Max (ms)

โฑ๏ธ Avg (ms)

๐Ÿ”ง Primary BottleneckRationale

1๏ธโƒฃMarket Custody OracleCap

100โ‰ฅ $250,000 USD

150

125

EmpireSufficient APIliquidity latencyfor CPMM stability

2๏ธโƒฃHolder OFAC ScreeningCount

200โ‰ฅ 127,000 unique wallets

500

350

SDNMathematical listproof size,of clusteringcommunity adoption (~0.5% of Solana active wallets)

3๏ธโƒฃTime AML AnalyticsElapsed

300โ‰ฅ 72 hours since deployment

400

350

MLMinimum inferencestabilization time

4๏ธโƒฃperiod Redemptionregardless Eligibility

50

100

75

KYCof database lookup

5๏ธโƒฃ Price Impact

50

100

75

TWAP calculation

6๏ธโƒฃ LP Sufficiency

50

100

75

Pool state read

โฑ๏ธ TOTAL

750

1,350

1,050

Sequential sumvolume


Graduation

occurs automatically when ANY criterion is met (OR logic). The 127,000 holder threshold represents approximately 0.5% of Solana's active wallet base, providing mathematical proof of genuine community adoption rather than artificial inflation.

๐Ÿ”น 5.34.4 ๐Ÿ”Transition Hookto 1:Permanent Custody Verification Oracle

AMM

TheUpon Custodygraduation, Verificationthe Oraclefollowing confirmsirreversible thatstate alltransitions circulatingoccur:

ST22
  • Bonding tokensCurve areDeactivation: backedSmart contract permanently disables bonding curve purchase/sale functions through immutable state flag
  • Liquidity Migration: All SOL accumulated in bonding curve reserve transfers to CEDEX CPMM pool
  • Pool Initialization: CPMM pool initializes with graduated token supply and migrated SOL reserve
  • Permanent Lock: Liquidity becomes permanently lockedโ€”cannot be withdrawn by equivalentany equityparty sharesincluding heldprotocol atadministrators
Empire Stock Transfer, the SEC-registered transfer agent providing qualified custody services for OTCM Protocol.


5.3.1 ๐Ÿ—๏ธ Oracle Architecture

The custody oracle operates as a cryptographically-signed data feed from Empire Stock Transfer's registry systems:

rust

// CustodyGraduation Oracle Data Structure
pub struct CustodyOracleData {
    /// CIK number of the issuing company
    pub issuer_cik: [u8; 10],
    /// CUSIP identifier for the security
    pub cusip: [u8; 9],
    /// Share class (Series M preferred)
    pub share_class: ShareClass,
    /// Total shares held in custody
    pub custodied_balance: u64,
    /// Total ST22 tokens in circulation
    pub circulating_tokens: u64,
    /// Ed25519 signature from Empire's HSM
    pub attestation_signature: [u8; 64],
    /// Merkle root of current shareholder registry
    pub registry_hash: [u8; 32],
    /// Unix timestamp of attestation
    pub attestation_timestamp: i64,
    /// Block height when attestation was recorded
    pub attestation_slot: u64,
}

5.3.2 ๐Ÿ›๏ธ Empire Stock Transfer Integration

Empire Stock Transfer provides real-time custody attestations through a dedicated API integration:

Component

Specification

๐ŸŒ

API Endpoint

https://api.empirestocktransfer.com/v1/custody/verify

๐Ÿ”

Authentication

API Key + Ed25519 request signing

โœ๏ธ

Response Signing

HSM-secured Ed25519 signature on every attestation

โฑ๏ธ

Update Frequency

Every Solana slot (~400ms)

๐Ÿ”„

Failover

Multi-region deployment with automatic failover


5.3.3 โš ๏ธ Discrepancy Detection

The hook implements strict discrepancy detection with configurable thresholds:

rust

// Custody Verification ImplementationFunction (Rust/Anchor)
pub const MAX_DISCREPANCY_BPS: u64 = 1;  // 0.01% maximum discrepancy

pub fn verify_custody(graduate_to_amm(ctx: oracle_data: &CustodyOracleData,
    transfer_amount: u64,
Context<Graduate>) -> Result<()> {
let curve = &mut ctx.accounts.bonding_curve;
let pool = &mut ctx.accounts.cpmm_pool;
// Verify signaturegraduation authenticitycriteria verify_ed25519_signature(met
&oracle_data.attestation_signature,require!(
&EMPIRE_PUBLIC_KEY, &oracle_data.serialize(),

curve.check_graduation_criteria()?,

CedexError::GraduationCriteriaNotMet

);

// CheckPermanently attestationdisable freshnessbonding (maxcurve
10 minutes old) let current_time

curve.is_graduated = true;

curve.graduation_timestamp = Some(Clock::get()?.unix_timestamp;unix_timestamp);

require!(
// current_timeInitialize -CPMM oracle_data.attestation_timestamppool <with migrated liquidity

pool.sol_reserve = 600,curve.sol_reserve;

CustodyError::StaleAttestation

pool.token_reserve = curve.tokens_issued;

pool.k_invariant = pool.sol_reserve * pool.token_reserve;

pool.liquidity_locked = true; // 6001PERMANENT - cannot be unlocked

// Transfer SOL to pool

transfer_sol(curve.sol_reserve, &ctx.accounts.pool_vault)?;

emit!(GraduationEvent {

token_mint: curve.token_mint,

final_market_cap: calculate_market_cap(curve),

holder_count: get_holder_count(curve.token_mint)?,

sol_migrated: curve.sol_reserve,

});

Ok(())

}

โš ๏ธ Irreversibility

Smart contract explicitly prevents bonding curve re-activation post-graduation through permanent disabling of bonding curve contract functions. This is enforced at the bytecode levelโ€”not through administrative controls that could be overridden.

๐Ÿ” 5.4 Constant Product Market Maker (CPMM)

Post-graduation, ST22 tokens trade on CEDEX's Constant Product Market Maker implementation. The CPMM model, pioneered by Uniswap, provides continuous liquidity at algorithmically determined prices without requiring traditional order books or market makers.

๐Ÿ”น 5.4.1 CPMM Mathematical Foundation

The CPMM maintains the invariant k = x ร— y, where:

  • x = SOL reserve in the liquidity pool
  • y = ST22 token reserve in the liquidity pool
  • k = constant product (invariant) Every swap changes reserves while maintaining the invariant:
// CPMM Swap Example
// CalculatePre-swap discrepancystate:

k = x ร— y = 100 SOL ร— 1,000,000 tokens = 100,000,000

// User swaps 10 SOL for tokens:

new_x = 100 + 10 = 110 SOL

new_y = k / new_x = 100,000,000 / 110 = 909,091 tokens

tokens_received = 1,000,000 - 909,091 = 90,909 tokens

// Post-swap state:

k = 110 ร— 909,091 โ‰ˆ 100,000,000 (invariant maintained)

๐Ÿ”น 5.4.2 Price Impact Calculation

Price impact measures how much a trade moves the market price. Larger trades relative to pool reserves create larger price impacts:

// Price Impact Calculation
pub fn calculate_price_impact(

input_amount: u64,

input_reserve: u64,

output_reserve: u64,

) -> f64 {

// Spot price before trade
let expected_tokensspot_price = oracle_data.custodied_balance;output_reserve letas actual_tokens = oracle_data.circulating_tokens;
    let discrepancy = if expected_tokens > actual_tokens {
        expected_tokens - actual_tokens
    } else {
        actual_tokens - expected_tokens
    };
    
    let discrepancy_bps = discrepancy * 10000f64 / expected_tokens;input_reserve require!(as discrepancy_bps <= MAX_DISCREPANCY_BPS,
        CustodyError::CustodyDiscrepancyf64;
// 6001Effective );
    
    // Verify sufficient custodyprice for this transfertrade
require!(let oracle_data.custodied_balanceoutput_amount >= transfer_amount,calculate_output(input_amount, CustodyError::InsufficientCustodyinput_reserve, output_reserve);
let effective_price = output_amount as f64 / input_amount as f64;
// 6001Price );impact Ok(as percentage
let impact = ())spot_price }- effective_price) / spot_price * 100.0;

๐Ÿ“‹ Regulatory Reference: 17 CFR Section 240.17a-1 et seq. โ€” Transfer Agent Custody Requirements

โŒ Error Code 6001: CUSTODY_VERIFICATION_FAILED Indicates custody verification failure. Possible causes: stale attestation (>10 min), discrepancy >0.01%, insufficient custodied shares, or invalid Empire signature. User should wait for fresh attestation or contact issuer.


5.4 ๐Ÿšซ Hook 2: OFAC Sanctions Screening

The OFAC Sanctions Screening hook prevents transactions to or from wallets associated with the Office of Foreign Assets Control's Specially Designated Nationals (SDN) list, implementing federal sanctions law requirements at the protocol level.


5.4.1 ๐Ÿ“‹ SDN List Integration

OTCM maintains an on-chain oracle updated hourly from OFAC's official SDN list, supplemented by blockchain-specific address intelligence:impact.abs()

rust

// OFAC Screening Implementation
pub struct OfacOracleData {
    /// Merkle root of current SDN list
    pub sdn_merkle_root: [u8; 32],
    /// Number of entries in SDN list
    pub sdn_entry_count: u32,
    /// Blockchain-specific blocked addresses
    pub crypto_sdn_addresses: Vec<Pubkey>,
    /// Last update timestamp
    pub last_update: i64,
    /// OFAC publication reference
    pub publication_id: [u8; 16],
}

// Screening checks BOTH sender and recipient
pub fn screen_ofac(
    sender: &Pubkey,
    recipient: &Pubkey,
    oracle: &OfacOracleData,
) -> Result<OfacScreeningResult> {
    // Direct address matching
    let sender_blocked = oracle.crypto_sdn_addresses.contains(sender);
    let recipient_blocked = oracle.crypto_sdn_addresses.contains(recipient);
    
    if sender_blocked || recipient_blocked {
        return Err(OfacError::SanctionedAddress.into());  // 6002
    }
    
    // Address clustering analysis (see 5.4.2)
    check_cluster_association(sender, recipient, oracle)?;
    
    Ok(OfacScreeningResult::Clear)
}

5.4.2 ๐Ÿ”— Address Clustering Analysis

Beyond direct SDN address matching, OTCM implements sophisticated address clustering analysis to detect wallets associated with sanctioned entities:

Analysis

Description

๐Ÿ’ฐ

Funding Source Analysis

Traces wallet funding sources to identify indirect SDN connections

๐Ÿ‘ฅ

Common Ownership Detection

Identifies wallets controlled by same entity through transaction pattern analysis

๐Ÿ”€

Mixer/Tumbler Detection

Flags wallets with significant exposure to known mixing services

๐ŸŒ

High-Risk Jurisdiction Exposure

Elevated scrutiny for wallets with connections to OFAC-sanctioned jurisdictions


5.4.3 ๐Ÿ“œ Implementation

rust

// Cluster Analysis Implementation
pub fn check_cluster_association(
    sender: &Pubkey,
    recipient: &Pubkey,
    oracle: &OfacOracleData,
) -> Result<()> {
    // Query clustering oracle for both addresses
    let sender_cluster = get_cluster_data(sender)?;
    let recipient_cluster = get_cluster_data(recipient)?;
    
    // Check for SDN cluster membership
    if sender_cluster.sdn_association_score > 70 {
        return Err(OfacError::ClusterAssociation {
            address: *sender,
            score: sender_cluster.sdn_association_score,
            reason: "High SDN cluster association".to_string(),
        }.into());
    }
    
    if recipient_cluster.sdn_association_score > 70 {
        return Err(OfacError::ClusterAssociation {
            address: *recipient,
            score: recipient_cluster.sdn_association_score,
            reason: "High SDN cluster association".to_string(),
        }.into());
    }
    
    Ok(())
}

๐Ÿ“‹ Regulatory Reference: 31 CFR ยง 500-598 โ€” OFAC Sanctions Administration Regulations

โŒ Error Code 6002: OFAC_SANCTIONS_MATCH Indicates wallet is blocked due to OFAC sanctions. This is a PERMANENT blockโ€”the wallet cannot transact ST22 tokens. There is no appeal process through OTCM; affected parties must resolve sanctions status with OFAC directly.


5.5 ๐Ÿ•ต๏ธ Hook 3: Blockchain Analytics Screening

The Blockchain Analytics Screening hook implements Bank Secrecy Act Anti-Money Laundering (AML) requirements through machine learning-based risk assessment, analyzing 200+ transaction features to identify money laundering patterns, sanctions evasion, theft proceeds, and coordinated suspicious activity.


5.5.1 ๐Ÿค– ML Risk Assessment

OTCM integrates with institutional-grade blockchain analytics providers to execute real-time risk assessment on every transfer:

rust

// AML Risk Assessment Data Structure
pub struct AmlRiskAssessment {
    /// Overall risk score (0-100)
    pub risk_score: u8,
    /// Risk category breakdown
    pub categories: AmlRiskCategories,
    /// Specific risk flags triggered
    pub triggered_flags: Vec<AmlFlag>,
    /// Confidence in assessment
    pub confidence: u8,
    /// Model version used
    pub model_version: [u8; 8],
}

pub struct AmlRiskCategories {
    pub sanctions_evasion: u8,      // 0-100
    pub money_laundering: u8,       // 0-100
    pub theft_proceeds: u8,         // 0-100
    pub darknet_exposure: u8,       // 0-100
    pub mixer_exposure: u8,         // 0-100
    pub gambling_exposure: u8,      // 0-100
    pub coordinated_activity: u8,   // 0-100
}

5.5.2 ๐Ÿ“Š Risk Scoring Model

The risk scoring model classifies transactions into three tiers with automated responses:

ScoreTrade Size

Risk% Levelof Pool

โš™๏ธPrice Automated ActionImpact

๐Ÿ“‹Circuit Follow-upBreaker

๐ŸŸข1

0-30SOL

Low1%

Auto-approve~0.99%

Noneโœ“ requiredAllowed

๐ŸŸก2

31-70SOL

Medium2%

Enhanced review queue~1.96%

Manualโœ“ analyst review within 24hAllowed

๐Ÿ”ด3

71-100SOL

High3%

Auto-reject (Error 6003)~2.91%

SARโœ— filingBlocked

5 evaluationSOL

5%

~4.76%

โœ— Blocked


Note: Examples assume 100 SOL pool reserve. Circuit breaker activates at >2% price impact.

๐Ÿ”น 5.5.4.3 ๐Ÿ”ฌSlippage Chainalysis/TRM IntegrationProtection

OTCMCEDEX integratesprovides withconfigurable industry-leadingslippage blockchainprotection analyticsensuring providers:users receive expected value:

Provider

Capability

๐Ÿ”ฌ

Chainalysis KYT

Real-time transaction screening with 15-second SLA

๐Ÿ”

TRM Labs Forensics

Deep historical analysis and entity resolution

๐ŸŒ

Elliptic Navigator

Cross-chain exposure analysis for multi-chain actors


5.5.4 ๐Ÿ“œ Implementation

rust

// AMLSlippage ScreeningProtection Implementation

pub conststruct LOW_RISK_THRESHOLD:SwapParams u8{

= 30;

pub constinput_amount: HIGH_RISK_THRESHOLD:u64,

u8 = 71;

pub fn screen_aml( sender: &Pubkey, recipient: &Pubkey, amount:min_output: u64, ) -> Result<AmlScreeningResult> { // QueryMinimum analyticsacceptable providersoutput

let

pub sender_riskmax_slippage_bps: = query_chainalysis(sender)?; let recipient_risk = query_chainalysis(recipient)?;u16, // UseMaximum higher of two risk scores let max_risk = sender_risk.risk_score.max(recipient_risk.risk_score); match max_risk { 0..=30 => Ok(AmlScreeningResult::AutoApprove), 31..=70 => { // Queue for enhanced review but allow transaction emit!(EnhancedReviewQueued { sender: *sender, recipient: *recipient, risk_score: max_risk, amount, }); Ok(AmlScreeningResult::ApproveWithReview) }, 71..=100 => { // Auto-reject high-risk transactions Err(AmlError::RiskThresholdExceeded { score: max_risk, threshold: HIGH_RISK_THRESHOLD, }.into()) // 6003 }, _ => unreachable!(), } }

๐Ÿ“‹ Regulatory Reference: 31 CFR ยง 1010 โ€” Bank Secrecy Act AML Requirements

โŒ Error Code 6003: AML_RISK_EXCEEDED Transaction rejected due to high AML risk score (71-100). Wallet may have exposure to: money laundering, sanctions evasion, theft proceeds, darknet markets, or coordinated suspicious activity. Appeal requires compliance review.


5.6 ๐Ÿชช Hook 4: Redemption Eligibility Verification

The Redemption Eligibility Verification hook implements a critical distinctionslippage in OTCM'sbasis compliance architecture: while permissionless trading allows any wallet to purchase and transfer ST22 tokens, redemption (conversion to underlying equity shares) requires investor verification in accordance with federal securities law.


5.6.1 ๐Ÿ“‹ KYC/AML Requirements

Before a wallet can redeem ST22 tokens for underlying shares, the beneficial owner must complete comprehensive verification:

Requirement

Verification Method

๐Ÿชช

Identity Verification

Government-issued photo ID + liveness check via Jumio/Onfido

๐Ÿ 

Address Verification

Utility bill or bank statement within 90 days

๐Ÿ”ข

SSN/TIN Verification

IRS W-9 form with SSN/TIN matching

๐Ÿšซ

Sanctions Screening

72-hour waiting period after initial OFAC/SDN clear

๐Ÿ‘”

PEP Screening

Politically Exposed Person database check


5.6.2 ๐ŸŽ–๏ธ Accredited Investor Verification

For offerings conducted under SEC Regulation D Rule 506(c), additional accreditation verification is required:points

rust

// Accreditation Status Types
pub enum AccreditationStatus {
    /// Not verified - cannot redeem Reg D offerings
    NotVerified,
    /// Verified accredited investor
    Accredited {
        method: AccreditationMethod,
        verification_date: i64,
        expiration_date:deadline: i64, // TypicallyUnix 90timestamp days
        verifier: String,      // e.g., "VerifyInvestor.com"
    },
    /// Non-accredited but permitted (Reg A+ or Reg CF)
    NonAccreditedPermitted {
        regulation: OfferingRegulation,
        investment_limit: u64,
    },
}

pub enum AccreditationMethod {
    Income,         // $200K/$300K annual income
    NetWorth,       // $1M+ net worth excluding residence
    Professional,   // Series 7, 65, or 82 license
    Entity,         // Qualified entity (bank, trust, etc.)
    KnowledgeTest,  // SEC proposed "accreditation exam"
}

5.6.3 ๐Ÿ“œ Implementation

rustexpiry

}

// Redemption Eligibility Verification
pub fn verify_redemption_eligibility(execute_swap_with_protection(
wallet:

ctx: &Pubkey,Context<Swap>,

token_mint:

params: &Pubkey,SwapParams,

amount: u64,

) -> Result<()> {

// LoadCheck investordeadline
recordrequire!(

Clock::get()?.unix_timestamp <= params.deadline,

SwapError::DeadlineExceeded

);

// Calculate output
let investoroutput = get_investor_record(wallet)calculate_output(...)?;
// CheckVerify KYCslippage completiontolerance
require!(
investor.kyc_status == KycStatus::Verified, RedemptionError::KycIncomplete // 6004 ); // Check 72-hour sanctions cooling period let current_time = Clock::get()?.unix_timestamp; let cooling_period = 72 * 60 * 60; // 72 hours in seconds require!( current_time - investor.sanctions_clear_timestamp

output >= cooling_period,params.min_output,

RedemptionError:

SwapError::SanctionsCoolingPeriodSlippageExceeded

);

// 6004Execute );swap
// Load offering details let offering = get_offering_details(token_mint)

execute_swap(output)?;

// Check accreditation if Reg D 506(c) if offering.regulation == Regulation::RegD506c { match &investor.accreditation { AccreditationStatus::Accredited { expiration_date, .. } => { require!( current_time < *expiration_date, RedemptionError::AccreditationExpired // 6004 ); }, _ => { return Err(RedemptionError::AccreditationRequired.into()); } } }
Ok(())
}

๐Ÿ“‹}

Regulatory

๐Ÿ”น Reference:5.4.4 17Liquidity CFRDepth 230.506(c)Analysis

โ€”

Pool Regulationliquidity Ddepth Accrediteddetermines Investortrading Requirementsefficiency. CEDEX targets minimum liquidity levels ensuring acceptable price impacts:

โŒPool ErrorTVL

Max Code 6004: REDEMPTION_ELIGIBILITY_FAILED Wallet not eligible for redemption. Possible causes: KYC incomplete, sanctions cooling period activeTrade (<72h)2%)

Market Depth

Classification

$100K

~$2,000

Low

Early Stage

$500K

~$10,000

Moderate

Developing

$1M

~$20,000

Good

Mature

$5M+

~$100,000+

Deep

Institutional

๐Ÿ—๏ธ 5.5 Circuit Breaker Architecture

CEDEX implements a comprehensive circuit breaker system protecting markets from manipulation, flash crashes, and coordinated attacks. Inspired by traditional securities exchange mechanisms (NYSE Rule 80B, NASDAQ halt procedures), accreditationthese expired/missingprotections foroperate Regat Dthe offerings.smart Note:contract Tradinglevel iswith stillno permitted;administrative onlyoverride redemptioncapability.

to

๐Ÿ”น shares is blocked.


5.7 ๐Ÿ“‰ Hook 5:5.1 Price Impact Circuit Breaker

Limits

TheCEDEX Priceenforces Impacta Circuithard Breakerlimit preventson price impact per transaction. Any single transactions from causing excessive market movement, implementing regulatory objectives prohibiting manipulative trading devices. Any transaction causing greater than 2% price movement against the Time-Weighted Average Price (TWAP) oracle is automatically rejected.rejected:


// 

5.7.1Price ๐Ÿ“ŠImpact Limit Implementation

pub const MAX_PRICE_IMPACT_BPS: u16 = 200; // 2% maximum

pub fn check_price_impact(

ctx: Context<PriceImpactCheck>,

proposed_trade: &SwapParams,

) -> Result<()> {

let twap = ctx.accounts.twap_oracle.get_price()?;
let expected_price = calculate_expected_price(proposed_trade)?;
// Calculate deviation from TWAP
let deviation_bps = ((twap - expected_price).abs() * 10000) / twap;
require!(

deviation_bps <= MAX_PRICE_IMPACT_BPS as u64,

CedexError::PriceImpactExceeded // Error 6006

);

Ok(())

}

This mechanism forces market participants to provide liquidity gradually versus attempting sudden massive liquidation. Large sellers must split orders across multiple transactions, allowing the market to absorb supply incrementally.

๐Ÿ”น 5.5.2 Volume-Based Halts

If any single wallet attempts to sell greater than 30% of circulating ST22 supply within a 24-hour period, transaction execution pauses for 24 hours:

// Volume-Based Halt Implementation

pub const MAX_DAILY_SELL_PERCENT: u8 = 30; // 30% max daily sale

pub const HALT_DURATION_SECONDS: i64 = 86400; // 24 hours

pub struct WalletTrackingState {

pub wallet: Pubkey,

pub daily_sell_amount: u64,

pub tracking_window_start: i64,

pub is_halted: bool,

pub halt_expiry: Option<i64>,

}

pub fn check_volume_limit(

ctx: Context<VolumeCheck>,

sell_amount: u64,

) -> Result<()> {

let tracking = &mut ctx.accounts.wallet_tracking;
let circulating_supply = ctx.accounts.mint.supply;
// Reset tracking window if >24h elapsed
let current_time = Clock::get()?.unix_timestamp;

if current_time - tracking.tracking_window_start > HALT_DURATION_SECONDS {

tracking.daily_sell_amount = 0;

tracking.tracking_window_start = current_time;

}

// Check if halt is active

if tracking.is_halted {

if current_time < tracking.halt_expiry.unwrap() {

return Err(CedexError::WalletHalted.into());

}

tracking.is_halted = false;

}

// Check if this sale would exceed limit
let new_daily_total = tracking.daily_sell_amount + sell_amount;
let threshold = circulating_supply * MAX_DAILY_SELL_PERCENT as u64 / 100;

if new_daily_total > threshold {

tracking.is_halted = true;

tracking.halt_expiry = Some(current_time + HALT_DURATION_SECONDS);

return Err(CedexError::DailySellLimitExceeded.into());

}

tracking.daily_sell_amount = new_daily_total;

Ok(())

}

๐Ÿ”น 5.5.3 Coordinated Activity Detection

CEDEX implements machine learning-based detection of coordinated selling patterns suggesting manipulative intent. The algorithm analyzes four correlation dimensions:

Dimension

Analysis Method

Suspicious Threshold

Wallet Clustering

Graph analysis of funding sources

>5 wallets sharing funding source

Timing Correlation

Transaction timestamp clustering

>3 sells within 10-second window

Amount Correlation

Statistical analysis of sale sizes

<5% variance across multiple sales

Price Impact Correlation

Sequential impact accumulation

Cumulative >5% within 1 hour

When coordinated activity is detected, affected wallets enter 24-hour cooldown periods, and the compliance team receives alerts for manual review.

๐Ÿ”น 5.5.4 Time-Weighted Average Price (TWAP) Oracle Integration

The TWAP oracle provides manipulation-resistant referenceprice pricing:data for circuit breaker calculations:

rust

// TWAP Oracle Implementation

pub struct TwapOracle {

pub token_mint: Pubkey,

pub price_observations: Vec<PriceObservation>,

pub observation_window: i64, /// Rolling1 1-hour TWAP pub twap_1h: u64, /// Rolling 24-hour TWAP pub twap_24h: u64, /// Number of observations in windowseconds

pub observation_count: u32, /// Minimum observations required

pub min_observations: u32, /// LastMinimum update60 slotobservations

pub

}

last_update_slot: u64, }

impl TwapOracle {

pub fn get_reference_price(calculate_twap(&self) -> Result<u64> {
//let Usecurrent_time shorter= TWAPClock::get()?.unix_timestamp;
forlet morewindow_start responsive= circuitcurrent_time breakers- self.observation_window;
// but require minimumFilter observations towithin preventwindow
manipulationlet valid_observations: Vec<_> = self.price_observations

.iter()

.filter(|o| o.timestamp >= window_start)

.collect();

require!(
self.observation_count

valid_observations.len() >= self.min_observations,min_observations as usize,

OracleError::InsufficientObservations ); Ok(self.twap_1h) } }


5.7.2 ๐Ÿ›‘ 2% Threshold Enforcement

The 2% threshold forces large market participants to execute trades gradually, preventing sudden price dislocations:

rust);

// Time-weighted calculation
let mut weighted_sum: u128 = 0;
let mut total_time: u128 = 0;

for i in 1..valid_observations.len() {

let time_delta = valid_observations[i].timestamp -

valid_observations[i-1].timestamp;

weighted_sum += valid_observations[i-1].price as u128 * time_delta as u128;

total_time += time_delta as u128;

}

Ok((weighted_sum / total_time) as u64)

}

}

๐Ÿ“‹ 5.6 Order Types and Execution

CEDEX supports multiple order types optimized for different trading strategies while maintaining compliance verification for all executions.

๐Ÿ”น 5.6.1 Market Orders

Market orders execute immediately at current pool prices, subject to slippage tolerance:

Parameter

Specification

Execution Speed

Immediate (subject to compliance verification ~2-3 seconds)

Price ImpactGuarantee

None โ€” executes at current pool price

Slippage Protection

Configurable (default 1%, max 5%)

Partial Fills

Not supported โ€” all-or-nothing execution

Circuit Breaker

Rejects if price impact exceeds 2% TWAP deviation

๐Ÿ”น 5.6.2 Limit Orders

Limit orders specify maximum buy price or minimum sell price, executing only when pool price reaches specified threshold:

// Limit Order Data Structure

pub struct LimitOrder {

pub order_id: u64,

pub owner: Pubkey,

pub token_mint: Pubkey,

pub side: OrderSide, // Buy or Sell

pub amount: u64, // Token amount

pub limit_price: u64, // Price threshold (lamports per token)

pub expiry: i64, // Unix timestamp

pub status: OrderStatus,

}

pub enum OrderSide {

Buy, // Execute when pool price <= limit_price

Sell, // Execute when pool price >= limit_price

}

pub enum OrderStatus {

Open,

Filled,

Cancelled,

Expired,

}

๐Ÿ”น 5.6.3 Swap Interface

The primary trading interface presents unified swap functionality:

// Swap Interface (TypeScript)
// User-facing swap interface

interface SwapRequest {

inputToken: 'SOL' | ST22Address;

outputToken: 'SOL' | ST22Address;

inputAmount: bigint;

minOutputAmount: bigint;

slippageTolerance: number; // Basis points

deadline: number; // Unix timestamp

}

// Response includes compliance verification status

interface SwapResponse {

transactionId: string;

inputAmount: bigint;

outputAmount: bigint;

effectivePrice: number;

priceImpact: number;

fees: {

protocol: bigint;

network: bigint;

};

complianceVerification: {

status: 'VERIFIED' | 'PENDING' | 'REJECTED';

hooks: HookResult[];

duration: number; // milliseconds

};

}

๐Ÿ’ธ 5.7 Fee Structure and Distribution

CEDEX implements a transparent fee structure aligned with protocol sustainability and participant incentives. Unlike traditional exchanges with complex fee tiers, CEDEX applies uniform fees ensuring equal treatment of all market participants.

๐Ÿ”น 5.7.1 Transaction Fee Breakdown

Every CEDEX swap incurs a 5% total transaction fee (500 basis points), distributed as follows:

Fee Component

Rate

Purpose

Issuer Allocation

2.00%

Revenue share to issuing company treasury

Staking Rewards

1.50%

Distributed to OTCM token stakers (8-60% APY)

Protocol Operations

1.06%

Infrastructure, compliance oracles, development

Liquidity Pool Growth

0.44%

Permanently locked in OTCM LP for depth

TOTAL

5.00%

Complete fee structure

๐Ÿ”น 5.7.2 Fee Distribution Mechanism

// Fee Distribution Implementation
pub const MAX_PRICE_IMPACT_BPS: u64 = 200;  // 2.00%

pub fn check_price_impact(distribute_fees(
pool:

fee_amount: u64,

issuer_treasury: &LiquidityPool,Pubkey,

trade_amount:

staking_pool: u64,&Pubkey,

trade_direction:

protocol_treasury: TradeDirection,&Pubkey,

liquidity_pool: &Pubkey,

) -> Result<()> {

// Fee distribution ratios (basis points of 5% fee)

const ISSUER_SHARE: u64 = 4000; // Get40% TWAPof reference5% price= 2.00%

const STAKING_SHARE: u64 = 3000; // 30% of 5% = 1.50%

const PROTOCOL_SHARE: u64 = 2120; // 21.2% of 5% = 1.06%

const LP_SHARE: u64 = 880; // 8.8% of 5% = 0.44%

// Calculate individual amounts
let twapissuer_amount = pool.twap_oracle.get_reference_price()fee_amount * ISSUER_SHARE / 10000;
let staking_amount = fee_amount * STAKING_SHARE / 10000;
let protocol_amount = fee_amount * PROTOCOL_SHARE / 10000;
let lp_amount = fee_amount * LP_SHARE / 10000;
// Execute transfers atomically

transfer_sol(issuer_amount, issuer_treasury)?;

transfer_sol(staking_amount, staking_pool)?;

transfer_sol(protocol_amount, protocol_treasury)?;

transfer_sol(lp_amount, liquidity_pool)?; // CalculatePermanently expectedlocked

post-trade price using CPMM formula let
emit!(new_sol_reserve, new_token_reserve) = match trade_directionFeeDistributed { TradeDirection::Buy => (
            pool.sol_reserve + trade_amount,
            pool.token_reserve - calculate_output(trade_amount, pool)?,
        ),
        TradeDirection::Sell => (
            pool.sol_reserve - calculate_output(trade_amount, pool)?,
            pool.token_reserve + trade_amount,
        ),... };
    
    let post_trade_price = new_sol_reserve * 1_000_000_000 / new_token_reserve;
    
    // Calculate deviation from TWAP
    let deviation = if post_trade_price > twap {
        (post_trade_price - twap) * 10000 / twap
    } else {
        (twap - post_trade_price) * 10000 / twap
    };
    
    require!(
        deviation <= MAX_PRICE_IMPACT_BPS,
        CircuitBreakerError::PriceImpactExceeded {
            expected_impact_bps: deviation,
            max_allowed_bps: MAX_PRICE_IMPACT_BPS,
        }  // 6006
    );
Ok(())
}

๐Ÿ“‹}

Regulatory

๐Ÿ”น Reference:5.7.3 17Fee CFRComparison 240.10b-5(b)Analysis

โ€”

Platform

Swap ProhibitionFee

Compliance

LP onRewards

Issuer ManipulativeRev

CEDEX

5.00%

โœ“ TradingFull

8-60% DevicesAPY

2.00%

Raydium

0.25%

โœ—

None

โŒVariable

0%

Orca

0.30%

โœ— ErrorNone

Variable

0%

Pump.fun

1.00%

โœ— CodeNone

None

0%

6006:

๐Ÿ’ก PRICE_IMPACT_EXCEEDEDFee Justification

While CEDEX's 5% fee exceeds traditional DEX fees, it includes comprehensive compliance verification ($2-5 per transaction in oracle costs), issuer revenue sharing, and permanent liquidity growth. For institutional securities trading, this represents significant cost savings versus traditional broker-dealer infrastructure.

๐Ÿค– 5.8 MEV Protection

Maximum Extractable Value (MEV) attacks represent one of the most significant threats to DeFi users, with an estimated $1.38 billion extracted from traders in 2023 alone. CEDEX implements multiple protection layers making MEV extraction economically unfeasible.

๐Ÿ”น 5.8.1 Frontrunning Prevention

Frontrunning occurs when malicious actors observe pending transactions and insert their own transactions ahead in the block order to profit from predictable price movements. CEDEX prevents frontrunning through:

  • Private Transaction wouldSubmission: causeTransactions >route through Jito's private mempool, invisible to searchers until block inclusion
  • Slippage Enforcement: Strict slippage limits (default 1%) reduce profitability of frontrunning attempts
  • Circuit Breaker Integration: 2% price movementimpact limit prevents large frontrun trades from TWAP.executing

๐Ÿ”น 5.8.2 Sandwich Attack Mitigation

Sandwich attacks bracket victim transactions with buy-before and sell-after trades, extracting value through induced price movements. CEDEX's protection mechanisms:

// Sandwich Attack Prevention
// Sandwich Attack Scenario (Without Protection):
// 1. Attacker sees: User shouldwants reduceto buy 10,000 tokens
// 2. Attacker frontruns: Buys 50,000 tokens (price increases)
// 3. User trade sizeexecutes: orBuys splitat into multiple smaller transactions. This protects all market participants from suddenhigher price
manipulation.

//
4.

5.8Attacker ๐Ÿ’งbackruns: HookSells 6:50,000 Liquiditytokens Pool(profit Sufficiency

extracted)

The// LiquidityCEDEX PoolProtection: Sufficiency// hook1. ensuresTransaction thein OTCMprivate LiquidityJito Poolmempool maintains adequate reserves(invisible to supportattacker) all// outstanding2. ST22Even tokens.if Thevisible, hook2% confirmscircuit thebreaker poolblocks maintainsattacker's afrontrun minimum// 150%3. ratioUser oftrade lockedprotected capitalby toslippage circulatingtolerance ST22// value4. beforeSequential allowinglarge redemptiontrades transactions.

trigger
coordinated activity detection

๐Ÿ”น 5.8.13 ๐Ÿ“ŠJito 150%Bundle Ratio RequirementIntegration

TheCEDEX 150%integrates over-collateralizationwith providesJito's ablock-building safetyinfrastructure bufferfor ensuringinstitutional-grade redemptionsMEV can always be honored:protection:

ComponentFeature

CalculationImplementation

๐Ÿ’ฐBundle

Locked CapitalSubmission

TotalAll SOLCEDEX intrades unifiedsubmitted LPas (permanentlyJito locked)bundles with guaranteed atomicity

๐ŸŽซPrivate

Circulating ValueMempool

SumTransactions ofinvisible until block inclusion (ST22no supplypublic ร—mempool current price) for all tokensexposure)

๐Ÿ“ŠPriority

Sufficiency RatioFees

LockedDynamic Capitalpriority /fee Circulatingcalculation Valuefor ร—reliable 100%inclusion

โœ…Backrun

Minimum RequiredProtection

โ‰ฅBundle 150%structure โ€”prevents redemptionsinsertion pausebetween ifcompliance belowverification and execution


โšก

5.8.2 ๐Ÿ“œ Implementation

rust

// Liquidity Sufficiency Check
pub const MIN_SUFFICIENCY_RATIO_BPS: u64 = 15000;  // 150%

pub fn check_liquidity_sufficiency(
    pool: &UnifiedLiquidityPool,
    redemption_amount: u64,
) -> Result<()> {
    // Calculate current ratio
    let locked_capital = pool.total_sol_reserve;
    let circulating_value = calculate_total_circulating_value(pool)?;
    
    // Add redemption impact
    let post_redemption_capital = locked_capital - redemption_amount;
    let post_redemption_ratio = post_redemption_capital * 10000 / circulating_value;
    
    require!(
        post_redemption_ratio >= MIN_SUFFICIENCY_RATIO_BPS,
        LiquidityError::InsufficientLiquidity {
            current_ratio: post_redemption_ratio,
            required_ratio: MIN_SUFFICIENCY_RATIO_BPS,
        }  // 6007
    );
    
    Ok(())
}

๐Ÿ“‹ Regulatory Reference: Securities Exchange Act Rule 15c2-11 โ€” Capital Adequacy Requirements

โŒ Error Code 6007: LIQUIDITY_INSUFFICIENT Pool ratio below 150% threshold. Redemptions temporarily paused until trading volume rebuilds reserves. Regular ST22 trading (non-redemption) remains permitted. Users can wait for ratio recovery or reduce redemption amount.


5.9 ๐Ÿ›ก๏ธ Thirty-Six Supplementary Security Controls

Beyond the six primary Transfer Hooks, OTCM implements thirty-six supplementary security controls integrated into the transfer hook logic, creating a comprehensive 42-point security framework.


5.9.1 ๐Ÿ“œ Smart Contract Controls (1-6)

#

Control

Description

1๏ธโƒฃ

Formal Verification

Certora Prover mathematical proof of contract correctness

2๏ธโƒฃ

Multi-Audit Requirement

Independent audits by Quantstamp, Halborn, and OtterSec

3๏ธโƒฃ

Immutable Bytecode

No proxy patternโ€”code cannot be changed post-deployment

4๏ธโƒฃ

Bug Bounty Program

Up to $500K rewards for critical vulnerabilities

5๏ธโƒฃ

Reentrancy Guards

Check-Effects-Interactions pattern enforcement

6๏ธโƒฃ

Integer Overflow Protection

Rust's checked arithmetic prevents overflow attacks


5.9.2 ๐Ÿ” Access Control Framework (7-12)

#

Control

Description

7๏ธโƒฃ

Multi-Sig Administration

4-of-7 threshold for administrative actions

8๏ธโƒฃ

Timelock Delays

48-hour delay on all parameter changes

9๏ธโƒฃ

Role-Based Access

Granular permission system (operator, compliance, admin)

๐Ÿ”Ÿ

Emergency Pause

2-of-7 emergency pause with 24hr auto-unpause

1๏ธโƒฃ1๏ธโƒฃ

DAO Override

2/3 supermajority required for lock override

1๏ธโƒฃ2๏ธโƒฃ

Key Rotation

Quarterly key rotation with HSM backing


5.9.3 โš›๏ธ Transaction Integrity Controls (13-18)

#

Control

Description

1๏ธโƒฃ3๏ธโƒฃ

Atomic Execution

All-or-nothing transaction commitment

1๏ธโƒฃ4๏ธโƒฃ

Orphan Prevention

No partial execution states possible

1๏ธโƒฃ5๏ธโƒฃ

Replay Protection

Unique transaction signatures prevent replay

1๏ธโƒฃ6๏ธโƒฃ

Nonce Management

Sequential nonces prevent transaction ordering attacks

1๏ธโƒฃ7๏ธโƒฃ

Deadline Enforcement

Transactions expire after specified block height

1๏ธโƒฃ8๏ธโƒฃ

Slippage Protection

User-configurable maximum price deviation


5.9.4 ๐Ÿ”ฎ Oracle & Data Controls (19-24)

#

Control

Description

1๏ธโƒฃ9๏ธโƒฃ

Multi-Oracle Consensus

Cross-reference multiple data sources

2๏ธโƒฃ0๏ธโƒฃ

Staleness Detection

Reject data older than threshold (10 min)

2๏ธโƒฃ1๏ธโƒฃ

Signature Verification

Ed25519 verification of all oracle data

2๏ธโƒฃ2๏ธโƒฃ

Rate Limiting

Maximum oracle queries per block per mint

2๏ธโƒฃ3๏ธโƒฃ

Fallback Oracles

Automatic failover to backup data sources

2๏ธโƒฃ4๏ธโƒฃ

Data Freshness Proofs

On-chain attestation of data recency


5.9.5 ๐Ÿ‘๏ธ Monitoring & Alerting (25-30)

#

Control

Description

2๏ธโƒฃ5๏ธโƒฃ

Real-Time Monitoring

24/7 transaction pattern analysis

2๏ธโƒฃ6๏ธโƒฃ

Anomaly Detection

ML-based unusual activity identification

2๏ธโƒฃ7๏ธโƒฃ

SEC Notification

Automatic reporting of compliance failures

2๏ธโƒฃ8๏ธโƒฃ

Compliance Dashboard

Real-time visibility for regulators

2๏ธโƒฃ9๏ธโƒฃ

Audit Log Export

On-demand historical data retrieval

3๏ธโƒฃ0๏ธโƒฃ

Alert Escalation

Tiered notification for severity levels


5.9.6 ๐Ÿ›๏ธ Governance & Recovery (31-36)

#

Control

Description

3๏ธโƒฃ1๏ธโƒฃ

Proposal System

On-chain governance for parameter changes

3๏ธโƒฃ2๏ธโƒฃ

Voting Mechanism

Token-weighted voting with delegation

3๏ธโƒฃ3๏ธโƒฃ

Quorum Requirements

Minimum participation thresholds

3๏ธโƒฃ4๏ธโƒฃ

Veto Power

Compliance officer veto on security-relevant proposals

3๏ธโƒฃ5๏ธโƒฃ

Migration Capability

Controlled upgrade path for critical fixes

3๏ธโƒฃ6๏ธโƒฃ

Disaster Recovery

Documented procedures for catastrophic scenarios


5.10 โš ๏ธ Error Handling and Recovery

Code

Hook

Condition

๐Ÿ”ง User Action

โŒ

6001

๐Ÿ” Custody

Discrepancy >0.01%

Wait, retry, contact issuer

โŒ

6002

๐Ÿšซ OFAC

Sanctioned address

PERMANENT

 โ€” contact OFAC

โŒ

6003

๐Ÿ•ต๏ธ AML

Risk score 71-100

Request compliance review

โŒ

6004

๐Ÿชช Redemption

KYC/accreditation issue

Complete verification

โŒ

6006

๐Ÿ“‰ Price Impact

>2% TWAP deviation

Reduce size, split trade

โŒ

6007

๐Ÿ’ง Liquidity

<150% pool ratio

Wait for ratio recovery


5.11 ๐Ÿ“Š Performance Specifications

Metric

ValueSpecification

Notes

โฑ๏ธThroughput

Total Hook Latency(TPS)

750-1,350ms400-600

SequentialLimited executionby compliance verification

๐Ÿ”ขCompliance Latency

2,000-3,000ms

Six hooks + oracle queries

Execution Latency

400-600ms

CPMM swap post-verification

Block Finality

~13 seconds

32 Solana blocks

Compute Units

~800,000 CU

Per complete transferswap transaction

โšกNetwork

Effective TPSFee

400-600~$0.01-0.05

ComplianceSolana overhead

๐Ÿ’ตbase

Oracle+ Cost/Transfer

$2-5

Chainalysis,priority Empire APIsfee


๐Ÿ—๏ธ

5.12 ๐Ÿ”10 Security Audit StatusArchitecture

AuditorCEDEX security combines smart contract hardening, economic attack resistance, and operational security measures:

StatusSmart Contract Security

๐Ÿ”ฌ

Quantstamp

Audit

  • Formal scheduledverification Q1using 2026

๐Ÿ”

Halborn

Engagement in progress

๐Ÿฆฆ

OtterSec

Preliminary review complete

โœ…

Certora FormalProver

  • Security Verification

  • Specificationaudits developmentby underway

    ๐Ÿ›Quantstamp,

    BugHalborn, Bounty

    $500Kand OtterSec

  • Active bug bounty program launching(up withto mainnet

  • $100K

    rewards)

  • Immutable core contracts post-deployment Economic Security
  • Circuit breakers prevent flash loan attacks
  • TWAP oracle resists price manipulation
  • Permanent liquidity locks prevent rug pulls
  • Volume limits prevent coordinated dumps Operational Security
  • Multi-signature admin keys (4-of-7 threshold)
  • 48-hour timelock on parameter changes
  • Real-time monitoring and alerting
  • Incident response playbooks โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”

    ยฉ 2025 OTCM Protocol, Inc. | All Rights Reserved