Skip to main content

Overview

Reflex prioritizes security through multiple defensive layers to ensure safe and reliable MEV operations. This document outlines our security architecture, implementation details, and best practices for integration.

🛡️ Security Architecture

Core Security Principles

Reflex implements a multi-layered security approach protecting all participants in the MEV ecosystem:

Failsafe Architecture - Comprehensive failsafe mechanisms guarantee zero impact on user transactions and funds. All MEV operations use try-catch patterns ensuring MEV failures cannot affect underlying user transactions.

Independent Operation - Reflex operates completely independently from protocol and user swaps. The system has no access to user funds or protocol treasuries, capturing MEV only through legitimate arbitrage opportunities using flash loan-based swaps.

Zero Risk to Users - Mathematical guarantees ensure user funds cannot be accessed, locked, or affected. Users never approve tokens to Reflex, and all MEV operations remain isolated from user transaction flow.

Zero Trust Architecture - No admin keys for core functionality, transparent and verifiable execution, permissionless participation, and censorship resistance.

Multi-Layer Protection

  • Contract-level: Reentrancy guards, access controls, and comprehensive input validation
  • Architecture-level: Modular design with isolated components and fail-safe mechanisms
  • Economic-level: Incentive alignment and built-in profitability guarantees
  • Operational-level: Granular permissions and emergency procedures

🔒 User Protection

Safe by Design

Critical Safety Guarantee: Reflex ensures zero impact on user transactions and funds under all circumstances by design

1. No Token Approvals Required

Reflex never requires users to approve tokens or grant spending permissions:

  • Zero approvals - Users never approve tokens to Reflex contracts
  • No fund access - Reflex cannot access, transfer, or lock user funds
  • Flash loan based - All MEV operations use flash loans exclusively
  • Public arbitrage only - Captures value from market inefficiencies, not user balances
  • Complete independence - Operates entirely separate from user transaction flow

2. Transaction Isolation

MEV operations are completely isolated from user transactions:

  • Try-catch wrappers prevent MEV failures from propagating to user transactions
  • Graceful degradation ensures user transactions continue normally if MEV extraction fails
  • Zero fund access means Reflex has no access to user funds or token approvals
  • Independent execution keeps MEV operations separate from user swap logic

Atomic Operations

All MEV operations are atomic:

  • Either fully successful with profit distribution, or completely reverted
  • No partial state changes that could leave funds locked

Integration Best Practices

Always use try-catch for MEV operations to guarantee user transaction protection:

contract SecureProtocolIntegration {
function executeSwapWithMEV(SwapParams memory params) external {
// Step 1: Execute user transaction first (guaranteed completion)
uint256 amountOut = _executeUserSwap(params);

// Step 2: Attempt MEV extraction with full isolation
try reflexRouter.triggerBackrun(
params.poolId,
params.amountIn,
params.zeroForOne,
params.recipient,
configId
) returns (uint256 profit, address profitToken) {
// MEV succeeded
} catch {
// don't revert user transaction
}

}

function _executeUserSwap(SwapParams memory params) internal returns (uint256) {
// User swap logic - completely independent of MEV
// This must complete successfully regardless of MEV outcome
return pool.swap(params.amountIn, params.minAmountOut, params.recipient);
}
}

Key Integration Principles:

  • Execute user logic first - Ensure user transactions complete before MEV attempts
  • Use comprehensive try-catch - Handle both string errors and low-level failures
  • Never revert on MEV failure - User transactions must complete regardless of MEV outcome
  • Log MEV failures - Track MEV performance without affecting user experience
  • Validate user protection - Test that MEV failures don't impact user transactions

🚨 Emergency Response

Emergency Procedures

Pause Authority:

  • Protocol integrators can pause their specific integration
  • Reflex team can pause system-wide operations if needed
  • Multi-signature requirements for all emergency actions

Response Timeline:

  • Immediate (0-15 min): Automated systems respond to anomalies
  • Short-term (15-60 min): Security team assessment and manual intervention
  • Medium-term (1-24 hours): Root cause analysis and fix development
  • Long-term (24+ hours): Fix deployment, testing, and ecosystem communication

Security Contacts

Primary Contacts: