This question already has an answer here:

Is it possible to use a ENS name as an address in solidity, instead of having to use the usual long address?


address public _address = myname.eth;

marked as duplicate by Eli Drion, Community Apr 1 '18 at 18:54

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


It is... but it isn't...

You can't do it like you present above, but you could call the ENS contract to get the resolver contract address, then call the resolver contract to get the name's contract address...

This would cost a bit of gas though, so you're probably best just looking up the address and entering it in directly; unless of course you need it to be continuously up to date with the current live address.

Not the answer you're looking for? Browse other questions tagged or ask your own question.