diff options
author | Marek Kotewicz <marek.kotewicz@gmail.com> | 2015-01-19 19:59:29 +0800 |
---|---|---|
committer | Marek Kotewicz <marek.kotewicz@gmail.com> | 2015-01-19 19:59:29 +0800 |
commit | af54832d2435ff4116c887effa09e4f276ac970c (patch) | |
tree | d7e47bdf6ba4c6a7ab8cd7a688d8f7249428a132 /dist/ethereum.js | |
parent | 86b417e83f1f631cd55d16596b458b74601c43e5 (diff) | |
download | go-tangerine-af54832d2435ff4116c887effa09e4f276ac970c.tar go-tangerine-af54832d2435ff4116c887effa09e4f276ac970c.tar.gz go-tangerine-af54832d2435ff4116c887effa09e4f276ac970c.tar.bz2 go-tangerine-af54832d2435ff4116c887effa09e4f276ac970c.tar.lz go-tangerine-af54832d2435ff4116c887effa09e4f276ac970c.tar.xz go-tangerine-af54832d2435ff4116c887effa09e4f276ac970c.tar.zst go-tangerine-af54832d2435ff4116c887effa09e4f276ac970c.zip |
encoding real on input
Diffstat (limited to 'dist/ethereum.js')
-rw-r--r-- | dist/ethereum.js | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/dist/ethereum.js b/dist/ethereum.js index aadbf6835..f2e3e570e 100644 --- a/dist/ethereum.js +++ b/dist/ethereum.js @@ -117,6 +117,13 @@ var formatInputBool = function (value) { return '000000000000000000000000000000000000000000000000000000000000000' + (value ? '1' : '0'); }; +/// Formats input value to byte representation of real +/// Values are multiplied by 2^m and encoded as integers +/// @returns byte representation of real +var formatInputReal = function (value) { + return formatInputInt(new BigNumber(value).times(new BigNumber(2).pow(128))); +}; + var dynamicTypeBytes = function (type, value) { // TODO: decide what to do with array of strings if (arrayType(type) || prefixedType('string')(type)) @@ -133,8 +140,8 @@ var setupInputTypes = function () { { type: prefixedType('int'), format: formatInputInt }, { type: prefixedType('hash'), format: formatInputInt }, { type: prefixedType('string'), format: formatInputString }, - { type: prefixedType('real'), format: formatInputInt }, - { type: prefixedType('ureal'), format: formatInputInt }, + { type: prefixedType('real'), format: formatInputReal }, + { type: prefixedType('ureal'), format: formatInputReal }, { type: namedType('address'), format: formatInputInt }, { type: namedType('bool'), format: formatInputBool } ]; |