mirror of
https://github.com/embarklabs/embark.git
synced 2025-02-09 04:15:08 +00:00
warn if configured account has no funds
This commit is contained in:
parent
29599112de
commit
4aab8cd374
@ -214,13 +214,6 @@ class Test {
|
|||||||
self.engine.events.emit(constants.events.contractConfigChanged, self.engine.config.contractsConfig);
|
self.engine.events.emit(constants.events.contractConfigChanged, self.engine.config.contractsConfig);
|
||||||
next();
|
next();
|
||||||
},
|
},
|
||||||
function deploy(next) {
|
|
||||||
self.engine.deployManager.gasLimit = 6000000;
|
|
||||||
self.engine.contractsManager.gasLimit = 6000000;
|
|
||||||
self.engine.deployManager.fatalErrors = true;
|
|
||||||
self.engine.deployManager.deployOnlyOnConfig = true;
|
|
||||||
self.engine.events.request('deploy:contracts', next);
|
|
||||||
},
|
|
||||||
function getAccounts(next) {
|
function getAccounts(next) {
|
||||||
self.web3.eth.getAccounts(function (err, accounts) {
|
self.web3.eth.getAccounts(function (err, accounts) {
|
||||||
if (err) {
|
if (err) {
|
||||||
@ -231,6 +224,23 @@ class Test {
|
|||||||
next(null, accounts);
|
next(null, accounts);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
function getBalance(accounts, next) {
|
||||||
|
web3.eth.getBalance(web3.eth.defaultAccount).then((balance) => {
|
||||||
|
if (parseInt(balance) === 0) {
|
||||||
|
console.warn("Warning: default account has no funds");
|
||||||
|
}
|
||||||
|
next(null, accounts);
|
||||||
|
}).catch((err) => { next(err) });
|
||||||
|
},
|
||||||
|
function deploy(accounts, next) {
|
||||||
|
self.engine.deployManager.gasLimit = 6000000;
|
||||||
|
self.engine.contractsManager.gasLimit = 6000000;
|
||||||
|
self.engine.deployManager.fatalErrors = true;
|
||||||
|
self.engine.deployManager.deployOnlyOnConfig = true;
|
||||||
|
self.engine.events.request('deploy:contracts', () => {
|
||||||
|
next(null, accounts);
|
||||||
|
});
|
||||||
|
},
|
||||||
function createContractObject(accounts, next) {
|
function createContractObject(accounts, next) {
|
||||||
async.each(Object.keys(self.engine.contractsManager.contracts), (contractName, eachCb) => {
|
async.each(Object.keys(self.engine.contractsManager.contracts), (contractName, eachCb) => {
|
||||||
const contract = self.engine.contractsManager.contracts[contractName];
|
const contract = self.engine.contractsManager.contracts[contractName];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user