Skip to main content

Architecture

Evix is structured around a minimal, auditable contract surface with deployment-level customization. Each customer integration is provisioned independently — there is no universal public router.

System Design

Core Components

Evix Contract

The on-chain execution contract with a single entry point:

function swap(
address tokenIn,
address tokenOut,
uint256 amountIn,
uint256 deadline,
uint256 minAmountOut,
address recipient
) external payable returns (uint256 amountOut);

The contract enforces the following checks before and after execution:

CheckWhenReverts With
Deadline not exceededBefore executionDeadlineExceeded()
Amount is non-zeroBefore executionInvalidAmountIn()
Recipient is validBefore executionInvalidRecipient()
Pair is supportedBefore executionUnsupportedPair(tokenIn, tokenOut)
Output meets minimumAfter executionInsufficientOutput(amountOut, minAmountOut)

Execution Engine

The _execute() function is the deployment-specific component. Each customer deployment overrides this with their configured strategy — optimized for their specific pairs, chains, and execution requirements.

function _execute(
address tokenIn,
address tokenOut,
uint256 amountIn
) internal virtual returns (uint256 amountOut);

This is where Evix differs from a generic router: execution logic is not one-size-fits-all. It is tuned per deployment.

Pair Access Control

Pairs are allowlisted per deployment by the owner:

function setPairSupport(
address tokenA,
address tokenB,
bool supported
) external onlyOwner;

Pair keys are computed using ordered, packed hashing — (tokenA, tokenB) and (tokenB, tokenA) resolve to the same key.

SDK Layer

The SDK provides a thin abstraction over the contract interface, available in TypeScript and Rust:

MethodDescription
swap()Execute a swap with a wallet client
simulateSwap()Optionally preview execution result via eth_call
populateSwap()Build a transaction request without broadcasting
encodeSwap()Encode calldata for custom pipelines (Rust)

The SDK does not add routing, quoting, or off-chain logic. It is a typed, validated wrapper around the contract.

Design Principles

  1. Minimal surface area — One function, six parameters. Nothing to misconfigure.
  2. On-chain verification — All safety checks happen in the contract, not the SDK.
  3. Deployment isolation — No shared state between customers or chains.
  4. Strategy flexibility — Execution logic is configurable per deployment.
  5. SDK transparency — The SDK generates contract calls. It does not introduce hidden behavior.