Price Discovery & Oracle
Overview
RedCarpetHQ uses a sophisticated price oracle system to track fair market prices for campaign tokens. Understanding how price discovery works is essential for trading, lending, and risk management.
VWAP Oracle System
What is VWAP?
Volume-Weighted Average Price (VWAP) is a trading benchmark that gives the average price a token has traded at throughout the day, based on both volume and price.
```
VWAP = Σ(Price × Volume) / Σ(Volume)
Why VWAP over TWAP?
How It Works
Update Mechanism:
1. Trade occurs on marketplace
2. Price and volume recorded
3. VWAP calculation updated
4. Oracle price refreshed
5. Risk tier assessment triggered
Lazy Update:
Price Tracking
Current Price
Displayed on:
Components:
Historical Data
Available metrics:
Price Staleness
Staleness Detection:
Staleness Thresholds:
Impact:
Risk Tier System
Tier Determination
The RiskOracle assesses tokens into risk tiers:
GREEN (Low Risk):
YELLOW (Medium Risk):
RED (High Risk):
Risk Factors Assessed
1. Price Staleness
2. Vault Utilization
3. Wash Trading Detection
4. Market Health
Impact on DeFi
Collateral Factors
Risk tier determines borrowing power:
| Risk Tier | Collateral Factor | Max LTV |
|-----------|------------------|---------|
| GREEN | 75% | 75% |
| YELLOW | 60% | 60% |
| RED | 40% | 40% |
Example:
Interest Rates
Risk tier affects interest distribution:
Lender Interest (from 12% base):
Stability Pool:
Safety Reserves:
Liquidation Risk
Price drops trigger liquidations:
1. Token price decreases
2. Collateral value drops
3. LTV exceeds maximum
4. Position becomes underwater
5. Liquidation triggered
6. Collateral sold to repay debt
Protection:
Price Manipulation Prevention
Anti-Manipulation Measures
1. VWAP Weighting
2. Wash Trading Detection
3. Minimum Volume Thresholds
4. Time-Weighted Factors
Penalties for Manipulation
Consequences:
Using Price Data
For Traders
Make informed decisions:
Trading strategies:
For Lenders
Assess lending risk:
Risk management:
For Borrowers
Optimize borrowing:
Technical Implementation
HybridPriceOracle Contract
`solidity``
// Simplified oracle structure
contract HybridPriceOracle {
struct PriceData {
uint256 vwap;
uint256 lastUpdate;
uint256 volume24h;
bool isStale;
}
// Update VWAP externally triggered via trade
function updatePrice(
address asset,
uint256 priceWad,
uint256 volumeWad
) external;
// Get current price
function getPrice(address token)
external view returns (uint256);
// Check staleness
function isPriceStale(address token)
external view returns (bool);
}
Integration Points
Connected contracts:
Best Practices
For All Users
✅ Do:
❌ Don't:
For Developers
Integrating price data:
Frequently Asked Questions
Q: How often is VWAP updated?
A: VWAP updates with each trade. No trades = no updates.
Q: What happens if there's no trading volume?
A: Price becomes stale, risk tier increases, collateral factors decrease.
Q: Can I see historical VWAP data?
A: Yes, historical data is available on token pages and via blockchain explorers.
Q: How is wash trading detected?
A: Through pattern analysis, same-address detection, and circular transaction monitoring.
Q: What if the oracle price seems wrong?
A: The oracle reflects actual market trades. If price seems wrong, it may indicate market conditions or manipulation.
Q: Can producers manipulate their token price?
A: They can try, but VWAP weighting and wash trading detection make it difficult and risky.
Related Resources
Need Help?
If you have questions about price discovery or the oracle system, contact our support team at support@redcarpethq.org.