From 25d6c6b25893487fc0cd7a7837044502779d7dd7 Mon Sep 17 00:00:00 2001 From: xinbenlv Date: Wed, 20 Jul 2022 16:27:38 -0700 Subject: [PATCH 1/6] Create eip-ens-as-holder --- EIPS/eip-ens-as-holder | 47 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 EIPS/eip-ens-as-holder diff --git a/EIPS/eip-ens-as-holder b/EIPS/eip-ens-as-holder new file mode 100644 index 00000000000000..c5d64b9018413d --- /dev/null +++ b/EIPS/eip-ens-as-holder @@ -0,0 +1,47 @@ +--- +eip: +title: ENS as Token Holder +description: An interface for holding tokens by ENS +author: Zainan Victor Zhou (@xinbenlv) +discussions-to: +status: Draft +type: Standards Track +category ERC +created: 2022-07-12 +requires: 137 +--- + +This is the suggested template for new EIPs. + +Note that an EIP number will be assigned by an editor. When opening a pull request to submit your EIP, please use an abbreviated title in the filename, `eip-draft_title_abbrev.md`. + +The title should be 44 characters or less. It should not repeat the EIP number in title, irrespective of the category. + +## Abstract +Abstract is a multi-sentence (short paragraph) technical summary. This should be a very terse and human-readable version of the specification section. Someone should be able to read only the abstract to get the gist of what this specification does. + +## Motivation +The motivation section should describe the "why" of this EIP. What problem does it solve? Why should someone want to implement this standard? What benefit does it provide to the Ethereum ecosystem? What use cases does this EIP address? + +## Specification +The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119. + +The technical specification should describe the syntax and semantics of any new feature. The specification should be detailed enough to allow competing, interoperable implementations for any of the current Ethereum platforms (go-ethereum, parity, cpp-ethereum, ethereumj, ethereumjs, and [others](https://github.com/ethereum/wiki/wiki/Clients)). + +## Rationale +The rationale fleshes out the specification by describing what motivated the design and why particular design decisions were made. It should describe alternate designs that were considered and related work, e.g. how the feature is supported in other languages. + +## Backwards Compatibility +All EIPs that introduce backwards incompatibilities must include a section describing these incompatibilities and their severity. The EIP must explain how the author proposes to deal with these incompatibilities. EIP submissions without a sufficient backwards compatibility treatise may be rejected outright. + +## Test Cases +Test cases for an implementation are mandatory for EIPs that are affecting consensus changes. If the test suite is too large to reasonably be included inline, then consider adding it as one or more files in `../assets/eip-####/`. + +## Reference Implementation +An optional section that contains a reference/example implementation that people can use to assist in understanding or implementing this specification. If the implementation is too large to reasonably be included inline, then consider adding it as one or more files in `../assets/eip-####/`. + +## Security Considerations +All EIPs must contain a section that discusses the security implications/considerations relevant to the proposed change. Include information that might be important for security discussions, surfaces risks and can be used throughout the life cycle of the proposal. E.g. include security-relevant design decisions, concerns, important discussions, implementation-specific guidance and pitfalls, an outline of threats and risks and how they are being addressed. EIP submissions missing the "Security Considerations" section will be rejected. An EIP cannot proceed to status "Final" without a Security Considerations discussion deemed sufficient by the reviewers. + +## Copyright +Copyright and related rights waived via [CC0](../LICENSE.md). From 59bea488d2dbfb09e05691d3993787a3baaa7b5a Mon Sep 17 00:00:00 2001 From: xinbenlv Date: Wed, 20 Jul 2022 16:36:13 -0700 Subject: [PATCH 2/6] Update eip-ens-as-holder --- EIPS/eip-ens-as-holder | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/EIPS/eip-ens-as-holder b/EIPS/eip-ens-as-holder index c5d64b9018413d..78f045d3c4d260 100644 --- a/EIPS/eip-ens-as-holder +++ b/EIPS/eip-ens-as-holder @@ -11,28 +11,35 @@ created: 2022-07-12 requires: 137 --- -This is the suggested template for new EIPs. - -Note that an EIP number will be assigned by an editor. When opening a pull request to submit your EIP, please use an abbreviated title in the filename, `eip-draft_title_abbrev.md`. - -The title should be 44 characters or less. It should not repeat the EIP number in title, irrespective of the category. - ## Abstract -Abstract is a multi-sentence (short paragraph) technical summary. This should be a very terse and human-readable version of the specification section. Someone should be able to read only the abstract to get the gist of what this specification does. +An interface for smart contract to become a holder of tokens by honoring ENS ownership. ## Motivation -The motivation section should describe the "why" of this EIP. What problem does it solve? Why should someone want to implement this standard? What benefit does it provide to the Ethereum ecosystem? What use cases does this EIP address? +Currently, if someone wants to receive token, they have to setup a wallet address, otherwise, +the minter or transferer will not be able to transfer or mint for that token. + +By creating smart contract that conform to this interface specification, we can decouple +the transfer of ownership from the existance of wallet addresses. + ## Specification -The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119. -The technical specification should describe the syntax and semantics of any new feature. The specification should be detailed enough to allow competing, interoperable implementations for any of the current Ethereum platforms (go-ethereum, parity, cpp-ethereum, ethereumj, ethereumjs, and [others](https://github.com/ethereum/wiki/wiki/Clients)). +1. Any conforming smart contract must conform to `ERC721Recever` in [EIP-721](./eip-721.md) and `ERC1155Receiver` in [EIP-1155](./eip-1155.md). + + +```solidity +interface IERC_ENS_AS_HOLDER is ERC721Receiver, ERC1155Receiver { +} +``` + + ## Rationale The rationale fleshes out the specification by describing what motivated the design and why particular design decisions were made. It should describe alternate designs that were considered and related work, e.g. how the feature is supported in other languages. ## Backwards Compatibility -All EIPs that introduce backwards incompatibilities must include a section describing these incompatibilities and their severity. The EIP must explain how the author proposes to deal with these incompatibilities. EIP submissions without a sufficient backwards compatibility treatise may be rejected outright. +No backward compatibility aware of. + ## Test Cases Test cases for an implementation are mandatory for EIPs that are affecting consensus changes. If the test suite is too large to reasonably be included inline, then consider adding it as one or more files in `../assets/eip-####/`. From 57401e8bf68e44f42fdb2fe79b8bea6594283d59 Mon Sep 17 00:00:00 2001 From: xinbenlv Date: Wed, 20 Jul 2022 16:38:45 -0700 Subject: [PATCH 3/6] Update eip-ens-as-holder --- EIPS/eip-ens-as-holder | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/EIPS/eip-ens-as-holder b/EIPS/eip-ens-as-holder index 78f045d3c4d260..cdd8b7c9bf0b98 100644 --- a/EIPS/eip-ens-as-holder +++ b/EIPS/eip-ens-as-holder @@ -1,7 +1,7 @@ --- eip: title: ENS as Token Holder -description: An interface for holding tokens by ENS +description: An interface for holding tokens by ENS. author: Zainan Victor Zhou (@xinbenlv) discussions-to: status: Draft @@ -13,6 +13,7 @@ requires: 137 ## Abstract An interface for smart contract to become a holder of tokens by honoring ENS ownership. +This specification supports ERC721 and ERC1155 and is expandable to future token standard or other standard. ## Motivation Currently, if someone wants to receive token, they have to setup a wallet address, otherwise, @@ -32,6 +33,8 @@ interface IERC_ENS_AS_HOLDER is ERC721Receiver, ERC1155Receiver { } ``` +2. + ## Rationale From c7f319482a2ba764b3ea11b452890cffdbcce552 Mon Sep 17 00:00:00 2001 From: xinbenlv Date: Wed, 20 Jul 2022 16:41:28 -0700 Subject: [PATCH 4/6] Update eip-ens-as-holder --- EIPS/eip-ens-as-holder | 35 ++++++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 7 deletions(-) diff --git a/EIPS/eip-ens-as-holder b/EIPS/eip-ens-as-holder index cdd8b7c9bf0b98..a6a2100dca2285 100644 --- a/EIPS/eip-ens-as-holder +++ b/EIPS/eip-ens-as-holder @@ -25,7 +25,7 @@ the transfer of ownership from the existance of wallet addresses. ## Specification -1. Any conforming smart contract must conform to `ERC721Recever` in [EIP-721](./eip-721.md) and `ERC1155Receiver` in [EIP-1155](./eip-1155.md). +1. Any conforming smart contract must conform to `ERC721TokenReceiver` defined in [EIP-721](./eip-721.md) and `ERC1155TokenReceiver` defined in [EIP-1155](./eip-1155.md). ```solidity @@ -33,8 +33,6 @@ interface IERC_ENS_AS_HOLDER is ERC721Receiver, ERC1155Receiver { } ``` -2. - ## Rationale @@ -43,13 +41,36 @@ The rationale fleshes out the specification by describing what motivated the des ## Backwards Compatibility No backward compatibility aware of. +## Reference Implementation +```solidity +contract ENSTokenHolding is ERC721TokenReceiver, Initializable { + address ENSRootRegistry _ensRoot; + mapping
tokenId=> string /* of owner*/)> _erc721TokenHolders; + +function initializer(address ensRoot) { +_ensRoot = ensRoot; +} -## Test Cases -Test cases for an implementation are mandatory for EIPs that are affecting consensus changes. If the test suite is too large to reasonably be included inline, then consider adding it as one or more files in `../assets/eip-####/`. +function onERC721Received(address _operator, address _from, uint256 _tokenId, bytes _data) external returns(bytes4) { + _erc721TokenHolders[_operator][_tokenId] = "0x" + msg.sender.toString(); -## Reference Implementation -An optional section that contains a reference/example implementation that people can use to assist in understanding or implementing this specification. If the implementation is too large to reasonably be included inline, then consider adding it as one or more files in `../assets/eip-####/`. + return /*bytes4 comply to ERC721 onReceived*/ +} + +function setOwner(address erc721, uint256 tokenId, string ens) { + require(msg.sender.toString == "0x" + _erc721TokenHolders[erc721][tokenId]); + _erc721TokenHolders[erc721][tokenId] = newOwnerENS; +} +function claim(address erc721, uint256 tokenId) { + + require(msg.sender.toString == "0x" + _erc721TokenHolders[erc721][tokenId] + || _ensRoot.reverseLookup() == /*stored ens*); + ERC721 contract = ERC721(erc721); + erc721.safeTransferFrom(this, msg.sender, tokenId); +); +} +``` ## Security Considerations All EIPs must contain a section that discusses the security implications/considerations relevant to the proposed change. Include information that might be important for security discussions, surfaces risks and can be used throughout the life cycle of the proposal. E.g. include security-relevant design decisions, concerns, important discussions, implementation-specific guidance and pitfalls, an outline of threats and risks and how they are being addressed. EIP submissions missing the "Security Considerations" section will be rejected. An EIP cannot proceed to status "Final" without a Security Considerations discussion deemed sufficient by the reviewers. From b6fe812defd9a015ef35c31e1893b6e642ded0bd Mon Sep 17 00:00:00 2001 From: xinbenlv Date: Wed, 20 Jul 2022 16:43:04 -0700 Subject: [PATCH 5/6] Update eip-ens-as-holder --- EIPS/eip-ens-as-holder | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/EIPS/eip-ens-as-holder b/EIPS/eip-ens-as-holder index a6a2100dca2285..b3c3e82f808be1 100644 --- a/EIPS/eip-ens-as-holder +++ b/EIPS/eip-ens-as-holder @@ -22,19 +22,15 @@ the minter or transferer will not be able to transfer or mint for that token. By creating smart contract that conform to this interface specification, we can decouple the transfer of ownership from the existance of wallet addresses. - ## Specification 1. Any conforming smart contract must conform to `ERC721TokenReceiver` defined in [EIP-721](./eip-721.md) and `ERC1155TokenReceiver` defined in [EIP-1155](./eip-1155.md). - ```solidity interface IERC_ENS_AS_HOLDER is ERC721Receiver, ERC1155Receiver { } ``` - - ## Rationale The rationale fleshes out the specification by describing what motivated the design and why particular design decisions were made. It should describe alternate designs that were considered and related work, e.g. how the feature is supported in other languages. @@ -63,7 +59,6 @@ function setOwner(address erc721, uint256 tokenId, string ens) { } function claim(address erc721, uint256 tokenId) { - require(msg.sender.toString == "0x" + _erc721TokenHolders[erc721][tokenId] || _ensRoot.reverseLookup() == /*stored ens*); ERC721 contract = ERC721(erc721); @@ -71,6 +66,7 @@ function claim(address erc721, uint256 tokenId) { ); } ``` + ## Security Considerations All EIPs must contain a section that discusses the security implications/considerations relevant to the proposed change. Include information that might be important for security discussions, surfaces risks and can be used throughout the life cycle of the proposal. E.g. include security-relevant design decisions, concerns, important discussions, implementation-specific guidance and pitfalls, an outline of threats and risks and how they are being addressed. EIP submissions missing the "Security Considerations" section will be rejected. An EIP cannot proceed to status "Final" without a Security Considerations discussion deemed sufficient by the reviewers. From fb2dc9d0cce2f99a2e963702041d7eee90e9a93a Mon Sep 17 00:00:00 2001 From: xinbenlv Date: Wed, 20 Jul 2022 16:43:45 -0700 Subject: [PATCH 6/6] Update eip-ens-as-holder --- EIPS/eip-ens-as-holder | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/EIPS/eip-ens-as-holder b/EIPS/eip-ens-as-holder index b3c3e82f808be1..70e757afc93f9b 100644 --- a/EIPS/eip-ens-as-holder +++ b/EIPS/eip-ens-as-holder @@ -13,7 +13,7 @@ requires: 137 ## Abstract An interface for smart contract to become a holder of tokens by honoring ENS ownership. -This specification supports ERC721 and ERC1155 and is expandable to future token standard or other standard. +This specification supports EIP-721 and EIP-1155 tokens and is expandable to future token standard or other standard. ## Motivation Currently, if someone wants to receive token, they have to setup a wallet address, otherwise,