Marble & Magic-Fi
  • Welcome
  • Getting Started
    • What is Magic-Fi?
    • Key Advantages of Magic-Fi
    • The first Sonic-based MemeFI NFT
    • Our Mission
    • $MARBLE Tokenomics
    • Roadmap
  • USER GUIDES
    • Magic Swap
    • Swap
    • Crosschain Swap
  • Guides
    • Optimus Proactive Market Making (oPMM)
    • Integrate Magic-Fi as a liquidity source on EVM
    • Rust SDK
    • TypeScript SDK
    • Architecture
  • Resources
    • Smart contract architecture
    • On-chain price feeds
  • legal
    • Security Audit
    • Terms of Service
    • Privacy Policy
    • Cookies Policy
Powered by GitBook

© 2025 MARBLE. All rights reserved.

On this page
  • Architecture Overview
  • Magic-Fi's oPMM Rust Environment Setup
  1. Guides

Architecture

PreviousTypeScript SDKNextSmart contract architecture

Last updated 1 month ago

Architecture Overview

Account Structure

Magic-Fi's oPMM is Optimus Proactive Market Making (oPMM) contract on the Solana blockchain. This repository contains the Rust smart contract as well as the Typescript SDK (@magicfi/Magic_Fi_Solana) to interact with a deployed program.

MagicConfig

A MagicConfig is a config struct to record:

  • authority: Owner of the program

  • paused: Whether the program is paused

  • Magicpool's admin authority

  • Magicoracle's admin_authority

  • Collect fee authority

  • Guardian set authority

  • Pause program authority

MagicPool

A MagicPool is a concentrated liquidity pool for a token.

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

A MagicPool account is hashed by the MagicConfig, token mint address and quote token mint address.

MagicOracle

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

MagicFi in Solana uses Pyth oracle to check whether Marble oracle's price is valid.

Detail explanation can check on MagicFi Developer Portal

Fee rate

Fee rate setting stored in MagicPool's fee_rate param, can be updated by set_pool_fee_rate function by admin.

Magic-Fi's oPMM Rust Environment Setup

Magic-Fi's oPMM is Synthetic Proactive Market Making (oPMM) contract on the Solana blockchain. This repository contains the Rust smart contract as well as the Typescript SDK (@magicfi/Magic_Fi_Solana) to interact with a deployed program.

Requirements

  • Anchor 0.29.0

  • Solana 1.17.31

  • Rust 1.72.0

Setup

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:

Copy

$ 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