Overview
The sample-propamm repository is a minimal, self-contained reference implementation of an onchain propAMM that plugs into the Rialto Router as a liquidity source. Use it as a starting skeleton: copy it, replace the pricing logic with your own, and keep the two integration entrypoints, getAmountOut and swapExactIn, matching the standard interface. Repository: https://github.com/rialto-plds/sample-propamm This is sample code for integration purposes only. It is not audited and not production-ready. Do not deploy it as-is with real funds.Contracts
- PropPair. An inventory-backed pair contract with quoting and exact-input swaps. This is the contract Rialto integrates with, one per token pair.
- PropOracle. An example price source with owner-gated updates and a pause switch. This stands in for your own pricing source; replace it with whatever drives your quotes.
Price format
PropOracle stores price as priceX18, the token1 amount per 1 token0, scaled by 1e18. For example, 2e18 means 1 token0 quotes to 2 token1, and 5e17 means 1 token0 quotes to 0.5 token1.Example flow
- Deploy PropOracle.
- Deploy PropPair with owner, token0, token1, and the oracle address.
- Call PropOracle.setPrice(pair, priceX18).
- Approve and fund both pair reserves with PropPair.fund.
- Quote with PropPair.getAmountOut.
- Settle via PropPair.swapExactIn, in production called by the Rialto Router.
