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:
| Check | When | Reverts With |
|---|---|---|
| Deadline not exceeded | Before execution | DeadlineExceeded() |
| Amount is non-zero | Before execution | InvalidAmountIn() |
| Recipient is valid | Before execution | InvalidRecipient() |
| Pair is supported | Before execution | UnsupportedPair(tokenIn, tokenOut) |
| Output meets minimum | After execution | InsufficientOutput(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:
| Method | Description |
|---|---|
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
- Minimal surface area — One function, six parameters. Nothing to misconfigure.
- On-chain verification — All safety checks happen in the contract, not the SDK.
- Deployment isolation — No shared state between customers or chains.
- Strategy flexibility — Execution logic is configurable per deployment.
- SDK transparency — The SDK generates contract calls. It does not introduce hidden behavior.