mirror of https://github.com/embarklabs/embark.git
finclude transaction cost in gas estimation
This commit is contained in:
parent
fc2c6a41ee
commit
135c3c06a7
|
@ -7,8 +7,9 @@ var async = require('async');
|
||||||
var adjustGas = function(contract) {
|
var adjustGas = function(contract) {
|
||||||
var maxGas, adjustedGas;
|
var maxGas, adjustedGas;
|
||||||
if (contract.gas === 'auto') {
|
if (contract.gas === 'auto') {
|
||||||
if (contract.deploy) {
|
if (contract.deploy || contract.deploy === undefined) {
|
||||||
if (contract.gasEstimates.creation !== undefined) {
|
if (contract.gasEstimates.creation !== undefined) {
|
||||||
|
// TODO: should sum it instead
|
||||||
maxGas = Math.max(contract.gasEstimates.creation[0], contract.gasEstimates.creation[1], 500000);
|
maxGas = Math.max(contract.gasEstimates.creation[0], contract.gasEstimates.creation[1], 500000);
|
||||||
} else {
|
} else {
|
||||||
maxGas = 500000;
|
maxGas = 500000;
|
||||||
|
@ -18,6 +19,7 @@ var adjustGas = function(contract) {
|
||||||
}
|
}
|
||||||
// TODO: put a check so it doesn't go over the block limit
|
// TODO: put a check so it doesn't go over the block limit
|
||||||
adjustedGas = Math.round(maxGas * 1.40);
|
adjustedGas = Math.round(maxGas * 1.40);
|
||||||
|
adjustedGas += 25000;
|
||||||
contract.gas = adjustedGas;
|
contract.gas = adjustedGas;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue