mirror of
https://github.com/status-im/embark-area-51.git
synced 2025-01-22 21:29:14 +00:00
compile contracts and request correct contract to proxy
This commit is contained in:
parent
bda4267fa2
commit
55cdf4c878
21
lib/test.js
21
lib/test.js
@ -3,6 +3,7 @@ var web3 = require('web3');
|
||||
var fs = require('fs');
|
||||
var mm = require('methodmissing');
|
||||
var sync = require('sync-me');
|
||||
var grunt = require('grunt');
|
||||
|
||||
py_exec = function(cmd) {
|
||||
console.log("python: " + cmd);
|
||||
@ -58,12 +59,24 @@ TestContract = function(contract, className) {
|
||||
return Obj;
|
||||
}
|
||||
|
||||
request = function(className) {
|
||||
filename = './app/contracts/simple_storage.sol'
|
||||
source = fs.readFileSync(filename).toString()
|
||||
//TODO: get the files from the config
|
||||
contractFiles = grunt.file.expand("./app/contracts/**/*.sol")
|
||||
contractDB = {}
|
||||
|
||||
var i;
|
||||
for (i = 0, len = contractFiles.length; i < len; i++) {
|
||||
var contractFile = contractFiles[i];
|
||||
var source = fs.readFileSync(contractFile).toString()
|
||||
|
||||
compiled_contracts = web3.eth.compile.solidity(source)
|
||||
contract = compiled_contracts[className]
|
||||
for (className in compiled_contracts) {
|
||||
var contract = compiled_contracts[className];
|
||||
contractDB[className] = contract;
|
||||
}
|
||||
}
|
||||
|
||||
request = function(className) {
|
||||
var contract = contractDB[className];
|
||||
return TestContract(contract, className)
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user