diff options
author | Fabio Berger <me@fabioberger.com> | 2018-06-26 14:43:37 +0800 |
---|---|---|
committer | Fabio Berger <me@fabioberger.com> | 2018-06-26 14:43:37 +0800 |
commit | 105b9273975b34d46dc98254846d2b31990d9d9a (patch) | |
tree | 2a099d173df79d6ce0f37960977b39ebc61eecc7 /packages/contracts/src | |
parent | 9219f9d8ae2166c7c7b1d0a4ede78890094a3831 (diff) | |
download | dexon-0x-contracts-105b9273975b34d46dc98254846d2b31990d9d9a.tar.gz dexon-0x-contracts-105b9273975b34d46dc98254846d2b31990d9d9a.tar.zst dexon-0x-contracts-105b9273975b34d46dc98254846d2b31990d9d9a.zip |
Fix merge issues
Diffstat (limited to 'packages/contracts/src')
-rw-r--r-- | packages/contracts/src/utils/asset_wrapper.ts | 19 | ||||
-rw-r--r-- | packages/contracts/src/utils/core_combinatorial_utils.ts | 2 | ||||
-rw-r--r-- | packages/contracts/src/utils/erc20_wrapper.ts | 6 | ||||
-rw-r--r-- | packages/contracts/src/utils/erc721_wrapper.ts | 6 |
4 files changed, 17 insertions, 16 deletions
diff --git a/packages/contracts/src/utils/asset_wrapper.ts b/packages/contracts/src/utils/asset_wrapper.ts index d5ce8cf1e..a7f91f413 100644 --- a/packages/contracts/src/utils/asset_wrapper.ts +++ b/packages/contracts/src/utils/asset_wrapper.ts @@ -1,4 +1,5 @@ import { assetProxyUtils } from '@0xproject/order-utils'; +import { AssetProxyId } from '@0xproject/types'; import { BigNumber, errorUtils } from '@0xproject/utils'; import * as _ from 'lodash'; @@ -9,7 +10,7 @@ import { ERC20Wrapper } from './erc20_wrapper'; import { ERC721Wrapper } from './erc721_wrapper'; interface ProxyIdToAssetWrappers { - [proxyId: number]: AbstractAssetWrapper; + [proxyId: string]: AbstractAssetWrapper; } /** @@ -28,12 +29,12 @@ export class AssetWrapper { public async getBalanceAsync(userAddress: string, assetData: string): Promise<BigNumber> { const proxyId = assetProxyUtils.decodeAssetDataId(assetData); switch (proxyId) { - case constants.ERC20_PROXY_ID: { + case AssetProxyId.ERC20: { const erc20Wrapper = this._proxyIdToAssetWrappers[proxyId] as ERC20Wrapper; const balance = await erc20Wrapper.getBalanceAsync(userAddress, assetData); return balance; } - case constants.ERC721_PROXY_ID: { + case AssetProxyId.ERC721: { const assetWrapper = this._proxyIdToAssetWrappers[proxyId] as ERC721Wrapper; const assetProxyData = assetProxyUtils.decodeERC721AssetData(assetData); const isOwner = await assetWrapper.isOwnerAsync( @@ -51,12 +52,12 @@ export class AssetWrapper { public async setBalanceAsync(userAddress: string, assetData: string, desiredBalance: BigNumber): Promise<void> { const proxyId = assetProxyUtils.decodeAssetDataId(assetData); switch (proxyId) { - case constants.ERC20_PROXY_ID: { + case AssetProxyId.ERC20: { const erc20Wrapper = this._proxyIdToAssetWrappers[proxyId] as ERC20Wrapper; await erc20Wrapper.setBalanceAsync(userAddress, assetData, desiredBalance); return; } - case constants.ERC721_PROXY_ID: { + case AssetProxyId.ERC721: { if (!desiredBalance.eq(0) && !desiredBalance.eq(1)) { throw new Error(`Balance for ERC721 token can only be set to 0 or 1. Got: ${desiredBalance}`); } @@ -102,12 +103,12 @@ export class AssetWrapper { public async getProxyAllowanceAsync(userAddress: string, assetData: string): Promise<BigNumber> { const proxyId = assetProxyUtils.decodeAssetDataId(assetData); switch (proxyId) { - case constants.ERC20_PROXY_ID: { + case AssetProxyId.ERC20: { const erc20Wrapper = this._proxyIdToAssetWrappers[proxyId] as ERC20Wrapper; const allowance = await erc20Wrapper.getProxyAllowanceAsync(userAddress, assetData); return allowance; } - case constants.ERC721_PROXY_ID: { + case AssetProxyId.ERC721: { const assetWrapper = this._proxyIdToAssetWrappers[proxyId] as ERC721Wrapper; const erc721ProxyData = assetProxyUtils.decodeERC721AssetData(assetData); const isProxyApprovedForAll = await assetWrapper.isProxyApprovedForAllAsync( @@ -136,12 +137,12 @@ export class AssetWrapper { ): Promise<void> { const proxyId = assetProxyUtils.decodeAssetDataId(assetData); switch (proxyId) { - case constants.ERC20_PROXY_ID: { + case AssetProxyId.ERC20: { const erc20Wrapper = this._proxyIdToAssetWrappers[proxyId] as ERC20Wrapper; await erc20Wrapper.setAllowanceAsync(userAddress, assetData, desiredAllowance); return; } - case constants.ERC721_PROXY_ID: { + case AssetProxyId.ERC721: { if ( !desiredAllowance.eq(0) && !desiredAllowance.eq(1) && diff --git a/packages/contracts/src/utils/core_combinatorial_utils.ts b/packages/contracts/src/utils/core_combinatorial_utils.ts index a2d2a500b..a775c619f 100644 --- a/packages/contracts/src/utils/core_combinatorial_utils.ts +++ b/packages/contracts/src/utils/core_combinatorial_utils.ts @@ -515,7 +515,7 @@ export class CoreCombinatorialUtils { const takerAssetProxyId = assetProxyUtils.decodeAssetDataId(signedOrder.takerAssetData); const makerAssetProxyId = assetProxyUtils.decodeAssetDataId(signedOrder.makerAssetData); const isEitherAssetERC721 = - takerAssetProxyId === constants.ERC721_PROXY_ID || makerAssetProxyId === constants.ERC721_PROXY_ID; + takerAssetProxyId === AssetProxyId.ERC721 || makerAssetProxyId === AssetProxyId.ERC721; if (isEitherAssetERC721) { throw new Error( 'Cannot test `TakerAssetFillAmountScenario.LessThanRemainingFillableTakerAssetAmount` together with ERC721 assets since orders involving ERC721 must always be filled exactly.', diff --git a/packages/contracts/src/utils/erc20_wrapper.ts b/packages/contracts/src/utils/erc20_wrapper.ts index 6dd717f4a..652f29726 100644 --- a/packages/contracts/src/utils/erc20_wrapper.ts +++ b/packages/contracts/src/utils/erc20_wrapper.ts @@ -19,7 +19,7 @@ export class ERC20Wrapper { private _provider: Provider; private _dummyTokenContracts: DummyERC20TokenContract[]; private _proxyContract?: ERC20ProxyContract; - private _proxyIdIfExists?: number; + private _proxyIdIfExists?: string; constructor(provider: Provider, tokenOwnerAddresses: string[], contractOwnerAddress: string) { this._dummyTokenContracts = []; this._web3Wrapper = new Web3Wrapper(provider); @@ -55,9 +55,9 @@ export class ERC20Wrapper { this._proxyIdIfExists = await this._proxyContract.getProxyId.callAsync(); return this._proxyContract; } - public getProxyId(): number { + public getProxyId(): string { this._validateProxyContractExistsOrThrow(); - return this._proxyIdIfExists as number; + return this._proxyIdIfExists as string; } public async setBalancesAndAllowancesAsync(): Promise<void> { this._validateDummyTokenContractsExistOrThrow(); diff --git a/packages/contracts/src/utils/erc721_wrapper.ts b/packages/contracts/src/utils/erc721_wrapper.ts index 0ad2fc7d7..309135ae4 100644 --- a/packages/contracts/src/utils/erc721_wrapper.ts +++ b/packages/contracts/src/utils/erc721_wrapper.ts @@ -19,7 +19,7 @@ export class ERC721Wrapper { private _provider: Provider; private _dummyTokenContracts: DummyERC721TokenContract[]; private _proxyContract?: ERC721ProxyContract; - private _proxyIdIfExists?: number; + private _proxyIdIfExists?: string; private _initialTokenIdsByOwner: ERC721TokenIdsByOwner = {}; constructor(provider: Provider, tokenOwnerAddresses: string[], contractOwnerAddress: string) { this._web3Wrapper = new Web3Wrapper(provider); @@ -51,9 +51,9 @@ export class ERC721Wrapper { this._proxyIdIfExists = await this._proxyContract.getProxyId.callAsync(); return this._proxyContract; } - public getProxyId(): number { + public getProxyId(): string { this._validateProxyContractExistsOrThrow(); - return this._proxyIdIfExists as number; + return this._proxyIdIfExists as string; } public async setBalancesAndAllowancesAsync(): Promise<void> { this._validateDummyTokenContractsExistOrThrow(); |