aboutsummaryrefslogtreecommitdiffstats
path: root/lib/formatters.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/formatters.js')
-rw-r--r--lib/formatters.js10
1 files changed, 4 insertions, 6 deletions
diff --git a/lib/formatters.js b/lib/formatters.js
index d8781e21e..857a01a40 100644
--- a/lib/formatters.js
+++ b/lib/formatters.js
@@ -25,10 +25,7 @@ if (process.env.NODE_ENV !== 'build') {
}
var utils = require('./utils');
-
-BigNumber.config({ ROUNDING_MODE: BigNumber.ROUND_DOWN });
-
-var ETH_PADDING = 32;
+var c = require('./const');
/// @param string string to be padded
/// @param number of characters that result string should have
@@ -43,10 +40,11 @@ var padLeft = function (string, chars, sign) {
/// If the value is floating point, round it down
/// @returns right-aligned byte representation of int
var formatInputInt = function (value) {
- var padding = ETH_PADDING * 2;
+ var padding = c.ETH_PADDING * 2;
if (value instanceof BigNumber || typeof value === 'number') {
if (typeof value === 'number')
value = new BigNumber(value);
+ BigNumber.config(c.ETH_BIGNUMBER_ROUNDING_MODE);
value = value.round();
if (value.lessThan(0))
@@ -65,7 +63,7 @@ var formatInputInt = function (value) {
/// Formats input value to byte representation of string
/// @returns left-algined byte representation of string
var formatInputString = function (value) {
- return utils.fromAscii(value, ETH_PADDING).substr(2);
+ return utils.fromAscii(value, c.ETH_PADDING).substr(2);
};
/// Formats input value to byte representation of bool