diff --git a/lib/contracts/blockchain.js b/lib/contracts/blockchain.js index 79a000bc..352fd775 100644 --- a/lib/contracts/blockchain.js +++ b/lib/contracts/blockchain.js @@ -86,6 +86,10 @@ class Blockchain { this.web3.eth.getCode(address, cb); } + getBlock(blockNumber, cb) { + this.web3.eth.getBlock(blockNumber, cb); + } + } module.exports = Blockchain; diff --git a/lib/contracts/deploy.js b/lib/contracts/deploy.js index 2ddc8d4c..3d957a4a 100644 --- a/lib/contracts/deploy.js +++ b/lib/contracts/deploy.js @@ -26,7 +26,7 @@ class Deploy { initTracker(cb) { this.deployTracker = new DeployTracker({ - logger: this.logger, chainConfig: this.chainConfig, web3: this.web3, env: this.env + logger: this.logger, chainConfig: this.chainConfig, blockchain: this.blockchain, env: this.env }, cb); } diff --git a/lib/contracts/deploy_tracker.js b/lib/contracts/deploy_tracker.js index 2873c56a..64d33b3a 100644 --- a/lib/contracts/deploy_tracker.js +++ b/lib/contracts/deploy_tracker.js @@ -7,14 +7,14 @@ class DeployTracker { this.logger = options.logger; this.env = options.env; this.chainConfig = options.chainConfig; - this.web3 = options.web3; + this.blockchain = options.blockchain; if (this.chainConfig === false) { this.currentChain = {contracts: []}; return cb(); } - this.web3.eth.getBlock(0, function(err, block) { + this.blockchain.getBlock(0, function(err, block) { let chainId = block.hash; if (self.chainConfig[chainId] === undefined) {