convert to average

Signed-off-by: VoR0220 <catalanor0220@gmail.com>
This commit is contained in:
VoR0220 2018-06-20 09:38:51 -05:00 committed by Iuri Matias
parent d2b89f88f9
commit c5a39649b9
1 changed files with 3 additions and 1 deletions

View File

@ -51,7 +51,9 @@ class GasEstimator {
} else if (_.isEqual(variance[0], variance[1]) && _.isEqual(variance[1], variance[2])) {
gasMap[name] = variance[0];
} else {
gasMap[name] = 'infinite';
let sum = _.reduce(variance, function(memo, num) { return memo + num; }, 0);
let average = sum / variance.length;
gasMap[name] = average;
}
return gasCb(null, name, abiMethod.type);
});