aboutsummaryrefslogtreecommitdiffstats
path: root/packages/order-utils/test
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2018-06-13 19:20:13 +0800
committerFabio Berger <me@fabioberger.com>2018-06-13 19:20:13 +0800
commit946e6c16442ce434e160fa47a87cd705c5274038 (patch)
treebf2569f06bac0ef14edebf60d1f5f7e1dfe120b1 /packages/order-utils/test
parent3eb232b3fcd73eec25efa6754530bc54b88f3f82 (diff)
downloaddexon-sol-tools-946e6c16442ce434e160fa47a87cd705c5274038.tar
dexon-sol-tools-946e6c16442ce434e160fa47a87cd705c5274038.tar.gz
dexon-sol-tools-946e6c16442ce434e160fa47a87cd705c5274038.tar.bz2
dexon-sol-tools-946e6c16442ce434e160fa47a87cd705c5274038.tar.lz
dexon-sol-tools-946e6c16442ce434e160fa47a87cd705c5274038.tar.xz
dexon-sol-tools-946e6c16442ce434e160fa47a87cd705c5274038.tar.zst
dexon-sol-tools-946e6c16442ce434e160fa47a87cd705c5274038.zip
Remaining refactors of order-utils components for V2
Diffstat (limited to 'packages/order-utils/test')
-rw-r--r--packages/order-utils/test/exchange_transfer_simulator_test.ts25
1 files changed, 13 insertions, 12 deletions
diff --git a/packages/order-utils/test/exchange_transfer_simulator_test.ts b/packages/order-utils/test/exchange_transfer_simulator_test.ts
index eeae42698..c8fc9fbf3 100644
--- a/packages/order-utils/test/exchange_transfer_simulator_test.ts
+++ b/packages/order-utils/test/exchange_transfer_simulator_test.ts
@@ -5,6 +5,7 @@ import * as chai from 'chai';
import 'make-promises-safe';
import { artifacts } from '../src/artifacts';
+import { assetProxyUtils } from '../src/asset_proxy_utils';
import { constants } from '../src/constants';
import { ExchangeTransferSimulator } from '../src/exchange_transfer_simulator';
import { DummyERC20TokenContract } from '../src/generated_contract_wrappers/dummy_e_r_c20_token';
@@ -28,7 +29,7 @@ describe('ExchangeTransferSimulator', async () => {
let coinbase: string;
let sender: string;
let recipient: string;
- let exampleTokenAddress: string;
+ let exampleAssetData: string;
let exchangeTransferSimulator: ExchangeTransferSimulator;
let txHash: string;
let erc20ProxyAddress: string;
@@ -66,7 +67,7 @@ describe('ExchangeTransferSimulator', async () => {
totalSupply,
);
- exampleTokenAddress = dummyERC20Token.address;
+ exampleAssetData = assetProxyUtils.encodeERC20AssetData(dummyERC20Token.address);
});
beforeEach(async () => {
await blockchainLifecycle.startAsync();
@@ -92,7 +93,7 @@ describe('ExchangeTransferSimulator', async () => {
it("throws if the user doesn't have enough allowance", async () => {
return expect(
exchangeTransferSimulator.transferFromAsync(
- exampleTokenAddress,
+ exampleAssetData,
sender,
recipient,
transferAmount,
@@ -108,7 +109,7 @@ describe('ExchangeTransferSimulator', async () => {
await web3Wrapper.awaitTransactionSuccessAsync(txHash);
return expect(
exchangeTransferSimulator.transferFromAsync(
- exampleTokenAddress,
+ exampleAssetData,
sender,
recipient,
transferAmount,
@@ -129,7 +130,7 @@ describe('ExchangeTransferSimulator', async () => {
await web3Wrapper.awaitTransactionSuccessAsync(txHash);
await exchangeTransferSimulator.transferFromAsync(
- exampleTokenAddress,
+ exampleAssetData,
sender,
recipient,
transferAmount,
@@ -137,9 +138,9 @@ describe('ExchangeTransferSimulator', async () => {
TransferType.Trade,
);
const store = (exchangeTransferSimulator as any)._store;
- const senderBalance = await store.getBalanceAsync(exampleTokenAddress, sender);
- const recipientBalance = await store.getBalanceAsync(exampleTokenAddress, recipient);
- const senderProxyAllowance = await store.getProxyAllowanceAsync(exampleTokenAddress, sender);
+ const senderBalance = await store.getBalanceAsync(exampleAssetData, sender);
+ const recipientBalance = await store.getBalanceAsync(exampleAssetData, recipient);
+ const senderProxyAllowance = await store.getProxyAllowanceAsync(exampleAssetData, sender);
expect(senderBalance).to.be.bignumber.equal(0);
expect(recipientBalance).to.be.bignumber.equal(transferAmount);
expect(senderProxyAllowance).to.be.bignumber.equal(0);
@@ -158,7 +159,7 @@ describe('ExchangeTransferSimulator', async () => {
);
await web3Wrapper.awaitTransactionSuccessAsync(txHash);
await exchangeTransferSimulator.transferFromAsync(
- exampleTokenAddress,
+ exampleAssetData,
sender,
recipient,
transferAmount,
@@ -166,9 +167,9 @@ describe('ExchangeTransferSimulator', async () => {
TransferType.Trade,
);
const store = (exchangeTransferSimulator as any)._store;
- const senderBalance = await store.getBalanceAsync(exampleTokenAddress, sender);
- const recipientBalance = await store.getBalanceAsync(exampleTokenAddress, recipient);
- const senderProxyAllowance = await store.getProxyAllowanceAsync(exampleTokenAddress, sender);
+ const senderBalance = await store.getBalanceAsync(exampleAssetData, sender);
+ const recipientBalance = await store.getBalanceAsync(exampleAssetData, recipient);
+ const senderProxyAllowance = await store.getProxyAllowanceAsync(exampleAssetData, sender);
expect(senderBalance).to.be.bignumber.equal(0);
expect(recipientBalance).to.be.bignumber.equal(transferAmount);
expect(senderProxyAllowance).to.be.bignumber.equal(constants.UNLIMITED_ALLOWANCE_IN_BASE_UNITS);