diff --git a/contracts/asset-proxy/compiler.json b/contracts/asset-proxy/compiler.json index 13d150d70c..28f73402ca 100644 --- a/contracts/asset-proxy/compiler.json +++ b/contracts/asset-proxy/compiler.json @@ -23,6 +23,7 @@ } }, "contracts": [ + "src/ERC1155Proxy.sol", "src/ERC20Proxy.sol", "src/ERC721Proxy.sol", "src/MixinAuthorizable.sol", diff --git a/contracts/asset-proxy/package.json b/contracts/asset-proxy/package.json index c59e6bde7e..138485472a 100644 --- a/contracts/asset-proxy/package.json +++ b/contracts/asset-proxy/package.json @@ -33,7 +33,7 @@ "lint-contracts": "solhint -c ../.solhint.json contracts/**/**/**/**/*.sol" }, "config": { - "abis": "./generated-artifacts/@(ERC20Proxy|ERC721Proxy|ERC1155Proxy|IAssetData|IAssetProxy|IAuthorizable|MixinAuthorizable|MultiAssetProxy).json", + "abis": "./generated-artifacts/@(ERC1155Proxy|ERC20Proxy|ERC721Proxy|IAssetData|IAssetProxy|IAuthorizable|MixinAuthorizable|MultiAssetProxy).json", "abis:comment": "This list is auto-generated by contracts-gen. Don't edit manually." }, "repository": { diff --git a/contracts/asset-proxy/src/artifacts.ts b/contracts/asset-proxy/src/artifacts.ts index c7c7f25dbb..0dc768bc11 100644 --- a/contracts/asset-proxy/src/artifacts.ts +++ b/contracts/asset-proxy/src/artifacts.ts @@ -5,8 +5,6 @@ */ import { ContractArtifact } from 'ethereum-types'; -import * as DummyERC1155Receiver from '../generated-artifacts/DummyERC1155Receiver.json'; -import * as ERC1155Mintable from '../generated-artifacts/ERC1155Mintable.json'; import * as ERC1155Proxy from '../generated-artifacts/ERC1155Proxy.json'; import * as ERC20Proxy from '../generated-artifacts/ERC20Proxy.json'; import * as ERC721Proxy from '../generated-artifacts/ERC721Proxy.json'; @@ -16,11 +14,9 @@ import * as IAuthorizable from '../generated-artifacts/IAuthorizable.json'; import * as MixinAuthorizable from '../generated-artifacts/MixinAuthorizable.json'; import * as MultiAssetProxy from '../generated-artifacts/MultiAssetProxy.json'; export const artifacts = { - DummyERC1155Receiver: DummyERC1155Receiver as ContractArtifact, - ERC1155Mintable: ERC1155Mintable as ContractArtifact, - ERC1155Proxy: ERC1155Proxy as ContractArtifact, ERC20Proxy: ERC20Proxy as ContractArtifact, ERC721Proxy: ERC721Proxy as ContractArtifact, + ERC1155Proxy: ERC1155Proxy as ContractArtifact, MixinAuthorizable: MixinAuthorizable as ContractArtifact, MultiAssetProxy: MultiAssetProxy as ContractArtifact, IAssetData: IAssetData as ContractArtifact, diff --git a/contracts/asset-proxy/src/wrappers.ts b/contracts/asset-proxy/src/wrappers.ts index 50de349723..3412cb0266 100644 --- a/contracts/asset-proxy/src/wrappers.ts +++ b/contracts/asset-proxy/src/wrappers.ts @@ -3,8 +3,6 @@ * Warning: This file is auto-generated by contracts-gen. Don't edit manually. * ----------------------------------------------------------------------------- */ -export * from '../generated-wrappers/dummy_erc1155_receiver'; -export * from '../generated-wrappers/erc1155_mintable'; export * from '../generated-wrappers/erc1155_proxy'; export * from '../generated-wrappers/erc20_proxy'; export * from '../generated-wrappers/erc721_proxy'; diff --git a/contracts/asset-proxy/test/erc1155_proxy.ts b/contracts/asset-proxy/test/erc1155_proxy.ts index 9452301ff1..01368f7833 100644 --- a/contracts/asset-proxy/test/erc1155_proxy.ts +++ b/contracts/asset-proxy/test/erc1155_proxy.ts @@ -1,3 +1,10 @@ +import { + artifacts as erc1155Artifacts, + DummyERC1155ReceiverBatchTokenReceivedEventArgs, + DummyERC1155ReceiverContract, + ERC1155MintableContract, + Erc1155Wrapper, +} from '@0x/contracts-erc1155'; import { chaiSetup, constants, @@ -14,15 +21,7 @@ import * as chai from 'chai'; import { LogWithDecodedArgs } from 'ethereum-types'; import * as _ from 'lodash'; -import { Erc1155Wrapper } from '../../erc1155/lib/src'; -import { - artifacts, - DummyERC1155ReceiverBatchTokenReceivedEventArgs, - DummyERC1155ReceiverContract, - ERC1155MintableContract, - ERC1155ProxyWrapper, - ERC721ProxyContract, -} from '../src'; +import { ERC1155ProxyWrapper, ERC721ProxyContract } from '../src'; chaiSetup.configure(); const expect = chai.expect; @@ -87,7 +86,7 @@ describe('ERC1155Proxy', () => { [erc1155Wrapper] = await erc1155ProxyWrapper.deployDummyContractsAsync(); erc1155Contract = erc1155Wrapper.getContract(); erc1155Receiver = await DummyERC1155ReceiverContract.deployFrom0xArtifactAsync( - artifacts.DummyERC1155Receiver, + erc1155Artifacts.DummyERC1155Receiver, provider, txDefaults, ); diff --git a/contracts/asset-proxy/test/utils/erc1155_proxy_wrapper.ts b/contracts/asset-proxy/test/utils/erc1155_proxy_wrapper.ts index a04008486b..4a43a4711b 100644 --- a/contracts/asset-proxy/test/utils/erc1155_proxy_wrapper.ts +++ b/contracts/asset-proxy/test/utils/erc1155_proxy_wrapper.ts @@ -1,4 +1,4 @@ -import { Erc1155Wrapper } from '@0x/contracts-erc1155'; +import { artifacts as erc1155Artifacts, ERC1155MintableContract, Erc1155Wrapper } from '@0x/contracts-erc1155'; import { constants, ERC1155FungibleHoldingsByOwner, @@ -13,7 +13,7 @@ import { Web3Wrapper } from '@0x/web3-wrapper'; import { Provider, TransactionReceiptWithDecodedLogs } from 'ethereum-types'; import * as _ from 'lodash'; -import { artifacts, ERC1155MintableContract, ERC1155ProxyContract, IAssetProxyContract } from '../../src'; +import { artifacts, ERC1155ProxyContract, IAssetProxyContract } from '../../src'; export class ERC1155ProxyWrapper { private readonly _tokenOwnerAddresses: string[]; @@ -33,7 +33,8 @@ export class ERC1155ProxyWrapper { constructor(provider: Provider, tokenOwnerAddresses: string[], contractOwnerAddress: string) { this._web3Wrapper = new Web3Wrapper(provider); this._provider = provider; - this._logDecoder = new LogDecoder(this._web3Wrapper, artifacts); + const allArtifacts = _.merge(artifacts, erc1155Artifacts); + this._logDecoder = new LogDecoder(this._web3Wrapper, allArtifacts); this._dummyTokenWrappers = []; this._assetProxyInterface = new IAssetProxyContract( artifacts.IAssetProxy.compilerOutput.abi, @@ -54,7 +55,7 @@ export class ERC1155ProxyWrapper { // tslint:disable-next-line:no-unused-variable for (const i of _.times(constants.NUM_DUMMY_ERC1155_CONTRACTS_TO_DEPLOY)) { const erc1155Contract = await ERC1155MintableContract.deployFrom0xArtifactAsync( - artifacts.ERC1155Mintable, + erc1155Artifacts.ERC1155Mintable, this._provider, txDefaults, ); diff --git a/contracts/asset-proxy/tsconfig.json b/contracts/asset-proxy/tsconfig.json index 2ea279b4e5..31358217c9 100644 --- a/contracts/asset-proxy/tsconfig.json +++ b/contracts/asset-proxy/tsconfig.json @@ -3,9 +3,7 @@ "compilerOptions": { "outDir": "lib", "rootDir": ".", "resolveJsonModule": true }, "include": ["./src/**/*", "./test/**/*", "./generated-wrappers/**/*"], "files": [ - "generated-artifacts/DummyERC1155Receiver.json", - "generated-artifacts/ERC1155Mintable.json", - "generated-artifacts/ERC1155Proxy.json", + "generated-artifacts/ERC1155Proxy.json", "generated-artifacts/ERC20Proxy.json", "generated-artifacts/ERC721Proxy.json", "generated-artifacts/IAssetData.json", diff --git a/contracts/erc1155/compiler.json b/contracts/erc1155/compiler.json index e24bb9224b..e545f46b08 100644 --- a/contracts/erc1155/compiler.json +++ b/contracts/erc1155/compiler.json @@ -18,13 +18,13 @@ } }, "contracts": [ - "test/DummyERC1155Receiver.sol", "src/ERC1155.sol", - "src/mixins/MNonFungibleToken.sol", "src/ERC1155Mintable.sol", "src/MixinNonFungibleToken.sol", + "src/interfaces/IERC1155.sol", "src/interfaces/IERC1155Mintable.sol", "src/interfaces/IERC1155Receiver.sol", - "src/interfaces/IERC1155.sol" + "src/mixins/MNonFungibleToken.sol", + "test/DummyERC1155Receiver.sol" ] } diff --git a/contracts/erc1155/package.json b/contracts/erc1155/package.json index e988deed8f..9c26f1c275 100644 --- a/contracts/erc1155/package.json +++ b/contracts/erc1155/package.json @@ -33,7 +33,7 @@ "lint-contracts": "solhint -c ../.solhint.json contracts/**/**/**/**/*.sol" }, "config": { - "abis": "generated-artifacts/@(Address|DummyERC1155Receiver|ERC1155|ERC1155Mintable|IERC1155|IERC1155Receiver|MixinNonFungibleToken|SafeMath).json", + "abis": "generated-artifacts/@(DummyERC1155Receiver|ERC1155|ERC1155Mintable|IERC1155|IERC1155Mintable|IERC1155Receiver|MNonFungibleToken|MixinNonFungibleToken).json", "abis:comment": "This list is auto-generated by contracts-gen. Don't edit manually." }, "repository": { diff --git a/contracts/erc1155/src/artifacts.ts b/contracts/erc1155/src/artifacts.ts index 1ec22628ad..be1ee9886b 100644 --- a/contracts/erc1155/src/artifacts.ts +++ b/contracts/erc1155/src/artifacts.ts @@ -5,21 +5,21 @@ */ import { ContractArtifact } from 'ethereum-types'; -import * as Address from '../generated-artifacts/Address.json'; import * as DummyERC1155Receiver from '../generated-artifacts/DummyERC1155Receiver.json'; import * as ERC1155 from '../generated-artifacts/ERC1155.json'; import * as ERC1155Mintable from '../generated-artifacts/ERC1155Mintable.json'; import * as IERC1155 from '../generated-artifacts/IERC1155.json'; +import * as IERC1155Mintable from '../generated-artifacts/IERC1155Mintable.json'; import * as IERC1155Receiver from '../generated-artifacts/IERC1155Receiver.json'; import * as MixinNonFungibleToken from '../generated-artifacts/MixinNonFungibleToken.json'; -import * as SafeMath from '../generated-artifacts/SafeMath.json'; +import * as MNonFungibleToken from '../generated-artifacts/MNonFungibleToken.json'; export const artifacts = { ERC1155: ERC1155 as ContractArtifact, ERC1155Mintable: ERC1155Mintable as ContractArtifact, MixinNonFungibleToken: MixinNonFungibleToken as ContractArtifact, IERC1155: IERC1155 as ContractArtifact, + IERC1155Mintable: IERC1155Mintable as ContractArtifact, IERC1155Receiver: IERC1155Receiver as ContractArtifact, - Address: Address as ContractArtifact, - SafeMath: SafeMath as ContractArtifact, + MNonFungibleToken: MNonFungibleToken as ContractArtifact, DummyERC1155Receiver: DummyERC1155Receiver as ContractArtifact, }; diff --git a/contracts/erc1155/src/wrappers.ts b/contracts/erc1155/src/wrappers.ts index 557d3dde9e..fad5514a49 100644 --- a/contracts/erc1155/src/wrappers.ts +++ b/contracts/erc1155/src/wrappers.ts @@ -3,11 +3,11 @@ * Warning: This file is auto-generated by contracts-gen. Don't edit manually. * ----------------------------------------------------------------------------- */ -export * from '../generated-wrappers/address'; export * from '../generated-wrappers/dummy_erc1155_receiver'; export * from '../generated-wrappers/erc1155'; export * from '../generated-wrappers/erc1155_mintable'; +export * from '../generated-wrappers/i_erc1155_mintable'; export * from '../generated-wrappers/i_erc1155_receiver'; export * from '../generated-wrappers/ierc1155'; +export * from '../generated-wrappers/m_non_fungible_token'; export * from '../generated-wrappers/mixin_non_fungible_token'; -export * from '../generated-wrappers/safe_math'; diff --git a/contracts/erc1155/test/utils/erc1155_wrapper.ts b/contracts/erc1155/test/utils/erc1155_wrapper.ts index 82e8705b1a..7f620ece02 100644 --- a/contracts/erc1155/test/utils/erc1155_wrapper.ts +++ b/contracts/erc1155/test/utils/erc1155_wrapper.ts @@ -138,22 +138,6 @@ export class Erc1155Wrapper { const isApprovedForAll = await this._erc1155Contract.isApprovedForAll.callAsync(owner, beneficiary); return isApprovedForAll; } - public async setApprovalForAllAsync( - owner: string, - beneficiary: string, - isApproved: boolean, - ): Promise { - const tx = await this._logDecoder.getTxWithDecodedLogsAsync( - await this._erc1155Contract.setApprovalForAll.sendTransactionAsync(beneficiary, isApproved, { - from: owner, - }), - ); - return tx; - } - public async isApprovedForAllAsync(owner: string, beneficiary: string): Promise { - const isApprovedForAll = await this._erc1155Contract.isApprovedForAll.callAsync(owner, beneficiary); - return isApprovedForAll; - } public async assertBalancesAsync( owners: string[], tokens: BigNumber[], diff --git a/contracts/erc1155/tsconfig.json b/contracts/erc1155/tsconfig.json index b26787d056..04206336be 100644 --- a/contracts/erc1155/tsconfig.json +++ b/contracts/erc1155/tsconfig.json @@ -3,14 +3,14 @@ "compilerOptions": { "outDir": "lib", "rootDir": ".", "resolveJsonModule": true }, "include": ["./src/**/*", "./test/**/*", "./generated-wrappers/**/*"], "files": [ - "generated-artifacts/Address.json", "generated-artifacts/DummyERC1155Receiver.json", "generated-artifacts/ERC1155.json", "generated-artifacts/ERC1155Mintable.json", "generated-artifacts/IERC1155.json", + "generated-artifacts/IERC1155Mintable.json", "generated-artifacts/IERC1155Receiver.json", - "generated-artifacts/MixinNonFungibleToken.json", - "generated-artifacts/SafeMath.json" + "generated-artifacts/MNonFungibleToken.json", + "generated-artifacts/MixinNonFungibleToken.json" ], "exclude": ["./deploy/solc/solc_bin"] } diff --git a/packages/order-utils/src/asset_data_utils.ts b/packages/order-utils/src/asset_data_utils.ts index bb61f3be9a..2acf57d5f6 100644 --- a/packages/order-utils/src/asset_data_utils.ts +++ b/packages/order-utils/src/asset_data_utils.ts @@ -107,7 +107,8 @@ export const assetDataUtils = { throw new Error(`Invalid assetProxyId. Expected '${AssetProxyId.ERC1155}', got '${assetProxyId}'`); } const abiEncoder = AbiEncoder.createMethod('ERC1155Token', ERC1155AssetDataAbi); - const decodedAssetData: ERC1155AssetDataNoProxyId = abiEncoder.decode(assetData, decodingRules); + // tslint:disable-next-line:no-unnecessary-type-assertion + const decodedAssetData = abiEncoder.decode(assetData, decodingRules) as ERC1155AssetDataNoProxyId; return { assetProxyId, tokenAddress: decodedAssetData.tokenAddress, diff --git a/packages/types/CHANGELOG.json b/packages/types/CHANGELOG.json index 1250688fc6..43f9ba0845 100644 --- a/packages/types/CHANGELOG.json +++ b/packages/types/CHANGELOG.json @@ -7,14 +7,13 @@ "pr": 1661 } ] - }, + }, { "version": "2.2.2", "changes": [ { "note": "Added ERC1155 revert reasons", "pr": 1657 - } ] },