very wip working register

This commit is contained in:
Jonathan Rainville 2018-07-12 16:31:00 -04:00 committed by Iuri Matias
parent 36ae882a26
commit 7d52c29f96
2 changed files with 8 additions and 2 deletions

View File

@ -10,7 +10,8 @@ contract FIFSRegistrar {
bytes32 rootNode; bytes32 rootNode;
modifier only_owner(bytes32 subnode) { modifier only_owner(bytes32 subnode) {
address currentOwner = ens.owner(keccak256(rootNode, subnode)); bytes32 node = sha3(rootNode, subnode);
address currentOwner = ens.owner(node);
require(currentOwner == 0 || currentOwner == msg.sender); require(currentOwner == 0 || currentOwner == msg.sender);
_; _;
} }
@ -29,6 +30,11 @@ contract FIFSRegistrar {
* Register a name, or change the owner of an existing registration. * Register a name, or change the owner of an existing registration.
* @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) public only_owner(subnode) {
ens.setSubnodeOwner(rootNode, subnode, owner);
}
*/ */
function register(bytes32 subnode, address owner) public only_owner(subnode) { function register(bytes32 subnode, address owner) public only_owner(subnode) {
ens.setSubnodeOwner(rootNode, subnode, owner); ens.setSubnodeOwner(rootNode, subnode, owner);

View File

@ -104,7 +104,7 @@ class ENS {
"FIFSRegistrar": { "FIFSRegistrar": {
"deploy": true, "deploy": true,
"args": ["$ENSRegistry", rootNode], "args": ["$ENSRegistry", rootNode],
"onDeploy": ["ENSRegistry.methods.setOwner(0, FIFSRegistrar.options.address).send()"] "onDeploy": ["ENSRegistry.methods.setOwner('"+rootNode+"', web3.eth.defaultAccount).send()"]
} }
} }
}, },