diff options
author | Jacob Evans <jacob@dekz.net> | 2018-05-10 13:59:44 +0800 |
---|---|---|
committer | Jacob Evans <jacob@dekz.net> | 2018-05-10 13:59:44 +0800 |
commit | f9d2689a1212703586927f0e8612ed1700750d1b (patch) | |
tree | 19c9acf0389ae3fd87818820e6bce921f4775c2d /packages | |
parent | 9744b1906a111aa0c65c8fafb4db66aef32a5a23 (diff) | |
download | dexon-sol-tools-f9d2689a1212703586927f0e8612ed1700750d1b.tar.gz dexon-sol-tools-f9d2689a1212703586927f0e8612ed1700750d1b.tar.zst dexon-sol-tools-f9d2689a1212703586927f0e8612ed1700750d1b.zip |
Pad to 32 if asset ids are small
Diffstat (limited to 'packages')
-rw-r--r-- | packages/contracts/src/utils/asset_proxy_utils.ts | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/packages/contracts/src/utils/asset_proxy_utils.ts b/packages/contracts/src/utils/asset_proxy_utils.ts index 1a7a312dd..dc31c3497 100644 --- a/packages/contracts/src/utils/asset_proxy_utils.ts +++ b/packages/contracts/src/utils/asset_proxy_utils.ts @@ -18,7 +18,8 @@ export const assetProxyUtils = { encodeUint256(value: BigNumber): Buffer { const formattedValue = new BN(value.toString(10)); const encodedValue = ethUtil.toBuffer(formattedValue); - return encodedValue; + const paddedValue = ethUtil.setLengthLeft(encodedValue, 32); + return paddedValue; }, encodeERC20ProxyData(tokenAddress: string): string { const encodedAssetProxyId = assetProxyUtils.encodeAssetProxyId(AssetProxyId.ERC20); |