VitreusDEX Developer Documentation

Everything you need to integrate with VitreusDEX — the native exchange for the Vitreus blockchain. Access real-time price data, portfolio analytics, AI-powered market insights, and on-chain pallet extrinsics.

Chain Information

Chain ID

1943

RPC Endpoint

Public testnet RPC coming soon — join Discord for updates

Explorer

Blockscout

Public APIs

All endpoints are unauthenticated and CORS-enabled. Rate limit: 60 requests/minute.

GEThttps://vitreusdex.com/api/vtrs-price

Returns the current VTRS price aggregated from multiple sources.

bash
curl https://vitreusdex.com/api/vtrs-price
json
{
  "symbol": "VTRS",
  "price_usd": 0.0098,
  "price_change_24h": 4.2,
  "volume_24h": 1420000,
  "sources": ["coingecko", "vitreus-oracle"],
  "last_updated": "2026-04-24T12:00:00Z"
}
GEThttps://vitreusdex.com/api/vnrg-price

Returns the current VNRG (Vitreus Energy) price.

bash
curl https://vitreusdex.com/api/vnrg-price
json
{
  "symbol": "VNRG",
  "price_usd": 0.012,
  "price_change_24h": -1.8,
  "volume_24h": 980000,
  "sources": ["coingecko", "vitreus-oracle"],
  "last_updated": "2026-04-24T12:00:00Z"
}
GEThttps://vitreusdex.com/api/portfolio?address=0x...

Returns VTRS and VNRG balances with USD values for any wallet address on Vitreus.

ParameterTypeRequiredDescription
addressstringYesWallet address (0x...)
bash
curl "https://vitreusdex.com/api/portfolio?address=0x7a3F8b2e1c4d9f01ab123456789abcdef0123456"
json
{
  "address": "0x7a3F8b2e1c4d9f01ab123456789abcdef0123456",
  "balances": {
    "VTRS": { "balance": 125000, "usd_value": 1225.00 },
    "VNRG": { "balance": 82104, "usd_value": 985.25 }
  },
  "total_usd": 2210.25,
  "last_updated": "2026-04-24T12:00:00Z"
}
POSThttps://vitreusdex.com/api/market-insight

Returns AI-powered market analysis using HiveIQ. Powered by Claude AI.

ParameterTypeRequiredDescription
pricenumberYesCurrent VTRS price in USD
volatilitynumberYes24h volatility percentage
poolDepthnumberYesTotal liquidity depth in USD
bash
curl -X POST https://vitreusdex.com/api/market-insight \
  -H "Content-Type: application/json" \
  -d '{"price": 0.0098, "volatility": 4.2, "poolDepth": 4800000}'
json
{
  "insight": "VTRS is showing bullish momentum with moderate volatility...",
  "sentiment": "bullish",
  "confidence": 0.78,
  "recommendation": "Favorable conditions for liquidity provision.",
  "model": "claude-sonnet-4-20250514"
}

Embeddable Widgets

Drop these into any website to show live Vitreus data.

Price Widget

Displays live VTRS price with 24h change. Two lines of HTML, zero dependencies.

html
<script src="https://vitreusdex.com/widget.js"></script>
<div id="vtrs-widget"></div>

Portfolio Widget

Shows wallet balances for any connected address.

html
<div id="vitreus-portfolio-widget" data-address="0x..."></div>
<script src="https://vitreusdex.com/widgets/portfolio.js" async></script>

Preview

VTRS Balance125,000 ($1,225)
VNRG Balance82,104 ($985)
Total Value$2,210

Pallet Reference

On-chain extrinsics for pallet-vitreus-dex (pallet index 43, PalletId: vtrs/dex).

call_index(0)

create_pool

Create a new AMM pool for a given asset pair. Restricted to ManageOrigin (governance).

ParameterTypeRequiredDescription
asset_aAssetKindYesFirst asset in the pair
asset_bAssetKindYesSecond asset in the pair
fee_tieru32YesFee tier: 1 (0.1%), 3 (0.3%), or 10 (1.0%)
rust
// Pair is automatically canonicalized — (A,B) and (B,A) map to the same pool.
// Fee tier must be 1, 3, or 10. Pool account derived from PalletId + pair encoding.
api.tx.vitreusDex.createPool(assetA, assetB, 3);
call_index(1)

add_liquidity

Add liquidity to an existing pool. Optimal amounts are computed automatically — no excess token donation.

ParameterTypeRequiredDescription
asset_aAssetKindYesFirst asset
asset_bAssetKindYesSecond asset
amount_aBalanceYesMaximum amount of asset_a to deposit
amount_bBalanceYesMaximum amount of asset_b to deposit
amount_a_minBalanceYesMinimum acceptable asset_a (slippage)
amount_b_minBalanceYesMinimum acceptable asset_b (slippage)
rust
// First deposit: sqrt(a*b) shares minted, MINIMUM_LIQUIDITY (1000) locked.
// Subsequent: optimal amounts calculated, min(share_a, share_b) minted.
api.tx.vitreusDex.addLiquidity(assetA, assetB, 10000, 40000, 9500, 38000);
call_index(2)

remove_liquidity

Remove liquidity by burning LP shares. Reserves are synced from actual balances before withdrawal.

ParameterTypeRequiredDescription
asset_aAssetKindYesFirst asset
asset_bAssetKindYesSecond asset
sharesBalanceYesNumber of LP shares to burn
amount_a_minBalanceYesMinimum asset_a to receive
amount_b_minBalanceYesMinimum asset_b to receive
rust
// Respects locked_until — reverts if position is still locked.
// MINIMUM_LIQUIDITY shares can never be removed.
api.tx.vitreusDex.removeLiquidity(assetA, assetB, 19000, 9000, 36000);
call_index(3)

swap_exact_tokens_for_tokens

Swap an exact input amount for as much output as the pool yields. Constant product formula with fee.

ParameterTypeRequiredDescription
asset_inAssetKindYesInput asset
asset_outAssetKindYesOutput asset
amount_inBalanceYesExact amount to swap
amount_out_minBalanceYesMinimum output (slippage protection)
recipientAccountIdYesRecipient of output tokens
rust
// Fee deducted from input. Only after-fee amount added to reserves.
// Reserves synced from actual balances at start of swap.
api.tx.vitreusDex.swapExactTokensForTokens(vtrs, vnrg, 100, 90, recipient);
call_index(4)

lock_liquidity

Lock a liquidity position until a specified block number. Prevents removal until the lock expires.

ParameterTypeRequiredDescription
asset_aAssetKindYesFirst asset
asset_bAssetKindYesSecond asset
lock_untilBlockNumberYesBlock number until which position is locked
rust
// Can only be called by the position owner. Emits LiquidityLocked event.
api.tx.vitreusDex.lockLiquidity(assetA, assetB, 1_000_000);

Security

Security Audit — April 2026

pallet-vitreus-dex underwent a comprehensive AI-assisted security audit. 12 findings were identified and resolved — 1 Critical, 4 High, 4 Medium, 3 Low. All 11 unit tests pass. Full runtime compiles clean.

1

Critical

4

High

4

Medium

3

Low

Key fixes: first depositor attack prevention (MINIMUM_LIQUIDITY), pair canonicalization, reserve syncing, fee separation, optimal deposit calculation, slippage enforcement.

Security Contact

Report vulnerabilities to security@vitreus.io. We operate a responsible disclosure policy.

Changelog

v0.1.0April 2026 — Initial Preview Release
  • Native AMM swap interface with real-time price feeds
  • Liquidity pool creation wizard with HiveIQ AI advisor
  • Token Launch Wizard — 3-step ERC-20 deployment with tokenomics designer
  • Pool detail pages with price charts, trade history, LP leaderboard
  • Analytics dashboard — ecosystem overview, volume/TVL charts, burn tracker
  • Token Explorer with AI analyst and 8-token universe
  • Portfolio tracker with wallet connection (MetaMask, WalletConnect)
  • Staking interface with VIP tiers and yield display
  • Bridge interface for cross-chain asset transfers
  • pallet-vitreus-dex security audit — 12 findings resolved
  • Preview mode banner with localStorage dismissal
  • Developer documentation and public API reference