diff options
author | Greg Hysen <greg.hysen@gmail.com> | 2018-04-12 01:24:33 +0800 |
---|---|---|
committer | Amir Bandeali <abandeali1@gmail.com> | 2018-04-21 04:56:17 +0800 |
commit | 9b624a884bebc1775f5777a0845d5f093defd038 (patch) | |
tree | 9b5082b4d88ab9f8db25f0b1d47b12ed04ac568e /packages | |
parent | bc7672652ecbb39c57955d47cb96a8b9d558ba70 (diff) | |
download | dexon-sol-tools-9b624a884bebc1775f5777a0845d5f093defd038.tar dexon-sol-tools-9b624a884bebc1775f5777a0845d5f093defd038.tar.gz dexon-sol-tools-9b624a884bebc1775f5777a0845d5f093defd038.tar.bz2 dexon-sol-tools-9b624a884bebc1775f5777a0845d5f093defd038.tar.lz dexon-sol-tools-9b624a884bebc1775f5777a0845d5f093defd038.tar.xz dexon-sol-tools-9b624a884bebc1775f5777a0845d5f093defd038.tar.zst dexon-sol-tools-9b624a884bebc1775f5777a0845d5f093defd038.zip |
snake case to camel case
Diffstat (limited to 'packages')
-rw-r--r-- | packages/contracts/src/utils/asset_proxy_utils.ts | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/packages/contracts/src/utils/asset_proxy_utils.ts b/packages/contracts/src/utils/asset_proxy_utils.ts index 938110a75..e3d2ff55c 100644 --- a/packages/contracts/src/utils/asset_proxy_utils.ts +++ b/packages/contracts/src/utils/asset_proxy_utils.ts @@ -8,60 +8,60 @@ export function zeroPad(value: string, width: number): string { return '0'.repeat(width - value.length) + value; } -export function encodeAssetProxyId(assetProxyId: AssetProxyId, encoded_metadata: { value: string }) { - encoded_metadata.value += zeroPad(new BigNumber(assetProxyId).toString(16), 2); +export function encodeAssetProxyId(assetProxyId: AssetProxyId, encodedMetadata: { value: string }) { + encodedMetadata.value += zeroPad(new BigNumber(assetProxyId).toString(16), 2); } -export function encodeAddress(address: string, encoded_metadata: { value: string }) { - encoded_metadata.value += zeroPad(address.replace('0x', ''), 40); +export function encodeAddress(address: string, encodedMetadata: { value: string }) { + encodedMetadata.value += zeroPad(address.replace('0x', ''), 40); } -export function encodeUint256(value: BigNumber, encoded_metadata: { value: string }) { - encoded_metadata.value += zeroPad(value.toString(16), 64); +export function encodeUint256(value: BigNumber, encodedMetadata: { value: string }) { + encodedMetadata.value += zeroPad(value.toString(16), 64); } export function encodeERC20ProxyMetadata_V1(tokenAddress: string) { // Encode metadata - const encoded_metadata = { value: '0x' }; - encodeAssetProxyId(AssetProxyId.ERC20_V1, encoded_metadata); - encodeAddress(tokenAddress, encoded_metadata); + const encodedMetadata = { value: '0x' }; + encodeAssetProxyId(AssetProxyId.ERC20_V1, encodedMetadata); + encodeAddress(tokenAddress, encodedMetadata); // Verify encoding length - '0x' plus 21 bytes of encoded data - if (encoded_metadata.value.length != 44) { - throw Error('Bad encoding length. Expected 44, got ' + encoded_metadata.value.length); + if (encodedMetadata.value.length != 44) { + throw Error('Bad encoding length. Expected 44, got ' + encodedMetadata.value.length); } // Return encoded metadata - return encoded_metadata.value; + return encodedMetadata.value; } export function encodeERC20ProxyMetadata(tokenAddress: string) { // Encode metadata - const encoded_metadata = { value: '0x' }; - encodeAssetProxyId(AssetProxyId.ERC20, encoded_metadata); - encodeAddress(tokenAddress, encoded_metadata); + const encodedMetadata = { value: '0x' }; + encodeAssetProxyId(AssetProxyId.ERC20, encodedMetadata); + encodeAddress(tokenAddress, encodedMetadata); // Verify encoding length - '0x' plus 21 bytes of encoded data - if (encoded_metadata.value.length != 44) { - throw Error('Bad encoding length. Expected 44, got ' + encoded_metadata.value.length); + if (encodedMetadata.value.length != 44) { + throw Error('Bad encoding length. Expected 44, got ' + encodedMetadata.value.length); } // Return encoded metadata - return encoded_metadata.value; + return encodedMetadata.value; } export function encodeERC721ProxyMetadata(tokenAddress: string, tokenId: BigNumber) { // Encode metadata - const encoded_metadata = { value: '0x' }; - encodeAssetProxyId(AssetProxyId.ERC721, encoded_metadata); - encodeAddress(tokenAddress, encoded_metadata); - encodeUint256(tokenId, encoded_metadata); + const encodedMetadata = { value: '0x' }; + encodeAssetProxyId(AssetProxyId.ERC721, encodedMetadata); + encodeAddress(tokenAddress, encodedMetadata); + encodeUint256(tokenId, encodedMetadata); // Verify encoding length - '0x' plus 53 bytes of encoded data - if (encoded_metadata.value.length != 108) { - throw Error('Bad encoding length. Expected 108, got ' + encoded_metadata.value.length); + if (encodedMetadata.value.length != 108) { + throw Error('Bad encoding length. Expected 108, got ' + encodedMetadata.value.length); } // Return encoded metadata - return encoded_metadata.value; + return encodedMetadata.value; } |