Created
November 11, 2021 21:54
-
-
Save cburgdorf/43b37d8926377bd48ae187f672d9a69c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Poor man's interfaces | |
contract ENS: | |
pub fn resolver(node: String<32>) -> Resolver: | |
revert | |
contract Resolver: | |
pub fn addr(node: String<32>) -> address: | |
revert | |
fn ens() -> ENS: | |
return ENS(address(0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e)) | |
contract SupportsENS: | |
pub fn get_ens_address(name_hash: String<32>) -> address: | |
let resolver: Resolver = ens().resolver(name_hash) | |
return resolver.addr(name_hash) | |
pub fn get_safe_ens_address(name_hash: String<32>) -> address: | |
let resolver: Resolver = ens().resolver(name_hash) | |
let res: address = resolver.addr(name_hash) | |
assert res != address(0), "address not set or set to burn" | |
return res |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment