Technical documentation
How Vantage works.
Vantage turns a market view into a transparent, time-bound onchain position. Prices come from an external oracle, the interface keeps them fresh, and settlement follows the published reference price at expiry.
01 · System model
A simple path from data to decision
The app has four layers. The browser renders markets and manages interaction. The Next.js route keeps provider requests server-side. CoinGecko supplies reference data for supported crypto and tokenized RWA assets. A future settlement program validates the final observation and pays the winning side.
Market data
Fetch current price, 24h change, volume and sparkline data.
Application
Render live cards, probabilities and the position builder.
User wallet
Connect MetaMask and sign only explicit transaction requests.
Settlement
Lock terms at entry and settle against the expiry observation.
02 · Market data
Live quotes with a server boundary
The client never calls the provider directly. The route normalizes the upstream response into a small stable contract. SWR then polls that route every 15 seconds, keeps the last good result during refresh, and revalidates when the tab becomes active.
// app/api/quotes/route.ts
export async function GET() {
const ids = "bitcoin,ethereum,pax-gold";
const response = await fetch(
`https://api.coingecko.com/api/v3/coins/markets?vs_currency=usd&ids=${ids}&sparkline=true`,
{ next: { revalidate: 15 } },
);
if (!response.ok) {
return Response.json({ error: "Quote provider unavailable" }, { status: 502 });
}
const markets = await response.json();
return Response.json(markets.map((market) => ({
symbol: market.symbol.toUpperCase(),
price: market.current_price,
change24h: market.price_change_percentage_24h,
volume24h: market.total_volume,
sparkline: market.sparkline_in_7d?.price ?? [],
})));
}// lib/use-live-quotes.ts
export function useLiveQuotes() {
return useSWR<Quote[]>("/api/quotes", fetcher, {
refreshInterval: 15_000,
revalidateOnFocus: true,
keepPreviousData: true,
});
}In production, add provider rate-limit handling, a cache layer, stale-data timestamps and a second independent provider for failover. A quote should always carry its source timestamp so the UI can disclose when data is delayed.
03 · Coverage
Assets you can take a view on
Vantage references a curated set of liquid markets across crypto, tokenized real-world assets and macro benchmarks. Each asset resolves against the same oracle pipeline, so behaviour is consistent regardless of the underlying.
Crypto
BTC, ETH and other high-liquidity tokens with deep 24/7 markets.
Tokenized RWA
PAX Gold and similar tokens that mirror an offchain reference.
Equities reference
NVDA, TSLA and AAPL price references for directional views.
Commodities
Gold (XAU) and oil (WTI) benchmarks for macro positioning.
Asset availability depends on reliable oracle coverage. A market is only listed once it has a fresh, verifiable reference price and sufficient liquidity to settle positions fairly.
04 · Position lifecycle
What happens when someone takes a position
The displayed probability is a market-facing estimate, not a guarantee. The contract should validate positive amounts, supported symbols, expiry bounds, slippage limits and the oracle round used for settlement. The UI should show the exact payoff formula before signing.
// Conceptual payoff check
const finalPrice = await oracle.read(symbol, expiry);
const won = side === "up" ? finalPrice > strike : finalPrice < strike;
const payout = won ? collateral + reward : 0;05 · Economics
How payouts and fees are calculated
Every position is priced as shares. The share price reflects the market-implied probability of the outcome, so a cheaper side implies a lower probability and a larger potential payout. At settlement, each winning share is worth one unit of collateral.
Entry price
Probability-weighted cost per share, shown in cents.
Payout if right
Winning shares settle at $1.00 each in USDC.
Protocol fee
A small transparent fee applied to net winnings only.
// Conceptual position math
const shares = amount / entryPrice; // entryPrice in [0, 1]
const grossPayout = won ? shares * 1 : 0; // each share settles at $1
const profit = grossPayout - amount; // net of the collateral paidLosing positions forfeit their collateral to the winning side. Because settlement is deterministic and tied to the oracle round, payouts can be verified independently once the expiry observation is published.
06 · Wallet connection
MetaMask stays in control of signing
The connect button only requests a public Ethereum account. It does not ask for a signature or move funds. A separate action should build and simulate a transaction, present the terms, and then call MetaMask's signing method.
const provider = window.ethereum;
if (!provider) {
window.open("https://metamask.io/download/", "_blank");
return;
}
const accounts = await provider.request({
method: "eth_requestAccounts",
});
console.log("Connected:", accounts[0]);Always handle rejection, missing extensions, network mismatch and a disconnected account. Never place a private key or seed phrase in the browser, server environment, URL, logs or analytics payload.
07 · Risk and security
What must be true before production
- Oracle integrity: use signed observations, freshness windows and heartbeat checks.
- Contract safety: cap exposure, reject expired markets and make settlement deterministic.
- Frontend safety: validate inputs again on-chain; the UI is not a security boundary.
- Operational safety: monitor quote age, failed transactions, RPC health and abnormal volume.
- User clarity: show that positions reference prices and do not represent ownership of the underlying asset.
08 · Reference
Key terms in plain language
- Oracle
- The external, verifiable price source used for entry and settlement.
- Reference price
- The observed market price an asset resolves against — not a tradable spot.
- Share
- A unit of a position that settles at $1.00 if the chosen outcome is correct.
- Notional
- The USDC amount committed to a position before any payout.
- Horizon
- The time window (24h, 1 week, 1 month) until the market settles.
- Settlement
- The deterministic resolution of a market against the expiry observation.
09 · Questions
Frequently asked questions
Do I own the underlying asset?
No. A Vantage position references an asset's price. It does not grant ownership of the stock, token or commodity.
Which wallet do I need?
MetaMask on an Ethereum-compatible network. The connect flow only requests a public account and never asks for your seed phrase.
What currency is used?
Positions are collateralized and settled in USDC, so payouts are denominated in a stable unit.
How often do prices update?
The interface polls the quote route every 15 seconds and keeps the last good value while refreshing.
What happens at expiry?
The market settles against the oracle observation at the horizon. Winning shares pay out; losing positions forfeit their collateral.
Is this financial advice?
No. Displayed probabilities are market-facing estimates and everything here is for informational purposes only.
