Skip to main content

Liquidity Engine

The Liquidity Engine is Encrypto's core technical moat. It's the system that enables users to spend any crypto asset at point of sale by handling real-time conversion, route optimization, and risk management.

What It Does​

In simple terms: the Liquidity Engine takes any supported crypto asset and converts it to USDC at the best available rate, fast enough to settle a card transaction within Visa's authorization window (~3 seconds).

This is harder than it sounds.

Architecture​

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Liquidity Engine β”‚
β”‚ β”‚
β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚ β”‚ Price Oracle β”‚ β”‚ Liquidity Aggregatorβ”‚ β”‚
β”‚ β”‚ (Multi-src) β”‚ β”‚ (Multi-DEX) β”‚ β”‚
β”‚ β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β”‚ β”‚ β”‚ β”‚
β”‚ β”Œβ”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚ β”‚ Route Optimizer β”‚ β”‚
β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚
β”‚ β”‚ β”‚ Direct β”‚ β”‚Multi-Hop β”‚ β”‚ Cross-DEX β”‚ β”‚ β”‚
β”‚ β”‚ β”‚ Swap β”‚ β”‚ Routes β”‚ β”‚ Split β”‚ β”‚ β”‚
β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚
β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β”‚ β”‚ β”‚
β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚ β”‚ Risk Manager β”‚ β”‚
β”‚ β”‚ β€’ Slippage bounds β€’ Pool depth check β”‚ β”‚
β”‚ β”‚ β€’ Price staleness β€’ Impact analysis β”‚ β”‚
β”‚ β”‚ β€’ Execution timeout β€’ Fallback logic β”‚ β”‚
β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β”‚ β”‚ β”‚
β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚ β”‚ Execution Engine β”‚ β”‚
β”‚ β”‚ Atomic swap + settlement in single tx β”‚ β”‚
β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Price Oracle​

The engine maintains a real-time price feed from multiple sources to prevent single-source manipulation:

  • On-chain TWAP β€” Time-weighted average price from DEX pools (30s, 60s, 300s windows)
  • Chainlink / Pyth β€” Oracle feeds for major pairs
  • CEX reference β€” Binance/Coinbase spot prices for cross-validation

The final price is a confidence-weighted median across sources. If sources diverge by more than 0.5%, the engine flags the asset as potentially manipulated and widens the slippage buffer or skips the asset entirely.

Liquidity Aggregation​

Rather than relying on a single DEX, the engine aggregates liquidity across multiple venues:

DEXChainsNotes
Uniswap V3Base, Ethereum, ArbitrumConcentrated liquidity, best for major pairs
AerodromeBaseNative Base DEX, deep USDC pools
CurveEthereum, BaseOptimized for stablecoin swaps
RaydiumSolanaPrimary Solana DEX
JupiterSolanaAggregator, multi-route

For each swap, the engine queries all available venues and selects the route with the best effective price (swap output minus gas minus fees).

Route Optimization​

The optimizer evaluates three types of routes for every conversion:

Direct Swap​

ETH β†’ USDC on a single DEX. Simplest and fastest, used when a deep pool exists.

Multi-Hop​

DOGE β†’ WETH β†’ USDC across two pools. Used when the direct pair has insufficient liquidity but intermediate pairs are deep.

Cross-DEX Split​

Split a large order across multiple DEXs to minimize price impact. A $10,000 ETH β†’ USDC conversion might execute 60% on Uniswap and 40% on Aerodrome to get better aggregate execution.

The optimizer runs in under 100ms and selects the route with the lowest total cost (slippage + gas + fees).

Risk Management​

Every conversion is evaluated against a risk model before execution:

Slippage Control​

# Simplified slippage check
expected_output = amount * oracle_price
simulated_output = simulate_swap(dex, amount, route)
slippage = (expected_output - simulated_output) / expected_output

if slippage > MAX_SLIPPAGE: # 1.0%
reject_or_fallback()

Pool Depth Analysis​

The engine checks that the swap amount won't move the pool price by more than 0.5%. For large transactions, this prevents front-running and excessive market impact.

Execution Timeout​

Card authorizations have a strict timeout. If the Liquidity Engine can't find and execute a route within 3 seconds, it falls back to the user's USDC balance. No conversion that takes longer than 3 seconds is executed.

Why This Matters​

Most crypto card products require users to manually convert assets before spending. This is like requiring someone to go to a currency exchange before every purchase abroad. It's a solved problem β€” the infrastructure just needs to be built.

Encrypto's Liquidity Engine makes crypto spendable the same way Visa makes foreign currency spendable: invisibly, instantly, at a fair rate.