mirror of
https://github.com/status-im/embark-area-51.git
synced 2025-01-09 21:46:12 +00:00
rebase fixes
This commit is contained in:
parent
46a24d9bae
commit
f3f0e8c19f
@ -49,42 +49,58 @@ class DeployManager {
|
||||
}
|
||||
|
||||
self.logger.info(__("deploying contracts"));
|
||||
self.events.emit("deploy:beforeAll");
|
||||
async.waterfall([
|
||||
function (next) {
|
||||
self.plugins.emitAndRunActionsForEvent("deploy:beforeAll", next);
|
||||
},
|
||||
function () {
|
||||
const contractDeploys = {};
|
||||
const errors = [];
|
||||
contracts.forEach(contract => {
|
||||
function deploy(result, callback) {
|
||||
if (typeof result === 'function') {
|
||||
callback = result;
|
||||
}
|
||||
contract._gasLimit = self.gasLimit;
|
||||
self.events.request('deploy:contract', contract, (err) => {
|
||||
if (err) {
|
||||
contract.error = err.message || err;
|
||||
self.logger.error(err.message || err);
|
||||
errors.push(err);
|
||||
}
|
||||
callback();
|
||||
});
|
||||
}
|
||||
|
||||
const contractDeploys = {};
|
||||
contracts.forEach(contract => {
|
||||
function deploy(result, callback) {
|
||||
if (typeof result === 'function') {
|
||||
callback = result;
|
||||
}
|
||||
contract._gasLimit = self.gasLimit;
|
||||
self.events.request('deploy:contract', contract, (err) => {
|
||||
callback(err);
|
||||
const className = contract.className;
|
||||
if (!contractDependencies[className] || contractDependencies[className].length === 0) {
|
||||
contractDeploys[className] = deploy;
|
||||
return;
|
||||
}
|
||||
contractDeploys[className] = cloneDeep(contractDependencies[className]);
|
||||
contractDeploys[className].push(deploy);
|
||||
});
|
||||
}
|
||||
|
||||
const className = contract.className;
|
||||
if (!contractDependencies[className] || contractDependencies[className].length === 0) {
|
||||
contractDeploys[className] = deploy;
|
||||
return;
|
||||
try {
|
||||
async.auto(contractDeploys, 1, function(_err, _results) {
|
||||
if (errors.length) {
|
||||
_err = __("Error deploying contracts. Please fix errors to continue.");
|
||||
self.logger.error(_err);
|
||||
return done(_err);
|
||||
}
|
||||
if (contracts.length === 0) {
|
||||
self.logger.info(__("no contracts found"));
|
||||
return done();
|
||||
}
|
||||
self.logger.info(__("finished deploying contracts"));
|
||||
done(err);
|
||||
});
|
||||
} catch (e) {
|
||||
self.logger.error(e.message || e);
|
||||
done(__('Error deploying'));
|
||||
}
|
||||
}
|
||||
contractDeploys[className] = cloneDeep(contractDependencies[className]);
|
||||
contractDeploys[className].push(deploy);
|
||||
});
|
||||
|
||||
async.auto(contractDeploys, function(err, _results) {
|
||||
if (err) {
|
||||
self.logger.error(__("error deploying contracts"));
|
||||
self.logger.error(err.message);
|
||||
self.logger.debug(err.stack);
|
||||
}
|
||||
if (contracts.length === 0) {
|
||||
self.logger.info(__("no contracts found"));
|
||||
return done();
|
||||
}
|
||||
self.logger.info(__("finished deploying contracts"));
|
||||
done(err);
|
||||
});
|
||||
]);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -152,7 +152,6 @@ __embarkENS.setProvider = function (config) {
|
||||
const ERROR_MESSAGE = 'ENS is not available in this chain';
|
||||
self.registration = config.registration;
|
||||
self.env = config.env;
|
||||
|
||||
EmbarkJS.onReady(() => {
|
||||
web3.eth.net.getId()
|
||||
.then((id) => {
|
||||
@ -259,7 +258,3 @@ __embarkENS.registerSubDomain = function (name, address, callback) {
|
||||
__embarkENS.isAvailable = function () {
|
||||
return Boolean(this._isAvailable);
|
||||
};
|
||||
|
||||
__embarkENS.register = function () {
|
||||
return new Error("Not available with ENS");
|
||||
};
|
||||
|
@ -219,14 +219,6 @@ class ENS {
|
||||
const config = {
|
||||
"default": {
|
||||
"gas": "auto",
|
||||
"contracts": {
|
||||
"ENS": {
|
||||
"deploy": false,
|
||||
"silent": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"development": {
|
||||
"contracts": {
|
||||
"ENS": {
|
||||
"deploy": false,
|
||||
@ -295,29 +287,29 @@ class ENS {
|
||||
if (this.registration && this.registration.rootDomain) {
|
||||
// Register root domain if it is defined
|
||||
const rootNode = namehash.hash(this.registration.rootDomain);
|
||||
config.development.contracts['FIFSRegistrar'] = {
|
||||
config.default.contracts['FIFSRegistrar'] = {
|
||||
"deploy": true,
|
||||
"silent": true,
|
||||
"args": ["$ENSRegistry", rootNode],
|
||||
"onDeploy": [
|
||||
`ENSRegistry.methods.setOwner('${rootNode}', web3.eth.defaultAccount).send({from: web3.eth.defaultAccount}).then(() => {
|
||||
ENSRegistry.methods.setResolver('${rootNode}', "$Resolver").send({from: web3.eth.defaultAccount});
|
||||
var reverseNode = web3.utils.soliditySha3(web3.eth.defaultAccount.toLowerCase().substr(2) + '${reverseAddrSuffix}');
|
||||
ENSRegistry.methods.setResolver(reverseNode, "$Resolver").send({from: web3.eth.defaultAccount});
|
||||
Resolver.methods.setAddr('${rootNode}', web3.eth.defaultAccount).send({from: web3.eth.defaultAccount});
|
||||
Resolver.methods.setName(reverseNode, '${this.registration.rootDomain}').send({from: web3.eth.defaultAccount});
|
||||
})`
|
||||
ENSRegistry.methods.setResolver('${rootNode}', "$Resolver").send({from: web3.eth.defaultAccount});
|
||||
var reverseNode = web3.utils.soliditySha3(web3.eth.defaultAccount.toLowerCase().substr(2) + '${reverseAddrSuffix}');
|
||||
ENSRegistry.methods.setResolver(reverseNode, "$Resolver").send({from: web3.eth.defaultAccount});
|
||||
Resolver.methods.setAddr('${rootNode}', web3.eth.defaultAccount).send({from: web3.eth.defaultAccount});
|
||||
Resolver.methods.setName(reverseNode, '${this.registration.rootDomain}').send({from: web3.eth.defaultAccount});
|
||||
})`
|
||||
]
|
||||
};
|
||||
}
|
||||
config.privatenet = config.development;
|
||||
this.embark.registerContractConfiguration(config);
|
||||
|
||||
if (this.isDev || this.env === 'privatenet') {
|
||||
//if (this.isDev || this.env === 'privatenet') {
|
||||
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) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user