diff options
author | Felix Lange <fjl@users.noreply.github.com> | 2018-01-08 20:15:57 +0800 |
---|---|---|
committer | Péter Szilágyi <peterke@gmail.com> | 2018-01-08 20:15:57 +0800 |
commit | 5c2f1e00148f16655d3fb63b93920b1108165c56 (patch) | |
tree | f3b453e05a8da60ceb006b5899554f8fbad86cf4 /contracts/ens/contract/ENS.sol | |
parent | a139041d409d0ffaf81c7cf931c6b24299a05705 (diff) | |
download | go-tangerine-5c2f1e00148f16655d3fb63b93920b1108165c56.tar go-tangerine-5c2f1e00148f16655d3fb63b93920b1108165c56.tar.gz go-tangerine-5c2f1e00148f16655d3fb63b93920b1108165c56.tar.bz2 go-tangerine-5c2f1e00148f16655d3fb63b93920b1108165c56.tar.lz go-tangerine-5c2f1e00148f16655d3fb63b93920b1108165c56.tar.xz go-tangerine-5c2f1e00148f16655d3fb63b93920b1108165c56.tar.zst go-tangerine-5c2f1e00148f16655d3fb63b93920b1108165c56.zip |
all: update generated code (#15808)
* core/types, core/vm, eth, tests: regenerate gencodec files
* Makefile: update devtools target
Install protoc-gen-go and print reminders about npm, solc and protoc.
Also switch to github.com/kevinburke/go-bindata because it's more
maintained.
* contracts/ens: update contracts and regenerate with solidity v0.4.19
The newer upstream version of the FIFSRegistrar contract doesn't set the
resolver anymore. The resolver is now deployed separately.
* contracts/release: regenerate with solidity v0.4.19
* contracts/chequebook: fix fallback and regenerate with solidity v0.4.19
The contract didn't have a fallback function, payments would be rejected
when compiled with newer solidity. References to 'mortal' and 'owned'
use the local file system so we can compile without network access.
* p2p/discv5: regenerate with recent stringer
* cmd/faucet: regenerate
* dashboard: regenerate
* eth/tracers: regenerate
* internal/jsre/deps: regenerate
* dashboard: avoid sed -i because it's not portable
* accounts/usbwallet/internal/trezor: fix go generate warnings
Diffstat (limited to 'contracts/ens/contract/ENS.sol')
-rw-r--r-- | contracts/ens/contract/ENS.sol | 94 |
1 files changed, 94 insertions, 0 deletions
diff --git a/contracts/ens/contract/ENS.sol b/contracts/ens/contract/ENS.sol new file mode 100644 index 000000000..47050c19d --- /dev/null +++ b/contracts/ens/contract/ENS.sol @@ -0,0 +1,94 @@ +pragma solidity ^0.4.0; + +import './AbstractENS.sol'; + +/** + * The ENS registry contract. + */ +contract ENS is AbstractENS { + struct Record { + address owner; + address resolver; + uint64 ttl; + } + + mapping(bytes32=>Record) records; + + // Permits modifications only by the owner of the specified node. + modifier only_owner(bytes32 node) { + if (records[node].owner != msg.sender) throw; + _; + } + + /** + * Constructs a new ENS registrar. + */ + function ENS() { + records[0].owner = msg.sender; + } + + /** + * 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; + } + + /** + * 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; + } +} |