aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2017-10-04 17:55:16 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2017-10-04 17:55:16 +0800
commit944f51d66c5afb92008ddd1bff9fe83ce51a5e10 (patch)
tree7aa9f9122d7d9175614c8da7ce09b4a336371d49 /src
parent499e60c4a3719ce0699f75f1993a5336d0074bc7 (diff)
downloaddexon-sol-tools-944f51d66c5afb92008ddd1bff9fe83ce51a5e10.tar
dexon-sol-tools-944f51d66c5afb92008ddd1bff9fe83ce51a5e10.tar.gz
dexon-sol-tools-944f51d66c5afb92008ddd1bff9fe83ce51a5e10.tar.bz2
dexon-sol-tools-944f51d66c5afb92008ddd1bff9fe83ce51a5e10.tar.lz
dexon-sol-tools-944f51d66c5afb92008ddd1bff9fe83ce51a5e10.tar.xz
dexon-sol-tools-944f51d66c5afb92008ddd1bff9fe83ce51a5e10.tar.zst
dexon-sol-tools-944f51d66c5afb92008ddd1bff9fe83ce51a5e10.zip
Use SolidityTypes
Diffstat (limited to 'src')
-rw-r--r--src/types.ts2
-rw-r--r--src/utils/abi_decoder.ts8
2 files changed, 7 insertions, 3 deletions
diff --git a/src/types.ts b/src/types.ts
index a6a24ef8e..92b873886 100644
--- a/src/types.ts
+++ b/src/types.ts
@@ -202,6 +202,8 @@ export interface TokenTransferProxyContract extends Web3.ContractInstance {
export enum SolidityTypes {
Address = 'address',
Uint256 = 'uint256',
+ Uint8 = 'uint8',
+ Uint = 'uint',
}
export enum ExchangeContractErrCodes {
diff --git a/src/utils/abi_decoder.ts b/src/utils/abi_decoder.ts
index 4646016f2..e9ba3bc5a 100644
--- a/src/utils/abi_decoder.ts
+++ b/src/utils/abi_decoder.ts
@@ -1,7 +1,7 @@
import * as Web3 from 'web3';
import * as _ from 'lodash';
import * as BigNumber from 'bignumber.js';
-import {AbiType, DecodedLogArgs, DecodedArgs, LogWithDecodedArgs, RawLog} from '../types';
+import {AbiType, DecodedLogArgs, DecodedArgs, LogWithDecodedArgs, RawLog, SolidityTypes} from '../types';
import * as SolidityCoder from 'web3/lib/solidity/coder';
export class AbiDecoder {
@@ -35,9 +35,11 @@ export class AbiDecoder {
value = decodedData[dataIndex];
dataIndex++;
}
- if (param.type === 'address') {
+ if (param.type === SolidityTypes.Address) {
value = this.padZeros(new BigNumber(value).toString(16));
- } else if (param.type === 'uint256' || param.type === 'uint8' || param.type === 'int' ) {
+ } else if (param.type === SolidityTypes.Uint256 ||
+ param.type === SolidityTypes.Uint8 ||
+ param.type === SolidityTypes.Uint ) {
value = new BigNumber(value);
}
decodedParams[param.name] = value;