For protocol developers

Refuse under-backed assets in one call

Lending pools, vaults, routers and payment contracts can ask the coverage ledger whether an asset is backed before accepting it. The answer is computed on-chain from the latest supply snapshot and the freshest reserve report at or above the tier you require.

Parameters

ArgumentTypeMeaning
sacAddressThe asset's Stellar Asset Contract.
min_bpsu32Minimum reserves ÷ supply in basis points. 10,000 = 100%.
max_ageu64Seconds. Both the supply snapshot and the report must be at most this old.
min_tierTier1 Transcribed, 2 Issuer-signed, 3 Auditor-signed. Weaker reports are ignored.

From a Soroban contract

// Cargo.toml: soroban-sdk = "28"
use soroban_sdk::{contractclient, contracttype, Address, Env};

#[contracttype]
#[derive(Clone, Copy)]
#[repr(u32)]
pub enum Tier { Transcribed = 1, IssuerSigned = 2, AuditorSigned = 3 }

#[contractclient(name = "CoverageLedgerClient")]
pub trait CoverageLedger {
    fn is_covered(env: Env, sac: Address, min_bps: u32, max_age: u64, min_tier: Tier) -> bool;
}

// In your deposit / borrow / route function:
let ok = CoverageLedgerClient::new(&env, &coverage_ledger).is_covered(
    &asset,              // the asset's Stellar Asset Contract
    &10_000,             // at least 100% backed
    &(7 * 24 * 60 * 60), // supply and report both under 7 days old
    &Tier::IssuerSigned, // ignore transcribed-only figures
);
if !ok {
    panic_with_error!(&env, MyError::AssetNotCovered);
}

A working example is the covered-vault contract: deposits are refused while the asset is not covered; withdrawals never are.

From TypeScript

import { PlimsollContracts, TESTNET, Tier, bpsToPercent } from "@plimsoll/sdk";

const plimsoll = new PlimsollContracts(TESTNET);
const sac = TESTNET.assets.PUSD.sac;

const cov = await plimsoll.coverage(sac, Tier.Transcribed);
console.log(bpsToPercent(cov!.bps));          // "102.00%"

const ok = await plimsoll.isCovered(sac, 10_000, 7 * 86_400, Tier.IssuerSigned);

From the command line

stellar contract invoke --network testnet --send=no \
  --id CC2QQ7R4FLPHZP7KA5AO4IASXXICTG6N4GQXCXITTEBNYQEYTYXKMN4D -- \
  is_covered --sac CCHPT4TEJDPZQDSUVW3NP6A35ROGV4WEFZKT45SKWYCFZSUB7R5HIM7S \
  --min_bps 10000 --max_age 604800 --min_tier 2

Testnet addresses

Coverage ledgerCC2QQ7R4FLPHZP7KA5AO4IASXXICTG6N4GQXCXITTEBNYQEYTYXKMN4D
Reporter registryCCZCBR7MGSW5LGIEUQR5TU5Z7JQWBDEESB3RGPTRPMCBUMOISRPY7GOB
Covered vault (example)CC3SUECAJSAC4PBV4QLUII7X5Y4WNVL5YGTBAQ4CHCAH6R3QLRYJUZHQ