aboutsummaryrefslogtreecommitdiffstats
path: root/contracts/ens/contract/ENS.sol
diff options
context:
space:
mode:
authorElad <theman@elad.im>2019-03-20 16:33:24 +0800
committerViktor TrĂ³n <viktor.tron@gmail.com>2019-03-20 16:33:24 +0800
commite7d1867964734cfa4c1067944f213ba5aaceffe1 (patch)
treeca09fbba4c68fe32a1c952160a24776dd27622d9 /contracts/ens/contract/ENS.sol
parentfb458280d1b0b90156745202677dabbc74187697 (diff)
downloadgo-tangerine-e7d1867964734cfa4c1067944f213ba5aaceffe1.tar
go-tangerine-e7d1867964734cfa4c1067944f213ba5aaceffe1.tar.gz
go-tangerine-e7d1867964734cfa4c1067944f213ba5aaceffe1.tar.bz2
go-tangerine-e7d1867964734cfa4c1067944f213ba5aaceffe1.tar.lz
go-tangerine-e7d1867964734cfa4c1067944f213ba5aaceffe1.tar.xz
go-tangerine-e7d1867964734cfa4c1067944f213ba5aaceffe1.tar.zst
go-tangerine-e7d1867964734cfa4c1067944f213ba5aaceffe1.zip
contracts, swarm: implement EIP-1577 (#19285)
* contracts/ens: update public resolver solidity code * contracts/ens: update public resolver, update go bindings * update build * fix ens.sol * contracts/ens: change contract interface * contracts/ens: implement public resolver changes * contracts/ens: added ENSRegistry contract * contracts/ens: reinstate old contract code * contracts/ens: update README.md * contracts/ens: added test coverage for fallback contract * contracts/ens: added support for fallback contract * contracts/ens: removed unused contract code * contracts/ens: add todo and decode multicodec stub * add encode * vendor: add ipfs cid libraries * contracts/ens: cid sanity tests * contracts/ens: more cid sanity checks * contracts/ens: wip integration * wip * Revert "vendor: add ipfs cid libraries" This reverts commit 29d9b6b294ded903a1065d96c8149119713cfd12. * contracts/ens: removed multiformats dependencies * contracts/ens: added decode tests * contracts/ens: added eip spec test, minor changes to exiting tests * contracts/ens: moved cid decoding to own file * contracts/ens: added unit test to encode hash to content hash * contracts/ens: removed unused code * contracts/ens: fix ens tests to use cid decode and encode * contracts/ens: adjust swarm multicodecs after pr merge * contracts/ens: fix linter error * constracts/ens: address PR comments * cmd, contracts: make peoples lives easier * contracts/ens: fix linter error * contracts/ens: address PR comments
Diffstat (limited to 'contracts/ens/contract/ENS.sol')
-rw-r--r--contracts/ens/contract/ENS.sol104
1 files changed, 18 insertions, 86 deletions
diff --git a/contracts/ens/contract/ENS.sol b/contracts/ens/contract/ENS.sol
index 47050c19d..5ab8c92b4 100644
--- a/contracts/ens/contract/ENS.sol
+++ b/contracts/ens/contract/ENS.sol
@@ -1,94 +1,26 @@
-pragma solidity ^0.4.0;
+pragma solidity >=0.4.24;
-import './AbstractENS.sol';
+interface ENS {
-/**
- * The ENS registry contract.
- */
-contract ENS is AbstractENS {
- struct Record {
- address owner;
- address resolver;
- uint64 ttl;
- }
+ // Logged when the owner of a node assigns a new owner to a subnode.
+ event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);
- mapping(bytes32=>Record) records;
+ // Logged when the owner of a node transfers ownership to a new account.
+ event Transfer(bytes32 indexed node, address owner);
- // Permits modifications only by the owner of the specified node.
- modifier only_owner(bytes32 node) {
- if (records[node].owner != msg.sender) throw;
- _;
- }
+ // Logged when the resolver for a node changes.
+ event NewResolver(bytes32 indexed node, address resolver);
- /**
- * Constructs a new ENS registrar.
- */
- function ENS() {
- records[0].owner = msg.sender;
- }
+ // Logged when the TTL of a node changes
+ event NewTTL(bytes32 indexed node, uint64 ttl);
- /**
- * Returns the address that owns the specified node.
- */
- function owner(bytes32 node) constant returns (address) {
- return records[node].owner;
- }
- /**
- * Returns the address of the resolver for the specified node.
- */
- function resolver(bytes32 node) constant returns (address) {
- return records[node].resolver;
- }
+ function setSubnodeOwner(bytes32 node, bytes32 label, address owner) external;
+ function setResolver(bytes32 node, address resolver) external;
+ function setOwner(bytes32 node, address owner) external;
+ function setTTL(bytes32 node, uint64 ttl) external;
+ function owner(bytes32 node) external view returns (address);
+ function resolver(bytes32 node) external view returns (address);
+ function ttl(bytes32 node) external view returns (uint64);
- /**
- * Returns the TTL of a node, and any records associated with it.
- */
- function ttl(bytes32 node) constant returns (uint64) {
- return records[node].ttl;
- }
-
- /**
- * Transfers ownership of a node to a new address. May only be called by the current
- * owner of the node.
- * @param node The node to transfer ownership of.
- * @param owner The address of the new owner.
- */
- function setOwner(bytes32 node, address owner) only_owner(node) {
- Transfer(node, owner);
- records[node].owner = owner;
- }
-
- /**
- * Transfers ownership of a subnode sha3(node, label) to a new address. May only be
- * called by the owner of the parent node.
- * @param node The parent node.
- * @param label The hash of the label specifying the subnode.
- * @param owner The address of the new owner.
- */
- function setSubnodeOwner(bytes32 node, bytes32 label, address owner) only_owner(node) {
- var subnode = sha3(node, label);
- NewOwner(node, label, owner);
- records[subnode].owner = owner;
- }
-
- /**
- * Sets the resolver address for the specified node.
- * @param node The node to update.
- * @param resolver The address of the resolver.
- */
- function setResolver(bytes32 node, address resolver) only_owner(node) {
- NewResolver(node, resolver);
- records[node].resolver = resolver;
- }
-
- /**
- * Sets the TTL for the specified node.
- * @param node The node to update.
- * @param ttl The TTL in seconds.
- */
- function setTTL(bytes32 node, uint64 ttl) only_owner(node) {
- NewTTL(node, ttl);
- records[node].ttl = ttl;
- }
-}
+} \ No newline at end of file