@0x:contracts-integrations
Fixed issues after rebase
This commit is contained in:
parent
b7d92c3c12
commit
18769f0b8f
@ -147,7 +147,7 @@ blockchainTests.resets.only('matchOrders', env => {
|
|||||||
tokenIds,
|
tokenIds,
|
||||||
);
|
);
|
||||||
|
|
||||||
matchOrderTester = new MatchOrderTester(deployment, blockchainBalanceStore);
|
matchOrderTester = new MatchOrderTester(deployment, devUtils, blockchainBalanceStore);
|
||||||
});
|
});
|
||||||
|
|
||||||
async function testMatchOrdersAsync(
|
async function testMatchOrdersAsync(
|
||||||
@ -1097,7 +1097,8 @@ blockchainTests.resets.only('matchOrders', env => {
|
|||||||
makerAssetAmount: toBaseUnitAmount(5, 18),
|
makerAssetAmount: toBaseUnitAmount(5, 18),
|
||||||
takerAssetAmount: toBaseUnitAmount(10, 18),
|
takerAssetAmount: toBaseUnitAmount(10, 18),
|
||||||
});
|
});
|
||||||
const signedOrderRight = await orderFactoryRight.newSignedOrderAsync({
|
const signedOrderRight = await makerRight.signOrderAsync({
|
||||||
|
takerAssetData: await devUtils.encodeERC20AssetData.callAsync(makerAssetAddressRight),
|
||||||
makerAssetAmount: toBaseUnitAmount(10, 18),
|
makerAssetAmount: toBaseUnitAmount(10, 18),
|
||||||
takerAssetAmount: toBaseUnitAmount(2, 18),
|
takerAssetAmount: toBaseUnitAmount(2, 18),
|
||||||
});
|
});
|
||||||
@ -1131,8 +1132,8 @@ blockchainTests.resets.only('matchOrders', env => {
|
|||||||
|
|
||||||
it('should revert if the right maker asset is not equal to the left taker asset', async () => {
|
it('should revert if the right maker asset is not equal to the left taker asset', async () => {
|
||||||
// Create orders to match
|
// Create orders to match
|
||||||
const signedOrderLeft = await orderFactoryLeft.newSignedOrderAsync({
|
const signedOrderLeft = await makerLeft.signOrderAsync({
|
||||||
takerAssetData: await devUtils.encodeERC20AssetData(defaultERC20MakerAssetAddress).callAsync(),
|
takerAssetData: await devUtils.encodeERC20AssetData.callAsync(makerAssetAddressLeft),
|
||||||
makerAssetAmount: toBaseUnitAmount(5, 18),
|
makerAssetAmount: toBaseUnitAmount(5, 18),
|
||||||
takerAssetAmount: toBaseUnitAmount(10, 18),
|
takerAssetAmount: toBaseUnitAmount(10, 18),
|
||||||
});
|
});
|
||||||
@ -2010,7 +2011,7 @@ blockchainTests.resets.only('matchOrders', env => {
|
|||||||
takerAssetAmount: toBaseUnitAmount(10, 18),
|
takerAssetAmount: toBaseUnitAmount(10, 18),
|
||||||
});
|
});
|
||||||
const signedOrderRight = await makerRight.signOrderAsync({
|
const signedOrderRight = await makerRight.signOrderAsync({
|
||||||
takerAssetData: await devUtils.encodeERC20AssetData.callAsync(defaultERC20TakerAssetAddress),
|
takerAssetData: await devUtils.encodeERC20AssetData.callAsync(makerAssetAddressRight),
|
||||||
makerAssetAmount: toBaseUnitAmount(10, 18),
|
makerAssetAmount: toBaseUnitAmount(10, 18),
|
||||||
takerAssetAmount: toBaseUnitAmount(2, 18),
|
takerAssetAmount: toBaseUnitAmount(2, 18),
|
||||||
});
|
});
|
||||||
@ -2043,7 +2044,7 @@ blockchainTests.resets.only('matchOrders', env => {
|
|||||||
it('should revert if the right maker asset is not equal to the left taker asset', async () => {
|
it('should revert if the right maker asset is not equal to the left taker asset', async () => {
|
||||||
// Create orders to match
|
// Create orders to match
|
||||||
const signedOrderLeft = await makerLeft.signOrderAsync({
|
const signedOrderLeft = await makerLeft.signOrderAsync({
|
||||||
takerAssetData: await devUtils.encodeERC20AssetData.callAsync(defaultERC20MakerAssetAddress),
|
takerAssetData: await devUtils.encodeERC20AssetData.callAsync(makerAssetAddressLeft),
|
||||||
makerAssetAmount: toBaseUnitAmount(5, 18),
|
makerAssetAmount: toBaseUnitAmount(5, 18),
|
||||||
takerAssetAmount: toBaseUnitAmount(10, 18),
|
takerAssetAmount: toBaseUnitAmount(10, 18),
|
||||||
});
|
});
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { DevUtilsContract } from '@0x/contracts-dev-utils';
|
import { DevUtilsContract } from '@0x/contracts-dev-utils';
|
||||||
import { BlockchainBalanceStore, ExchangeContract, LocalBalanceStore } from '@0x/contracts-exchange';
|
import { BlockchainBalanceStore, ExchangeContract, LocalBalanceStore } from '@0x/contracts-exchange';
|
||||||
import { constants, expect, OrderStatus } from '@0x/contracts-test-utils';
|
import { constants, expect, OrderStatus } from '@0x/contracts-test-utils';
|
||||||
import { assetDataUtils, orderHashUtils } from '@0x/order-utils';
|
import { orderHashUtils } from '@0x/order-utils';
|
||||||
import { BatchMatchedFillResults, FillResults, MatchedFillResults, SignedOrder } from '@0x/types';
|
import { BatchMatchedFillResults, FillResults, MatchedFillResults, SignedOrder } from '@0x/types';
|
||||||
import { BigNumber } from '@0x/utils';
|
import { BigNumber } from '@0x/utils';
|
||||||
import { LogWithDecodedArgs, TransactionReceiptWithDecodedLogs } from 'ethereum-types';
|
import { LogWithDecodedArgs, TransactionReceiptWithDecodedLogs } from 'ethereum-types';
|
||||||
@ -110,7 +110,7 @@ export class MatchOrderTester {
|
|||||||
// Update the blockchain balance store and create a new local balance store
|
// Update the blockchain balance store and create a new local balance store
|
||||||
// with the same initial balances.
|
// with the same initial balances.
|
||||||
await this._blockchainBalanceStore.updateBalancesAsync();
|
await this._blockchainBalanceStore.updateBalancesAsync();
|
||||||
const localBalanceStore = LocalBalanceStore.create(this._blockchainBalanceStore);
|
const localBalanceStore = LocalBalanceStore.create(this._devUtils, this._blockchainBalanceStore);
|
||||||
|
|
||||||
// Execute `batchMatchOrders()`
|
// Execute `batchMatchOrders()`
|
||||||
let actualBatchMatchResults;
|
let actualBatchMatchResults;
|
||||||
@ -187,7 +187,7 @@ export class MatchOrderTester {
|
|||||||
// Update the blockchain balance store and create a new local balance store
|
// Update the blockchain balance store and create a new local balance store
|
||||||
// with the same initial balances.
|
// with the same initial balances.
|
||||||
await this._blockchainBalanceStore.updateBalancesAsync();
|
await this._blockchainBalanceStore.updateBalancesAsync();
|
||||||
const localBalanceStore = LocalBalanceStore.create(this._blockchainBalanceStore);
|
const localBalanceStore = LocalBalanceStore.create(this._devUtils, this._blockchainBalanceStore);
|
||||||
|
|
||||||
// Execute `matchOrders()`
|
// Execute `matchOrders()`
|
||||||
let actualMatchResults;
|
let actualMatchResults;
|
||||||
@ -447,7 +447,7 @@ async function simulateMatchOrdersAsync(
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Right maker asset -> left maker
|
// Right maker asset -> left maker
|
||||||
localBalanceStore.transferAsset(
|
await localBalanceStore.transferAssetAsync(
|
||||||
orders.rightOrder.makerAddress,
|
orders.rightOrder.makerAddress,
|
||||||
orders.leftOrder.makerAddress,
|
orders.leftOrder.makerAddress,
|
||||||
transferAmounts.rightMakerAssetBoughtByLeftMakerAmount,
|
transferAmounts.rightMakerAssetBoughtByLeftMakerAmount,
|
||||||
@ -456,7 +456,7 @@ async function simulateMatchOrdersAsync(
|
|||||||
|
|
||||||
if (orders.leftOrder.makerAddress !== orders.leftOrder.feeRecipientAddress) {
|
if (orders.leftOrder.makerAddress !== orders.leftOrder.feeRecipientAddress) {
|
||||||
// Left maker fees
|
// Left maker fees
|
||||||
localBalanceStore.transferAsset(
|
await localBalanceStore.transferAssetAsync(
|
||||||
orders.leftOrder.makerAddress,
|
orders.leftOrder.makerAddress,
|
||||||
orders.leftOrder.feeRecipientAddress,
|
orders.leftOrder.feeRecipientAddress,
|
||||||
transferAmounts.leftMakerFeeAssetPaidByLeftMakerAmount,
|
transferAmounts.leftMakerFeeAssetPaidByLeftMakerAmount,
|
||||||
@ -465,7 +465,7 @@ async function simulateMatchOrdersAsync(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Left maker asset -> right maker
|
// Left maker asset -> right maker
|
||||||
localBalanceStore.transferAsset(
|
await localBalanceStore.transferAssetAsync(
|
||||||
orders.leftOrder.makerAddress,
|
orders.leftOrder.makerAddress,
|
||||||
orders.rightOrder.makerAddress,
|
orders.rightOrder.makerAddress,
|
||||||
transferAmounts.leftMakerAssetBoughtByRightMakerAmount,
|
transferAmounts.leftMakerAssetBoughtByRightMakerAmount,
|
||||||
@ -474,7 +474,7 @@ async function simulateMatchOrdersAsync(
|
|||||||
|
|
||||||
if (orders.rightOrder.makerAddress !== orders.rightOrder.feeRecipientAddress) {
|
if (orders.rightOrder.makerAddress !== orders.rightOrder.feeRecipientAddress) {
|
||||||
// Right maker fees
|
// Right maker fees
|
||||||
localBalanceStore.transferAsset(
|
await localBalanceStore.transferAssetAsync(
|
||||||
orders.rightOrder.makerAddress,
|
orders.rightOrder.makerAddress,
|
||||||
orders.rightOrder.feeRecipientAddress,
|
orders.rightOrder.feeRecipientAddress,
|
||||||
transferAmounts.rightMakerFeeAssetPaidByRightMakerAmount,
|
transferAmounts.rightMakerFeeAssetPaidByRightMakerAmount,
|
||||||
@ -483,7 +483,7 @@ async function simulateMatchOrdersAsync(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Left taker profit
|
// Left taker profit
|
||||||
localBalanceStore.transferAsset(
|
await localBalanceStore.transferAssetAsync(
|
||||||
orders.leftOrder.makerAddress,
|
orders.leftOrder.makerAddress,
|
||||||
takerAddress,
|
takerAddress,
|
||||||
transferAmounts.leftMakerAssetReceivedByTakerAmount,
|
transferAmounts.leftMakerAssetReceivedByTakerAmount,
|
||||||
@ -491,7 +491,7 @@ async function simulateMatchOrdersAsync(
|
|||||||
);
|
);
|
||||||
|
|
||||||
// Right taker profit
|
// Right taker profit
|
||||||
localBalanceStore.transferAsset(
|
await localBalanceStore.transferAssetAsync(
|
||||||
orders.rightOrder.makerAddress,
|
orders.rightOrder.makerAddress,
|
||||||
takerAddress,
|
takerAddress,
|
||||||
transferAmounts.rightMakerAssetReceivedByTakerAmount,
|
transferAmounts.rightMakerAssetReceivedByTakerAmount,
|
||||||
@ -499,7 +499,7 @@ async function simulateMatchOrdersAsync(
|
|||||||
);
|
);
|
||||||
|
|
||||||
// Left taker fees
|
// Left taker fees
|
||||||
localBalanceStore.transferAsset(
|
await localBalanceStore.transferAssetAsync(
|
||||||
takerAddress,
|
takerAddress,
|
||||||
orders.leftOrder.feeRecipientAddress,
|
orders.leftOrder.feeRecipientAddress,
|
||||||
transferAmounts.leftTakerFeeAssetPaidByTakerAmount,
|
transferAmounts.leftTakerFeeAssetPaidByTakerAmount,
|
||||||
@ -507,7 +507,7 @@ async function simulateMatchOrdersAsync(
|
|||||||
);
|
);
|
||||||
|
|
||||||
// Right taker fees
|
// Right taker fees
|
||||||
localBalanceStore.transferAsset(
|
await localBalanceStore.transferAssetAsync(
|
||||||
takerAddress,
|
takerAddress,
|
||||||
orders.rightOrder.feeRecipientAddress,
|
orders.rightOrder.feeRecipientAddress,
|
||||||
transferAmounts.rightTakerFeeAssetPaidByTakerAmount,
|
transferAmounts.rightTakerFeeAssetPaidByTakerAmount,
|
||||||
@ -515,7 +515,7 @@ async function simulateMatchOrdersAsync(
|
|||||||
);
|
);
|
||||||
|
|
||||||
// Protocol Fee
|
// Protocol Fee
|
||||||
const wethAssetData = assetDataUtils.encodeERC20AssetData(deployment.tokens.weth.address);
|
const wethAssetData = await devUtils.encodeERC20AssetData.callAsync(deployment.tokens.weth.address);
|
||||||
localBalanceStore.sendEth(
|
localBalanceStore.sendEth(
|
||||||
takerAddress,
|
takerAddress,
|
||||||
deployment.staking.stakingProxy.address,
|
deployment.staking.stakingProxy.address,
|
||||||
@ -526,13 +526,13 @@ async function simulateMatchOrdersAsync(
|
|||||||
deployment.staking.stakingProxy.address,
|
deployment.staking.stakingProxy.address,
|
||||||
transferAmounts.rightProtocolFeePaidByTakerInEthAmount,
|
transferAmounts.rightProtocolFeePaidByTakerInEthAmount,
|
||||||
);
|
);
|
||||||
localBalanceStore.transferAsset(
|
await localBalanceStore.transferAssetAsync(
|
||||||
takerAddress,
|
takerAddress,
|
||||||
deployment.staking.stakingProxy.address,
|
deployment.staking.stakingProxy.address,
|
||||||
transferAmounts.leftProtocolFeePaidByTakerInWethAmount,
|
transferAmounts.leftProtocolFeePaidByTakerInWethAmount,
|
||||||
wethAssetData,
|
wethAssetData,
|
||||||
);
|
);
|
||||||
localBalanceStore.transferAsset(
|
await localBalanceStore.transferAssetAsync(
|
||||||
takerAddress,
|
takerAddress,
|
||||||
deployment.staking.stakingProxy.address,
|
deployment.staking.stakingProxy.address,
|
||||||
transferAmounts.rightProtocolFeePaidByTakerInWethAmount,
|
transferAmounts.rightProtocolFeePaidByTakerInWethAmount,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user