Fix tests

This commit is contained in:
Amir Bandeali
2018-04-22 17:25:28 -07:00
parent a8a0a5cbfb
commit 432b064601
10 changed files with 116 additions and 181 deletions

View File

@@ -0,0 +1,33 @@
/*
Copyright 2018 ZeroEx Intl.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
pragma solidity ^0.4.21;
import "../../protocol/Exchange/MixinAssetProxyDispatcher.sol";
contract TestAssetProxyDispatcher is MixinAssetProxyDispatcher {
function publicDispatchTransferFrom(
bytes memory assetMetadata,
address from,
address to,
uint256 amount)
public
{
dispatchTransferFrom(assetMetadata, from, to, amount);
}
}

View File

@@ -9,7 +9,7 @@ import { constants } from './constants';
import { formatters } from './formatters';
import { LogDecoder } from './log_decoder';
import { orderUtils } from './order_utils';
import { SignedOrder } from './types';
import { AssetProxyId, SignedOrder } from './types';
export class ExchangeWrapper {
private _exchange: ExchangeContract;
@@ -189,7 +189,24 @@ export class ExchangeWrapper {
const tx = await this._getTxWithDecodedExchangeLogsAsync(txHash);
return tx;
}
public async registerAssetProxyAsync(
assetProxyId: AssetProxyId,
assetProxyAddress: string,
from: string,
opts: { oldAssetProxyAddressIfExists?: string } = {},
): Promise<TransactionReceiptWithDecodedLogs> {
const oldAssetProxyAddress = _.isUndefined(opts.oldAssetProxyAddressIfExists)
? ZeroEx.NULL_ADDRESS
: opts.oldAssetProxyAddressIfExists;
const txHash = await this._exchange.registerAssetProxy.sendTransactionAsync(
assetProxyId,
assetProxyAddress,
oldAssetProxyAddress,
{ from },
);
const tx = await this._getTxWithDecodedExchangeLogsAsync(txHash);
return tx;
}
public async getOrderHashAsync(signedOrder: SignedOrder): Promise<string> {
const order = orderUtils.getOrderStruct(signedOrder);
const orderHash = await this._exchange.getOrderHash.callAsync(order);

View File

@@ -93,11 +93,12 @@ export enum ContractName {
AccountLevels = 'AccountLevels',
EtherDelta = 'EtherDelta',
Arbitrage = 'Arbitrage',
AssetProxyDispatcher = 'AssetProxyDispatcher',
TestAssetProxyDispatcher = 'TestAssetProxyDispatcher',
ERC20Proxy = 'ERC20Proxy',
ERC721Proxy = 'ERC721Proxy',
DummyERC721Token = 'DummyERC721Token',
LibBytes = 'LibBytes',
Authorizable = 'Authorizable',
}
export interface Artifact {