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

Add ENS support for Moderator #2

Open
3 tasks
shayanb opened this issue Oct 21, 2018 · 1 comment
Open
3 tasks

Add ENS support for Moderator #2

shayanb opened this issue Oct 21, 2018 · 1 comment
Labels
enhancement New feature or request

Comments

@shayanb
Copy link
Member

shayanb commented Oct 21, 2018

  • Use ENS auctionify.eth for the moderator.
  • Set resolver for .eth domain to the moderator address
  • Get moderator .eth domain as an input
@shayanb shayanb added the enhancement New feature or request label Oct 21, 2018
@shayanb
Copy link
Member Author

shayanb commented Nov 11, 2018

    function namehash(bytes32 name) public pure returns (bytes32 result) {
        // 
        assembly {
             mstore(0, 0)

             if iszero(byte(0, name)) {
                 return(0, 32)
             }

             let scratch := mload(0x40)
             mstore8(add(scratch, 1), 0x2e)
             mstore(add(scratch, 2), name)

             // Find the end of the null-terminated bstring
             let back := add(scratch, 33)
             let front := sub(back, 1)
             for { } gt(front, scratch) { } {
                 switch byte(0, mload(front))
                     case 0x00 {
                         back := front
                     }
                     case 0x2e {
                         mstore(32, sha3(add(front, 1), sub(sub(back, front), 1)))
                         mstore(0, sha3(0, 64))
                         back := front
                     }
                 front := sub(front, 1)
             }

             //return(0, 32)
             result := mload(0)
        }
}



        bytes32 nodehash = namehash(ensName);
        AbstractPublicResolver resolver = _ens.resolver(nodehash);
        address addr = resolver.addr(nodehash);
        require(addr != address(0), "ENS name resolved to null addr");

Ref: https://ropsten.etherscan.io/address/0x199862247977a88aD825e8d4652a9d7a6EF0f40d#code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant