> For the complete documentation index, see [llms.txt](https://learn.woo.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://learn.woo.org/dev-docs/guides/integrate-woofi-as-a-liquidity-source-on-solana/architecture.md).

# Architecture

## Architecture Overview

<figure><img src="/files/RPWWuH4fA2WtsFCmHde4" alt=""><figcaption><p>WooFi's Overview</p></figcaption></figure>

### Account Structure

Here is the structure for WOOFi's Synthetic Proactive Market Making (sPMM) contract on Solana. This repository contains the Rust smart contract as well as the Typescript SDK (`@woonetwork/WOOFi_Solana`) to interact with a deployed program.

### WooConfig

A WooConfig is a config struct to record:

* authority: Owner of the program
* paused: Whether the program is paused
* Woopool's admin authority
* Wooracle's admin\_authority
* Collect fee authority
* Guardian set authority
* Pause program authority

### WooPool

A WooPool is a concentrated liquidity pool for a token.

Each WooPool account hosts the necessary information to deal with the accounting of the pool. It also hosts the PDAs to the vaults. Only the WOO sPMM program has the authority to withdraw from the vault.

A WooPool account is hashed by the WooConfig, token mint address and quote token mint address.

### WooOracle

A WooOracle is an on-chain price feed in order to simulate the order book from centralized exchanges without sacrificing capital efficiency.

WooFi in Solana uses [Pyth oracle](https://www.pyth.network/developers/price-feed-ids#solana-stable) to check whether Woo oracle's price is valid.

Detailed explanations can be found on the [WooFi Developer Portal](https://learn.woo.org/v/woofi-dev-docs/resources/on-chain-price-feeds)

### Fee rate

Fee rate settings stored in WooPool's fee\_rate param can be updated by set\_pool\_fee\_rate function by the admin.

## WOOFi's sPMM Rust Environment Setup

This repository contains the Rust smart contract as well as the Typescript SDK (`@woonetwork/WOOFi_Solana`) to interact with a deployed program.

### Requirements

* Anchor 0.29.0
* Solana 1.17.31
* Rust 1.72.0

### Setup

Install Anchor using instructions found [here](https://book.anchor-lang.com/getting_started/installation.html#anchor).

Set up a valid Solana keypair at the path specified in the `wallet` in `Anchor.toml` to do local testing with `anchor test` flows.

`$NODE_PATH` must be set to the `node_modules` directory of your global installs. For example, using Node 18.20.4 installed through `nvm`, the $NODE\_PATH is the following:

```
$ echo $NODE_PATH
/Users/<home_dir>/.nvm/versions/node/v18.20.4/lib/node_modules
```

### Usage

### Tests

* Run "cargo test --lib" to run Rust unit tests


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://learn.woo.org/dev-docs/guides/integrate-woofi-as-a-liquidity-source-on-solana/architecture.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
