Astra Logo DOCS
● Astra Protocol V2 — Developer Docs

Build with Multi-Chain Loss Protection

Astra brings automated loss-protection to Solana, Arbitrum One, and Hyperliquid. Accept payments with guaranteed exchange rate locks and protect token balances against market drawdowns.

Architecture & Core Concepts

Astra operates as an autonomous risk-underwriting layer. Users and merchants pay a small dynamic risk premium in USDC to guarantee the downside value of volatile assets (SOL, ETH, BTC, HYPE, ARB). If the market depegs or drops below the chosen threshold before settlement, the protocol automatically transfers loss compensation from multi-chain liquidity vaults.

⚡ Rate Lock (Payment Protection)

Guarantees a fixed exchange rate for merchant checkout or peer-to-peer transfers over windows from 15 minutes to 24 hours.

🛡️ Depeg Shield (Balance Protection)

Insulates on-chain portfolio balances against adverse market drawdowns with an adjustable floor trigger over 1 to 30 days.

Astra Underwriting Pricing Formula

Astra implements mathematical non-linear duration risk curves and reserve utilization safeguards:

// Astra Risk Premium Specification:
NotionalValue = Amount * CurrentOraclePrice
BaseRateBps   = DurationTier(30 bps, 100 bps, 150 bps, 250 bps)
SafetyMargin  = 20 bps
RawPremium    = (NotionalValue * (BaseRateBps + SafetyMargin)) / 10,000

// Fee Distribution (BPS Splits):
LP Underwriters (ReserveVault) : 7,800 bps (78%)
Protocol Treasury             : 1,200 bps (12%)
Safety Fund Margin             :   700 bps  (7%)
Automation Keeper Bounty       :   300 bps  (3%)

5-Minute Quickstart (TypeScript SDK)

Install the official client via npm install astra-protocol-sdk:

import { AstraClient } from 'astra-protocol-sdk';

// Initialize Astra unified client
const astra = new AstraClient({
  endpoint: 'http://localhost:4000/api/v1',
});

// 1. Fetch real-time underwriting quote
const quote = await astra.getQuote({
  asset: 'SOL',
  amount: 5,
  durationSeconds: 86400, // 24 hours
  mode: 'depeg-shield',
  floor: 95.00,
});

console.log(`Protected: $${quote.notional} | Premium Due: $${quote.totalDue} USDC`);

// 2. Activate protection on-chain
const tx = await astra.createProtectionPosition({
  asset: 'SOL',
  amount: 5,
  floor: 95.00,
  durationSeconds: 86400,
});
console.log('Position Active:', tx.positionId);

Arbitrum Nitro Contracts (Solidity 0.8.24)

ContractRoleKey Function
AstraProtectionEngine.sol Core engine for Rate Lock & Depeg Shields createPosition(asset, amount, duration, floor)
AstraReserveVault.sol USDC liquidity pool, LP share minting & fee splits depositUnderwritingCapital(amount)
AstraOracleAdapter.sol Pyth Network & Chainlink real-time feeds getPrice(asset)
AstraReceiptRegistry.sol Zero-knowledge receipt verification (BN254) verifyReceipt(paymentHash, proof)

Solana Anchor Program (Rust)

Solana Testnet Program ID
ABMTT5W2UNn5BZG8285V9Uzn3h5c1G3rG7YeCPMn7714

Located in contracts/solana/programs/astra/src/lib.rs:

// Solana Anchor Instruction: Create Position
pub fn create_position(
    ctx: Context<CreatePosition>,
    amount: u64,
    duration_seconds: i64,
    mode: u8,
    floor_price: u64,
) -> Result<()> {
    // CPI Pyth price check & underwriting capacity lock
    ...
}

REST API Reference

GET /api/v1/quote

Computes risk premiums, fee splits, and capacity checks in real time:

curl "http://localhost:4000/api/v1/quote?asset=SOL&amount=5&durationSeconds=86400"

GET /api/v1/history (Powered by Pyth Douro Labs)

Returns 1000ms fixed-rate institutional historical prices directly from Pyth Network:

curl "http://localhost:4000/api/v1/history?symbol=BTC"

POST /api/v1/positions

Registers an open protection position across connected chains.

POST /api/v1/receipts/register

Generates an on-chain cryptographic receipt with BN254 zero-knowledge proof hash.