aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contracts/test/asset_proxy/decoder.ts
diff options
context:
space:
mode:
authorGreg Hysen <greg.hysen@gmail.com>2018-06-01 05:06:47 +0800
committerGreg Hysen <greg.hysen@gmail.com>2018-06-08 06:38:48 +0800
commite042e0ad32cd2ac9e707cb8e52961957f58314ce (patch)
tree70183e915072dc90b7b5cb1597f022368e9a0c79 /packages/contracts/test/asset_proxy/decoder.ts
parent5db15ca54cd7e1fd90bf318d2975750dcd31cddc (diff)
downloaddexon-sol-tools-e042e0ad32cd2ac9e707cb8e52961957f58314ce.tar.gz
dexon-sol-tools-e042e0ad32cd2ac9e707cb8e52961957f58314ce.tar.zst
dexon-sol-tools-e042e0ad32cd2ac9e707cb8e52961957f58314ce.zip
Converged on naming scheme for asset data: renamed all instances of assetMetadata, proxyData, proxyMetadata to assetData
Diffstat (limited to 'packages/contracts/test/asset_proxy/decoder.ts')
-rw-r--r--packages/contracts/test/asset_proxy/decoder.ts40
1 files changed, 20 insertions, 20 deletions
diff --git a/packages/contracts/test/asset_proxy/decoder.ts b/packages/contracts/test/asset_proxy/decoder.ts
index 0f1413ff1..712ef8656 100644
--- a/packages/contracts/test/asset_proxy/decoder.ts
+++ b/packages/contracts/test/asset_proxy/decoder.ts
@@ -12,7 +12,7 @@ import { artifacts } from '../../src/utils/artifacts';
import { assetProxyUtils } from '../../src/utils/asset_proxy_utils';
import { chaiSetup } from '../../src/utils/chai_setup';
import { constants } from '../../src/utils/constants';
-import { AssetProxyId, ERC20ProxyData, ERC721ProxyData, ProxyData } from '../../src/utils/types';
+import { AssetProxyId, ERC20AssetData, ERC721AssetData, AssetData } from '../../src/utils/types';
import { provider, txDefaults, web3Wrapper } from '../../src/utils/web3_wrapper';
chaiSetup.configure();
@@ -45,21 +45,21 @@ describe('LibAssetProxyDecoder', () => {
describe('LibAssetProxyDecoder', () => {
it('should correctly decode ERC20 proxy data)', async () => {
- const encodedProxyData = assetProxyUtils.encodeERC20ProxyData(testAddress);
- const expectedDecodedProxyData = assetProxyUtils.decodeERC20ProxyData(encodedProxyData);
+ const encodedAssetData = assetProxyUtils.encodeERC20AssetData(testAddress);
+ const expectedDecodedAssetData = assetProxyUtils.decodeERC20AssetData(encodedAssetData);
let decodedAssetProxyId: number;
let decodedTokenAddress: string;
[decodedAssetProxyId, decodedTokenAddress] = await testAssetProxyDecoder.publicDecodeERC20Data.callAsync(
- encodedProxyData,
+ encodedAssetData,
);
- expect(decodedAssetProxyId).to.be.equal(expectedDecodedProxyData.assetProxyId);
- expect(decodedTokenAddress).to.be.equal(expectedDecodedProxyData.tokenAddress);
+ expect(decodedAssetProxyId).to.be.equal(expectedDecodedAssetData.assetProxyId);
+ expect(decodedTokenAddress).to.be.equal(expectedDecodedAssetData.tokenAddress);
});
it('should correctly decode ERC721 proxy data', async () => {
const tokenId = ZeroEx.generatePseudoRandomSalt();
- const encodedProxyData = assetProxyUtils.encodeERC721ProxyData(testAddress, tokenId);
- const expectedDecodedProxyData = assetProxyUtils.decodeERC721ProxyData(encodedProxyData);
+ const encodedAssetData = assetProxyUtils.encodeERC721AssetData(testAddress, tokenId);
+ const expectedDecodedAssetData = assetProxyUtils.decodeERC721AssetData(encodedAssetData);
let decodedAssetProxyId: number;
let decodedTokenAddress: string;
let decodedTokenId: BigNumber;
@@ -69,18 +69,18 @@ describe('LibAssetProxyDecoder', () => {
decodedTokenAddress,
decodedTokenId,
decodedData,
- ] = await testAssetProxyDecoder.publicDecodeERC721Data.callAsync(encodedProxyData);
- expect(decodedAssetProxyId).to.be.equal(expectedDecodedProxyData.assetProxyId);
- expect(decodedTokenAddress).to.be.equal(expectedDecodedProxyData.tokenAddress);
- expect(decodedTokenId).to.be.bignumber.equal(expectedDecodedProxyData.tokenId);
- expect(decodedData).to.be.equal(expectedDecodedProxyData.data);
+ ] = await testAssetProxyDecoder.publicDecodeERC721Data.callAsync(encodedAssetData);
+ expect(decodedAssetProxyId).to.be.equal(expectedDecodedAssetData.assetProxyId);
+ expect(decodedTokenAddress).to.be.equal(expectedDecodedAssetData.tokenAddress);
+ expect(decodedTokenId).to.be.bignumber.equal(expectedDecodedAssetData.tokenId);
+ expect(decodedData).to.be.equal(expectedDecodedAssetData.data);
});
it('should correctly decode ERC721 proxy data with receiver data', async () => {
const tokenId = ZeroEx.generatePseudoRandomSalt();
const data = ethUtil.bufferToHex(assetProxyUtils.encodeUint256(ZeroEx.generatePseudoRandomSalt())) + 'FFFF';
- const encodedProxyData = assetProxyUtils.encodeERC721ProxyData(testAddress, tokenId, data);
- const expectedDecodedProxyData = assetProxyUtils.decodeERC721ProxyData(encodedProxyData);
+ const encodedAssetData = assetProxyUtils.encodeERC721AssetData(testAddress, tokenId, data);
+ const expectedDecodedAssetData = assetProxyUtils.decodeERC721AssetData(encodedAssetData);
let decodedAssetProxyId: number;
let decodedTokenAddress: string;
let decodedTokenId: BigNumber;
@@ -90,11 +90,11 @@ describe('LibAssetProxyDecoder', () => {
decodedTokenAddress,
decodedTokenId,
decodedData,
- ] = await testAssetProxyDecoder.publicDecodeERC721Data.callAsync(encodedProxyData);
- expect(decodedAssetProxyId).to.be.equal(expectedDecodedProxyData.assetProxyId);
- expect(decodedTokenAddress).to.be.equal(expectedDecodedProxyData.tokenAddress);
- expect(decodedTokenId).to.be.bignumber.equal(expectedDecodedProxyData.tokenId);
- expect(decodedData).to.be.equal(expectedDecodedProxyData.data);
+ ] = await testAssetProxyDecoder.publicDecodeERC721Data.callAsync(encodedAssetData);
+ expect(decodedAssetProxyId).to.be.equal(expectedDecodedAssetData.assetProxyId);
+ expect(decodedTokenAddress).to.be.equal(expectedDecodedAssetData.tokenAddress);
+ expect(decodedTokenId).to.be.bignumber.equal(expectedDecodedAssetData.tokenId);
+ expect(decodedData).to.be.equal(expectedDecodedAssetData.data);
});
});
});