Architecture

Architecture Overview

WooFi's Overview

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 to check whether Woo oracle's price is valid.

Detailed explanations can be found on the WooFi Developer Portal

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.

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

Last updated

Was this helpful?