Swap App (app-swap)
A simple example app that allows users to deposit/withdraw tokens, transfer tokens, and swap tokens. The token swapping is powered by an AMM that users can also add/remove liquidity to. The App's architecture is broken down into two key components.
-
Core Architecture
A pure Rust state machine (written in Rust) that processes events to update the application state. It’s designed for testability, zkVM portability, and a clean separation between state logic and the external runtime. -
App Contracts
On-chain interfaces and state proof validation for the Swap App. App contracts are minimal, leveraging helper contracts fromvoid/void-contracts/. Functions are defined in a separate interface, with the main contract using a global fallback. State validation is managed by a separate, upgradeable contract.