{"eip":7893,"title":"DeFi Protocol Solvency Proof Mechanism","description":"Verifiable solvency proofs and financial health monitoring for DeFi protocols","authors":["Sean Luis Guada Rodríguez (@SeanLuis) \u003cseanluis47@gmail.com\u003e"],"status":"Final","type":"Standards Track","category":"ERC","created":"2025-01-30","requires":[20,165],"discussionsTo":"https://ethereum-magicians.org/t/erc-7893-defi-protocol-solvency-proof-mechanism/24566","repo":"ERCs","label":"ERC-7893","officialUrl":"https://eips.ethereum.org/EIPS/eip-7893","sourceUrl":"https://github.com/ethereum/ERCs/blob/master/ERCS/erc-7893.md","url":"https://eips.huatuo.xyz/eip-7893/","tldr":{"en":"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.","ja":"DeFi プロトコルが、資産、負債、支払能力比率（solvency ratio）を公開するための標準的なオンチェーンインターフェース。履歴と、誰でも監視できるリスクアラートのイベントを備える。","ko":"DeFi 프로토콜이 자산, 부채, 지급 능력 비율(solvency ratio)을 공개하기 위한 표준 온체인 인터페이스. 이력과, 누구나 모니터링할 수 있는 위험 경보 이벤트를 갖춘다.","zh":"一个供 DeFi 协议发布其资产、负债和偿付能力比率的标准链上接口，带有历史记录和任何人都可监控的风险警报事件。"},"tags":["defi","solvency","risk","oracle","interface"],"explainers":{"en":{"lang":"en","tldr":"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.","tags":["defi","solvency","risk","oracle","interface"],"related":[20,165],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/eip-7893/","markdown":"## What problem does it solve?\n\nEvery 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.\n\nERC-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.\n\n## How it works\n\nThe contract stores two snapshots, each made of parallel arrays plus a timestamp:\n\n- `ProtocolAssets` and `ProtocolLiabilities`: `tokens[]`, `amounts[]` (in token decimals), `values[]` (in ETH, 18 decimals), `timestamp`.\n\nKey rules:\n\n- 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`.\n- The solvency ratio is `totalAssets * 10000 / totalLiabilities` (basis points, so `10500` = 105 %).\n- `verifySolvency()` returns `(isSolvent, healthFactor)` against the implementation's minimum ratio.\n- `getSolvencyHistory(start, end)` returns all snapshots in that inclusive time range.\n- Every update emits `SolvencyMetricsUpdated`; breaching a threshold should emit `RiskAlert(riskLevel, currentValue, threshold, timestamp)`.\n- The contract must support [ERC-165](/eip-165/) and return true for the `ISolvencyProof` interface ID.\n\nThe spec recommends tiers: **CRITICAL** below 105 %, **HIGH RISK** 105–110 %, **WARNING** 110–120 %, **HEALTHY** at 120 % and above.\n\n## Sample code\n\nReading a protocol's health and watching for alerts (ethers v6):\n\n```ts\nimport { Contract, JsonRpcProvider, formatEther } from \"ethers\";\n\nconst abi = [\n  \"function verifySolvency() view returns (bool isSolvent, uint256 healthFactor)\",\n  \"function getProtocolAssets() view returns (tuple(address[] tokens, uint256[] amounts, uint256[] values, uint256 timestamp))\",\n  \"event RiskAlert(string riskLevel, uint256 currentValue, uint256 threshold, uint256 timestamp)\",\n];\n\nconst provider = new JsonRpcProvider(process.env.RPC_URL);\nconst proof = new Contract(process.env.SOLVENCY_CONTRACT!, abi, provider);\n\nconst [ok, hf] = await proof.verifySolvency();\nconsole.log(`solvent=${ok} ratio=${Number(hf) / 100}%`);\n\nconst assets = await proof.getProtocolAssets();\nconst total = assets.values.reduce((a: bigint, v: bigint) =\u003e a + v, 0n);\nconsole.log(\"assets (ETH):\", formatEther(total));\n\nproof.on(\"RiskAlert\", (level, value, threshold) =\u003e {\n  console.warn(`${level}: ratio ${value} below ${threshold}`);\n});\n```\n\n## Things to know\n\n- Status is **Final**.\n- 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.\n- All values are in ETH with 18 decimals, so a protocol holding mostly stablecoins still has to convert via a price feed.\n- If total liabilities are zero, implementations should either return a \"max solvency\" value or revert; consumers should handle both.\n- `getSolvencyHistory` can be expensive over long ranges, and implementations may expire old data as long as they document their retention policy.\n"},"ja":{"lang":"ja","tldr":"DeFi プロトコルが、資産、負債、支払能力比率（solvency ratio）を公開するための標準的なオンチェーンインターフェース。履歴と、誰でも監視できるリスクアラートのイベントを備える。","tags":["defi","solvency","risk","oracle","interface"],"related":[20,165],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ja/eip-7893/","markdown":"## 何を解決するのか\n\nDeFi プロトコルは、財務の健全性の報告の仕方がそれぞれ異なり、そもそも報告しないものもあります。ユーザー、監査人、リスクダッシュボードは、ポジションを手作業で再構築することになり、プロトコルが支払不能に向かって傾いていく際の共通の早期警戒シグナルもありません。\n\nERC-7893 は `ISolvencyProof` というインターフェースを 1 つ定義し、どのプロトコルでも同じデータを公開できるようにします。保有しているもの、負っているもの、その比率、比率が時間とともにどう変化したか、そしてリスクのしきい値を越えたときのイベントです。\n\n## 仕組み\n\nコントラクトは 2 つのスナップショットを保存します。それぞれ、並列の配列とタイムスタンプからなります。\n\n- `ProtocolAssets` と `ProtocolLiabilities`: `tokens[]`、`amounts[]`（トークンの decimals 単位）、`values[]`（ETH 建て、18 decimals）、`timestamp`。\n\n主なルール:\n\n- `updateAssets` / `updateLiabilities` を呼べるのは**認可されたオラクル**だけで、それ以外の呼び出し元はリバートしなければなりません。配列の長さは等しくなければならず、タイムスタンプは `block.timestamp` に設定されます。\n- 支払能力比率は `totalAssets * 10000 / totalLiabilities` です（ベーシスポイント。したがって `10500` = 105 %）。\n- `verifySolvency()` は、実装の最小比率に照らして `(isSolvent, healthFactor)` を返します。\n- `getSolvencyHistory(start, end)` は、その期間（両端を含む）のすべてのスナップショットを返します。\n- 更新のたびに `SolvencyMetricsUpdated` が emit されます。しきい値を割った場合は `RiskAlert(riskLevel, currentValue, threshold, timestamp)` を emit するべきです。\n- コントラクトは [ERC-165](/eip-165/) に対応し、`ISolvencyProof` のインターフェース ID に対して true を返さなければなりません。\n\n仕様は、次の段階分けを推奨しています。**CRITICAL** は 105 % 未満、**HIGH RISK** は 105〜110 %、**WARNING** は 110〜120 %、**HEALTHY** は 120 % 以上です。\n\n## サンプルコード\n\nプロトコルの健全性を読み取り、アラートを監視する例（ethers v6）:\n\n```ts\nimport { Contract, JsonRpcProvider, formatEther } from \"ethers\";\n\nconst abi = [\n  \"function verifySolvency() view returns (bool isSolvent, uint256 healthFactor)\",\n  \"function getProtocolAssets() view returns (tuple(address[] tokens, uint256[] amounts, uint256[] values, uint256 timestamp))\",\n  \"event RiskAlert(string riskLevel, uint256 currentValue, uint256 threshold, uint256 timestamp)\",\n];\n\nconst provider = new JsonRpcProvider(process.env.RPC_URL);\nconst proof = new Contract(process.env.SOLVENCY_CONTRACT!, abi, provider);\n\nconst [ok, hf] = await proof.verifySolvency();\nconsole.log(`solvent=${ok} ratio=${Number(hf) / 100}%`);\n\nconst assets = await proof.getProtocolAssets();\nconst total = assets.values.reduce((a: bigint, v: bigint) =\u003e a + v, 0n);\nconsole.log(\"assets (ETH):\", formatEther(total));\n\nproof.on(\"RiskAlert\", (level, value, threshold) =\u003e {\n  console.warn(`${level}: ratio ${value} below ${threshold}`);\n});\n```\n\n## 知っておくべきこと\n\n- ステータスは **Final** です。\n- 数値の信頼性は、それを書き込むオラクルの信頼性が上限です。この標準は準備金を暗号学的に証明するものではなく、認可された主体がそれらをオンチェーンで報告する方法を標準化するものです。\n- すべての値は 18 decimals の ETH 建てであるため、ステーブルコインを主に保有するプロトコルでも、価格フィード経由で換算する必要があります。\n- 負債の合計がゼロの場合、実装は「最大の支払能力」の値を返すか、リバートするべきです。利用側は両方に対応してください。\n- `getSolvencyHistory` は、長い範囲ではコストが高くなり得ます。実装は、保持ポリシーを文書化している限り、古いデータを失効させてもかまいません。\n"},"ko":{"lang":"ko","tldr":"DeFi 프로토콜이 자산, 부채, 지급 능력 비율(solvency ratio)을 공개하기 위한 표준 온체인 인터페이스. 이력과, 누구나 모니터링할 수 있는 위험 경보 이벤트를 갖춘다.","tags":["defi","solvency","risk","oracle","interface"],"related":[20,165],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ko/eip-7893/","markdown":"## 어떤 문제를 해결하나요?\n\nDeFi 프로토콜마다 재무 건전성을 보고하는 방식이 다르고, 아예 보고하지 않는 곳도 있습니다. 사용자, 감사자, 리스크 대시보드는 포지션을 손으로 재구성할 수밖에 없고, 프로토콜이 지급 불능으로 기울어 갈 때 쓸 공통의 조기 경보 신호도 없습니다.\n\nERC-7893은 `ISolvencyProof`라는 인터페이스 하나를 정의해, 어떤 프로토콜이든 같은 데이터를 공개할 수 있게 합니다. 무엇을 보유하고 있는지, 무엇을 빚지고 있는지, 둘 사이의 비율, 그 비율이 시간에 따라 어떻게 변했는지, 그리고 위험 임계값을 넘었을 때의 이벤트입니다.\n\n## 어떻게 동작하나요?\n\n컨트랙트는 두 개의 스냅샷을 저장하며, 각각 병렬 배열과 타임스탬프로 구성됩니다.\n\n- `ProtocolAssets`와 `ProtocolLiabilities`: `tokens[]`, `amounts[]`(토큰 decimals 기준), `values[]`(ETH 기준, 18 decimals), `timestamp`.\n\n주요 규칙:\n\n- `updateAssets` / `updateLiabilities`는 **승인된 오라클**만 호출할 수 있으며, 다른 호출자는 리버트되어야 합니다. 배열 길이는 같아야 하고 타임스탬프는 `block.timestamp`로 설정됩니다.\n- 지급 능력 비율은 `totalAssets * 10000 / totalLiabilities`입니다(베이시스 포인트이므로 `10500` = 105 %).\n- `verifySolvency()`는 구현의 최소 비율을 기준으로 `(isSolvent, healthFactor)`를 반환합니다.\n- `getSolvencyHistory(start, end)`는 그 시간 범위(양 끝 포함)의 모든 스냅샷을 반환합니다.\n- 업데이트마다 `SolvencyMetricsUpdated`를 emit하며, 임계값을 넘으면 `RiskAlert(riskLevel, currentValue, threshold, timestamp)`를 emit해야 합니다.\n- 컨트랙트는 [ERC-165](/eip-165/)를 지원해야 하고 `ISolvencyProof` 인터페이스 ID에 대해 true를 반환해야 합니다.\n\n명세가 권장하는 단계: 105 % 미만은 **CRITICAL**, 105–110 %는 **HIGH RISK**, 110–120 %는 **WARNING**, 120 % 이상은 **HEALTHY**입니다.\n\n## 샘플 코드\n\n프로토콜의 건전성을 읽고 경보를 지켜보기(ethers v6):\n\n```ts\nimport { Contract, JsonRpcProvider, formatEther } from \"ethers\";\n\nconst abi = [\n  \"function verifySolvency() view returns (bool isSolvent, uint256 healthFactor)\",\n  \"function getProtocolAssets() view returns (tuple(address[] tokens, uint256[] amounts, uint256[] values, uint256 timestamp))\",\n  \"event RiskAlert(string riskLevel, uint256 currentValue, uint256 threshold, uint256 timestamp)\",\n];\n\nconst provider = new JsonRpcProvider(process.env.RPC_URL);\nconst proof = new Contract(process.env.SOLVENCY_CONTRACT!, abi, provider);\n\nconst [ok, hf] = await proof.verifySolvency();\nconsole.log(`solvent=${ok} ratio=${Number(hf) / 100}%`);\n\nconst assets = await proof.getProtocolAssets();\nconst total = assets.values.reduce((a: bigint, v: bigint) =\u003e a + v, 0n);\nconsole.log(\"assets (ETH):\", formatEther(total));\n\nproof.on(\"RiskAlert\", (level, value, threshold) =\u003e {\n  console.warn(`${level}: ratio ${value} below ${threshold}`);\n});\n```\n\n## 알아둘 점\n\n- 상태는 **Final**입니다.\n- 숫자의 신뢰도는 그것을 기록하는 오라클만큼입니다. 이 표준은 준비금을 암호학적으로 증명하지 않으며, 승인된 주체가 준비금을 온체인에 보고하는 방식을 표준화할 뿐입니다.\n- 모든 값은 18 decimals의 ETH 기준이므로, 스테이블코인을 주로 보유한 프로토콜도 가격 피드로 환산해야 합니다.\n- 총 부채가 0이면 구현은 \"최대 지급 능력\" 값을 반환하거나 리버트해야 하며, 사용하는 쪽은 둘 다 처리해야 합니다.\n- `getSolvencyHistory`는 긴 범위에서는 비용이 클 수 있고, 구현은 보존 정책을 문서화하는 한 오래된 데이터를 만료시킬 수 있습니다.\n"},"zh":{"lang":"zh","tldr":"一个供 DeFi 协议发布其资产、负债和偿付能力比率的标准链上接口，带有历史记录和任何人都可监控的风险警报事件。","tags":["defi","solvency","risk","oracle","interface"],"related":[20,165],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/zh/eip-7893/","markdown":"## 它解决什么问题？\n\n每个 DeFi 协议报告财务健康状况的方式各不相同，有的甚至完全不报告。用户、审计方和风险仪表盘只能手工还原头寸，而当协议逐渐滑向资不抵债时，也没有统一的预警信号。\n\nERC-7893 定义了一个接口 `ISolvencyProof`，让任何协议都能公开相同的数据：持有什么、欠下什么、两者之间的比率、该比率随时间如何变化，以及比率越过风险阈值时的事件。\n\n## 它如何运作\n\n合约存储两份快照，每份由并行数组和一个时间戳组成：\n\n- `ProtocolAssets` 和 `ProtocolLiabilities`：`tokens[]`、`amounts[]`（按代币 decimals）、`values[]`（以 ETH 计，18 位小数）、`timestamp`。\n\n关键规则：\n\n- 只有**被授权的预言机**可以调用 `updateAssets` / `updateLiabilities`；其他调用者必须回滚。数组长度必须相等，时间戳设为 `block.timestamp`。\n- 偿付能力比率为 `totalAssets * 10000 / totalLiabilities`（以基点计，因此 `10500` = 105 %）。\n- `verifySolvency()` 根据实现的最低比率返回 `(isSolvent, healthFactor)`。\n- `getSolvencyHistory(start, end)` 返回该时间范围（含两端）内的所有快照。\n- 每次更新都会触发 `SolvencyMetricsUpdated`；突破阈值时应触发 `RiskAlert(riskLevel, currentValue, threshold, timestamp)`。\n- 合约必须支持 [ERC-165](/eip-165/)，并对 `ISolvencyProof` 的接口 ID 返回 true。\n\n规范推荐的分级：低于 105 % 为 **CRITICAL**，105–110 % 为 **HIGH RISK**，110–120 % 为 **WARNING**，120 % 及以上为 **HEALTHY**。\n\n## 示例代码\n\n读取协议的健康状况并监听警报（ethers v6）：\n\n```ts\nimport { Contract, JsonRpcProvider, formatEther } from \"ethers\";\n\nconst abi = [\n  \"function verifySolvency() view returns (bool isSolvent, uint256 healthFactor)\",\n  \"function getProtocolAssets() view returns (tuple(address[] tokens, uint256[] amounts, uint256[] values, uint256 timestamp))\",\n  \"event RiskAlert(string riskLevel, uint256 currentValue, uint256 threshold, uint256 timestamp)\",\n];\n\nconst provider = new JsonRpcProvider(process.env.RPC_URL);\nconst proof = new Contract(process.env.SOLVENCY_CONTRACT!, abi, provider);\n\nconst [ok, hf] = await proof.verifySolvency();\nconsole.log(`solvent=${ok} ratio=${Number(hf) / 100}%`);\n\nconst assets = await proof.getProtocolAssets();\nconst total = assets.values.reduce((a: bigint, v: bigint) =\u003e a + v, 0n);\nconsole.log(\"assets (ETH):\", formatEther(total));\n\nproof.on(\"RiskAlert\", (level, value, threshold) =\u003e {\n  console.warn(`${level}: ratio ${value} below ${threshold}`);\n});\n```\n\n## 需要注意\n\n- 状态为 **Final**。\n- 数字的可靠程度取决于写入它们的预言机。该标准并不以密码学方式证明储备，它标准化的是被授权方如何在链上报告储备。\n- 所有数值都以 18 位小数的 ETH 计价，因此主要持有稳定币的协议仍然需要通过价格源进行换算。\n- 如果总负债为零，实现应当返回一个\"最大偿付能力\"值，或者回滚；使用方应同时处理这两种情况。\n- `getSolvencyHistory` 在较长的范围内可能开销很大，只要文档中说明保留策略，实现可以让旧数据过期。\n"}}}
