diff options
author | Fabio Berger <me@fabioberger.com> | 2018-04-24 15:51:32 +0800 |
---|---|---|
committer | Fabio Berger <me@fabioberger.com> | 2018-04-24 15:51:32 +0800 |
commit | b24b98a36557729acdc87aee3dabb4ff40f27d51 (patch) | |
tree | a98ddb2dfa620406152f5ae812263f3698641fd6 /packages/contracts/test/asset_proxy | |
parent | 432b064601776d4daacfc2415c3da41c91a24d27 (diff) | |
parent | fd041e2997dd10eeb5a50f413775e247176a8432 (diff) | |
download | dexon-sol-tools-b24b98a36557729acdc87aee3dabb4ff40f27d51.tar dexon-sol-tools-b24b98a36557729acdc87aee3dabb4ff40f27d51.tar.gz dexon-sol-tools-b24b98a36557729acdc87aee3dabb4ff40f27d51.tar.bz2 dexon-sol-tools-b24b98a36557729acdc87aee3dabb4ff40f27d51.tar.lz dexon-sol-tools-b24b98a36557729acdc87aee3dabb4ff40f27d51.tar.xz dexon-sol-tools-b24b98a36557729acdc87aee3dabb4ff40f27d51.tar.zst dexon-sol-tools-b24b98a36557729acdc87aee3dabb4ff40f27d51.zip |
merge v2-prototype
Diffstat (limited to 'packages/contracts/test/asset_proxy')
-rw-r--r-- | packages/contracts/test/asset_proxy/proxies.ts | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/packages/contracts/test/asset_proxy/proxies.ts b/packages/contracts/test/asset_proxy/proxies.ts index 8d60ef0e9..6aefadee7 100644 --- a/packages/contracts/test/asset_proxy/proxies.ts +++ b/packages/contracts/test/asset_proxy/proxies.ts @@ -28,7 +28,7 @@ describe('Asset Transfer Proxies', () => { let makerAddress: string; let takerAddress: string; - let zrx: DummyERC20TokenContract; + let zrxToken: DummyERC20TokenContract; let erc721Token: DummyERC721TokenContract; let erc20Proxy: ERC20ProxyContract; let erc721Proxy: ERC721ProxyContract; @@ -44,15 +44,15 @@ describe('Asset Transfer Proxies', () => { erc20Wrapper = new ERC20Wrapper(deployer, provider, usedAddresses, owner); erc721Wrapper = new ERC721Wrapper(deployer, provider, usedAddresses, owner); - [zrx] = await erc20Wrapper.deployDummyERC20TokensAsync(); - erc20Proxy = await erc20Wrapper.deployERC20ProxyAsync(); + [zrxToken] = await erc20Wrapper.deployDummyTokensAsync(); + erc20Proxy = await erc20Wrapper.deployProxyAsync(); await erc20Wrapper.setBalancesAndAllowancesAsync(); await erc20Proxy.addAuthorizedAddress.sendTransactionAsync(exchangeAddress, { from: owner, }); - [erc721Token] = await erc721Wrapper.deployDummyERC721TokensAsync(); - erc721Proxy = await erc721Wrapper.deployERC721ProxyAsync(); + [erc721Token] = await erc721Wrapper.deployDummyTokensAsync(); + erc721Proxy = await erc721Wrapper.deployProxyAsync(); await erc721Wrapper.setBalancesAndAllowancesAsync(); const erc721Balances = await erc721Wrapper.getBalancesAsync(); erc721MakerTokenId = erc721Balances[makerAddress][erc721Token.address][0]; @@ -69,7 +69,7 @@ describe('Asset Transfer Proxies', () => { describe('Transfer Proxy - ERC20', () => { it('should successfully transfer tokens', async () => { // Construct metadata for ERC20 proxy - const encodedProxyMetadata = assetProxyUtils.encodeERC20ProxyData(zrx.address); + const encodedProxyMetadata = assetProxyUtils.encodeERC20ProxyData(zrxToken.address); // Perform a transfer from makerAddress to takerAddress const erc20Balances = await erc20Wrapper.getBalancesAsync(); const amount = new BigNumber(10); @@ -82,17 +82,17 @@ describe('Asset Transfer Proxies', () => { ); // Verify transfer was successful const newBalances = await erc20Wrapper.getBalancesAsync(); - expect(newBalances[makerAddress][zrx.address]).to.be.bignumber.equal( - erc20Balances[makerAddress][zrx.address].minus(amount), + expect(newBalances[makerAddress][zrxToken.address]).to.be.bignumber.equal( + erc20Balances[makerAddress][zrxToken.address].minus(amount), ); - expect(newBalances[takerAddress][zrx.address]).to.be.bignumber.equal( - erc20Balances[takerAddress][zrx.address].add(amount), + expect(newBalances[takerAddress][zrxToken.address]).to.be.bignumber.equal( + erc20Balances[takerAddress][zrxToken.address].add(amount), ); }); it('should do nothing if transferring 0 amount of a token', async () => { // Construct metadata for ERC20 proxy - const encodedProxyMetadata = assetProxyUtils.encodeERC20ProxyData(zrx.address); + const encodedProxyMetadata = assetProxyUtils.encodeERC20ProxyData(zrxToken.address); // Perform a transfer from makerAddress to takerAddress const erc20Balances = await erc20Wrapper.getBalancesAsync(); const amount = new BigNumber(0); @@ -105,21 +105,21 @@ describe('Asset Transfer Proxies', () => { ); // Verify transfer was successful const newBalances = await erc20Wrapper.getBalancesAsync(); - expect(newBalances[makerAddress][zrx.address]).to.be.bignumber.equal( - erc20Balances[makerAddress][zrx.address], + expect(newBalances[makerAddress][zrxToken.address]).to.be.bignumber.equal( + erc20Balances[makerAddress][zrxToken.address], ); - expect(newBalances[takerAddress][zrx.address]).to.be.bignumber.equal( - erc20Balances[takerAddress][zrx.address], + expect(newBalances[takerAddress][zrxToken.address]).to.be.bignumber.equal( + erc20Balances[takerAddress][zrxToken.address], ); }); it('should throw if allowances are too low', async () => { // Construct metadata for ERC20 proxy - const encodedProxyMetadata = assetProxyUtils.encodeERC20ProxyData(zrx.address); + const encodedProxyMetadata = assetProxyUtils.encodeERC20ProxyData(zrxToken.address); // Create allowance less than transfer amount. Set allowance on proxy. const allowance = new BigNumber(0); const transferAmount = new BigNumber(10); - await zrx.approve.sendTransactionAsync(erc20Proxy.address, allowance, { + await zrxToken.approve.sendTransactionAsync(erc20Proxy.address, allowance, { from: makerAddress, }); // Perform a transfer; expect this to fail. @@ -136,7 +136,7 @@ describe('Asset Transfer Proxies', () => { it('should throw if requesting address is not authorized', async () => { // Construct metadata for ERC20 proxy - const encodedProxyMetadata = assetProxyUtils.encodeERC20ProxyData(zrx.address); + const encodedProxyMetadata = assetProxyUtils.encodeERC20ProxyData(zrxToken.address); // Perform a transfer from makerAddress to takerAddress const amount = new BigNumber(10); return expect( |