mirror of https://github.com/embarklabs/embark.git
change 70000 for a constant
This commit is contained in:
parent
d34428a129
commit
f71c158164
|
@ -8,6 +8,8 @@ const reverseAddrSuffix = '.addr.reverse';
|
||||||
const MAINNET_ID = '1';
|
const MAINNET_ID = '1';
|
||||||
const ROPSTEN_ID = '3';
|
const ROPSTEN_ID = '3';
|
||||||
const RINKEBY_ID = '4';
|
const RINKEBY_ID = '4';
|
||||||
|
// Price of ENS registration contract functions
|
||||||
|
const ENS_GAS_PRICE = 700000;
|
||||||
|
|
||||||
const ENS_CONTRACTS_CONFIG = {
|
const ENS_CONTRACTS_CONFIG = {
|
||||||
[MAINNET_ID]: {
|
[MAINNET_ID]: {
|
||||||
|
@ -317,14 +319,14 @@ class ENS {
|
||||||
|
|
||||||
const rootNode = namehash.hash(self.registration.rootDomain);
|
const rootNode = namehash.hash(self.registration.rootDomain);
|
||||||
var reverseNode = web3.utils.soliditySha3(web3.eth.defaultAccount.toLowerCase().substr(2) + reverseAddrSuffix);
|
var reverseNode = web3.utils.soliditySha3(web3.eth.defaultAccount.toLowerCase().substr(2) + reverseAddrSuffix);
|
||||||
self.ensContract.methods.setOwner(rootNode, web3.eth.defaultAccount).send({from: web3.eth.defaultAccount, gas: 700000}).then(() => {
|
self.ensContract.methods.setOwner(rootNode, web3.eth.defaultAccount).send({from: web3.eth.defaultAccount, gas: ENS_GAS_PRICE}).then(() => {
|
||||||
return self.ensContract.methods.setResolver(rootNode, config.resolverAddress).send({from: web3.eth.defaultAccount, gas: 700000});
|
return self.ensContract.methods.setResolver(rootNode, config.resolverAddress).send({from: web3.eth.defaultAccount, gas: ENS_GAS_PRICE});
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
return self.ensContract.methods.setResolver(reverseNode, config.resolverAddress).send({from: web3.eth.defaultAccount, gas: 700000});
|
return self.ensContract.methods.setResolver(reverseNode, config.resolverAddress).send({from: web3.eth.defaultAccount, gas: ENS_GAS_PRICE});
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
return self.resolverContract.methods.setAddr(rootNode, web3.eth.defaultAccount).send({from: web3.eth.defaultAccount, gas: 700000});
|
return self.resolverContract.methods.setAddr(rootNode, web3.eth.defaultAccount).send({from: web3.eth.defaultAccount, gas: ENS_GAS_PRICE});
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
return self.resolverContract.methods.setName(reverseNode, self.registration.rootDomain).send({from: web3.eth.defaultAccount, gas: 700000});
|
return self.resolverContract.methods.setName(reverseNode, self.registration.rootDomain).send({from: web3.eth.defaultAccount, gas: ENS_GAS_PRICE});
|
||||||
}).then((_result) => {
|
}).then((_result) => {
|
||||||
next();
|
next();
|
||||||
})
|
})
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
/*global web3*/
|
/*global web3*/
|
||||||
const namehash = require('eth-ens-namehash');
|
const namehash = require('eth-ens-namehash');
|
||||||
|
// Price of ENS registration contract functions
|
||||||
|
const ENS_GAS_PRICE = 700000;
|
||||||
|
|
||||||
function registerSubDomain(ens, registrar, resolver, defaultAccount, subdomain, rootDomain, reverseNode, address, logger, secureSend, callback) {
|
function registerSubDomain(ens, registrar, resolver, defaultAccount, subdomain, rootDomain, reverseNode, address, logger, secureSend, callback) {
|
||||||
const subnode = namehash.hash(subdomain);
|
const subnode = namehash.hash(subdomain);
|
||||||
|
@ -10,7 +12,7 @@ function registerSubDomain(ens, registrar, resolver, defaultAccount, subdomain,
|
||||||
const toSend = ens.methods.setSubnodeOwner(rootNode, subnode, defaultAccount);
|
const toSend = ens.methods.setSubnodeOwner(rootNode, subnode, defaultAccount);
|
||||||
let transaction;
|
let transaction;
|
||||||
|
|
||||||
secureSend(web3, toSend, {from: defaultAccount, gas: 700000}, false)
|
secureSend(web3, toSend, {from: defaultAccount, gas: ENS_GAS_PRICE}, false)
|
||||||
// Set resolver for the node
|
// Set resolver for the node
|
||||||
.then(transac => {
|
.then(transac => {
|
||||||
if (transac.status !== "0x1" && transac.status !== "0x01" && transac.status !== true) {
|
if (transac.status !== "0x1" && transac.status !== "0x01" && transac.status !== true) {
|
||||||
|
@ -18,19 +20,19 @@ function registerSubDomain(ens, registrar, resolver, defaultAccount, subdomain,
|
||||||
return callback('Failed to register. Check gas cost.');
|
return callback('Failed to register. Check gas cost.');
|
||||||
}
|
}
|
||||||
transaction = transac;
|
transaction = transac;
|
||||||
return secureSend(web3, ens.methods.setResolver(node, resolver.options.address), {from: defaultAccount, gas: 700000}, false);
|
return secureSend(web3, ens.methods.setResolver(node, resolver.options.address), {from: defaultAccount, gas: ENS_GAS_PRICE}, false);
|
||||||
})
|
})
|
||||||
// Set address for node
|
// Set address for node
|
||||||
.then(_result => {
|
.then(_result => {
|
||||||
return secureSend(web3, resolver.methods.setAddr(node, address), {from: defaultAccount, gas: 700000}, false);
|
return secureSend(web3, resolver.methods.setAddr(node, address), {from: defaultAccount, gas: ENS_GAS_PRICE}, false);
|
||||||
})
|
})
|
||||||
// Set resolver for the reverse node
|
// Set resolver for the reverse node
|
||||||
.then(_result => {
|
.then(_result => {
|
||||||
return secureSend(web3, ens.methods.setResolver(reverseNode, resolver.options.address), {from: defaultAccount, gas: 700000}, false);
|
return secureSend(web3, ens.methods.setResolver(reverseNode, resolver.options.address), {from: defaultAccount, gas: ENS_GAS_PRICE}, false);
|
||||||
})
|
})
|
||||||
// Set name for reverse node
|
// Set name for reverse node
|
||||||
.then(_result => {
|
.then(_result => {
|
||||||
return secureSend(web3, resolver.methods.setName(reverseNode, `${subdomain}.${rootDomain}`), {from: defaultAccount, gas: 700000}, false);
|
return secureSend(web3, resolver.methods.setName(reverseNode, `${subdomain}.${rootDomain}`), {from: defaultAccount, gas: ENS_GAS_PRICE}, false);
|
||||||
})
|
})
|
||||||
.then(_result => {
|
.then(_result => {
|
||||||
callback(null, transaction);
|
callback(null, transaction);
|
||||||
|
|
Loading…
Reference in New Issue