diff --git a/packages/asset-swapper/src/utils/market_operation_utils/index.ts b/packages/asset-swapper/src/utils/market_operation_utils/index.ts index 815431d643..748e551a42 100644 --- a/packages/asset-swapper/src/utils/market_operation_utils/index.ts +++ b/packages/asset-swapper/src/utils/market_operation_utils/index.ts @@ -106,11 +106,10 @@ export class MarketOperationUtils { if (!optimalPath) { throw new Error(AggregationError.NoOptimalPath); } - const [outputToken, inputToken] = getOrderTokens(nativeOrders[0]); return this._createOrderUtils.createSellOrdersFromPath( this._orderDomain, - inputToken, - outputToken, + takerToken, + makerToken, collapsePath(optimalPath, false), _opts.bridgeSlippage, ); diff --git a/packages/asset-swapper/test/dex_sampler_test.ts b/packages/asset-swapper/test/dex_sampler_test.ts index 8b94f34935..50db083f51 100644 --- a/packages/asset-swapper/test/dex_sampler_test.ts +++ b/packages/asset-swapper/test/dex_sampler_test.ts @@ -55,7 +55,7 @@ describe('DexSampler tests', () => { function createOrder(overrides?: Partial): SignedOrder { return { chainId: CHAIN_ID, - exchangeAddress: hexUtils.random(20), + exchangeAddress: randomAddress(), makerAddress: constants.NULL_ADDRESS, takerAddress: constants.NULL_ADDRESS, senderAddress: constants.NULL_ADDRESS, @@ -111,8 +111,8 @@ describe('DexSampler tests', () => { }); it('getKyberSellQuotes()', async () => { - const expectedTakerToken = hexUtils.random(20); - const expectedMakerToken = hexUtils.random(20); + const expectedTakerToken = randomAddress(); + const expectedMakerToken = randomAddress(); const expectedTakerFillAmounts = getSampleAmounts(new BigNumber(100e18), 10); const expectedMakerFillAmounts = getSampleAmounts(new BigNumber(100e18), 10); const sampler = new MockSamplerContract({ @@ -135,8 +135,8 @@ describe('DexSampler tests', () => { }); it('getEth2DaiSellQuotes()', async () => { - const expectedTakerToken = hexUtils.random(20); - const expectedMakerToken = hexUtils.random(20); + const expectedTakerToken = randomAddress(); + const expectedMakerToken = randomAddress(); const expectedTakerFillAmounts = getSampleAmounts(new BigNumber(100e18), 10); const expectedMakerFillAmounts = getSampleAmounts(new BigNumber(100e18), 10); const sampler = new MockSamplerContract({ @@ -159,8 +159,8 @@ describe('DexSampler tests', () => { }); it('getUniswapSellQuotes()', async () => { - const expectedTakerToken = hexUtils.random(20); - const expectedMakerToken = hexUtils.random(20); + const expectedTakerToken = randomAddress(); + const expectedMakerToken = randomAddress(); const expectedTakerFillAmounts = getSampleAmounts(new BigNumber(100e18), 10); const expectedMakerFillAmounts = getSampleAmounts(new BigNumber(100e18), 10); const sampler = new MockSamplerContract({ @@ -183,8 +183,8 @@ describe('DexSampler tests', () => { }); it('getEth2DaiBuyQuotes()', async () => { - const expectedTakerToken = hexUtils.random(20); - const expectedMakerToken = hexUtils.random(20); + const expectedTakerToken = randomAddress(); + const expectedMakerToken = randomAddress(); const expectedTakerFillAmounts = getSampleAmounts(new BigNumber(100e18), 10); const expectedMakerFillAmounts = getSampleAmounts(new BigNumber(100e18), 10); const sampler = new MockSamplerContract({ @@ -207,8 +207,8 @@ describe('DexSampler tests', () => { }); it('getUniswapBuyQuotes()', async () => { - const expectedTakerToken = hexUtils.random(20); - const expectedMakerToken = hexUtils.random(20); + const expectedTakerToken = randomAddress(); + const expectedMakerToken = randomAddress(); const expectedTakerFillAmounts = getSampleAmounts(new BigNumber(100e18), 10); const expectedMakerFillAmounts = getSampleAmounts(new BigNumber(100e18), 10); const sampler = new MockSamplerContract({ @@ -235,8 +235,8 @@ describe('DexSampler tests', () => { } it('getSellQuotes()', async () => { - const expectedTakerToken = hexUtils.random(20); - const expectedMakerToken = hexUtils.random(20); + const expectedTakerToken = randomAddress(); + const expectedMakerToken = randomAddress(); const sources = [ERC20BridgeSource.Kyber, ERC20BridgeSource.Eth2Dai, ERC20BridgeSource.Uniswap]; const ratesBySource: RatesBySource = { [ERC20BridgeSource.Kyber]: getRandomFloat(0, 100), @@ -285,8 +285,8 @@ describe('DexSampler tests', () => { }); it('getBuyQuotes()', async () => { - const expectedTakerToken = hexUtils.random(20); - const expectedMakerToken = hexUtils.random(20); + const expectedTakerToken = randomAddress(); + const expectedMakerToken = randomAddress(); const sources = [ERC20BridgeSource.Eth2Dai, ERC20BridgeSource.Uniswap]; const ratesBySource: RatesBySource = { [ERC20BridgeSource.Eth2Dai]: getRandomFloat(0, 100),