Shielded Swaps

Shielded Swaps let you swap tokens through an AMM without revealing your identity. The ShieldedSwapRouter contract wraps Ekubo's AMM using the ILocker interface — Ekubo only sees the router contract as the swapper, never your address.

Ekubo
AMM
Identity Hidden
Privacy
30bps
Fee
Yes
Atomic

How It Works

The swap happens in a single atomic transaction through Ekubo's ILocker callback:

1
Withdraw from source privacy pool
The router withdraws your tokens from the input pool (e.g., ETH pool) using your Merkle inclusion proof and nullifier. Your identity is separated from the tokens.
2
Swap via Ekubo AMM
The router locks Ekubo and executes the swap. The AMM sees the ShieldedSwapRouter contract as the swapper — it has no idea who you are.
3
Deposit into destination pool
Swapped tokens are deposited into the output privacy pool (e.g., USDC pool). A new Pedersen commitment is created for you.
ILocker Pattern

Ekubo uses an ILocker interface where the swap executor "locks" the pool, performs operations, and settles deltas. The ShieldedSwapRouter implements this interface, making it the on-chain actor for the swap while your address stays completely hidden.

Privacy Model

PropertyVisible?
Your identityHidden — router is the on-chain actor
Swap amountsVisible to Ekubo (required for constant-product math)
Source of fundsHidden — withdrawn from privacy pool with ZK proof
Destination of fundsHidden — deposited into privacy pool as new commitment
Amount Visibility

Swap amounts are visible to the Ekubo AMM because constant-product math requires plaintext values. However, your identity is completely hidden — the AMM cannot link the swap to your address.

Fee Structure

  • Protocol fee: 30bps (0.30%) deducted from the output amount before re-deposit
  • Ekubo AMM fee: Standard Ekubo pool fees apply (varies by pool)
  • Total cost: Protocol fee + AMM fee

Fees accumulate per output token in the ShieldedSwapRouter contract.

SDK Usage

const result = await obelysk.swap.execute({
  tokenIn: 'eth',
  tokenOut: 'usdc',
  amountIn: '0.5',
  slippageBps: 50, // 0.5% slippage tolerance
});

console.log('Received:', result.amountOut, 'USDC');
console.log('Tx:', result.transactionHash);

Contract Details

  • Address: 0x05a7f8a6ab74ee6ab41169118ca2ea21070dc6594bae5a39f5bb9ac50629725b
  • Integration: Ekubo ILocker interface
  • Fee: 30bps (max 500bps = 5%, configurable)
  • Upgrade timelock: 48 hours

Next Steps