{"eip":1438,"title":"dApp Components (avatar) \u0026 Universal Wallet","description":"Contracts are open source based. And most developers use the public contracts at the start of the project to modify or simply include them. This is project-oriented centralized development and I think it is a waste of resources.","authors":["Jet Lim (@Nitro888)"],"status":"Stagnant","type":"Standards Track","category":"ERC","created":"2018-09-21","discussionsTo":"https://ethresear.ch/t/avatar-system-and-universal-wallet-for-ethereum-address/3473","repo":"ERCs","label":"ERC-1438","officialUrl":"https://eips.ethereum.org/EIPS/eip-1438","sourceUrl":"https://github.com/ethereum/ERCs/blob/master/ERCS/erc-1438.md","url":"https://eips.huatuo.xyz/eip-1438/","tldr":{"en":"A stagnant proposal for reusable dApp components, an on-chain avatar shop and a contract-based 'universal wallet' that pays any ERC-20-accepting service in one call, even tokens without approveAndCall.","ja":"再利用可能な dApp コンポーネント、オンチェーンのアバターショップ、そして approveAndCall を持たないトークンでも、ERC-20 を受け付けるサービスに 1 回の呼び出しで支払えるコントラクトベースの「ユニバーサルウォレット」を扱う、停滞した提案。","ko":"재사용 가능한 dApp 컴포넌트, 온체인 아바타 상점, 그리고 approveAndCall이 없는 토큰이라도 ERC-20을 받는 서비스에 한 번의 호출로 결제할 수 있는 컨트랙트 기반 \"유니버설 지갑\"을 다루는 정체된 제안.","zh":"一个已停滞的提案，涉及可复用的 dApp 组件、链上头像商店，以及一个基于合约的\"通用钱包\"，可以一次调用就向任何接受 ERC-20 的服务付款，即使代币没有 approveAndCall 也可以。"},"tags":["wallet","erc20","avatar","components","stagnant"],"explainers":{"en":{"lang":"en","tldr":"A stagnant proposal for reusable dApp components, an on-chain avatar shop and a contract-based 'universal wallet' that pays any ERC-20-accepting service in one call, even tokens without approveAndCall.","tags":["wallet","erc20","avatar","components","stagnant"],"related":[20,1363],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/eip-1438/","markdown":"## What problem does it solve?\n\nThe author observed that most projects copy open-source contracts into their own isolated dApps, so the data each dApp produces is locked inside it. The proposal argues that on-chain resources should be reusable across services, and gives two example \"component dApps\":\n\n1. **Avatar shop**: users create an avatar once and any other service can display it.\n2. **Universal wallet**: paying a service with an [ERC-20](/eip-20/) token normally takes two transactions (`approve`, then the service calls `transferFrom`). Some tokens add `approveAndCall` to do it in one step, but most deployed ERC-20s do not. A wallet contract can provide the same one-step experience for *any* ERC-20.\n\n## How it works\n\n**Avatar.** A shop is created for a chosen ERC-20 currency with configurable asset categories and a viewer script. Avatar assets are gzip-compressed SVG and avatar data is msgpack-encoded JSON, both stored in event logs rather than contract storage to keep costs down.\n\n**Universal wallet.** Each user deploys a wallet contract that holds ETH and tokens:\n\n- `balanceOf(erc20)`, `transfer(erc20, to, amount)`, `approve(erc20, spender, amount)`, with `address(0)` meaning ETH.\n- `pay(store, amount, options)`: looks up which token and spender the store wants, approves (or sends ETH), then immediately calls the store's `receiveApproval(...)`. Approval and use happen in one transaction from the user's point of view.\n\nStores implement an `ApproveAndCallFallBack`-style interface exposing `erc20()`, `spender()` and `receiveApproval(...)`.\n\n## Sample code\n\nThe `approveAndCall` pattern the wallet emulates, and a store that receives it (modern Solidity, simplified):\n\n```solidity\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.20;\n\ninterface IERC20 {\n    function approve(address spender, uint256 amount) external returns (bool);\n    function transferFrom(address from, address to, uint256 amount) external returns (bool);\n}\n\ninterface IStore {\n    function erc20() external view returns (address);\n    function spender() external view returns (address);\n    function receiveApproval(uint256[] calldata options) external;\n}\n\ncontract UniversalWallet {\n    address public immutable owner;\n    constructor() { owner = msg.sender; }\n\n    /// Approve and notify the store in one transaction.\n    function pay(IStore store, uint256 amount, uint256[] calldata options) external {\n        require(msg.sender == owner, \"owner only\");\n        IERC20(store.erc20()).approve(store.spender(), amount);\n        store.receiveApproval(options); // store pulls funds with transferFrom\n    }\n}\n```\n\n## Things to know\n\n- Status is **Stagnant**. The reference code targets Solidity 0.4 and uses an `onlyOwner` base contract that is not specified in the EIP.\n- In the reference `pay`, the store's `receiveApproval` is not told which wallet or amount is involved; a real store must track that safely (e.g. use `msg.sender` and check allowances).\n- The one-transaction payment problem was later addressed by standards such as [ERC-1363](/eip-1363/) (`transferAndCall` / `approveAndCall`) and by permit-style signatures, and today by smart-contract accounts that batch calls.\n- Storing data in event logs is cheap, but logs cannot be read by contracts, only off-chain.\n"},"ja":{"lang":"ja","tldr":"再利用可能な dApp コンポーネント、オンチェーンのアバターショップ、そして approveAndCall を持たないトークンでも、ERC-20 を受け付けるサービスに 1 回の呼び出しで支払えるコントラクトベースの「ユニバーサルウォレット」を扱う、停滞した提案。","tags":["wallet","erc20","avatar","components","stagnant"],"related":[20,1363],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ja/eip-1438/","markdown":"## 何を解決するのか\n\n作者は、ほとんどのプロジェクトがオープンソースのコントラクトを自分専用の孤立した dApp にコピーしており、各 dApp が生み出すデータがその中に閉じ込められていることに気づきました。この提案は、オンチェーンのリソースはサービス間で再利用できるべきだと主張し、2 つの「コンポーネント dApp」の例を挙げています。\n\n1. **アバターショップ**: ユーザーがアバターを一度作成すれば、他のどのサービスでも表示できます。\n2. **ユニバーサルウォレット**: [ERC-20](/eip-20/) トークンでサービスに支払うには、通常 2 回のトランザクション（`approve`、続いてサービスが `transferFrom` を呼ぶ）が必要です。一部のトークンは `approveAndCall` を追加して 1 ステップで行えるようにしていますが、デプロイ済みの ERC-20 の大半は対応していません。ウォレットコントラクトは、*どの* ERC-20 に対しても同じ 1 ステップの体験を提供できます。\n\n## 仕組み\n\n**アバター。** ショップは、選択した ERC-20 通貨、設定可能なアセットカテゴリ、ビューアースクリプトとともに作成されます。アバターのアセットは gzip 圧縮された SVG、アバターのデータは msgpack でエンコードされた JSON で、どちらもコストを抑えるため、コントラクトのストレージではなくイベントログに保存されます。\n\n**ユニバーサルウォレット。** 各ユーザーは、ETH とトークンを保有するウォレットコントラクトをデプロイします。\n\n- `balanceOf(erc20)`、`transfer(erc20, to, amount)`、`approve(erc20, spender, amount)`。`address(0)` は ETH を意味します。\n- `pay(store, amount, options)`: ストアがどのトークンとスペンダーを求めているかを調べ、承認（または ETH の送信）を行い、すぐにストアの `receiveApproval(...)` を呼びます。ユーザーから見ると、承認と利用が 1 つのトランザクションで行われます。\n\nストアは、`erc20()`、`spender()`、`receiveApproval(...)` を公開する `ApproveAndCallFallBack` 風のインターフェースを実装します。\n\n## サンプルコード\n\nウォレットが模倣している `approveAndCall` パターンと、それを受け取るストア（現代的な Solidity、簡略化）:\n\n```solidity\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.20;\n\ninterface IERC20 {\n    function approve(address spender, uint256 amount) external returns (bool);\n    function transferFrom(address from, address to, uint256 amount) external returns (bool);\n}\n\ninterface IStore {\n    function erc20() external view returns (address);\n    function spender() external view returns (address);\n    function receiveApproval(uint256[] calldata options) external;\n}\n\ncontract UniversalWallet {\n    address public immutable owner;\n    constructor() { owner = msg.sender; }\n\n    /// Approve and notify the store in one transaction.\n    function pay(IStore store, uint256 amount, uint256[] calldata options) external {\n        require(msg.sender == owner, \"owner only\");\n        IERC20(store.erc20()).approve(store.spender(), amount);\n        store.receiveApproval(options); // store pulls funds with transferFrom\n    }\n}\n```\n\n## 知っておくべきこと\n\n- ステータスは **Stagnant** です。リファレンスコードは Solidity 0.4 を対象とし、EIP で規定されていない `onlyOwner` の基底コントラクトを使っています。\n- リファレンスの `pay` では、ストアの `receiveApproval` にどのウォレットや金額が関わっているかが伝えられません。実際のストアは、それを安全に追跡する必要があります（例: `msg.sender` を使い、allowance を確認する）。\n- 1 トランザクションでの支払いの問題は、後に [ERC-1363](/eip-1363/)（`transferAndCall` / `approveAndCall`）などの標準や、permit 形式の署名によって、そして現在では呼び出しをバッチ処理するスマートコントラクトアカウントによって対処されました。\n- イベントログへのデータ保存は安価ですが、ログはコントラクトからは読めず、オフチェーンでしか読めません。\n"},"ko":{"lang":"ko","tldr":"재사용 가능한 dApp 컴포넌트, 온체인 아바타 상점, 그리고 approveAndCall이 없는 토큰이라도 ERC-20을 받는 서비스에 한 번의 호출로 결제할 수 있는 컨트랙트 기반 \"유니버설 지갑\"을 다루는 정체된 제안.","tags":["wallet","erc20","avatar","components","stagnant"],"related":[20,1363],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ko/eip-1438/","markdown":"## 어떤 문제를 해결하나요?\n\n작성자는 대부분의 프로젝트가 오픈소스 컨트랙트를 자기만의 고립된 dApp에 복사하기 때문에, 각 dApp이 만들어 내는 데이터가 그 안에 갇힌다는 점을 관찰했습니다. 이 제안은 온체인 리소스가 서비스 간에 재사용될 수 있어야 한다고 주장하며, 두 가지 \"컴포넌트 dApp\" 예시를 제시합니다.\n\n1. **아바타 상점**: 사용자가 아바타를 한 번 만들면 다른 어떤 서비스에서도 표시할 수 있습니다.\n2. **유니버설 지갑**: [ERC-20](/eip-20/) 토큰으로 서비스에 결제하려면 보통 트랜잭션이 두 번 필요합니다(`approve` 후 서비스가 `transferFrom` 호출). 일부 토큰은 한 단계로 처리하도록 `approveAndCall`을 추가했지만, 배포된 대부분의 ERC-20은 그렇지 않습니다. 지갑 컨트랙트는 *어떤* ERC-20에 대해서도 같은 한 단계 경험을 제공할 수 있습니다.\n\n## 어떻게 동작하나요?\n\n**아바타.** 상점은 선택한 ERC-20 통화, 설정 가능한 에셋 카테고리, 뷰어 스크립트와 함께 만들어집니다. 아바타 에셋은 gzip으로 압축한 SVG이고 아바타 데이터는 msgpack으로 인코딩한 JSON이며, 둘 다 비용을 낮추기 위해 컨트랙트 스토리지가 아니라 이벤트 로그에 저장됩니다.\n\n**유니버설 지갑.** 각 사용자는 ETH와 토큰을 보유하는 지갑 컨트랙트를 배포합니다.\n\n- `balanceOf(erc20)`, `transfer(erc20, to, amount)`, `approve(erc20, spender, amount)`이며, `address(0)`은 ETH를 뜻합니다.\n- `pay(store, amount, options)`: 상점이 원하는 토큰과 spender를 조회하고, 승인(또는 ETH 전송)을 한 뒤, 곧바로 상점의 `receiveApproval(...)`을 호출합니다. 사용자 입장에서는 승인과 사용이 하나의 트랜잭션에서 일어납니다.\n\n상점은 `erc20()`, `spender()`, `receiveApproval(...)`을 노출하는 `ApproveAndCallFallBack` 스타일의 인터페이스를 구현합니다.\n\n## 샘플 코드\n\n지갑이 흉내 내는 `approveAndCall` 패턴과 이를 받는 상점(현대적인 Solidity, 단순화):\n\n```solidity\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.20;\n\ninterface IERC20 {\n    function approve(address spender, uint256 amount) external returns (bool);\n    function transferFrom(address from, address to, uint256 amount) external returns (bool);\n}\n\ninterface IStore {\n    function erc20() external view returns (address);\n    function spender() external view returns (address);\n    function receiveApproval(uint256[] calldata options) external;\n}\n\ncontract UniversalWallet {\n    address public immutable owner;\n    constructor() { owner = msg.sender; }\n\n    /// Approve and notify the store in one transaction.\n    function pay(IStore store, uint256 amount, uint256[] calldata options) external {\n        require(msg.sender == owner, \"owner only\");\n        IERC20(store.erc20()).approve(store.spender(), amount);\n        store.receiveApproval(options); // store pulls funds with transferFrom\n    }\n}\n```\n\n## 알아둘 점\n\n- 상태는 **Stagnant**입니다. 참조 코드는 Solidity 0.4를 대상으로 하며 EIP에 명시되지 않은 `onlyOwner` 기반 컨트랙트를 사용합니다.\n- 참조 `pay`에서는 상점의 `receiveApproval`에 어떤 지갑이나 금액이 관련되어 있는지 알려 주지 않습니다. 실제 상점은 이를 안전하게 추적해야 합니다(예: `msg.sender`를 사용하고 allowance를 확인).\n- 한 트랜잭션으로 결제하는 문제는 이후 [ERC-1363](/eip-1363/)(`transferAndCall` / `approveAndCall`) 같은 표준과 permit 방식 서명으로, 그리고 오늘날에는 호출을 일괄 처리하는 스마트 컨트랙트 계정으로 해결되었습니다.\n- 데이터를 이벤트 로그에 저장하면 저렴하지만, 로그는 컨트랙트가 읽을 수 없고 오프체인에서만 읽을 수 있습니다.\n"},"zh":{"lang":"zh","tldr":"一个已停滞的提案，涉及可复用的 dApp 组件、链上头像商店，以及一个基于合约的\"通用钱包\"，可以一次调用就向任何接受 ERC-20 的服务付款，即使代币没有 approveAndCall 也可以。","tags":["wallet","erc20","avatar","components","stagnant"],"related":[20,1363],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/zh/eip-1438/","markdown":"## 它解决什么问题？\n\n作者观察到，大多数项目把开源合约复制到自己孤立的 dApp 中，因此每个 dApp 产生的数据都被锁在其内部。该提案认为链上资源应当能在各服务之间复用，并给出了两个\"组件 dApp\"的例子：\n\n1. **头像商店**：用户只需创建一次头像，其他任何服务都可以显示它。\n2. **通用钱包**：用 [ERC-20](/eip-20/) 代币向服务付款通常需要两笔交易（先 `approve`，再由服务调用 `transferFrom`）。一些代币增加了 `approveAndCall` 以便一步完成，但大多数已部署的 ERC-20 并不支持。钱包合约可以为*任何* ERC-20 提供同样的一步式体验。\n\n## 它如何运作\n\n**头像。** 商店针对选定的 ERC-20 货币创建，带有可配置的资源类别和一个查看器脚本。头像资源是 gzip 压缩的 SVG，头像数据是 msgpack 编码的 JSON，两者都存放在事件日志而非合约存储中，以降低成本。\n\n**通用钱包。** 每个用户部署一个持有 ETH 和代币的钱包合约：\n\n- `balanceOf(erc20)`、`transfer(erc20, to, amount)`、`approve(erc20, spender, amount)`，其中 `address(0)` 表示 ETH。\n- `pay(store, amount, options)`：查询商店想要哪种代币和哪个 spender，进行授权（或发送 ETH），然后立即调用商店的 `receiveApproval(...)`。从用户的角度看，授权和使用发生在同一笔交易中。\n\n商店实现一个 `ApproveAndCallFallBack` 风格的接口，暴露 `erc20()`、`spender()` 和 `receiveApproval(...)`。\n\n## 示例代码\n\n钱包所模拟的 `approveAndCall` 模式，以及接收它的商店（现代 Solidity，已简化）：\n\n```solidity\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.20;\n\ninterface IERC20 {\n    function approve(address spender, uint256 amount) external returns (bool);\n    function transferFrom(address from, address to, uint256 amount) external returns (bool);\n}\n\ninterface IStore {\n    function erc20() external view returns (address);\n    function spender() external view returns (address);\n    function receiveApproval(uint256[] calldata options) external;\n}\n\ncontract UniversalWallet {\n    address public immutable owner;\n    constructor() { owner = msg.sender; }\n\n    /// Approve and notify the store in one transaction.\n    function pay(IStore store, uint256 amount, uint256[] calldata options) external {\n        require(msg.sender == owner, \"owner only\");\n        IERC20(store.erc20()).approve(store.spender(), amount);\n        store.receiveApproval(options); // store pulls funds with transferFrom\n    }\n}\n```\n\n## 需要注意\n\n- 状态为 **Stagnant**。参考代码面向 Solidity 0.4，并使用了 EIP 中未规定的 `onlyOwner` 基础合约。\n- 在参考实现的 `pay` 中，商店的 `receiveApproval` 并不知道涉及哪个钱包或金额；真实的商店必须安全地跟踪这一点（例如使用 `msg.sender` 并检查 allowance）。\n- 单笔交易完成付款的问题后来由 [ERC-1363](/eip-1363/)（`transferAndCall` / `approveAndCall`）等标准和 permit 风格的签名解决，如今则由批量调用的智能合约账户解决。\n- 把数据存进事件日志很便宜，但日志无法被合约读取，只能在链下读取。\n"}}}
