Skip to content
This repository has been archived by the owner on Jul 9, 2021. It is now read-only.

Commit

Permalink
Rebased against development
Browse files Browse the repository at this point in the history
  • Loading branch information
hysz committed Mar 12, 2019
1 parent 07fdc3b commit 12eeed4
Show file tree
Hide file tree
Showing 15 changed files with 34 additions and 57 deletions.
1 change: 1 addition & 0 deletions contracts/asset-proxy/compiler.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
}
},
"contracts": [
"src/ERC1155Proxy.sol",
"src/ERC20Proxy.sol",
"src/ERC721Proxy.sol",
"src/MixinAuthorizable.sol",
Expand Down
2 changes: 1 addition & 1 deletion contracts/asset-proxy/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
6 changes: 1 addition & 5 deletions contracts/asset-proxy/src/artifacts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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,
Expand Down
2 changes: 0 additions & 2 deletions contracts/asset-proxy/src/wrappers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
19 changes: 9 additions & 10 deletions contracts/asset-proxy/test/erc1155_proxy.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
import {
artifacts as erc1155Artifacts,
DummyERC1155ReceiverBatchTokenReceivedEventArgs,
DummyERC1155ReceiverContract,
ERC1155MintableContract,
Erc1155Wrapper,
} from '@0x/contracts-erc1155';
import {
chaiSetup,
constants,
Expand All @@ -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;
Expand Down Expand Up @@ -87,7 +86,7 @@ describe('ERC1155Proxy', () => {
[erc1155Wrapper] = await erc1155ProxyWrapper.deployDummyContractsAsync();
erc1155Contract = erc1155Wrapper.getContract();
erc1155Receiver = await DummyERC1155ReceiverContract.deployFrom0xArtifactAsync(
artifacts.DummyERC1155Receiver,
erc1155Artifacts.DummyERC1155Receiver,
provider,
txDefaults,
);
Expand Down
9 changes: 5 additions & 4 deletions contracts/asset-proxy/test/utils/erc1155_proxy_wrapper.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Erc1155Wrapper } from '@0x/contracts-erc1155';
import { artifacts as erc1155Artifacts, ERC1155MintableContract, Erc1155Wrapper } from '@0x/contracts-erc1155';
import {
constants,
ERC1155FungibleHoldingsByOwner,
Expand All @@ -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[];
Expand All @@ -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,
Expand All @@ -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,
);
Expand Down
4 changes: 1 addition & 3 deletions contracts/asset-proxy/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
6 changes: 3 additions & 3 deletions contracts/erc1155/compiler.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
]
}
2 changes: 1 addition & 1 deletion contracts/erc1155/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
8 changes: 4 additions & 4 deletions contracts/erc1155/src/artifacts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
4 changes: 2 additions & 2 deletions contracts/erc1155/src/wrappers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
16 changes: 0 additions & 16 deletions contracts/erc1155/test/utils/erc1155_wrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<TransactionReceiptWithDecodedLogs> {
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<boolean> {
const isApprovedForAll = await this._erc1155Contract.isApprovedForAll.callAsync(owner, beneficiary);
return isApprovedForAll;
}
public async assertBalancesAsync(
owners: string[],
tokens: BigNumber[],
Expand Down
6 changes: 3 additions & 3 deletions contracts/erc1155/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
}
3 changes: 2 additions & 1 deletion packages/order-utils/src/asset_data_utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 1 addition & 2 deletions packages/types/CHANGELOG.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,13 @@
"pr": 1661
}
]
},
},
{
"version": "2.2.2",
"changes": [
{
"note": "Added ERC1155 revert reasons",
"pr": 1657

}
]
},
Expand Down

0 comments on commit 12eeed4

Please sign in to comment.