> ## Documentation Index
> Fetch the complete documentation index at: https://staging.docs.aile.tech/llms.txt
> Use this file to discover all available pages before exploring further.

# Aile protocol

> Aile settles through an unmodified deployment of the audited 1inch Limit Order Protocol v4 under its own EIP-712 domain.

## Contracts

A swap on Aile calls exactly one Aile contract: the order protocol. You approve it for the token you sell
and send the fill to it.

| | |
| - | - |
| Contract | `AileLimitOrderProtocol` |
| Address on Base | [`0x26110236656013A0d0Bad7e6b926AD9d4568A268`](https://basescan.org/address/0x26110236656013A0d0Bad7e6b926AD9d4568A268) |
| EIP-712 domain | name `Aile Intent Protocol`, version `1`, chain ID `8453`, verifying contract as above |
| Fill method | `fillContractOrder(order, signature, amount, takerTraits)` when the maker quotes from a contract, as every maker does today; `fillOrder(order, r, vs, amount, takerTraits)` when it signs with a wallet key. Either way the calldata is ready in `fill.data` |
| Events | `OrderFilled(bytes32 orderHash, uint256 remainingAmount)`, `OrderCancelled(bytes32 orderHash)` |
| Owner functions | `pause()`, `unpause()` — stop and resume new fills; they cannot move funds or alter orders |
| ABI | [AileLimitOrderProtocol.abi.json](https://staging.docs.aile.tech/assets/AileLimitOrderProtocol.abi.json) — the 1inch `OrderMixin` v4 interface plus `pause`, `unpause`, `DOMAIN_SEPARATOR` and `Ownable` |

The address above is the one `GET /config` returns as `contracts.lop`. The tokens are standard ERC-20s; their addresses are on [Networks and tokens](https://staging.docs.aile.tech/reference/networks-and-tokens.md).

## Security and audit

**What is audited.** The order protocol inherits `OrderMixin` from the 1inch Limit Order Protocol v4
([`@1inch/limit-order-protocol-contract` 4.3.2](https://github.com/1inch/limit-order-protocol)) without
modification. 1inch publishes the security audits of that release in
[1inch/1inch-audits](https://github.com/1inch/1inch-audits/tree/master/Limit%20Order%20Protocol).

**What the contract enforces.** On a fill the protocol verifies the maker's signature: for a maker
contract, that the contract itself confirms it (ERC-1271); for a wallet maker, that `r` and `vs` (EIP-2098)
recover to `order.maker`. It also verifies that `msg.sender` is the taker the order was signed for
(`allowedSender`); that the order has not expired (`expiresAt`); and that its nonce bit is unspent (a replay
reverts `BitInvalidatedOrder`). It then transfers `takingAmount` of the sold token from the taker to the
order's `receiver` (the maker's treasury) and `makingAmount` of the bought token from the maker to the
taker in one transaction, or reverts. The maker pays under an ERC-20 allowance it granted the protocol.

**What it does not enforce.** The contract does not check the price: the amounts are whatever the maker
signed. The midmarket rate and the spread are information in the quote for you to judge before you send
([Rates & fees](https://staging.docs.aile.tech/reference/rates-and-fees.md)).

**Custody and control.** Funds never sit in an Aile contract or on an Aile server; settlement is one
atomic transfer between the taker's wallet and the maker's. Aile's servers price and sign quotes; the fill
is sent by your wallet straight to the order protocol. The protocol's owner can pause new fills during an
incident; a pause cannot move funds or alter a signed order.

## Order format

`quote.order` is the 1inch v4 order struct with decimal-string amounts:

| Field | Meaning |
| - | - |
| `maker` | The market maker: its contract, or its wallet. Informational; do not pin it. |
| `receiver` | Where the taker's token goes: the maker's treasury, or the settlement address when an extension is present. |
| `makerAsset`, `takerAsset` | The token you receive and the token you pay. |
| `makingAmount`, `takingAmount` | The exact amounts of the fill. |
| `makerTraits` | Packed flags: allowed sender, expiry, nonce, no partial fills. |
| `salt` | Random per quote; its low 160 bits hash the extension (`0x` today). |

`orderHash` (the key of `GET /orders/{hash}`) is the EIP-712 hash of this struct under the domain above.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.