Rebased against development

This commit is contained in:
Greg Hysen 2019-03-11 17:30:42 -07:00
parent 8916d0d367
commit 9ec380777a
10 changed files with 21 additions and 44 deletions

View File

@ -23,6 +23,7 @@
} }
}, },
"contracts": [ "contracts": [
"src/ERC1155Proxy.sol",
"src/ERC20Proxy.sol", "src/ERC20Proxy.sol",
"src/ERC721Proxy.sol", "src/ERC721Proxy.sol",
"src/MixinAuthorizable.sol", "src/MixinAuthorizable.sol",

View File

@ -33,7 +33,7 @@
"lint-contracts": "solhint -c ../.solhint.json contracts/**/**/**/**/*.sol" "lint-contracts": "solhint -c ../.solhint.json contracts/**/**/**/**/*.sol"
}, },
"config": { "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." "abis:comment": "This list is auto-generated by contracts-gen. Don't edit manually."
}, },
"repository": { "repository": {

View File

@ -5,8 +5,6 @@
*/ */
import { ContractArtifact } from 'ethereum-types'; 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 ERC1155Proxy from '../generated-artifacts/ERC1155Proxy.json';
import * as ERC20Proxy from '../generated-artifacts/ERC20Proxy.json'; import * as ERC20Proxy from '../generated-artifacts/ERC20Proxy.json';
import * as ERC721Proxy from '../generated-artifacts/ERC721Proxy.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 MixinAuthorizable from '../generated-artifacts/MixinAuthorizable.json';
import * as MultiAssetProxy from '../generated-artifacts/MultiAssetProxy.json'; import * as MultiAssetProxy from '../generated-artifacts/MultiAssetProxy.json';
export const artifacts = { export const artifacts = {
DummyERC1155Receiver: DummyERC1155Receiver as ContractArtifact,
ERC1155Mintable: ERC1155Mintable as ContractArtifact,
ERC1155Proxy: ERC1155Proxy as ContractArtifact,
ERC20Proxy: ERC20Proxy as ContractArtifact, ERC20Proxy: ERC20Proxy as ContractArtifact,
ERC721Proxy: ERC721Proxy as ContractArtifact, ERC721Proxy: ERC721Proxy as ContractArtifact,
ERC1155Proxy: ERC1155Proxy as ContractArtifact,
MixinAuthorizable: MixinAuthorizable as ContractArtifact, MixinAuthorizable: MixinAuthorizable as ContractArtifact,
MultiAssetProxy: MultiAssetProxy as ContractArtifact, MultiAssetProxy: MultiAssetProxy as ContractArtifact,
IAssetData: IAssetData as ContractArtifact, IAssetData: IAssetData as ContractArtifact,

View File

@ -3,8 +3,6 @@
* Warning: This file is auto-generated by contracts-gen. Don't edit manually. * 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/erc1155_proxy';
export * from '../generated-wrappers/erc20_proxy'; export * from '../generated-wrappers/erc20_proxy';
export * from '../generated-wrappers/erc721_proxy'; export * from '../generated-wrappers/erc721_proxy';

View File

@ -1,3 +1,10 @@
import {
artifacts as erc1155Artifacts,
DummyERC1155ReceiverBatchTokenReceivedEventArgs,
DummyERC1155ReceiverContract,
ERC1155MintableContract,
Erc1155Wrapper,
} from '@0x/contracts-erc1155';
import { import {
chaiSetup, chaiSetup,
constants, constants,
@ -14,15 +21,7 @@ import * as chai from 'chai';
import { LogWithDecodedArgs } from 'ethereum-types'; import { LogWithDecodedArgs } from 'ethereum-types';
import * as _ from 'lodash'; import * as _ from 'lodash';
import { Erc1155Wrapper } from '../../erc1155/lib/src'; import { ERC1155ProxyWrapper, ERC721ProxyContract } from '../src';
import {
artifacts,
DummyERC1155ReceiverBatchTokenReceivedEventArgs,
DummyERC1155ReceiverContract,
ERC1155MintableContract,
ERC1155ProxyWrapper,
ERC721ProxyContract,
} from '../src';
chaiSetup.configure(); chaiSetup.configure();
const expect = chai.expect; const expect = chai.expect;
@ -87,7 +86,7 @@ describe('ERC1155Proxy', () => {
[erc1155Wrapper] = await erc1155ProxyWrapper.deployDummyContractsAsync(); [erc1155Wrapper] = await erc1155ProxyWrapper.deployDummyContractsAsync();
erc1155Contract = erc1155Wrapper.getContract(); erc1155Contract = erc1155Wrapper.getContract();
erc1155Receiver = await DummyERC1155ReceiverContract.deployFrom0xArtifactAsync( erc1155Receiver = await DummyERC1155ReceiverContract.deployFrom0xArtifactAsync(
artifacts.DummyERC1155Receiver, erc1155Artifacts.DummyERC1155Receiver,
provider, provider,
txDefaults, txDefaults,
); );

View File

@ -1,4 +1,4 @@
import { Erc1155Wrapper } from '@0x/contracts-erc1155'; import { artifacts as erc1155Artifacts, ERC1155MintableContract, Erc1155Wrapper } from '@0x/contracts-erc1155';
import { import {
constants, constants,
ERC1155FungibleHoldingsByOwner, ERC1155FungibleHoldingsByOwner,
@ -13,7 +13,7 @@ import { Web3Wrapper } from '@0x/web3-wrapper';
import { Provider, TransactionReceiptWithDecodedLogs } from 'ethereum-types'; import { Provider, TransactionReceiptWithDecodedLogs } from 'ethereum-types';
import * as _ from 'lodash'; import * as _ from 'lodash';
import { artifacts, ERC1155MintableContract, ERC1155ProxyContract, IAssetProxyContract } from '../../src'; import { artifacts, ERC1155ProxyContract, IAssetProxyContract } from '../../src';
export class ERC1155ProxyWrapper { export class ERC1155ProxyWrapper {
private readonly _tokenOwnerAddresses: string[]; private readonly _tokenOwnerAddresses: string[];
@ -33,7 +33,8 @@ export class ERC1155ProxyWrapper {
constructor(provider: Provider, tokenOwnerAddresses: string[], contractOwnerAddress: string) { constructor(provider: Provider, tokenOwnerAddresses: string[], contractOwnerAddress: string) {
this._web3Wrapper = new Web3Wrapper(provider); this._web3Wrapper = new Web3Wrapper(provider);
this._provider = 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._dummyTokenWrappers = [];
this._assetProxyInterface = new IAssetProxyContract( this._assetProxyInterface = new IAssetProxyContract(
artifacts.IAssetProxy.compilerOutput.abi, artifacts.IAssetProxy.compilerOutput.abi,
@ -54,7 +55,7 @@ export class ERC1155ProxyWrapper {
// tslint:disable-next-line:no-unused-variable // tslint:disable-next-line:no-unused-variable
for (const i of _.times(constants.NUM_DUMMY_ERC1155_CONTRACTS_TO_DEPLOY)) { for (const i of _.times(constants.NUM_DUMMY_ERC1155_CONTRACTS_TO_DEPLOY)) {
const erc1155Contract = await ERC1155MintableContract.deployFrom0xArtifactAsync( const erc1155Contract = await ERC1155MintableContract.deployFrom0xArtifactAsync(
artifacts.ERC1155Mintable, erc1155Artifacts.ERC1155Mintable,
this._provider, this._provider,
txDefaults, txDefaults,
); );

View File

@ -3,9 +3,7 @@
"compilerOptions": { "outDir": "lib", "rootDir": ".", "resolveJsonModule": true }, "compilerOptions": { "outDir": "lib", "rootDir": ".", "resolveJsonModule": true },
"include": ["./src/**/*", "./test/**/*", "./generated-wrappers/**/*"], "include": ["./src/**/*", "./test/**/*", "./generated-wrappers/**/*"],
"files": [ "files": [
"generated-artifacts/DummyERC1155Receiver.json", "generated-artifacts/ERC1155Proxy.json",
"generated-artifacts/ERC1155Mintable.json",
"generated-artifacts/ERC1155Proxy.json",
"generated-artifacts/ERC20Proxy.json", "generated-artifacts/ERC20Proxy.json",
"generated-artifacts/ERC721Proxy.json", "generated-artifacts/ERC721Proxy.json",
"generated-artifacts/IAssetData.json", "generated-artifacts/IAssetData.json",

View File

@ -138,22 +138,6 @@ export class Erc1155Wrapper {
const isApprovedForAll = await this._erc1155Contract.isApprovedForAll.callAsync(owner, beneficiary); const isApprovedForAll = await this._erc1155Contract.isApprovedForAll.callAsync(owner, beneficiary);
return isApprovedForAll; 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( public async assertBalancesAsync(
owners: string[], owners: string[],
tokens: BigNumber[], tokens: BigNumber[],

View File

@ -107,7 +107,8 @@ export const assetDataUtils = {
throw new Error(`Invalid assetProxyId. Expected '${AssetProxyId.ERC1155}', got '${assetProxyId}'`); throw new Error(`Invalid assetProxyId. Expected '${AssetProxyId.ERC1155}', got '${assetProxyId}'`);
} }
const abiEncoder = AbiEncoder.createMethod('ERC1155Token', ERC1155AssetDataAbi); 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 { return {
assetProxyId, assetProxyId,
tokenAddress: decodedAssetData.tokenAddress, tokenAddress: decodedAssetData.tokenAddress,

View File

@ -7,14 +7,13 @@
"pr": 1661 "pr": 1661
} }
] ]
}, },
{ {
"version": "2.2.2", "version": "2.2.2",
"changes": [ "changes": [
{ {
"note": "Added ERC1155 revert reasons", "note": "Added ERC1155 revert reasons",
"pr": 1657 "pr": 1657
} }
] ]
}, },