@dydxfoundation/governance
Version:
dYdX governance smart contracts
15 lines (14 loc) • 566 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getGasPrice = exports.estimateGas = void 0;
const DEFAULT_SURPLUS = 30; // 30%
const estimateGas = async (tx, config, gasSurplus) => {
const estimatedGas = await config.provider.estimateGas(tx);
return estimatedGas.add(estimatedGas.mul(gasSurplus || DEFAULT_SURPLUS).div(100));
};
exports.estimateGas = estimateGas;
const getGasPrice = async (config) => {
const gasPrice = await config.provider.getGasPrice();
return gasPrice;
};
exports.getGasPrice = getGasPrice;