From b43a766de73e913172e287123b8ffb866be7350e Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Wed, 30 May 2018 12:26:49 -0400 Subject: [PATCH] cleanup module call --- lib/core/engine.js | 33 +++++++-------------------------- lib/core/plugins.js | 2 +- lib/modules/ens/index.js | 5 ++--- lib/modules/ipfs/index.js | 2 +- lib/modules/profiler/index.js | 1 - lib/modules/solidity/index.js | 4 ++-- lib/modules/swarm/index.js | 2 +- lib/modules/vyper/index.js | 4 ++-- lib/modules/whisper/index.js | 2 +- test/compiler.js | 10 ++++++---- test/contracts.js | 14 ++++++++++---- 11 files changed, 33 insertions(+), 46 deletions(-) diff --git a/lib/core/engine.js b/lib/core/engine.js index e135a434..671b7cd0 100644 --- a/lib/core/engine.js +++ b/lib/core/engine.js @@ -93,7 +93,7 @@ class Engine { } registerModule(moduleName, options) { - this.plugins.loadInternalPlugin(moduleName, options); + this.plugins.loadInternalPlugin(moduleName, options || {}); } startService(serviceName, _options) { @@ -149,12 +149,7 @@ class Engine { } namingSystem(_options) { - this.registerModule('ens', { - logger: this.logger, - events: this.events, - web3: this.blockchain.web3, - namesConfig: this.config.namesystemConfig - }); + this.registerModule('ens'); } codeRunnerService(_options) { @@ -206,22 +201,11 @@ class Engine { compiler.compile_contracts(contractFiles, cb); }); - this.registerModule('solidity', { - contractDirectories: self.config.contractDirectories - }); - this.registerModule('vyper', { - contractDirectories: self.config.contractDirectories - }); - this.registerModule('profiler', { - events: this.events, - logger: this.logger - }); - - this.registerModule('deploytracker', { - }); - - this.registerModule('specialconfigs', { - }); + this.registerModule('solidity'); + this.registerModule('vyper'); + this.registerModule('profiler'); + this.registerModule('deploytracker'); + this.registerModule('specialconfigs'); this.contractsManager = new ContractsManager({ contractFiles: this.config.contractsFiles, @@ -284,7 +268,6 @@ class Engine { ipfsService(_options) { this.registerModule('ipfs', { addCheck: this.servicesMonitor.addCheck.bind(this.servicesMonitor), - storageConfig: this.config.storageConfig, host: _options.host, port: _options.port }); @@ -293,7 +276,6 @@ class Engine { swarmService(_options) { this.registerModule('swarm', { addCheck: this.servicesMonitor.addCheck.bind(this.servicesMonitor), - storageConfig: this.config.storageConfig, // TODO: this should not be needed and should be deducted from the config instead // the eth provider is not necessary the same as the swarm one bzz: this.blockchain.web3.bzz @@ -314,7 +296,6 @@ class Engine { this.registerModule('whisper', { addCheck: this.servicesMonitor.addCheck.bind(this.servicesMonitor), - communicationConfig: this.config.communicationConfig, // TODO: this should not be needed and should be deducted from the config instead // the eth provider is not necessary the same as the whisper one web3: this.blockchain.web3 diff --git a/lib/core/plugins.js b/lib/core/plugins.js index d98305e8..096ce43f 100644 --- a/lib/core/plugins.js +++ b/lib/core/plugins.js @@ -59,7 +59,7 @@ Plugins.prototype.loadInternalPlugin = function(pluginName, pluginConfig) { var pluginWrapper = new Plugin({ name: pluginName, pluginModule: plugin, - pluginConfig: pluginConfig, + pluginConfig: pluginConfig || {}, logger: this.logger, pluginPath: pluginPath, interceptLogs: this.interceptLogs, diff --git a/lib/modules/ens/index.js b/lib/modules/ens/index.js index e6ba7295..0b0c6656 100644 --- a/lib/modules/ens/index.js +++ b/lib/modules/ens/index.js @@ -2,11 +2,10 @@ const fs = require('../../core/fs.js'); const utils = require('../../utils/utils.js'); class ENS { - constructor(embark, options) { + constructor(embark, _options) { this.logger = embark.logger; this.events = embark.events; - this.web3 = options.web3; - this.namesConfig = options.namesConfig; + this.namesConfig = embark.config.namesystemConfig; this.embark = embark; this.addENSToEmbarkJS(); diff --git a/lib/modules/ipfs/index.js b/lib/modules/ipfs/index.js index bccd839c..a2f01d9e 100644 --- a/lib/modules/ipfs/index.js +++ b/lib/modules/ipfs/index.js @@ -10,7 +10,7 @@ class IPFS { this.logger = embark.logger; this.events = embark.events; this.buildDir = options.buildDir; - this.storageConfig = options.storageConfig; + this.storageConfig = embark.config.storageConfig; this.host = options.host || this.storageConfig.host; this.port = options.port || this.storageConfig.port; this.addCheck = options.addCheck; diff --git a/lib/modules/profiler/index.js b/lib/modules/profiler/index.js index e78c2dcf..f86ad995 100644 --- a/lib/modules/profiler/index.js +++ b/lib/modules/profiler/index.js @@ -5,7 +5,6 @@ class Profiler { this.embark = embark; this.logger = embark.logger; this.events = embark.events; - this.plugins = embark.plugins; this.registerConsoleCommand(); } diff --git a/lib/modules/solidity/index.js b/lib/modules/solidity/index.js index b28fb039..c0d77188 100644 --- a/lib/modules/solidity/index.js +++ b/lib/modules/solidity/index.js @@ -3,10 +3,10 @@ let SolcW = require('./solcW.js'); class Solidity { - constructor(embark, options) { + constructor(embark, _options) { this.logger = embark.logger; this.events = embark.events; - this.contractDirectories = options.contractDirectories; + this.contractDirectories = embark.config.contractDirectories; this.solcAlreadyLoaded = false; this.solcW = null; diff --git a/lib/modules/swarm/index.js b/lib/modules/swarm/index.js index a8901cc1..b6479b94 100644 --- a/lib/modules/swarm/index.js +++ b/lib/modules/swarm/index.js @@ -8,7 +8,7 @@ class Swarm { this.logger = embark.logger; this.events = embark.events; this.buildDir = options.buildDir; - this.storageConfig = options.storageConfig; + this.storageConfig = embark.config.storageConfig; this.host = options.host || this.storageConfig.host; this.port = options.port || this.storageConfig.port; this.addCheck = options.addCheck; diff --git a/lib/modules/vyper/index.js b/lib/modules/vyper/index.js index 10a603de..6e11d0b3 100644 --- a/lib/modules/vyper/index.js +++ b/lib/modules/vyper/index.js @@ -4,10 +4,10 @@ const path = require('path'); class Vyper { - constructor(embark, options) { + constructor(embark, _options) { this.logger = embark.logger; this.events = embark.events; - this.contractDirectories = options.contractDirectories; + this.contractDirectories = embark.config.contractDirectories; // FIXME: Use array of extensions instead of duplicatiing embark.registerCompiler(".py", this.compile_vyper.bind(this)); diff --git a/lib/modules/whisper/index.js b/lib/modules/whisper/index.js index 624fb63e..f2d961f1 100644 --- a/lib/modules/whisper/index.js +++ b/lib/modules/whisper/index.js @@ -6,7 +6,7 @@ class Whisper { constructor(embark, options) { this.logger = embark.logger; this.events = embark.events; - this.communicationConfig = options.communicationConfig; + this.communicationConfig = embark.config.communicationConfig; this.addCheck = options.addCheck; // TODO: this should not be needed and should be deducted from the config instead this.web3 = options.web3; diff --git a/test/compiler.js b/test/compiler.js index 1fffdc55..e79fcd52 100644 --- a/test/compiler.js +++ b/test/compiler.js @@ -19,20 +19,22 @@ var TestEvents = { var apiObject = { registerCompiler: function() {}, logger: new TestLogger({}), - events: TestEvents + events: TestEvents, + config: { + contractDirectories: ['app/contracts/'] + } }; describe('embark.Compiler', function() { //let compiler = new Compiler({logger: new TestLogger({})}); - let compiler = new SolidityCompiler(apiObject, {contractDirectories: ['app/contracts/']}); + let compiler = new SolidityCompiler(apiObject); describe('#compile_solidity', function() { this.timeout(0); let expectedObject = {}; - //expectedObject["SimpleStorage"] = {"code":"608060405234801561001057600080fd5b50604051602080610114833981016040525160005560e1806100336000396000f30060806040526004361060525763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416632a1afcd98114605757806360fe47b114607b5780636d4ce63c146092575b600080fd5b348015606257600080fd5b50606960a4565b60408051918252519081900360200190f35b348015608657600080fd5b50609060043560aa565b005b348015609d57600080fd5b50606960af565b60005481565b600055565b600054905600a165627a7a72305820194e9895d54b0b5d8b469e794926ef9115b42631ab9a06ce726f9fea067633850029","runtimeBytecode":"60806040526004361060525763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416632a1afcd98114605757806360fe47b114607b5780636d4ce63c146092575b600080fd5b348015606257600080fd5b50606960a4565b60408051918252519081900360200190f35b348015608657600080fd5b50609060043560aa565b005b348015609d57600080fd5b50606960af565b60005481565b600055565b600054905600a165627a7a72305820194e9895d54b0b5d8b469e794926ef9115b42631ab9a06ce726f9fea067633850029","realRuntimeBytecode":"60806040526004361060525763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416632a1afcd98114605757806360fe47b114607b5780636d4ce63c146092575b600080fd5b348015606257600080fd5b50606960a4565b60408051918252519081900360200190f35b348015608657600080fd5b50609060043560aa565b005b348015609d57600080fd5b50606960af565b60005481565b600055565b600054905600a165627a7a72305820","swarmHash":"194e9895d54b0b5d8b469e794926ef9115b42631ab9a06ce726f9fea06763385","gasEstimates":{"creation":{"codeDepositCost":"45000","executionCost":"20141","totalCost":"65141"},"external":{"get()":"428","set(uint256)":"20161","storedData()":"384"}},"functionHashes":{"get()":"6d4ce63c","set(uint256)":"60fe47b1","storedData()":"2a1afcd9"},"abiDefinition":[{"constant":true,"inputs":[],"name":"storedData","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"x","type":"uint256"}],"name":"set","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"get","outputs":[{"name":"retVal","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[{"name":"initialValue","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"}],"filename":"test/contracts/simple_storage.sol"}; - expectedObject["SimpleStorage"] = expectedObject["SimpleStorage"] = {"code":"608060405234801561001057600080fd5b50604051602080610114833981016040525160005560e1806100336000396000f30060806040526004361060525763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416632a1afcd98114605757806360fe47b114607b5780636d4ce63c146092575b600080fd5b348015606257600080fd5b50606960a4565b60408051918252519081900360200190f35b348015608657600080fd5b50609060043560aa565b005b348015609d57600080fd5b50606960af565b60005481565b600055565b600054905600a165627a7a72305820194e9895d54b0b5d8b469e794926ef9115b42631ab9a06ce726f9fea067633850029","runtimeBytecode":"60806040526004361060525763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416632a1afcd98114605757806360fe47b114607b5780636d4ce63c146092575b600080fd5b348015606257600080fd5b50606960a4565b60408051918252519081900360200190f35b348015608657600080fd5b50609060043560aa565b005b348015609d57600080fd5b50606960af565b60005481565b600055565b600054905600a165627a7a72305820194e9895d54b0b5d8b469e794926ef9115b42631ab9a06ce726f9fea067633850029","realRuntimeBytecode":"60806040526004361060525763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416632a1afcd98114605757806360fe47b114607b5780636d4ce63c146092575b600080fd5b348015606257600080fd5b50606960a4565b60408051918252519081900360200190f35b348015608657600080fd5b50609060043560aa565b005b348015609d57600080fd5b50606960af565b60005481565b600055565b600054905600a165627a7a72305820","swarmHash":"194e9895d54b0b5d8b469e794926ef9115b42631ab9a06ce726f9fea06763385","gasEstimates":{"creation":{"codeDepositCost":"45000","executionCost":"20141","totalCost":"65141"},"external":{"get()":"428","set(uint256)":"20161","storedData()":"384"}},"functionHashes":{"get()":"6d4ce63c","set(uint256)":"60fe47b1","storedData()":"2a1afcd9"},"abiDefinition":[{"constant":true,"inputs":[],"name":"storedData","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"x","type":"uint256"}],"name":"set","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"get","outputs":[{"name":"retVal","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[{"name":"initialValue","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"}],"filename":"test/contracts/simple_storage.sol"}; + expectedObject["SimpleStorage"] = {"code":"608060405234801561001057600080fd5b50604051602080610114833981016040525160005560e1806100336000396000f30060806040526004361060525763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416632a1afcd98114605757806360fe47b114607b5780636d4ce63c146092575b600080fd5b348015606257600080fd5b50606960a4565b60408051918252519081900360200190f35b348015608657600080fd5b50609060043560aa565b005b348015609d57600080fd5b50606960af565b60005481565b600055565b600054905600a165627a7a72305820194e9895d54b0b5d8b469e794926ef9115b42631ab9a06ce726f9fea067633850029","runtimeBytecode":"60806040526004361060525763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416632a1afcd98114605757806360fe47b114607b5780636d4ce63c146092575b600080fd5b348015606257600080fd5b50606960a4565b60408051918252519081900360200190f35b348015608657600080fd5b50609060043560aa565b005b348015609d57600080fd5b50606960af565b60005481565b600055565b600054905600a165627a7a72305820194e9895d54b0b5d8b469e794926ef9115b42631ab9a06ce726f9fea067633850029","realRuntimeBytecode":"60806040526004361060525763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416632a1afcd98114605757806360fe47b114607b5780636d4ce63c146092575b600080fd5b348015606257600080fd5b50606960a4565b60408051918252519081900360200190f35b348015608657600080fd5b50609060043560aa565b005b348015609d57600080fd5b50606960af565b60005481565b600055565b600054905600a165627a7a72305820","swarmHash":"194e9895d54b0b5d8b469e794926ef9115b42631ab9a06ce726f9fea06763385","gasEstimates":{"creation":{"codeDepositCost":"45000","executionCost":"20141","totalCost":"65141"},"external":{"get()":"428","set(uint256)":"20161","storedData()":"384"}},"functionHashes":{"get()":"6d4ce63c","set(uint256)":"60fe47b1","storedData()":"2a1afcd9"},"abiDefinition":[{"constant":true,"inputs":[],"name":"storedData","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"x","type":"uint256"}],"name":"set","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"get","outputs":[{"name":"retVal","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[{"name":"initialValue","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"}],"filename":"test/contracts/simple_storage.sol"}; expectedObject["Token"] = {"code":"608060405234801561001057600080fd5b5060405160208061047e8339810160409081529051600160a060020a033316600090815260208190529190912081905560025561042c806100526000396000f3006080604052600436106100775763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663095ea7b3811461007c57806318160ddd146100b457806323b872dd146100db57806370a0823114610105578063a9059cbb14610126578063dd62ed3e1461014a575b600080fd5b34801561008857600080fd5b506100a0600160a060020a0360043516602435610171565b604080519115158252519081900360200190f35b3480156100c057600080fd5b506100c96101db565b60408051918252519081900360200190f35b3480156100e757600080fd5b506100a0600160a060020a03600435811690602435166044356101e1565b34801561011157600080fd5b506100c9600160a060020a03600435166102f2565b34801561013257600080fd5b506100a0600160a060020a036004351660243561030d565b34801561015657600080fd5b506100c9600160a060020a03600435811690602435166103ce565b600160a060020a03338116600081815260016020908152604080832094871680845294825280832086905580518681529051929493927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a350600192915050565b60025490565b600160a060020a03831660009081526020819052604081205482111561020657600080fd5b600160a060020a038085166000908152600160209081526040808320339094168352929052205482111561023957600080fd5b600160a060020a03831660009081526020819052604090205461025c90836103f9565b151561026757600080fd5b600160a060020a038085166000818152600160209081526040808320338616845282528083208054889003905583835282825280832080548890039055938716808352918490208054870190558351868152935191937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929081900390910190a35060019392505050565b600160a060020a031660009081526020819052604090205490565b600160a060020a03331660009081526020819052604081205482111561033257600080fd5b600160a060020a03831660009081526020819052604090205461035590836103f9565b151561036057600080fd5b600160a060020a0333811660008181526020818152604080832080548890039055938716808352918490208054870190558351868152935191937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929081900390910190a350600192915050565b600160a060020a03918216600090815260016020908152604080832093909416825291909152205490565b81011015905600a165627a7a72305820c34209c42f57b08f62d29e65db6744b4c8991eee33c4c83e0d81674550945da80029","runtimeBytecode":"6080604052600436106100775763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663095ea7b3811461007c57806318160ddd146100b457806323b872dd146100db57806370a0823114610105578063a9059cbb14610126578063dd62ed3e1461014a575b600080fd5b34801561008857600080fd5b506100a0600160a060020a0360043516602435610171565b604080519115158252519081900360200190f35b3480156100c057600080fd5b506100c96101db565b60408051918252519081900360200190f35b3480156100e757600080fd5b506100a0600160a060020a03600435811690602435166044356101e1565b34801561011157600080fd5b506100c9600160a060020a03600435166102f2565b34801561013257600080fd5b506100a0600160a060020a036004351660243561030d565b34801561015657600080fd5b506100c9600160a060020a03600435811690602435166103ce565b600160a060020a03338116600081815260016020908152604080832094871680845294825280832086905580518681529051929493927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a350600192915050565b60025490565b600160a060020a03831660009081526020819052604081205482111561020657600080fd5b600160a060020a038085166000908152600160209081526040808320339094168352929052205482111561023957600080fd5b600160a060020a03831660009081526020819052604090205461025c90836103f9565b151561026757600080fd5b600160a060020a038085166000818152600160209081526040808320338616845282528083208054889003905583835282825280832080548890039055938716808352918490208054870190558351868152935191937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929081900390910190a35060019392505050565b600160a060020a031660009081526020819052604090205490565b600160a060020a03331660009081526020819052604081205482111561033257600080fd5b600160a060020a03831660009081526020819052604090205461035590836103f9565b151561036057600080fd5b600160a060020a0333811660008181526020818152604080832080548890039055938716808352918490208054870190558351868152935191937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929081900390910190a350600192915050565b600160a060020a03918216600090815260016020908152604080832093909416825291909152205490565b81011015905600a165627a7a72305820c34209c42f57b08f62d29e65db6744b4c8991eee33c4c83e0d81674550945da80029","realRuntimeBytecode":"6080604052600436106100775763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663095ea7b3811461007c57806318160ddd146100b457806323b872dd146100db57806370a0823114610105578063a9059cbb14610126578063dd62ed3e1461014a575b600080fd5b34801561008857600080fd5b506100a0600160a060020a0360043516602435610171565b604080519115158252519081900360200190f35b3480156100c057600080fd5b506100c96101db565b60408051918252519081900360200190f35b3480156100e757600080fd5b506100a0600160a060020a03600435811690602435166044356101e1565b34801561011157600080fd5b506100c9600160a060020a03600435166102f2565b34801561013257600080fd5b506100a0600160a060020a036004351660243561030d565b34801561015657600080fd5b506100c9600160a060020a03600435811690602435166103ce565b600160a060020a03338116600081815260016020908152604080832094871680845294825280832086905580518681529051929493927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a350600192915050565b60025490565b600160a060020a03831660009081526020819052604081205482111561020657600080fd5b600160a060020a038085166000908152600160209081526040808320339094168352929052205482111561023957600080fd5b600160a060020a03831660009081526020819052604090205461025c90836103f9565b151561026757600080fd5b600160a060020a038085166000818152600160209081526040808320338616845282528083208054889003905583835282825280832080548890039055938716808352918490208054870190558351868152935191937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929081900390910190a35060019392505050565b600160a060020a031660009081526020819052604090205490565b600160a060020a03331660009081526020819052604081205482111561033257600080fd5b600160a060020a03831660009081526020819052604090205461035590836103f9565b151561036057600080fd5b600160a060020a0333811660008181526020818152604080832080548890039055938716808352918490208054870190558351868152935191937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929081900390910190a350600192915050565b600160a060020a03918216600090815260016020908152604080832093909416825291909152205490565b81011015905600a165627a7a72305820","swarmHash":"c34209c42f57b08f62d29e65db6744b4c8991eee33c4c83e0d81674550945da8","gasEstimates":{"creation":{"codeDepositCost":"213600","executionCost":"40466","totalCost":"254066"},"external":{"allowance(address,address)":"818","approve(address,uint256)":"22344","balanceOf(address)":"675","totalSupply()":"406","transfer(address,uint256)":"43625","transferFrom(address,address,uint256)":"64402"},"internal":{"safeToAdd(uint256,uint256)":"24"}},"functionHashes":{"allowance(address,address)":"dd62ed3e","approve(address,uint256)":"095ea7b3","balanceOf(address)":"70a08231","totalSupply()":"18160ddd","transfer(address,uint256)":"a9059cbb","transferFrom(address,address,uint256)":"23b872dd"},"abiDefinition":[{"constant":false,"inputs":[{"name":"spender","type":"address"},{"name":"value","type":"uint256"}],"name":"approve","outputs":[{"name":"ok","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"supply","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"from","type":"address"},{"name":"to","type":"address"},{"name":"value","type":"uint256"}],"name":"transferFrom","outputs":[{"name":"ok","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"who","type":"address"}],"name":"balanceOf","outputs":[{"name":"value","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"to","type":"address"},{"name":"value","type":"uint256"}],"name":"transfer","outputs":[{"name":"ok","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"owner","type":"address"},{"name":"spender","type":"address"}],"name":"allowance","outputs":[{"name":"_allowance","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[{"name":"initial_balance","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"name":"from","type":"address"},{"indexed":true,"name":"to","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":true,"name":"spender","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Approval","type":"event"}],"filename":"test/contracts/token.sol"}; diff --git a/test/contracts.js b/test/contracts.js index bb695dc7..b8452b80 100644 --- a/test/contracts.js +++ b/test/contracts.js @@ -26,9 +26,12 @@ describe('embark.Contracts', function() { describe('simple', function() { let plugins = new Plugins({ logger: new TestLogger({}), - events: TestEvents + events: TestEvents, + config: { + contractDirectories: ['app/contracts/'] + } }); - plugins.loadInternalPlugin('solidity', {solcVersion: '0.4.17', contractDirectories: ['app/contracts/']}); + plugins.loadInternalPlugin('solidity'); let compiler = new Compiler({plugins: plugins, logger: plugins.logger}); let events = new Events(); @@ -115,9 +118,12 @@ describe('embark.Contracts', function() { describe('config with contract instances', function() { let plugins = new Plugins({ logger: new TestLogger({}), - events: TestEvents + events: TestEvents, + config: { + contractDirectories: ['app/contracts/'] + } }); - plugins.loadInternalPlugin('solidity', {solcVersion: '0.4.17', contractDirectories: ['app/contracts/']}); + plugins.loadInternalPlugin('solidity'); let compiler = new Compiler({plugins: plugins, logger: plugins.logger}); let events = new Events();