{"id":13729588,"url":"https://github.com/0xsequence/erc20-meta-token","last_synced_at":"2025-05-08T02:30:27.720Z","repository":{"id":40748601,"uuid":"165729827","full_name":"0xsequence/erc20-meta-token","owner":"0xsequence","description":"General ERC20 to ERC1155 Token Wrapper Contract","archived":false,"fork":false,"pushed_at":"2024-05-22T01:01:25.000Z","size":1775,"stargazers_count":207,"open_issues_count":15,"forks_count":42,"subscribers_count":23,"default_branch":"master","last_synced_at":"2025-05-07T23:01:53.441Z","etag":null,"topics":["erc20","ethereum","meta-transaction-functionality"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/0xsequence.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":"audits/Security_Audit_Horizon_Games_23-12-19_2.pdf","citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-01-14T20:26:18.000Z","updated_at":"2025-05-06T10:41:21.000Z","dependencies_parsed_at":"2024-06-18T21:21:57.390Z","dependency_job_id":"d2d17e45-816f-4b49-ac3f-971c0d559b16","html_url":"https://github.com/0xsequence/erc20-meta-token","commit_stats":{"total_commits":112,"total_committers":8,"mean_commits":14.0,"dds":0.4285714285714286,"last_synced_commit":"f528dd46d2091c1c44bef55203e76fff28eb9fcf"},"previous_names":["horizon-games/erc20-meta-wrapper"],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xsequence%2Ferc20-meta-token","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xsequence%2Ferc20-meta-token/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xsequence%2Ferc20-meta-token/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xsequence%2Ferc20-meta-token/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/0xsequence","download_url":"https://codeload.github.com/0xsequence/erc20-meta-token/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252986515,"owners_count":21836169,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["erc20","ethereum","meta-transaction-functionality"],"created_at":"2024-08-03T02:01:02.682Z","updated_at":"2025-05-08T02:30:27.403Z","avatar_url":"https://github.com/0xsequence.png","language":"TypeScript","funding_links":[],"categories":["Ethereum Tools"],"sub_categories":[],"readme":"General ERC20 to ERC1155 Token Wrapper Contract\n===============================================\n\nAllows any ERC-20 token to be wrapped inside of an ERC-1155 contract, and thereby allows\nan ERC-20 token to function as an ERC-1155 contract.\n\n## Getting started\n\n### Install\n\n`yarn add @0xsequence/erc20-meta-token` or `npm install @0xsequence/erc20-meta-token`\n\n### Usage from Solidity\n\n```solidity\npragma solidity ^0.8.0;\n\nimport '@0xsequence/erc20-meta-token/contracts/interfaces/IERC20Wrapper.sol';\n\ncontract ContractA {\n  //...\n  function f(address payable wrapperAddress, address ERC20tokenAddress, uint256 amount) public {\n    IERC20Wrapper(wrapperAddress).deposit(ERC20tokenAddress, msg.sender, amount);\n  }\n}\n```\n\n## How does it work?\n\nWhen you deposit ERC-20 tokens (e.g. DAI) in the wrapper contract, it will give you back ERC-1155 metaTokens (e.g. MetaDAI) with a 1:1 ratio. These metaToken have native meta-transaction functionalities, which allow you to transfer tokens without doing an on-chain transaction yourself, but by simply signing a message and broadcasting this message to \"executors\". You can also \"approve\" addresses to transfer tokens on your behalf with a signed message instead of calling the ERC-20 `approve()` function. \n\nIf you want to transfer some metaTokens, you simply need to call `safeTransferFrom(sender, recipient, ERC20tokenAddress, amount, metaTransactionData)` where token address is the address of the ERC-20 token you want to transfer. Obtaining the balance is similar; `balanceOf(user, ERC20tokenAddress)`.\n\nYou can, at anytime, convert back these metaTokens back to their original tokens by calling the `withdraw()` method. \n\n## Gas Fee Abstraction\n\nWhen transferring metaTokens, like metaDAI, you can specify in which currency you want the transaction fee to be paid in. By default, ERC20 token transfers require users to pay the fee in ETH, but with metaTokens, users can pay directly in any ERC20 token they wish. Hence, at a high level, users could transfer DAI by paying the transaction fee in DAI as well, never needing to possess ETH. \n\n## Why use the ERC-1155 Interface?\n\nThere are a few reasons why the ERC-1155 standard interface was chosen for this contract. First of all, since byte arrays needs to be passed to the contract, supporting the ERC-20 interface for these metaTokens would not be possible (at least not without adding significant complexity).  Secondly, having a single contract for all ERC-20s is simpler for developers and third parties. Indeed, you don't need to deploy a contract for every ERC-20 token contract users want to augment with meta transaction functionality and third parties don't need to maintain a list of which ERC20 token address maps with which wrapper contract address. \n\nIn addition, it becomes easier to have multiple version of wrapper contracts. Indeed, if 5 versions exists, you only need 5 contracts to support all ERC20s in the five different versions, compared for 5N contracts, where N is the number of ERC-20 contracts. \n\n# Security Review\n\nerc20-meta-token has been audited by two independant parties and all issues discovered were addressed. \n- [Agustín Aguilar**](https://github.com/0xsequence/erc20-meta-token/blob/master/audits/Security_Audit_Horizon_Games_23-12-19_2.pdf)\n- [Consensys Diligence](https://github.com/0xsequence/erc20-meta-token/blob/master/audits/horizon-games-audit-2020-02.pdf)\n\n** Agustín was hired as a full-time employee at Horizon after the audit was completed. Agustín did not take part in the writing of erc20-meta-token contracts.\n\n## Dev env \u0026 release\n\nThis repository is configured as a yarn workspace, and has multiple pacakge.json files. Specifically,\nwe have the root ./package.json for the development environment, contract compilation and testing. Contract\nsource code and distribution files are packaged in \"src/package.json\".\n\nTo release a new version, make sure to bump the version, tag it, and run `yarn release`. The `release` command\nwill publish the `@0xsequence/erc20-meta-token` package in the \"src/\" folder, separate from the root package. The advantage\nhere is that application developers who consume `@0xsequence/erc20-meta-token` aren't required to install any of the devDependencies\nin their toolchains as our build and contract packages are separated.\n\n## LICENSE\n\nCopyright (c) 2017-present [Horizon Blockchain Games Inc](https://horizon.io).\n\nLicensed under [Apache-2.0](./LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F0xsequence%2Ferc20-meta-token","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F0xsequence%2Ferc20-meta-token","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F0xsequence%2Ferc20-meta-token/lists"}