π€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
On-chain Price Discovery: Prices sourced directly from Cetus liquidity pools
Real-time Updates: Continuous monitoring of price changes
Automated Triggers: Automatic milestone progression based on price targets
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 UnlockingKey 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
Extract sqrt_price: Get square root price from Cetus pool
Calculate FDV: Convert sqrt_price to FDV using supply
Compare Targets: Check if current FDV meets milestone targets
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