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

# Standard Interface

> The two-function interface a propAMM pair implements for Rialto.

## What you implement

Deploy one contract per token pair implementing the standard Rialto propAMM
interface: a getAmountOut quote and a swapExactIn settle. Rialto calls them by
their 4-byte selector, so match these signatures, or put a thin adapter in front
if your AMM already exposes different ones. token0() and token1() are optional;
Rialto never calls them, since the pair and ordering come from Rialto's config.

```solidity theme={null}
interface IPropPair {
    /// OPTIONAL — Rialto never calls these; pair & ordering come from config.
    function token0() external view returns (address);
    function token1() external view returns (address);

    /// QUOTE (read-only view). Exact-in only.
    /// zeroForOne = true  -> selling token0, receiving token1
    /// zeroForOne = false -> selling token1, receiving token0
    function getAmountOut(bool zeroForOne, uint256 amountIn)
        external view returns (uint256 amountOut);

    /// SETTLE (state-changing). Called by RialtoRouter only.
    function swapExactIn(
        bool zeroForOne,
        uint256 amountIn,
        uint256 amountOutMin,
        address to,
        uint256 deadline
    ) external payable returns (uint256 amountOut);
}
```

getAmountOut is sampled at quote time; swapExactIn settles. The trade direction
zeroForOne is fixed by Rialto's config ordering, not by token0() or token1():
zeroForOne = true means sell config-token0 and buy config-token1.

## Why the shape matters

The interface is a convention Rialto standardizes on, not a protocol constraint,
but two things are coupled to the exact shape:

* The settle selector is allowlisted onchain per pool, and the router patches the
  real input amount into the calldata at a fixed offset that assumes
  swapExactIn(bool, uint256 amountIn, ...) with amountIn as the second argument. A
  different argument layout moves that offset.
* The quote and settle selectors are currently a single shared interface across all
  propAMM pools.

payable is part of the standard signature so native-ETH pairs are possible.
