contract SupportsENS {
    // Same address for Mainet, Ropsten, Rinkerby, Gorli and other networks;
    ENS ens = ENS(0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e);

    // Optional modifier to only allow calls from a specific ENS owner
    modifier onlyENSOwner(bytes32 nameHash) {
        require(
            msg.sender == getENSAddress(nameHash),
            "Only ENS owner can call this contract"
            );
            _;
    }

    // Main function to get an address
    // ATTENTION: if an ENS is not set or claimed, it will return 0x0.
    // Make sure to check this before sending ether.
    function getENSAddress(bytes32 nameHash) public view returns (address){
        Resolver resolver = ens.resolver(nameHash);
        return resolver.addr(nameHash);
    }

    // Similar to the function above but will
    // revert if the address returns 0x00..
    function getSafeENSAddress(bytes32 nameHash) public view returns (address){
        Resolver resolver = ens.resolver(nameHash);
        address res = resolver.addr(nameHash);
        require(res != address(0), "address not set or set to burn");
        return res;
    }

}
function getSafeENSAddress(bytes32 nameHash) public view returns (address){
    Resolver resolver = ens.resolver(nameHash);
    address res = resolver.addr(nameHash);
    require(res != address(0), "address not set or set to burn");
    return res;
}

// Similar to the function above but will
// revert if the address returns 0x00..