Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create EIP-5298: ENS Trust to hold NFTs under ENS name #5300

Merged
merged 27 commits into from
Nov 15, 2022
Merged
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 74 additions & 0 deletions EIPS/eip-ens-as-holder
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
---
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SamWilsn what is going on here? 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's required for the first draft to wait for the editor to assign a EIP number, hence I was adding this file without a number

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it was something else that was odd. It fixed itself though.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

25d6c6b#diff-464c8e2f23e1608a3c2e5b5a2e153ce449fb69bebd257c649d3c5a095fd73155R1

^ this one?

Things get a little wacky if the preamble doesn't parse correctly in its entirety.

eip: <to be assigned>
xinbenlv marked this conversation as resolved.
Show resolved Hide resolved
title: ENS as Token Holder
description: An interface for holding tokens by ENS.
author: Zainan Victor Zhou (@xinbenlv)
discussions-to: <URL>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please create a thread on ethereum magicians

status: Draft
type: Standards Track
category ERC
xinbenlv marked this conversation as resolved.
Show resolved Hide resolved
created: 2022-07-12
requires: 137
xinbenlv marked this conversation as resolved.
Show resolved Hide resolved
---

## Abstract
An interface for smart contract to become a holder of tokens by honoring ENS ownership.
This specification supports EIP-721 and EIP-1155 tokens and is expandable to future token standard or other standard.
xinbenlv marked this conversation as resolved.
Show resolved Hide resolved

## Motivation
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 existence of wallet addresses.
xinbenlv marked this conversation as resolved.
Show resolved Hide resolved

## 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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't include placeholder text. TBD is appropriate if you don't have any content yet.

cc @SamWilsn we should create a lint rule for people who leave the placeholder text in.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you. Added a rationale

xinbenlv marked this conversation as resolved.
Show resolved Hide resolved

## Backwards Compatibility
No backward compatibility aware of.
xinbenlv marked this conversation as resolved.
Show resolved Hide resolved

## Reference Implementation
```solidity
contract ENSTokenHolding is ERC721TokenReceiver, Initializable {
address ENSRootRegistry _ensRoot;
mapping<address /* of ERC721 */ => tokenId=> string /* of owner*/)> _erc721TokenHolders;

function initializer(address ensRoot) {
_ensRoot = ensRoot;
}

function onERC721Received(address _operator, address _from, uint256 _tokenId, bytes _data) external returns(bytes4) {
_erc721TokenHolders[_operator][_tokenId] = "0x" + msg.sender.toString();

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.
xinbenlv marked this conversation as resolved.
Show resolved Hide resolved

## Copyright
Copyright and related rights waived via [CC0](../LICENSE.md).