EIPs Explained

ERC-7893 · Final · ERC · 2025-01-30

ERC-7893: DeFi Protocol Solvency Proof Mechanism

A standard on-chain interface for DeFi protocols to publish their assets, liabilities and solvency ratio, with history and risk-alert events that anyone can monitor.

What problem does it solve?

Every DeFi protocol reports its financial health differently, if at all. Users, auditors and risk dashboards end up reconstructing positions by hand, and there is no common early-warning signal when a protocol drifts toward insolvency.

ERC-7893 defines one interface, ISolvencyProof, so any protocol can expose the same data: what it holds, what it owes, the ratio between the two, how that ratio changed over time, and an event when it crosses a risk threshold.

How it works

The contract stores two snapshots, each made of parallel arrays plus a timestamp:

  • ProtocolAssets and ProtocolLiabilities: tokens[], amounts[] (in token decimals), values[] (in ETH, 18 decimals), timestamp.

Key rules:

  • Only authorized oracles may call updateAssets / updateLiabilities; other callers must be reverted. The arrays must have equal length, and the timestamp is set to block.timestamp.
  • The solvency ratio is totalAssets * 10000 / totalLiabilities (basis points, so 10500 = 105 %).
  • verifySolvency() returns (isSolvent, healthFactor) against the implementation's minimum ratio.
  • getSolvencyHistory(start, end) returns all snapshots in that inclusive time range.
  • Every update emits SolvencyMetricsUpdated; breaching a threshold should emit RiskAlert(riskLevel, currentValue, threshold, timestamp).
  • The contract must support ERC-165 and return true for the ISolvencyProof interface ID.

The spec recommends tiers: CRITICAL below 105 %, HIGH RISK 105–110 %, WARNING 110–120 %, HEALTHY at 120 % and above.

Sample code

Reading a protocol's health and watching for alerts (ethers v6):

import { Contract, JsonRpcProvider, formatEther } from "ethers";

const abi = [
  "function verifySolvency() view returns (bool isSolvent, uint256 healthFactor)",
  "function getProtocolAssets() view returns (tuple(address[] tokens, uint256[] amounts, uint256[] values, uint256 timestamp))",
  "event RiskAlert(string riskLevel, uint256 currentValue, uint256 threshold, uint256 timestamp)",
];

const provider = new JsonRpcProvider(process.env.RPC_URL);
const proof = new Contract(process.env.SOLVENCY_CONTRACT!, abi, provider);

const [ok, hf] = await proof.verifySolvency();
console.log(`solvent=${ok} ratio=${Number(hf) / 100}%`);

const assets = await proof.getProtocolAssets();
const total = assets.values.reduce((a: bigint, v: bigint) => a + v, 0n);
console.log("assets (ETH):", formatEther(total));

proof.on("RiskAlert", (level, value, threshold) => {
  console.warn(`${level}: ratio ${value} below ${threshold}`);
});

Things to know

  • Status is Final.
  • The numbers are only as good as the oracle that writes them. The standard does not prove reserves cryptographically; it standardizes how an authorized party reports them on-chain.
  • All values are in ETH with 18 decimals, so a protocol holding mostly stablecoins still has to convert via a price feed.
  • If total liabilities are zero, implementations should either return a "max solvency" value or revert; consumers should handle both.
  • getSolvencyHistory can be expensive over long ranges, and implementations may expire old data as long as they document their retention policy.

#defi #solvency #risk #oracle #interface

Details

Authors
Sean Luis Guada Rodríguez (@SeanLuis) <[email protected]>
Status
Final
Type
Standards Track / ERC
Created
2025-01-30
Requires

Machine-readable: Markdown · JSON