Last active
July 18, 2017 19:18
-
-
Save dickolsson/cb85cfb447378215c63885e8a1d0045f to your computer and use it in GitHub Desktop.
Example deployment of ENS
This file contains hidden or 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
const ENS = artifacts.require("./ENS.sol"); | |
const FIFSRegistrar = artifacts.require('./FIFSRegistrar.sol'); | |
const PublicResolver = artifacts.require('./PublicResolver.sol'); | |
const namehash = require('../node_modules/eth-ens-namehash'); | |
const Web3 = require('web3'); | |
const web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545")); | |
module.exports = function(deployer, network, accounts) { | |
var domain = 'irondoers'; | |
var tld = 'test'; | |
var rootNode = { | |
namehash: namehash(tld), | |
sha3: web3.sha3(tld) | |
}; | |
deployer.deploy(ENS) | |
.then(function() { | |
return deployer.deploy(FIFSRegistrar, ENS.address, rootNode.namehash); | |
}) | |
.then(function() { | |
return ENS.at(ENS.address).setSubnodeOwner('0x0', rootNode.sha3, FIFSRegistrar.address); | |
}) | |
.then(function() { | |
return deployer.deploy(PublicResolver, ENS.address); | |
}) | |
.then(function() { | |
return FIFSRegistrar.at(FIFSRegistrar.address).register(web3.sha3(domain), web3.eth.accounts[0]); | |
}) | |
.then(function() { | |
return ENS.at(ENS.address).setResolver(namehash(domain + '.' + tld), PublicResolver.address); | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment