2017-12-13 19:49:05 -05:00
|
|
|
/*eslint no-unused-vars: off*/
|
2017-03-30 02:50:05 +09:00
|
|
|
let Web3 = require('web3');
|
|
|
|
let web3;
|
2017-10-07 19:53:57 -04:00
|
|
|
let __mainContext;
|
2017-02-18 16:53:49 -05:00
|
|
|
|
|
|
|
// ======================
|
|
|
|
// the eval is used for evaluating some of the contact calls for different purposes
|
|
|
|
// this should be at least moved to a different process and scope
|
|
|
|
// for now it is defined here
|
|
|
|
// ======================
|
|
|
|
function doEval(code, _web3) {
|
|
|
|
if (_web3) {
|
2017-06-26 09:01:54 -04:00
|
|
|
web3 = _web3;
|
2017-02-18 16:53:49 -05:00
|
|
|
}
|
2017-10-07 19:53:57 -04:00
|
|
|
|
2017-10-13 20:01:35 -04:00
|
|
|
try {
|
2017-12-27 11:40:21 -05:00
|
|
|
// TODO: add trace log here
|
2018-02-07 19:49:54 -05:00
|
|
|
return eval(code);
|
2017-10-13 20:01:35 -04:00
|
|
|
} catch(e) {
|
|
|
|
throw new Error(e + "\n" + code);
|
|
|
|
}
|
2017-02-18 16:53:49 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
doEval: doEval
|
|
|
|
};
|