aboutsummaryrefslogtreecommitdiffstats
path: root/packages/utils/src/abi_decoder.ts
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2018-05-24 03:01:38 +0800
committerGitHub <noreply@github.com>2018-05-24 03:01:38 +0800
commit513007a82ce9065d44694516bc94771ee4bc2c6f (patch)
treefe156fa4bb2dc5fecd2df4dd1fcd82e1e3007821 /packages/utils/src/abi_decoder.ts
parentaf0d9439d4f4e05fce8018665e375cf2db07184c (diff)
parentbf18a90da79d43e90901b0cd156f15398e215d91 (diff)
downloaddexon-sol-tools-513007a82ce9065d44694516bc94771ee4bc2c6f.tar
dexon-sol-tools-513007a82ce9065d44694516bc94771ee4bc2c6f.tar.gz
dexon-sol-tools-513007a82ce9065d44694516bc94771ee4bc2c6f.tar.bz2
dexon-sol-tools-513007a82ce9065d44694516bc94771ee4bc2c6f.tar.lz
dexon-sol-tools-513007a82ce9065d44694516bc94771ee4bc2c6f.tar.xz
dexon-sol-tools-513007a82ce9065d44694516bc94771ee4bc2c6f.tar.zst
dexon-sol-tools-513007a82ce9065d44694516bc94771ee4bc2c6f.zip
Merge pull request #589 from 0xProject/feature/truffle-sol-cov
Sol-cov artifact Adapters (truffle)
Diffstat (limited to 'packages/utils/src/abi_decoder.ts')
-rw-r--r--packages/utils/src/abi_decoder.ts13
1 files changed, 2 insertions, 11 deletions
diff --git a/packages/utils/src/abi_decoder.ts b/packages/utils/src/abi_decoder.ts
index c78bfa343..d2d8364ca 100644
--- a/packages/utils/src/abi_decoder.ts
+++ b/packages/utils/src/abi_decoder.ts
@@ -12,21 +12,12 @@ import {
import * as ethers from 'ethers';
import * as _ from 'lodash';
+import { addressUtils } from './address_utils';
import { BigNumber } from './configured_bignumber';
export class AbiDecoder {
private _savedABIs: AbiDefinition[] = [];
private _methodIds: { [signatureHash: string]: EventAbi } = {};
- private static _padZeros(address: string): string {
- let formatted = address;
- if (_.startsWith(formatted, '0x')) {
- formatted = formatted.slice(2);
- }
-
- const addressLength = 40;
- formatted = _.padStart(formatted, addressLength, '0');
- return `0x${formatted}`;
- }
constructor(abiArrays: AbiDefinition[][]) {
_.forEach(abiArrays, this.addABI.bind(this));
}
@@ -56,7 +47,7 @@ export class AbiDecoder {
}
if (param.type === SolidityTypes.Address) {
const baseHex = 16;
- value = AbiDecoder._padZeros(new BigNumber(value).toString(baseHex));
+ value = addressUtils.padZeros(new BigNumber(value).toString(baseHex));
} else if (param.type === SolidityTypes.Uint256 || param.type === SolidityTypes.Uint) {
value = new BigNumber(value);
} else if (param.type === SolidityTypes.Uint8) {