Skip to main content

Overview

In the Architecture Overview, we explored the core components that make up the Euclid Unified Liquidity layer. This section covers the Solidity (EVM) smart contracts that power Euclid on EVM-compatible chains.

Since the Factory smart contract is the main entry point for users/projects to interact with the Euclid layer, this page focuses on the common Solidity types used across Factory methods.

Common Types

TokenType

Defines the type and source of a token used in the Euclid protocol.

struct TokenType {
    string token_type;
    string native_denom;
    string erc20_address;
}
FieldTypeDescription
token_typestringThe token type (native, smart, or voucher).
native_denomstringNative token denom.
erc20_addressstringERC20 contract address.

TokenWithDenom

Represents a token identifier along with its token type.

struct TokenWithDenom {
    string token;
    TokenType token_type;
}
FieldTypeDescription
tokenstringThe token id.
token_typeTokenTypeThe token type (native, smart, or voucher).

TokenWithDenomAndAmount

Represents a token id, amount, and token type.

struct TokenWithDenomAndAmount {
    string token;
    uint256 amount;
    TokenType token_type;
}
FieldTypeDescription
tokenstringThe token id.
amountuint256The amount for this token.
token_typeTokenTypeThe denomination/type of this token.

Pair

Token pair consisting of two token ids.

struct Pair {
    string token_1;
    string token_2;
}
FieldTypeDescription
token_1stringId of the first token in the pair.
token_2stringId of the second token in the pair.

PairWithDenomAndAmount

Token pair including amount and denomination details for each side.

struct PairWithDenomAndAmount {
    TokenWithDenomAndAmount token_1;
    TokenWithDenomAndAmount token_2;
}
FieldTypeDescription
token_1TokenWithDenomAndAmountInformation about the first token in the pair.
token_2TokenWithDenomAndAmountInformation about the second token in the pair.

CrossChainUser

Represents a user on a specific chain.

struct CrossChainUser {
    string chain_uid;
    string sender;
}
FieldTypeDescription
chain_uidstringUnique identifier of the chain.
senderstringUser address on that chain.

EuclidReceive

Message payload forwarded to destination integrations.

struct EuclidReceive {
    bytes data;
}
FieldTypeDescription
databytesBinary payload forwarded to receive hook target.

Limit

Defines a per-recipient release policy.

struct Limit {
    string limit_type;
    uint256 value;
}
{
  "equal": {
    "limit_type": "equal",
    "value": "1000000"
  },
  "less_than_or_equal": {
    "limit_type": "less_than_or_equal",
    "value": "1000000"
  },
  "greater_than_or_equal": {
    "limit_type": "greater_than_or_equal",
    "value": "1000000"
  },
  "dynamic": {
    "limit_type": "dynamic",
    "value": "0"
  }
}
FieldTypeDescription
limit_typestringOne of: equal, less_than_or_equal, greater_than_or_equal, dynamic.
valueuint256Value for limit evaluation. For dynamic, this should be 0.

limit_type options:

OptionDescription
dynamicUse when final output is unknown before execution (for example swaps).
Forces release of the full computed amount to this recipient.
If full release is not possible, the transaction fails.
equalEnforces an exact release amount.
Useful when expected output is known beforehand.
greater_than_or_equalSets a minimum amount that must be released.
Execution can still release more than this threshold.
less_than_or_equalSets a maximum amount that may be released to this recipient.
Useful for capped distribution across recipients.

Recipient

Defines destination release instructions for swap/deposit/transfer outputs.

struct Recipient {
    CrossChainUser recipient;
    Limit amount;
    TokenType denom;
    bytes forwarding_message;
    bool unsafe_refund_as_voucher;
}
FieldTypeDescription
recipientCrossChainUserDestination cross-chain user receiving funds.
amountLimitRelease amount constraint for this recipient.
denomTokenTypeDenomination/type to release for this recipient.
forwarding_messagebytesOptional encoded message for downstream integrations.
unsafe_refund_as_voucherboolIf true, failed release refunds vouchers to recipient (unsafe because router cannot validate destination address). If false, refund goes back to sender.

CrossChainConfig

Cross-chain transport options attached to execute messages.

struct CrossChainConfig {
    uint256 timeout;
    bytes ack_response;
    string meta;
}
FieldTypeDescription
timeoutuint256Timeout for the cross chain message.
ack_responsebytesAck response for the cross chain message. Will be used to trigger a receive message on sender when ack is received.
metastringMeta data for the cross chain message. Will be used to store any additional data needed for the cross chain message as event attributes.

PoolConfig

Pool configuration used during pool creation.

struct PoolConfig {
    string pool_type;
    uint256 amp_factor;
}
FieldTypeDescription
pool_typestringPool type literal: stable or cp (constant product).
amp_factoruint256Amplification factor used for stable pools.

NextSwapPair

Describes a hop in a swap route.

struct NextSwapPair {
    string token_in;
    string token_out;
    bool test_fail;
}
FieldTypeDescription
token_instringInput token id for this route step.
token_outstringOutput token id for this route step.
test_failboolTesting flag used in module tests. Keep false for normal usage.

PartnerFee

Partner fee settings for swap transactions.

struct PartnerFee {
    uint64 partner_fee_bps;
    address recipient;
}
FieldTypeDescription
partner_fee_bpsuint64Partner fee in basis points. Max supported value is 30 (0.3%).
recipientaddressAddress receiving the partner fee.