Skip to content

A service to standardize "ownerOf" and obtain ownership of any NFT.

Notifications You must be signed in to change notification settings

Benjythebee/Ownerof.xyz

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Repo of the frontend and solidity contracts of OwnerOf.xyz

What's this about?

Sometimes you just want to know if someone owns an NFT regardless of the chain, regardless of the ERC- standard. This protocol was made just for this. I got sick of making edge cases for every single contracts and every single standards. So the idea behind this network of contracts and this API is to obtain the owner of an NFT in one single call.

How to use:

Rest API:

Documentation and repo is available at https://api.ownerof.xyz/

Solidity:

Find the list of addresses here

///@dev Interface of OwnershipChecker;
interface IOwnershipChecker{
    function ownerOfTokenAt(address _impl,uint256 _tokenId,address _potentialOwner) external view  returns (address);
}


contract MyContract{
    address checker;

    constructor(address _checker){
        _checker = checker;
    }

    function getOwnerOfToken_NotERC1155(address myOtherTokenAddress, uint256 myToken) public view returns(address){
        // In this case we assume we know for a fact the myOtherTokenAddress is not an ERC1155.
        address result = IOwnershipChecker(checker).ownerOfTokenAt(myOtherTokenAddress,myToken,address(0))
        return result
    }

    function getOwnerOfToken(address myOtherTokenAddress, uint256 myToken,address potentialOwner) public view returns(address){
        address result = IOwnershipChecker(checker).ownerOfTokenAt(myOtherTokenAddress,myToken,potentialOwner)
        return result
    }
}

Standardizing ownerOf? Why?

Noawadays, we thankfully have ethereum standards. For example EIP721, EIP1155 and more.

These, on top of EIP165 make checking the standard of a given smart contract easier.
However, this completely ignores previous NFT projects that were born prior to 2018 (for example Cryptokitties).
This means that now, to know who owns a given NFT, one has to check for the standard of a smart contract, and then has to call different functions depending on those standards IF that contract supports the ERC721 interface or the ERC1155 interface.
If the contract doesn't support those, a manual process begins where the front-end has to iterate through some specific interfaces and call non-standard methods.
All of that to know who owns a given NFT.

Goal: Know the owner of an NFT in one single call.

Behind the box: diagram (3)

Supported Conctracts by the protocol:

https://github.com/Benjythebee/OwnershipChecker/blob/master/solidity/readme.md

To add a supported contract, create an issue or a pull request!

List of currently supported chains:

  • Polygon
  • Ethereum
List of currently supported Contracts:
  • any ERC1155
  • any ERC721

Todo:

  • More contracts to be supported
  • create ownerOf for ERC20;

Contributing;

  1. Clone the repo

  2. Make a branch and make changes;

  3. Make a pull request.

About

A service to standardize "ownerOf" and obtain ownership of any NFT.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published