πŸ€–Price Oracle

🎯 Purpose of Price Monitoring

Why Monitor Prices?

  • Real-time Valuation: Get current market value of tokens

  • FDV Calculation: Calculate FDV based on actual market prices

  • Milestone Triggering: Automatically trigger milestones when price targets are reached

  • Market Transparency: Provide transparent and verifiable price data

Core Principles

  1. On-chain Price Discovery: Prices sourced directly from Cetus liquidity pools

  2. Real-time Updates: Continuous monitoring of price changes

  3. Automated Triggers: Automatic milestone progression based on price targets

  4. Transparent Calculation: All calculations performed on-chain and verifiable

πŸ“Š Price Monitoring Architecture

Data Flow

Cetus Liquidity Pool
    ↓
Price Oracle (sqrt_price)
    ↓
FDV Calculation Engine
    ↓
Milestone Trigger System
    ↓
Token Unlocking

Key Components

  • Cetus Pool: Source of real-time price data

  • Price Oracle: Extracts sqrt_price from pool

  • FDV Calculator: Converts price to FDV

  • Milestone Engine: Determines unlocking based on FDV

πŸ”§ Technical Implementation

Price Extraction from Cetus

Get Token Price Function

Price Calculation Process

  1. Extract sqrt_price: Get square root price from Cetus pool

  2. Calculate FDV: Convert sqrt_price to FDV using supply

  3. Compare Targets: Check if current FDV meets milestone targets

  4. Trigger Unlocking: Automatically unlock tokens if targets are met

FDV Calculation from Price

Current FDV Calculation

Mathematical Formula

πŸ“ˆ Price Monitoring Workflow

1. Real-time Price Monitoring

  • Continuous Monitoring: System constantly monitors pool prices

  • Price Updates: New prices trigger FDV recalculations

  • Event Emission: Price changes emit events for tracking

2. FDV Calculation

  • Price Input: Current sqrt_price from Cetus pool

  • Supply Factor: Maximum token supply (1B tokens)

  • Precision Handling: 6-digit precision for accuracy

  • FDV Output: Calculated FDV in SUI

3. Milestone Comparison

  • Target Check: Compare current FDV with milestone targets

  • Progress Calculation: Determine milestone completion percentage

  • Trigger Decision: Decide if milestone should be triggered

4. Automatic Unlocking

  • Milestone Achievement: When FDV reaches target

  • Token Release: Automatically unlock tokens

  • Event Emission: Emit unlocking events

πŸ”„ Price Update Process

Update Milestone Function

πŸ“Š Price Monitoring Queries

Get Current Price Information

Get Milestone Progress

Get Debug Information

⚑ Performance Optimization

Square Root Price Usage

  • Stability: Using sqrt_price prevents overflow in calculations

  • Precision: Maintains high precision for accurate FDV calculation

  • Efficiency: Optimized for on-chain computation

Batch Processing

  • Multiple Updates: Process multiple wallets simultaneously

  • Gas Efficiency: Reduce transaction costs

  • Atomic Operations: Ensure consistency across updates

πŸ”— Integration with Cetus

Cetus Pool Integration

  • Liquidity Pool: Token pairs traded on Cetus

  • Price Oracle: Real-time price feed from pool

  • AMM Mechanism: Automated market maker for price discovery

  • Liquidity Provision: Encourages liquidity provision

Pool Management

  • Pool Creation: Automatic pool creation for new tokens

  • Liquidity Addition: Initial liquidity provision

  • Price Stability: Maintain price stability through liquidity

  • Market Making: Automated market making through AMM


Note: The price monitoring system provides real-time, transparent, and automated token unlocking based on market performance. All price data is sourced from verified Cetus liquidity pools and calculations are performed on-chain for maximum transparency and security.

Last updated