Skip to main content
Full working code: The complete source code for this example is available in test-contracts/pool/
This example closely mirrors the AMM contract’s logic but supports only one token pair. This design allows the pool to implement a token interface, where the pool’s token represents shares in the liquidity pool, enabling interaction through standard token methods (demonstrated at the test’s end). In a production environment, a middleware application would manage pool creation for users and maintain a mapping of token pairs to pool contract IDs.

WIT Interface

Rust Implementation

Testing