{"eip":5252,"title":"Account-bound Finance","description":"An ERC-5114 extension that aids in preventing arbitrary loss of funds","authors":["Hyungsuk Kang (@hskang9)","Viktor Pernjek (@smuxx)"],"status":"Stagnant","type":"Standards Track","category":"ERC","created":"2022-06-29","requires":[20,721,1155,5114],"discussionsTo":"https://ethereum-magicians.org/t/pr-5252-discussion-account-bound-finance/10027","repo":"ERCs","label":"ERC-5252","officialUrl":"https://eips.ethereum.org/EIPS/eip-5252","sourceUrl":"https://github.com/ethereum/ERCs/blob/master/ERCS/erc-5252.md","url":"https://eips.huatuo.xyz/eip-5252/","tldr":{"en":"Proposed a design pattern where each investor gets their own cloned finance contract, controlled only by whoever holds a matching account-bound NFT, so a protocol's operators cannot move user funds.","ja":"投資家ごとに専用のクローン金融コントラクトを持たせ、対応するアカウントバウンド NFT の保有者だけが制御できるようにする設計パターンを提案した。これにより、プロトコルの運営者はユーザーの資金を動かせない。","ko":"투자자마다 자신만의 복제된 금융 컨트랙트를 갖게 하고, 일치하는 계정 귀속 NFT를 가진 사람만 이를 제어하게 하는 설계 패턴을 제안했다. 이를 통해 프로토콜 운영자는 사용자 자금을 움직일 수 없다.","zh":"提出一种设计模式：每位投资者拥有自己克隆出的金融合约，仅由持有匹配的账户绑定 NFT 的人控制，使协议运营方无法动用用户资金。"},"tags":["defi","account-bound","design-pattern","governance","custody"],"explainers":{"en":{"lang":"en","tldr":"Proposed a design pattern where each investor gets their own cloned finance contract, controlled only by whoever holds a matching account-bound NFT, so a protocol's operators cannot move user funds.","tags":["defi","account-bound","design-pattern","governance","custody"],"related":[5114,721,1167,20],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/eip-5252/","markdown":"## What problem does it solve?\n\nMany DeFi protocols pool every user's funds in a handful of contracts, often behind upgradeable proxies and multisigs with broad powers. Users effectively trust the operators not to misuse those keys. The authors point to high-profile collapses as examples of what that trust can cost.\n\nEIP-5252 proposes isolating funds per person instead: every investor gets a personal `Finance` contract, and only the holder of a credential token for that contract can move the money. Operator fees are separated out at deposit time, so the operators never hold the principal.\n\n## How it works\n\n**Interaction pattern** (the core of the proposal):\n\n- **Manager**: entry point for investors; stores the financial parameters; the only contract allowed to ask the factory for new instances.\n- **Factory**: clones a uniform `Finance` implementation per user and is the only minter of the account-bound token.\n- **Finance**: holds one investor's funds. Every state-changing function requires the caller to own the matching token, except clearly marked `/* global */` functions such as liquidation. Funds cannot leave without the token holder's signature.\n- **Account-bound token**: an [ERC-721](/eip-721/) credential (extending [ERC-5114](/eip-5114/)) whose metadata can show the position, for example as SVG. If transferable it is \"account-bound\" (lets you move a position between your wallets); if not, \"soul-bound\".\n- **Extension / Metadata**: optional contracts that can use locked funds with operator approval, or store credential data.\n\n**Governance pattern** (secondary): voting power is staked tokens weighted by an \"influence\" multiplier derived from contributions recorded in these tokens (for example deposit size and holding time), and tokens are locked while a vote is open to prevent double voting.\n\nThe authors argue one-contract-per-user also saves gas over time, since users stop paying for storage shared with everyone else.\n\n## Sample code\n\nA minimal `Finance` contract gated by ownership of its credential NFT:\n\n```solidity\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.20;\n\ninterface IERC721 { function ownerOf(uint256 id) external view returns (address); }\n\ncontract Finance {\n    IERC721 public abt;\n    uint256 public abtId;\n    bool private initialized;\n\n    function initialize(IERC721 _abt, uint256 _abtId) external {\n        require(!initialized, \"init once\");          // called once by the factory\n        initialized = true;\n        (abt, abtId) = (_abt, _abtId);\n    }\n\n    modifier onlyHolder() {\n        require(abt.ownerOf(abtId) == msg.sender, \"not credential holder\");\n        _;\n    }\n\n    receive() external payable {}\n\n    function withdraw(address payable to, uint256 amount) external onlyHolder {\n        (bool ok, ) = to.call{value: amount}(\"\");\n        require(ok, \"send failed\");\n    }\n}\n```\n\nA factory would deploy these as minimal-proxy clones ([EIP-1167](/eip-1167/)) and mint the credential to the investor.\n\n## Things to know\n\n- Status: **Stagnant**.\n- It is a design pattern rather than a fixed ABI: the spec lists roles and requirements but no function signatures for the interaction contracts.\n- The governance formulas are loosely specified (the worked example uses a \"base factor\" that the influence equation does not include), so treat that part as illustrative.\n- Whoever holds a transferable account-bound token controls the funds, so losing or selling the token is equivalent to losing the position.\n- Factories must register every clone and guard against reentrancy, or duplicate `Finance` contracts could corrupt accounting.\n"},"ja":{"lang":"ja","tldr":"投資家ごとに専用のクローン金融コントラクトを持たせ、対応するアカウントバウンド NFT の保有者だけが制御できるようにする設計パターンを提案した。これにより、プロトコルの運営者はユーザーの資金を動かせない。","tags":["defi","account-bound","design-pattern","governance","custody"],"related":[5114,721,1167,20],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ja/eip-5252/","markdown":"## 何を解決するのか\n\n多くの DeFi プロトコルは、全ユーザーの資金を少数のコントラクトにプールしており、しばしばアップグレード可能なプロキシや強力な権限を持つマルチシグの背後にあります。ユーザーは事実上、運営者がそれらの鍵を悪用しないことを信頼しています。作者は、その信頼が何をもたらしうるかの例として、世間を騒がせた破綻事例を挙げています。\n\nEIP-5252 は、代わりに資金を個人ごとに分離することを提案します。すべての投資家が個人用の `Finance` コントラクトを持ち、そのコントラクトの資格トークンを保有する人だけが資金を動かせます。運営者の手数料は入金時に分離されるため、運営者が元本を保持することはありません。\n\n## 仕組み\n\n**インタラクションパターン**（提案の中核）:\n\n- **Manager**: 投資家の入口です。金融パラメータを保存し、ファクトリーに新しいインスタンスを要求できる唯一のコントラクトです。\n- **Factory**: ユーザーごとに統一された `Finance` 実装をクローンし、アカウントバウンドトークンを mint できる唯一の存在です。\n- **Finance**: 1 人の投資家の資金を保持します。状態を変更するすべての関数は、呼び出し元が対応するトークンを所有していることを要求します。ただし、清算のように `/* global */` と明記された関数は例外です。トークン保有者の署名なしに資金が出ていくことはできません。\n- **アカウントバウンドトークン**: （[ERC-5114](/eip-5114/) を拡張した）[ERC-721](/eip-721/) の資格証明で、メタデータにはポジションを（たとえば SVG で）表示できます。転送可能なら「アカウントバウンド」（自分のウォレット間でポジションを移せる）、そうでなければ「ソウルバウンド」です。\n- **Extension / Metadata**: 運営者の承認を得てロックされた資金を使えるオプションのコントラクト、または資格情報データを保存するオプションのコントラクトです。\n\n**ガバナンスパターン**（副次的）: 投票権は、ステークされたトークンに、これらのトークンに記録された貢献（たとえば入金額や保有期間）から導かれる「影響力」の乗数を掛けたものです。二重投票を防ぐため、投票が開いている間はトークンがロックされます。\n\n作者は、ユーザーごとに 1 つのコントラクトを持つ方式は、他のユーザーと共有するストレージの費用を払わなくなるため、長期的にはガスの節約にもなると主張しています。\n\n## サンプルコード\n\n資格 NFT の所有でアクセスが制限される、最小限の `Finance` コントラクトです。\n\n```solidity\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.20;\n\ninterface IERC721 { function ownerOf(uint256 id) external view returns (address); }\n\ncontract Finance {\n    IERC721 public abt;\n    uint256 public abtId;\n    bool private initialized;\n\n    function initialize(IERC721 _abt, uint256 _abtId) external {\n        require(!initialized, \"init once\");          // called once by the factory\n        initialized = true;\n        (abt, abtId) = (_abt, _abtId);\n    }\n\n    modifier onlyHolder() {\n        require(abt.ownerOf(abtId) == msg.sender, \"not credential holder\");\n        _;\n    }\n\n    receive() external payable {}\n\n    function withdraw(address payable to, uint256 amount) external onlyHolder {\n        (bool ok, ) = to.call{value: amount}(\"\");\n        require(ok, \"send failed\");\n    }\n}\n```\n\nファクトリーはこれらを最小プロキシのクローン（[EIP-1167](/eip-1167/)）としてデプロイし、資格トークンを投資家に mint します。\n\n## 知っておくべきこと\n\n- ステータス: **Stagnant**。\n- 固定された ABI ではなく設計パターンです。仕様は役割と要件を挙げていますが、インタラクション用コントラクトの関数シグネチャは示していません。\n- ガバナンスの数式は大まかにしか定められておらず（具体例では、影響力の式に含まれない「base factor」が使われています）、その部分は例示として扱ってください。\n- 転送可能なアカウントバウンドトークンを保有する人が資金を制御するため、トークンを失くしたり売ったりすることは、ポジションを失うことと同じです。\n- ファクトリーはすべてのクローンを登録し、リエントランシーから保護する必要があります。そうしないと、重複した `Finance` コントラクトによって会計が壊れる可能性があります。\n"},"ko":{"lang":"ko","tldr":"투자자마다 자신만의 복제된 금융 컨트랙트를 갖게 하고, 일치하는 계정 귀속 NFT를 가진 사람만 이를 제어하게 하는 설계 패턴을 제안했다. 이를 통해 프로토콜 운영자는 사용자 자금을 움직일 수 없다.","tags":["defi","account-bound","design-pattern","governance","custody"],"related":[5114,721,1167,20],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ko/eip-5252/","markdown":"## 어떤 문제를 해결하나요?\n\n많은 DeFi 프로토콜은 모든 사용자의 자금을 소수의 컨트랙트에 모아 두며, 흔히 업그레이드 가능한 프록시와 넓은 권한을 가진 멀티시그 뒤에 있습니다. 사용자는 사실상 운영자가 그 키를 악용하지 않으리라고 믿는 셈입니다. 작성자들은 그 신뢰가 어떤 대가를 치를 수 있는지 보여 주는 예로 세간의 이목을 끈 붕괴 사례들을 듭니다.\n\nEIP-5252는 대신 자금을 개인별로 분리하자고 제안합니다. 모든 투자자는 개인용 `Finance` 컨트랙트를 갖고, 그 컨트랙트의 자격 토큰을 가진 사람만 자금을 옮길 수 있습니다. 운영자 수수료는 예치 시점에 분리되므로 운영자가 원금을 보유하는 일이 없습니다.\n\n## 어떻게 동작하나요?\n\n**상호작용 패턴**(제안의 핵심):\n\n- **Manager**: 투자자의 진입점이며 금융 파라미터를 저장합니다. 팩토리에 새 인스턴스를 요청할 수 있는 유일한 컨트랙트입니다.\n- **Factory**: 사용자마다 통일된 `Finance` 구현을 복제하며, 계정 귀속 토큰을 민팅할 수 있는 유일한 주체입니다.\n- **Finance**: 투자자 한 명의 자금을 보관합니다. 청산처럼 `/* global */`로 명시된 함수를 제외하면, 상태를 바꾸는 모든 함수는 호출자가 해당 토큰을 소유할 것을 요구합니다. 토큰 보유자의 서명 없이는 자금이 나갈 수 없습니다.\n- **계정 귀속 토큰**: ([ERC-5114](/eip-5114/)를 확장한) [ERC-721](/eip-721/) 자격 증명으로, 메타데이터에 포지션을 예를 들어 SVG로 표시할 수 있습니다. 양도 가능하면 \"계정 귀속\"(내 지갑들 사이에서 포지션을 옮길 수 있음)이고, 아니면 \"소울 바운드\"입니다.\n- **Extension / Metadata**: 운영자의 승인을 받아 잠긴 자금을 사용하거나 자격 데이터를 저장할 수 있는 선택적 컨트랙트입니다.\n\n**거버넌스 패턴**(부차적): 투표권은 스테이킹한 토큰에, 이 토큰들에 기록된 기여(예: 예치 규모와 보유 기간)에서 도출되는 \"영향력\" 배수를 곱한 값입니다. 중복 투표를 막기 위해 투표가 열려 있는 동안 토큰은 잠깁니다.\n\n작성자들은 사용자별로 컨트랙트를 하나씩 두면, 다른 모든 사람과 공유하는 스토리지 비용을 더 이상 내지 않게 되므로 시간이 지나면 가스도 절약된다고 주장합니다.\n\n## 샘플 코드\n\n자격 NFT의 소유 여부로 접근을 제한하는 최소한의 `Finance` 컨트랙트입니다.\n\n```solidity\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.20;\n\ninterface IERC721 { function ownerOf(uint256 id) external view returns (address); }\n\ncontract Finance {\n    IERC721 public abt;\n    uint256 public abtId;\n    bool private initialized;\n\n    function initialize(IERC721 _abt, uint256 _abtId) external {\n        require(!initialized, \"init once\");          // called once by the factory\n        initialized = true;\n        (abt, abtId) = (_abt, _abtId);\n    }\n\n    modifier onlyHolder() {\n        require(abt.ownerOf(abtId) == msg.sender, \"not credential holder\");\n        _;\n    }\n\n    receive() external payable {}\n\n    function withdraw(address payable to, uint256 amount) external onlyHolder {\n        (bool ok, ) = to.call{value: amount}(\"\");\n        require(ok, \"send failed\");\n    }\n}\n```\n\n팩토리는 이를 최소 프록시 복제([EIP-1167](/eip-1167/))로 배포하고 투자자에게 자격 토큰을 민팅합니다.\n\n## 알아둘 점\n\n- 상태: **Stagnant**.\n- 고정된 ABI가 아니라 설계 패턴입니다. 사양은 역할과 요구 사항을 나열하지만 상호작용 컨트랙트의 함수 시그니처는 제시하지 않습니다.\n- 거버넌스 공식은 느슨하게 정의되어 있으므로(구체적인 예시에서는 영향력 공식에 없는 \"base factor\"를 사용합니다) 그 부분은 예시로만 받아들이세요.\n- 양도 가능한 계정 귀속 토큰을 가진 사람이 자금을 제어하므로, 토큰을 잃어버리거나 팔면 포지션을 잃는 것과 같습니다.\n- 팩토리는 모든 복제본을 등록하고 재진입을 막아야 합니다. 그렇지 않으면 중복된 `Finance` 컨트랙트가 회계를 망가뜨릴 수 있습니다.\n"},"zh":{"lang":"zh","tldr":"提出一种设计模式：每位投资者拥有自己克隆出的金融合约，仅由持有匹配的账户绑定 NFT 的人控制，使协议运营方无法动用用户资金。","tags":["defi","account-bound","design-pattern","governance","custody"],"related":[5114,721,1167,20],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/zh/eip-5252/","markdown":"## 它解决什么问题？\n\n许多 DeFi 协议把所有用户的资金汇集在少数几个合约中，这些合约往往位于可升级代理和权力很大的多签之后。用户实际上是在信任运营方不会滥用这些密钥。作者以几起备受关注的崩盘事件为例，说明这种信任可能付出的代价。\n\nEIP-5252 提出改为按个人隔离资金：每位投资者都有一个专属的 `Finance` 合约，只有该合约对应凭证代币的持有者才能转移资金。运营方的费用在存款时就被分离出来，因此运营方从不持有本金。\n\n## 它如何运作\n\n**交互模式**（该提案的核心）：\n\n- **Manager**：投资者的入口；存储金融参数；是唯一被允许向工厂请求新实例的合约。\n- **Factory**：为每个用户克隆统一的 `Finance` 实现，并且是账户绑定代币的唯一铸造者。\n- **Finance**：持有一位投资者的资金。除了清算等明确标注 `/* global */` 的函数外，每个会改变状态的函数都要求调用者拥有对应的代币。没有代币持有者的签名，资金无法转出。\n- **账户绑定代币**：一种 [ERC-721](/eip-721/) 凭证（扩展自 [ERC-5114](/eip-5114/)），其元数据可以展示仓位，例如以 SVG 形式。如果可转让，则是\"账户绑定\"（让你在自己的钱包之间移动仓位）；如果不可转让，则是\"灵魂绑定\"。\n- **Extension / Metadata**：可选合约，可在运营方批准下使用被锁定的资金，或存储凭证数据。\n\n**治理模式**（次要）：投票权是质押的代币乘以一个\"影响力\"系数，该系数来自这些代币中记录的贡献（例如存款规模和持有时间），并且在投票开放期间代币被锁定，以防止重复投票。\n\n作者认为，每个用户一个合约也会随着时间推移节省 gas，因为用户不再为与所有人共享的存储付费。\n\n## 示例代码\n\n一个最小的 `Finance` 合约，由其凭证 NFT 的所有权把关：\n\n```solidity\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.20;\n\ninterface IERC721 { function ownerOf(uint256 id) external view returns (address); }\n\ncontract Finance {\n    IERC721 public abt;\n    uint256 public abtId;\n    bool private initialized;\n\n    function initialize(IERC721 _abt, uint256 _abtId) external {\n        require(!initialized, \"init once\");          // called once by the factory\n        initialized = true;\n        (abt, abtId) = (_abt, _abtId);\n    }\n\n    modifier onlyHolder() {\n        require(abt.ownerOf(abtId) == msg.sender, \"not credential holder\");\n        _;\n    }\n\n    receive() external payable {}\n\n    function withdraw(address payable to, uint256 amount) external onlyHolder {\n        (bool ok, ) = to.call{value: amount}(\"\");\n        require(ok, \"send failed\");\n    }\n}\n```\n\n工厂会以最小代理克隆（[EIP-1167](/eip-1167/)）的方式部署这些合约，并把凭证铸造给投资者。\n\n## 需要注意\n\n- 状态：**Stagnant**。\n- 它是一种设计模式，而不是固定的 ABI：规范列出了角色和要求，但没有给出交互合约的函数签名。\n- 治理公式的规定比较松散（示例中使用了一个\"base factor\"，而影响力公式里并不包含它），因此这部分请当作示意。\n- 谁持有可转让的账户绑定代币，谁就控制资金，所以丢失或卖掉代币就等于失去仓位。\n- 工厂必须登记每一个克隆并防范重入，否则重复的 `Finance` 合约可能破坏记账。\n"}}}
