> For the complete documentation index, see [llms.txt](https://docs.ammplify.xyz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.ammplify.xyz/technical-specs/smart-contract-details.md).

# Smart Contract Details

## High-Level Description

Ammplify is a protocol that wraps UniswapV3, manages deposits by breaking them into smaller pieces.

This means when a users deposits a typical UniV3 range, we split it into smaller pieces and re-deposits them back into UniV3. The reason to do this is because each piece falls into a bucket and all liquidity within each bucket is fungible. This allows us to apply two optimizations on each bucket: auto-compounding and borrowing.&#x20;

In contract, the buckets are nodes in our segment tree and borrowed liquidity is called Taker liquidity. Regular liquidity is called Maker liquidity and Maker liquidity is split into a compounding version and a non-compounding version.

## High-level Architecture

Ammplify is built according to the Diamond standard (EIP 2535) and it installs these facets:

* Maker Facet (For opening and closing liquidity positions)
* Taker Facet (A privileged facet for borrowing liquidity)
* View Facet (For examining contract storage)
* Admin Facet (For managing Taker rights and time-gating and protocol changes)
* Pool Facet (For interacting with the underlying pool)

The meat of the complexity is in the Walker library called by the Maker and Taker facets to deposit/borrow liquidity to/from the nodes in the segment tree stored in the tree folder. The majority of the tree logic is in Route.sol.
