Skip to main content

Contract Interface

The Evix smart contract exposes a minimal interface for on-chain swap execution.

IEvix

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;

interface IEvix {
/// @notice Executes a swap through the Evix execution layer.
/// @param tokenIn The input token address.
/// @param tokenOut The output token address.
/// @param amountIn The exact amount of tokenIn to swap.
/// @param deadline Unix timestamp after which the transaction must revert.
/// @param minAmountOut Minimum acceptable output amount.
/// @param recipient Address that receives the output tokens.
/// @return amountOut The final output amount delivered to the recipient.
function swap(
address tokenIn,
address tokenOut,
uint256 amountIn,
uint256 deadline,
uint256 minAmountOut,
address recipient
) external payable returns (uint256 amountOut);
}

Parameters

ParameterTypeDescription
tokenInaddressThe ERC-20 token being sold
tokenOutaddressThe ERC-20 token being bought
amountInuint256Exact amount of tokenIn to swap (must be > 0)
deadlineuint256Unix timestamp — transaction reverts if block.timestamp > deadline
minAmountOutuint256Minimum acceptable output — reverts if actual output is lower
recipientaddressReceives the output tokens (must not be address(0))

Return Value

NameTypeDescription
amountOutuint256The actual amount of tokenOut delivered to recipient

Events

Swap

Emitted on every successful swap execution.

event Swap(
address indexed sender,
address indexed tokenIn,
address indexed tokenOut,
uint256 amountIn,
uint256 amountOut,
address recipient
);
FieldIndexedDescription
senderYesmsg.sender — the address that initiated the swap
tokenInYesInput token address
tokenOutYesOutput token address
amountInNoInput amount
amountOutNoActual output amount
recipientNoAddress that received the output tokens

Errors

ErrorSignatureWhen
Deadline exceededDeadlineExceeded()block.timestamp > deadline
Insufficient outputInsufficientOutput(uint256 amountOut, uint256 minAmountOut)Actual output < minAmountOut
Invalid inputInvalidAmountIn()amountIn == 0
Invalid recipientInvalidRecipient()recipient == address(0)
Unsupported pairUnsupportedPair(address tokenIn, address tokenOut)Pair not allowlisted

ABI

The full ABI is available in the TypeScript SDK as evixAbi:

import { evixAbi } from "@inductiv/evix-sdk";
Raw ABI JSON
[
{
"type": "function",
"name": "swap",
"inputs": [
{ "name": "tokenIn", "type": "address" },
{ "name": "tokenOut", "type": "address" },
{ "name": "amountIn", "type": "uint256" },
{ "name": "deadline", "type": "uint256" },
{ "name": "minAmountOut", "type": "uint256" },
{ "name": "recipient", "type": "address" }
],
"outputs": [{ "name": "amountOut", "type": "uint256" }],
"stateMutability": "payable"
},
{
"type": "event",
"name": "Swap",
"inputs": [
{ "name": "sender", "type": "address", "indexed": true },
{ "name": "tokenIn", "type": "address", "indexed": true },
{ "name": "tokenOut", "type": "address", "indexed": true },
{ "name": "amountIn", "type": "uint256", "indexed": false },
{ "name": "amountOut", "type": "uint256", "indexed": false },
{ "name": "recipient", "type": "address", "indexed": false }
]
},
{
"type": "error",
"name": "DeadlineExceeded",
"inputs": []
},
{
"type": "error",
"name": "InsufficientOutput",
"inputs": [
{ "name": "amountOut", "type": "uint256" },
{ "name": "minAmountOut", "type": "uint256" }
]
},
{
"type": "error",
"name": "InvalidAmountIn",
"inputs": []
},
{
"type": "error",
"name": "InvalidRecipient",
"inputs": []
},
{
"type": "error",
"name": "UnsupportedPair",
"inputs": [
{ "name": "tokenIn", "type": "address" },
{ "name": "tokenOut", "type": "address" }
]
}
]

Owner Functions

These functions are restricted to the deployment owner and are not part of the integrator-facing interface.

setPairSupport

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

Enables or disables a token pair on the deployment. Pair order does not matter — (A, B) and (B, A) resolve to the same pair key via ordered hashing.