mirror of
https://github.com/status-im/embark-area-51.git
synced 2025-01-09 13:36:14 +00:00
add resolver contract
This commit is contained in:
parent
d0e14096c3
commit
188d6afa19
@ -48,6 +48,13 @@ contract ENSRegistry is ENS {
|
|||||||
emit NewOwner(node, label, owner);
|
emit NewOwner(node, label, owner);
|
||||||
records[subnode].owner = owner;
|
records[subnode].owner = owner;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
function setSubnodeOwner(bytes32 node, bytes32 label, address owner) public {
|
||||||
|
var subnode = sha3(node, label);
|
||||||
|
NewOwner(node, label, owner);
|
||||||
|
records[subnode].owner = owner;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dev Sets the resolver address for the specified node.
|
* @dev Sets the resolver address for the specified node.
|
||||||
|
@ -9,6 +9,7 @@ import './Resolver.sol';
|
|||||||
contract FIFSRegistrar {
|
contract FIFSRegistrar {
|
||||||
ENS ens;
|
ENS ens;
|
||||||
bytes32 rootNode;
|
bytes32 rootNode;
|
||||||
|
Resolver resolver;
|
||||||
|
|
||||||
modifier only_owner(bytes32 subnode) {
|
modifier only_owner(bytes32 subnode) {
|
||||||
bytes32 node = keccak256(abi.encodePacked(rootNode, subnode));
|
bytes32 node = keccak256(abi.encodePacked(rootNode, subnode));
|
||||||
@ -25,6 +26,7 @@ contract FIFSRegistrar {
|
|||||||
constructor(ENS ensAddr, bytes32 node) public {
|
constructor(ENS ensAddr, bytes32 node) public {
|
||||||
ens = ensAddr;
|
ens = ensAddr;
|
||||||
rootNode = node;
|
rootNode = node;
|
||||||
|
resolver = resolverAddr;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -32,12 +34,13 @@ contract FIFSRegistrar {
|
|||||||
* @param subnode The hash of the label to register.
|
* @param subnode The hash of the label to register.
|
||||||
* @param owner The address of the new owner.
|
* @param owner The address of the new owner.
|
||||||
*/
|
*/
|
||||||
/*
|
function register(bytes32 subnode, address owner, address _account) public only_owner(subnode) {
|
||||||
function register(bytes32 subnode, address owner) public only_owner(subnode) {
|
bytes32 subdomainHash = sha3(rootNode, subnode);
|
||||||
ens.setSubnodeOwner(rootNode, subnode, owner);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
function register(bytes32 subnode, address owner) public only_owner(subnode) {
|
|
||||||
ens.setSubnodeOwner(rootNode, subnode, owner);
|
ens.setSubnodeOwner(rootNode, subnode, owner);
|
||||||
|
ens.setResolver(subdomainHash, resolver); //default resolver
|
||||||
|
bool resolveAccount = _account != address(0);
|
||||||
|
if (resolveAccount) {
|
||||||
|
resolver.setAddr(subdomainHash, _account);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -329,13 +329,21 @@ class ENS {
|
|||||||
"contracts": {
|
"contracts": {
|
||||||
"FIFSRegistrar": {
|
"FIFSRegistrar": {
|
||||||
"deploy": true,
|
"deploy": true,
|
||||||
"args": ["$ENSRegistry", rootNode],
|
"args": ["$ENSRegistry", rootNode, "$Resolver"],
|
||||||
"onDeploy": ["ENSRegistry.methods.setOwner('"+rootNode+"', web3.eth.defaultAccount).send()"]
|
"onDeploy": [
|
||||||
|
`ENSRegistry.methods.setOwner('${rootNode}', web3.eth.defaultAccount).send().then(() => {
|
||||||
|
ENSRegistry.methods.setResolver('${rootNode}', "$Resolver").send();
|
||||||
|
Resolver.methods.setAddr('${rootNode}', web3.eth.defaultAccount).send();
|
||||||
|
})`
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"ropsten": {
|
"ropsten": {
|
||||||
"contracts": {
|
"contracts": {
|
||||||
|
"ENSRegistry": {
|
||||||
|
"address": "0x112234455c3a32fd11230c42e7bccd4a84e02010"
|
||||||
|
},
|
||||||
"FIFSRegistrar": {
|
"FIFSRegistrar": {
|
||||||
"deploy": false
|
"deploy": false
|
||||||
}
|
}
|
||||||
@ -343,6 +351,9 @@ class ENS {
|
|||||||
},
|
},
|
||||||
"rinkeby": {
|
"rinkeby": {
|
||||||
"contracts": {
|
"contracts": {
|
||||||
|
"ENSRegistry": {
|
||||||
|
"address": "0xe7410170f87102DF0055eB195163A03B7F2Bff4A"
|
||||||
|
},
|
||||||
"FIFSRegistrar": {
|
"FIFSRegistrar": {
|
||||||
"deploy": false
|
"deploy": false
|
||||||
}
|
}
|
||||||
@ -350,13 +361,19 @@ class ENS {
|
|||||||
},
|
},
|
||||||
"livenet": {
|
"livenet": {
|
||||||
"contracts": {
|
"contracts": {
|
||||||
|
"ENSRegistry": {
|
||||||
|
"address": "0x314159265dd8dbb310642f98f50c066173c1259b"
|
||||||
|
},
|
||||||
"FIFSRegistrar": {
|
"FIFSRegistrar": {
|
||||||
"deploy": false
|
"deploy": false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
self.embark.events.request("config:contractsFiles:add", self.embark.pathToFile('./contracts/FIFSRegistrar.sol'));
|
|
||||||
|
this.embark.events.request("config:contractsFiles:add", this.embark.pathToFile('./contracts/ENSRegistry.sol'));
|
||||||
|
this.embark.events.request("config:contractsFiles:add", this.embark.pathToFile('./contracts/FIFSRegistrar.sol'));
|
||||||
|
this.embark.events.request("config:contractsFiles:add", this.embark.pathToFile('./contracts/Resolver.sol'));
|
||||||
}
|
}
|
||||||
|
|
||||||
addSetProvider(config) {
|
addSetProvider(config) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user