Changed artifactDependencies/abiDependencies to logDecodeDependencies + removed lodash depency in contract wrappers
This commit is contained in:
@@ -26,7 +26,6 @@ import { SimpleContractArtifact } from '@0x/types';
|
||||
import { Web3Wrapper } from '@0x/web3-wrapper';
|
||||
import { assert } from '@0x/assert';
|
||||
import * as ethers from 'ethers';
|
||||
import * as _ from 'lodash';
|
||||
// tslint:enable:no-unused-variable
|
||||
|
||||
{{#if events}}
|
||||
@@ -64,7 +63,7 @@ export class {{contractName}}Contract extends BaseContract {
|
||||
artifact: ContractArtifact | SimpleContractArtifact,
|
||||
supportedProvider: SupportedProvider,
|
||||
txDefaults: Partial<TxData>,
|
||||
artifactDependencies: { [contractName: string]: (ContractArtifact | SimpleContractArtifact) },
|
||||
logDecodeDependencies: { [contractName: string]: (ContractArtifact | SimpleContractArtifact) },
|
||||
{{> typed_params inputs=ctor.inputs}}
|
||||
): Promise<{{contractName}}Contract> {
|
||||
assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [
|
||||
@@ -78,15 +77,15 @@ export class {{contractName}}Contract extends BaseContract {
|
||||
const provider = providerUtils.standardizeOrThrow(supportedProvider);
|
||||
const bytecode = artifact.compilerOutput.evm.bytecode.object;
|
||||
const abi = artifact.compilerOutput.abi;
|
||||
const abiDependencies = _.mapValues(artifactDependencies, (artifactDependency: ContractArtifact | SimpleContractArtifact) => {return artifactDependency.compilerOutput.abi});
|
||||
return {{contractName}}Contract.deployAsync(bytecode, abi, provider, txDefaults, abiDependencies, {{> params inputs=ctor.inputs}});
|
||||
const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce((accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), {});
|
||||
return {{contractName}}Contract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly, {{> params inputs=ctor.inputs}});
|
||||
}
|
||||
public static async deployAsync(
|
||||
bytecode: string,
|
||||
abi: ContractAbi,
|
||||
supportedProvider: SupportedProvider,
|
||||
txDefaults: Partial<TxData>,
|
||||
abiDependencies: { [contractName: string]: ContractAbi },
|
||||
logDecodeDependencies: { [contractName: string]: ContractAbi },
|
||||
{{> typed_params inputs=ctor.inputs}}
|
||||
): Promise<{{contractName}}Contract> {
|
||||
assert.isHexString('bytecode', bytecode);
|
||||
@@ -115,7 +114,7 @@ export class {{contractName}}Contract extends BaseContract {
|
||||
logUtils.log(`transactionHash: ${txHash}`);
|
||||
const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash);
|
||||
logUtils.log(`{{contractName}} successfully deployed at ${txReceipt.contractAddress}`);
|
||||
const contractInstance = new {{contractName}}Contract(txReceipt.contractAddress as string, provider, txDefaults, abiDependencies);
|
||||
const contractInstance = new {{contractName}}Contract(txReceipt.contractAddress as string, provider, txDefaults, logDecodeDependencies);
|
||||
contractInstance.constructorArgs = [{{> params inputs=ctor.inputs}}];
|
||||
return contractInstance;
|
||||
}
|
||||
|
||||
@@ -29,7 +29,6 @@ import { SimpleContractArtifact } from '@0x/types';
|
||||
import { Web3Wrapper } from '@0x/web3-wrapper';
|
||||
import { assert } from '@0x/assert';
|
||||
import * as ethers from 'ethers';
|
||||
import * as _ from 'lodash';
|
||||
// tslint:enable:no-unused-variable
|
||||
|
||||
export type AssetProxyOwnerEventArgs =
|
||||
@@ -2097,7 +2096,7 @@ export class AssetProxyOwnerContract extends BaseContract {
|
||||
artifact: ContractArtifact | SimpleContractArtifact,
|
||||
supportedProvider: SupportedProvider,
|
||||
txDefaults: Partial<TxData>,
|
||||
artifactDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact },
|
||||
logDecodeDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact },
|
||||
_owners: string[],
|
||||
_assetProxyContracts: string[],
|
||||
_required: BigNumber,
|
||||
@@ -2114,18 +2113,16 @@ export class AssetProxyOwnerContract extends BaseContract {
|
||||
const provider = providerUtils.standardizeOrThrow(supportedProvider);
|
||||
const bytecode = artifact.compilerOutput.evm.bytecode.object;
|
||||
const abi = artifact.compilerOutput.abi;
|
||||
const abiDependencies = _.mapValues(
|
||||
artifactDependencies,
|
||||
(artifactDependency: ContractArtifact | SimpleContractArtifact) => {
|
||||
return artifactDependency.compilerOutput.abi;
|
||||
},
|
||||
const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce(
|
||||
(accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }),
|
||||
{},
|
||||
);
|
||||
return AssetProxyOwnerContract.deployAsync(
|
||||
bytecode,
|
||||
abi,
|
||||
provider,
|
||||
txDefaults,
|
||||
abiDependencies,
|
||||
logDecodeDependenciesAbiOnly,
|
||||
_owners,
|
||||
_assetProxyContracts,
|
||||
_required,
|
||||
@@ -2137,7 +2134,7 @@ export class AssetProxyOwnerContract extends BaseContract {
|
||||
abi: ContractAbi,
|
||||
supportedProvider: SupportedProvider,
|
||||
txDefaults: Partial<TxData>,
|
||||
abiDependencies: { [contractName: string]: ContractAbi },
|
||||
logDecodeDependencies: { [contractName: string]: ContractAbi },
|
||||
_owners: string[],
|
||||
_assetProxyContracts: string[],
|
||||
_required: BigNumber,
|
||||
@@ -2173,7 +2170,7 @@ export class AssetProxyOwnerContract extends BaseContract {
|
||||
txReceipt.contractAddress as string,
|
||||
provider,
|
||||
txDefaults,
|
||||
abiDependencies,
|
||||
logDecodeDependencies,
|
||||
);
|
||||
contractInstance.constructorArgs = [_owners, _assetProxyContracts, _required, _secondsTimeLocked];
|
||||
return contractInstance;
|
||||
|
||||
@@ -21,7 +21,6 @@ import { SimpleContractArtifact } from '@0x/types';
|
||||
import { Web3Wrapper } from '@0x/web3-wrapper';
|
||||
import { assert } from '@0x/assert';
|
||||
import * as ethers from 'ethers';
|
||||
import * as _ from 'lodash';
|
||||
// tslint:enable:no-unused-variable
|
||||
|
||||
/* istanbul ignore next */
|
||||
@@ -616,7 +615,7 @@ export class CoordinatorContract extends BaseContract {
|
||||
artifact: ContractArtifact | SimpleContractArtifact,
|
||||
supportedProvider: SupportedProvider,
|
||||
txDefaults: Partial<TxData>,
|
||||
artifactDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact },
|
||||
logDecodeDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact },
|
||||
_exchange: string,
|
||||
): Promise<CoordinatorContract> {
|
||||
assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [
|
||||
@@ -630,20 +629,25 @@ export class CoordinatorContract extends BaseContract {
|
||||
const provider = providerUtils.standardizeOrThrow(supportedProvider);
|
||||
const bytecode = artifact.compilerOutput.evm.bytecode.object;
|
||||
const abi = artifact.compilerOutput.abi;
|
||||
const abiDependencies = _.mapValues(
|
||||
artifactDependencies,
|
||||
(artifactDependency: ContractArtifact | SimpleContractArtifact) => {
|
||||
return artifactDependency.compilerOutput.abi;
|
||||
},
|
||||
const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce(
|
||||
(accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }),
|
||||
{},
|
||||
);
|
||||
return CoordinatorContract.deployAsync(
|
||||
bytecode,
|
||||
abi,
|
||||
provider,
|
||||
txDefaults,
|
||||
logDecodeDependenciesAbiOnly,
|
||||
_exchange,
|
||||
);
|
||||
return CoordinatorContract.deployAsync(bytecode, abi, provider, txDefaults, abiDependencies, _exchange);
|
||||
}
|
||||
public static async deployAsync(
|
||||
bytecode: string,
|
||||
abi: ContractAbi,
|
||||
supportedProvider: SupportedProvider,
|
||||
txDefaults: Partial<TxData>,
|
||||
abiDependencies: { [contractName: string]: ContractAbi },
|
||||
logDecodeDependencies: { [contractName: string]: ContractAbi },
|
||||
_exchange: string,
|
||||
): Promise<CoordinatorContract> {
|
||||
assert.isHexString('bytecode', bytecode);
|
||||
@@ -676,7 +680,7 @@ export class CoordinatorContract extends BaseContract {
|
||||
txReceipt.contractAddress as string,
|
||||
provider,
|
||||
txDefaults,
|
||||
abiDependencies,
|
||||
logDecodeDependencies,
|
||||
);
|
||||
contractInstance.constructorArgs = [_exchange];
|
||||
return contractInstance;
|
||||
|
||||
@@ -29,7 +29,6 @@ import { SimpleContractArtifact } from '@0x/types';
|
||||
import { Web3Wrapper } from '@0x/web3-wrapper';
|
||||
import { assert } from '@0x/assert';
|
||||
import * as ethers from 'ethers';
|
||||
import * as _ from 'lodash';
|
||||
// tslint:enable:no-unused-variable
|
||||
|
||||
export type CoordinatorRegistryEventArgs = CoordinatorRegistryCoordinatorEndpointSetEventArgs;
|
||||
@@ -206,7 +205,7 @@ export class CoordinatorRegistryContract extends BaseContract {
|
||||
artifact: ContractArtifact | SimpleContractArtifact,
|
||||
supportedProvider: SupportedProvider,
|
||||
txDefaults: Partial<TxData>,
|
||||
artifactDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact },
|
||||
logDecodeDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact },
|
||||
): Promise<CoordinatorRegistryContract> {
|
||||
assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [
|
||||
schemas.addressSchema,
|
||||
@@ -219,20 +218,24 @@ export class CoordinatorRegistryContract extends BaseContract {
|
||||
const provider = providerUtils.standardizeOrThrow(supportedProvider);
|
||||
const bytecode = artifact.compilerOutput.evm.bytecode.object;
|
||||
const abi = artifact.compilerOutput.abi;
|
||||
const abiDependencies = _.mapValues(
|
||||
artifactDependencies,
|
||||
(artifactDependency: ContractArtifact | SimpleContractArtifact) => {
|
||||
return artifactDependency.compilerOutput.abi;
|
||||
},
|
||||
const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce(
|
||||
(accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }),
|
||||
{},
|
||||
);
|
||||
return CoordinatorRegistryContract.deployAsync(
|
||||
bytecode,
|
||||
abi,
|
||||
provider,
|
||||
txDefaults,
|
||||
logDecodeDependenciesAbiOnly,
|
||||
);
|
||||
return CoordinatorRegistryContract.deployAsync(bytecode, abi, provider, txDefaults, abiDependencies);
|
||||
}
|
||||
public static async deployAsync(
|
||||
bytecode: string,
|
||||
abi: ContractAbi,
|
||||
supportedProvider: SupportedProvider,
|
||||
txDefaults: Partial<TxData>,
|
||||
abiDependencies: { [contractName: string]: ContractAbi },
|
||||
logDecodeDependencies: { [contractName: string]: ContractAbi },
|
||||
): Promise<CoordinatorRegistryContract> {
|
||||
assert.isHexString('bytecode', bytecode);
|
||||
assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [
|
||||
@@ -260,7 +263,7 @@ export class CoordinatorRegistryContract extends BaseContract {
|
||||
txReceipt.contractAddress as string,
|
||||
provider,
|
||||
txDefaults,
|
||||
abiDependencies,
|
||||
logDecodeDependencies,
|
||||
);
|
||||
contractInstance.constructorArgs = [];
|
||||
return contractInstance;
|
||||
|
||||
@@ -29,7 +29,6 @@ import { SimpleContractArtifact } from '@0x/types';
|
||||
import { Web3Wrapper } from '@0x/web3-wrapper';
|
||||
import { assert } from '@0x/assert';
|
||||
import * as ethers from 'ethers';
|
||||
import * as _ from 'lodash';
|
||||
// tslint:enable:no-unused-variable
|
||||
|
||||
export type DummyERC20TokenEventArgs = DummyERC20TokenTransferEventArgs | DummyERC20TokenApprovalEventArgs;
|
||||
@@ -1116,7 +1115,7 @@ export class DummyERC20TokenContract extends BaseContract {
|
||||
artifact: ContractArtifact | SimpleContractArtifact,
|
||||
supportedProvider: SupportedProvider,
|
||||
txDefaults: Partial<TxData>,
|
||||
artifactDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact },
|
||||
logDecodeDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact },
|
||||
_name: string,
|
||||
_symbol: string,
|
||||
_decimals: BigNumber,
|
||||
@@ -1133,18 +1132,16 @@ export class DummyERC20TokenContract extends BaseContract {
|
||||
const provider = providerUtils.standardizeOrThrow(supportedProvider);
|
||||
const bytecode = artifact.compilerOutput.evm.bytecode.object;
|
||||
const abi = artifact.compilerOutput.abi;
|
||||
const abiDependencies = _.mapValues(
|
||||
artifactDependencies,
|
||||
(artifactDependency: ContractArtifact | SimpleContractArtifact) => {
|
||||
return artifactDependency.compilerOutput.abi;
|
||||
},
|
||||
const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce(
|
||||
(accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }),
|
||||
{},
|
||||
);
|
||||
return DummyERC20TokenContract.deployAsync(
|
||||
bytecode,
|
||||
abi,
|
||||
provider,
|
||||
txDefaults,
|
||||
abiDependencies,
|
||||
logDecodeDependenciesAbiOnly,
|
||||
_name,
|
||||
_symbol,
|
||||
_decimals,
|
||||
@@ -1156,7 +1153,7 @@ export class DummyERC20TokenContract extends BaseContract {
|
||||
abi: ContractAbi,
|
||||
supportedProvider: SupportedProvider,
|
||||
txDefaults: Partial<TxData>,
|
||||
abiDependencies: { [contractName: string]: ContractAbi },
|
||||
logDecodeDependencies: { [contractName: string]: ContractAbi },
|
||||
_name: string,
|
||||
_symbol: string,
|
||||
_decimals: BigNumber,
|
||||
@@ -1192,7 +1189,7 @@ export class DummyERC20TokenContract extends BaseContract {
|
||||
txReceipt.contractAddress as string,
|
||||
provider,
|
||||
txDefaults,
|
||||
abiDependencies,
|
||||
logDecodeDependencies,
|
||||
);
|
||||
contractInstance.constructorArgs = [_name, _symbol, _decimals, _totalSupply];
|
||||
return contractInstance;
|
||||
|
||||
@@ -29,7 +29,6 @@ import { SimpleContractArtifact } from '@0x/types';
|
||||
import { Web3Wrapper } from '@0x/web3-wrapper';
|
||||
import { assert } from '@0x/assert';
|
||||
import * as ethers from 'ethers';
|
||||
import * as _ from 'lodash';
|
||||
// tslint:enable:no-unused-variable
|
||||
|
||||
export type DummyERC721TokenEventArgs =
|
||||
@@ -1446,7 +1445,7 @@ export class DummyERC721TokenContract extends BaseContract {
|
||||
artifact: ContractArtifact | SimpleContractArtifact,
|
||||
supportedProvider: SupportedProvider,
|
||||
txDefaults: Partial<TxData>,
|
||||
artifactDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact },
|
||||
logDecodeDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact },
|
||||
_name: string,
|
||||
_symbol: string,
|
||||
): Promise<DummyERC721TokenContract> {
|
||||
@@ -1461,18 +1460,16 @@ export class DummyERC721TokenContract extends BaseContract {
|
||||
const provider = providerUtils.standardizeOrThrow(supportedProvider);
|
||||
const bytecode = artifact.compilerOutput.evm.bytecode.object;
|
||||
const abi = artifact.compilerOutput.abi;
|
||||
const abiDependencies = _.mapValues(
|
||||
artifactDependencies,
|
||||
(artifactDependency: ContractArtifact | SimpleContractArtifact) => {
|
||||
return artifactDependency.compilerOutput.abi;
|
||||
},
|
||||
const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce(
|
||||
(accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }),
|
||||
{},
|
||||
);
|
||||
return DummyERC721TokenContract.deployAsync(
|
||||
bytecode,
|
||||
abi,
|
||||
provider,
|
||||
txDefaults,
|
||||
abiDependencies,
|
||||
logDecodeDependenciesAbiOnly,
|
||||
_name,
|
||||
_symbol,
|
||||
);
|
||||
@@ -1482,7 +1479,7 @@ export class DummyERC721TokenContract extends BaseContract {
|
||||
abi: ContractAbi,
|
||||
supportedProvider: SupportedProvider,
|
||||
txDefaults: Partial<TxData>,
|
||||
abiDependencies: { [contractName: string]: ContractAbi },
|
||||
logDecodeDependencies: { [contractName: string]: ContractAbi },
|
||||
_name: string,
|
||||
_symbol: string,
|
||||
): Promise<DummyERC721TokenContract> {
|
||||
@@ -1516,7 +1513,7 @@ export class DummyERC721TokenContract extends BaseContract {
|
||||
txReceipt.contractAddress as string,
|
||||
provider,
|
||||
txDefaults,
|
||||
abiDependencies,
|
||||
logDecodeDependencies,
|
||||
);
|
||||
contractInstance.constructorArgs = [_name, _symbol];
|
||||
return contractInstance;
|
||||
|
||||
@@ -21,7 +21,6 @@ import { SimpleContractArtifact } from '@0x/types';
|
||||
import { Web3Wrapper } from '@0x/web3-wrapper';
|
||||
import { assert } from '@0x/assert';
|
||||
import * as ethers from 'ethers';
|
||||
import * as _ from 'lodash';
|
||||
// tslint:enable:no-unused-variable
|
||||
|
||||
/* istanbul ignore next */
|
||||
@@ -540,7 +539,7 @@ export class DutchAuctionContract extends BaseContract {
|
||||
artifact: ContractArtifact | SimpleContractArtifact,
|
||||
supportedProvider: SupportedProvider,
|
||||
txDefaults: Partial<TxData>,
|
||||
artifactDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact },
|
||||
logDecodeDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact },
|
||||
_exchange: string,
|
||||
): Promise<DutchAuctionContract> {
|
||||
assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [
|
||||
@@ -554,20 +553,25 @@ export class DutchAuctionContract extends BaseContract {
|
||||
const provider = providerUtils.standardizeOrThrow(supportedProvider);
|
||||
const bytecode = artifact.compilerOutput.evm.bytecode.object;
|
||||
const abi = artifact.compilerOutput.abi;
|
||||
const abiDependencies = _.mapValues(
|
||||
artifactDependencies,
|
||||
(artifactDependency: ContractArtifact | SimpleContractArtifact) => {
|
||||
return artifactDependency.compilerOutput.abi;
|
||||
},
|
||||
const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce(
|
||||
(accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }),
|
||||
{},
|
||||
);
|
||||
return DutchAuctionContract.deployAsync(
|
||||
bytecode,
|
||||
abi,
|
||||
provider,
|
||||
txDefaults,
|
||||
logDecodeDependenciesAbiOnly,
|
||||
_exchange,
|
||||
);
|
||||
return DutchAuctionContract.deployAsync(bytecode, abi, provider, txDefaults, abiDependencies, _exchange);
|
||||
}
|
||||
public static async deployAsync(
|
||||
bytecode: string,
|
||||
abi: ContractAbi,
|
||||
supportedProvider: SupportedProvider,
|
||||
txDefaults: Partial<TxData>,
|
||||
abiDependencies: { [contractName: string]: ContractAbi },
|
||||
logDecodeDependencies: { [contractName: string]: ContractAbi },
|
||||
_exchange: string,
|
||||
): Promise<DutchAuctionContract> {
|
||||
assert.isHexString('bytecode', bytecode);
|
||||
@@ -600,7 +604,7 @@ export class DutchAuctionContract extends BaseContract {
|
||||
txReceipt.contractAddress as string,
|
||||
provider,
|
||||
txDefaults,
|
||||
abiDependencies,
|
||||
logDecodeDependencies,
|
||||
);
|
||||
contractInstance.constructorArgs = [_exchange];
|
||||
return contractInstance;
|
||||
|
||||
@@ -29,7 +29,6 @@ import { SimpleContractArtifact } from '@0x/types';
|
||||
import { Web3Wrapper } from '@0x/web3-wrapper';
|
||||
import { assert } from '@0x/assert';
|
||||
import * as ethers from 'ethers';
|
||||
import * as _ from 'lodash';
|
||||
// tslint:enable:no-unused-variable
|
||||
|
||||
export type ERC20ProxyEventArgs =
|
||||
@@ -705,7 +704,7 @@ export class ERC20ProxyContract extends BaseContract {
|
||||
artifact: ContractArtifact | SimpleContractArtifact,
|
||||
supportedProvider: SupportedProvider,
|
||||
txDefaults: Partial<TxData>,
|
||||
artifactDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact },
|
||||
logDecodeDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact },
|
||||
): Promise<ERC20ProxyContract> {
|
||||
assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [
|
||||
schemas.addressSchema,
|
||||
@@ -718,20 +717,18 @@ export class ERC20ProxyContract extends BaseContract {
|
||||
const provider = providerUtils.standardizeOrThrow(supportedProvider);
|
||||
const bytecode = artifact.compilerOutput.evm.bytecode.object;
|
||||
const abi = artifact.compilerOutput.abi;
|
||||
const abiDependencies = _.mapValues(
|
||||
artifactDependencies,
|
||||
(artifactDependency: ContractArtifact | SimpleContractArtifact) => {
|
||||
return artifactDependency.compilerOutput.abi;
|
||||
},
|
||||
const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce(
|
||||
(accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }),
|
||||
{},
|
||||
);
|
||||
return ERC20ProxyContract.deployAsync(bytecode, abi, provider, txDefaults, abiDependencies);
|
||||
return ERC20ProxyContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly);
|
||||
}
|
||||
public static async deployAsync(
|
||||
bytecode: string,
|
||||
abi: ContractAbi,
|
||||
supportedProvider: SupportedProvider,
|
||||
txDefaults: Partial<TxData>,
|
||||
abiDependencies: { [contractName: string]: ContractAbi },
|
||||
logDecodeDependencies: { [contractName: string]: ContractAbi },
|
||||
): Promise<ERC20ProxyContract> {
|
||||
assert.isHexString('bytecode', bytecode);
|
||||
assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [
|
||||
@@ -759,7 +756,7 @@ export class ERC20ProxyContract extends BaseContract {
|
||||
txReceipt.contractAddress as string,
|
||||
provider,
|
||||
txDefaults,
|
||||
abiDependencies,
|
||||
logDecodeDependencies,
|
||||
);
|
||||
contractInstance.constructorArgs = [];
|
||||
return contractInstance;
|
||||
|
||||
@@ -29,7 +29,6 @@ import { SimpleContractArtifact } from '@0x/types';
|
||||
import { Web3Wrapper } from '@0x/web3-wrapper';
|
||||
import { assert } from '@0x/assert';
|
||||
import * as ethers from 'ethers';
|
||||
import * as _ from 'lodash';
|
||||
// tslint:enable:no-unused-variable
|
||||
|
||||
export type ERC20TokenEventArgs = ERC20TokenTransferEventArgs | ERC20TokenApprovalEventArgs;
|
||||
@@ -593,7 +592,7 @@ export class ERC20TokenContract extends BaseContract {
|
||||
artifact: ContractArtifact | SimpleContractArtifact,
|
||||
supportedProvider: SupportedProvider,
|
||||
txDefaults: Partial<TxData>,
|
||||
artifactDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact },
|
||||
logDecodeDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact },
|
||||
): Promise<ERC20TokenContract> {
|
||||
assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [
|
||||
schemas.addressSchema,
|
||||
@@ -606,20 +605,18 @@ export class ERC20TokenContract extends BaseContract {
|
||||
const provider = providerUtils.standardizeOrThrow(supportedProvider);
|
||||
const bytecode = artifact.compilerOutput.evm.bytecode.object;
|
||||
const abi = artifact.compilerOutput.abi;
|
||||
const abiDependencies = _.mapValues(
|
||||
artifactDependencies,
|
||||
(artifactDependency: ContractArtifact | SimpleContractArtifact) => {
|
||||
return artifactDependency.compilerOutput.abi;
|
||||
},
|
||||
const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce(
|
||||
(accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }),
|
||||
{},
|
||||
);
|
||||
return ERC20TokenContract.deployAsync(bytecode, abi, provider, txDefaults, abiDependencies);
|
||||
return ERC20TokenContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly);
|
||||
}
|
||||
public static async deployAsync(
|
||||
bytecode: string,
|
||||
abi: ContractAbi,
|
||||
supportedProvider: SupportedProvider,
|
||||
txDefaults: Partial<TxData>,
|
||||
abiDependencies: { [contractName: string]: ContractAbi },
|
||||
logDecodeDependencies: { [contractName: string]: ContractAbi },
|
||||
): Promise<ERC20TokenContract> {
|
||||
assert.isHexString('bytecode', bytecode);
|
||||
assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [
|
||||
@@ -647,7 +644,7 @@ export class ERC20TokenContract extends BaseContract {
|
||||
txReceipt.contractAddress as string,
|
||||
provider,
|
||||
txDefaults,
|
||||
abiDependencies,
|
||||
logDecodeDependencies,
|
||||
);
|
||||
contractInstance.constructorArgs = [];
|
||||
return contractInstance;
|
||||
|
||||
@@ -29,7 +29,6 @@ import { SimpleContractArtifact } from '@0x/types';
|
||||
import { Web3Wrapper } from '@0x/web3-wrapper';
|
||||
import { assert } from '@0x/assert';
|
||||
import * as ethers from 'ethers';
|
||||
import * as _ from 'lodash';
|
||||
// tslint:enable:no-unused-variable
|
||||
|
||||
export type ERC721ProxyEventArgs =
|
||||
@@ -705,7 +704,7 @@ export class ERC721ProxyContract extends BaseContract {
|
||||
artifact: ContractArtifact | SimpleContractArtifact,
|
||||
supportedProvider: SupportedProvider,
|
||||
txDefaults: Partial<TxData>,
|
||||
artifactDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact },
|
||||
logDecodeDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact },
|
||||
): Promise<ERC721ProxyContract> {
|
||||
assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [
|
||||
schemas.addressSchema,
|
||||
@@ -718,20 +717,18 @@ export class ERC721ProxyContract extends BaseContract {
|
||||
const provider = providerUtils.standardizeOrThrow(supportedProvider);
|
||||
const bytecode = artifact.compilerOutput.evm.bytecode.object;
|
||||
const abi = artifact.compilerOutput.abi;
|
||||
const abiDependencies = _.mapValues(
|
||||
artifactDependencies,
|
||||
(artifactDependency: ContractArtifact | SimpleContractArtifact) => {
|
||||
return artifactDependency.compilerOutput.abi;
|
||||
},
|
||||
const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce(
|
||||
(accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }),
|
||||
{},
|
||||
);
|
||||
return ERC721ProxyContract.deployAsync(bytecode, abi, provider, txDefaults, abiDependencies);
|
||||
return ERC721ProxyContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly);
|
||||
}
|
||||
public static async deployAsync(
|
||||
bytecode: string,
|
||||
abi: ContractAbi,
|
||||
supportedProvider: SupportedProvider,
|
||||
txDefaults: Partial<TxData>,
|
||||
abiDependencies: { [contractName: string]: ContractAbi },
|
||||
logDecodeDependencies: { [contractName: string]: ContractAbi },
|
||||
): Promise<ERC721ProxyContract> {
|
||||
assert.isHexString('bytecode', bytecode);
|
||||
assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [
|
||||
@@ -759,7 +756,7 @@ export class ERC721ProxyContract extends BaseContract {
|
||||
txReceipt.contractAddress as string,
|
||||
provider,
|
||||
txDefaults,
|
||||
abiDependencies,
|
||||
logDecodeDependencies,
|
||||
);
|
||||
contractInstance.constructorArgs = [];
|
||||
return contractInstance;
|
||||
|
||||
@@ -29,7 +29,6 @@ import { SimpleContractArtifact } from '@0x/types';
|
||||
import { Web3Wrapper } from '@0x/web3-wrapper';
|
||||
import { assert } from '@0x/assert';
|
||||
import * as ethers from 'ethers';
|
||||
import * as _ from 'lodash';
|
||||
// tslint:enable:no-unused-variable
|
||||
|
||||
export type ERC721TokenEventArgs =
|
||||
@@ -986,7 +985,7 @@ export class ERC721TokenContract extends BaseContract {
|
||||
artifact: ContractArtifact | SimpleContractArtifact,
|
||||
supportedProvider: SupportedProvider,
|
||||
txDefaults: Partial<TxData>,
|
||||
artifactDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact },
|
||||
logDecodeDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact },
|
||||
): Promise<ERC721TokenContract> {
|
||||
assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [
|
||||
schemas.addressSchema,
|
||||
@@ -999,20 +998,18 @@ export class ERC721TokenContract extends BaseContract {
|
||||
const provider = providerUtils.standardizeOrThrow(supportedProvider);
|
||||
const bytecode = artifact.compilerOutput.evm.bytecode.object;
|
||||
const abi = artifact.compilerOutput.abi;
|
||||
const abiDependencies = _.mapValues(
|
||||
artifactDependencies,
|
||||
(artifactDependency: ContractArtifact | SimpleContractArtifact) => {
|
||||
return artifactDependency.compilerOutput.abi;
|
||||
},
|
||||
const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce(
|
||||
(accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }),
|
||||
{},
|
||||
);
|
||||
return ERC721TokenContract.deployAsync(bytecode, abi, provider, txDefaults, abiDependencies);
|
||||
return ERC721TokenContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly);
|
||||
}
|
||||
public static async deployAsync(
|
||||
bytecode: string,
|
||||
abi: ContractAbi,
|
||||
supportedProvider: SupportedProvider,
|
||||
txDefaults: Partial<TxData>,
|
||||
abiDependencies: { [contractName: string]: ContractAbi },
|
||||
logDecodeDependencies: { [contractName: string]: ContractAbi },
|
||||
): Promise<ERC721TokenContract> {
|
||||
assert.isHexString('bytecode', bytecode);
|
||||
assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [
|
||||
@@ -1040,7 +1037,7 @@ export class ERC721TokenContract extends BaseContract {
|
||||
txReceipt.contractAddress as string,
|
||||
provider,
|
||||
txDefaults,
|
||||
abiDependencies,
|
||||
logDecodeDependencies,
|
||||
);
|
||||
contractInstance.constructorArgs = [];
|
||||
return contractInstance;
|
||||
|
||||
@@ -21,7 +21,6 @@ import { SimpleContractArtifact } from '@0x/types';
|
||||
import { Web3Wrapper } from '@0x/web3-wrapper';
|
||||
import { assert } from '@0x/assert';
|
||||
import * as ethers from 'ethers';
|
||||
import * as _ from 'lodash';
|
||||
// tslint:enable:no-unused-variable
|
||||
|
||||
/* istanbul ignore next */
|
||||
@@ -76,7 +75,7 @@ export class EthBalanceCheckerContract extends BaseContract {
|
||||
artifact: ContractArtifact | SimpleContractArtifact,
|
||||
supportedProvider: SupportedProvider,
|
||||
txDefaults: Partial<TxData>,
|
||||
artifactDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact },
|
||||
logDecodeDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact },
|
||||
): Promise<EthBalanceCheckerContract> {
|
||||
assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [
|
||||
schemas.addressSchema,
|
||||
@@ -89,20 +88,18 @@ export class EthBalanceCheckerContract extends BaseContract {
|
||||
const provider = providerUtils.standardizeOrThrow(supportedProvider);
|
||||
const bytecode = artifact.compilerOutput.evm.bytecode.object;
|
||||
const abi = artifact.compilerOutput.abi;
|
||||
const abiDependencies = _.mapValues(
|
||||
artifactDependencies,
|
||||
(artifactDependency: ContractArtifact | SimpleContractArtifact) => {
|
||||
return artifactDependency.compilerOutput.abi;
|
||||
},
|
||||
const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce(
|
||||
(accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }),
|
||||
{},
|
||||
);
|
||||
return EthBalanceCheckerContract.deployAsync(bytecode, abi, provider, txDefaults, abiDependencies);
|
||||
return EthBalanceCheckerContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly);
|
||||
}
|
||||
public static async deployAsync(
|
||||
bytecode: string,
|
||||
abi: ContractAbi,
|
||||
supportedProvider: SupportedProvider,
|
||||
txDefaults: Partial<TxData>,
|
||||
abiDependencies: { [contractName: string]: ContractAbi },
|
||||
logDecodeDependencies: { [contractName: string]: ContractAbi },
|
||||
): Promise<EthBalanceCheckerContract> {
|
||||
assert.isHexString('bytecode', bytecode);
|
||||
assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [
|
||||
@@ -130,7 +127,7 @@ export class EthBalanceCheckerContract extends BaseContract {
|
||||
txReceipt.contractAddress as string,
|
||||
provider,
|
||||
txDefaults,
|
||||
abiDependencies,
|
||||
logDecodeDependencies,
|
||||
);
|
||||
contractInstance.constructorArgs = [];
|
||||
return contractInstance;
|
||||
|
||||
@@ -29,7 +29,6 @@ import { SimpleContractArtifact } from '@0x/types';
|
||||
import { Web3Wrapper } from '@0x/web3-wrapper';
|
||||
import { assert } from '@0x/assert';
|
||||
import * as ethers from 'ethers';
|
||||
import * as _ from 'lodash';
|
||||
// tslint:enable:no-unused-variable
|
||||
|
||||
export type ExchangeEventArgs =
|
||||
@@ -4569,7 +4568,7 @@ export class ExchangeContract extends BaseContract {
|
||||
artifact: ContractArtifact | SimpleContractArtifact,
|
||||
supportedProvider: SupportedProvider,
|
||||
txDefaults: Partial<TxData>,
|
||||
artifactDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact },
|
||||
logDecodeDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact },
|
||||
_zrxAssetData: string,
|
||||
): Promise<ExchangeContract> {
|
||||
assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [
|
||||
@@ -4583,20 +4582,25 @@ export class ExchangeContract extends BaseContract {
|
||||
const provider = providerUtils.standardizeOrThrow(supportedProvider);
|
||||
const bytecode = artifact.compilerOutput.evm.bytecode.object;
|
||||
const abi = artifact.compilerOutput.abi;
|
||||
const abiDependencies = _.mapValues(
|
||||
artifactDependencies,
|
||||
(artifactDependency: ContractArtifact | SimpleContractArtifact) => {
|
||||
return artifactDependency.compilerOutput.abi;
|
||||
},
|
||||
const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce(
|
||||
(accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }),
|
||||
{},
|
||||
);
|
||||
return ExchangeContract.deployAsync(
|
||||
bytecode,
|
||||
abi,
|
||||
provider,
|
||||
txDefaults,
|
||||
logDecodeDependenciesAbiOnly,
|
||||
_zrxAssetData,
|
||||
);
|
||||
return ExchangeContract.deployAsync(bytecode, abi, provider, txDefaults, abiDependencies, _zrxAssetData);
|
||||
}
|
||||
public static async deployAsync(
|
||||
bytecode: string,
|
||||
abi: ContractAbi,
|
||||
supportedProvider: SupportedProvider,
|
||||
txDefaults: Partial<TxData>,
|
||||
abiDependencies: { [contractName: string]: ContractAbi },
|
||||
logDecodeDependencies: { [contractName: string]: ContractAbi },
|
||||
_zrxAssetData: string,
|
||||
): Promise<ExchangeContract> {
|
||||
assert.isHexString('bytecode', bytecode);
|
||||
@@ -4629,7 +4633,7 @@ export class ExchangeContract extends BaseContract {
|
||||
txReceipt.contractAddress as string,
|
||||
provider,
|
||||
txDefaults,
|
||||
abiDependencies,
|
||||
logDecodeDependencies,
|
||||
);
|
||||
contractInstance.constructorArgs = [_zrxAssetData];
|
||||
return contractInstance;
|
||||
|
||||
@@ -21,7 +21,6 @@ import { SimpleContractArtifact } from '@0x/types';
|
||||
import { Web3Wrapper } from '@0x/web3-wrapper';
|
||||
import { assert } from '@0x/assert';
|
||||
import * as ethers from 'ethers';
|
||||
import * as _ from 'lodash';
|
||||
// tslint:enable:no-unused-variable
|
||||
|
||||
/* istanbul ignore next */
|
||||
@@ -1042,7 +1041,7 @@ export class ForwarderContract extends BaseContract {
|
||||
artifact: ContractArtifact | SimpleContractArtifact,
|
||||
supportedProvider: SupportedProvider,
|
||||
txDefaults: Partial<TxData>,
|
||||
artifactDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact },
|
||||
logDecodeDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact },
|
||||
_exchange: string,
|
||||
_zrxAssetData: string,
|
||||
_wethAssetData: string,
|
||||
@@ -1058,18 +1057,16 @@ export class ForwarderContract extends BaseContract {
|
||||
const provider = providerUtils.standardizeOrThrow(supportedProvider);
|
||||
const bytecode = artifact.compilerOutput.evm.bytecode.object;
|
||||
const abi = artifact.compilerOutput.abi;
|
||||
const abiDependencies = _.mapValues(
|
||||
artifactDependencies,
|
||||
(artifactDependency: ContractArtifact | SimpleContractArtifact) => {
|
||||
return artifactDependency.compilerOutput.abi;
|
||||
},
|
||||
const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce(
|
||||
(accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }),
|
||||
{},
|
||||
);
|
||||
return ForwarderContract.deployAsync(
|
||||
bytecode,
|
||||
abi,
|
||||
provider,
|
||||
txDefaults,
|
||||
abiDependencies,
|
||||
logDecodeDependenciesAbiOnly,
|
||||
_exchange,
|
||||
_zrxAssetData,
|
||||
_wethAssetData,
|
||||
@@ -1080,7 +1077,7 @@ export class ForwarderContract extends BaseContract {
|
||||
abi: ContractAbi,
|
||||
supportedProvider: SupportedProvider,
|
||||
txDefaults: Partial<TxData>,
|
||||
abiDependencies: { [contractName: string]: ContractAbi },
|
||||
logDecodeDependencies: { [contractName: string]: ContractAbi },
|
||||
_exchange: string,
|
||||
_zrxAssetData: string,
|
||||
_wethAssetData: string,
|
||||
@@ -1115,7 +1112,7 @@ export class ForwarderContract extends BaseContract {
|
||||
txReceipt.contractAddress as string,
|
||||
provider,
|
||||
txDefaults,
|
||||
abiDependencies,
|
||||
logDecodeDependencies,
|
||||
);
|
||||
contractInstance.constructorArgs = [_exchange, _zrxAssetData, _wethAssetData];
|
||||
return contractInstance;
|
||||
|
||||
@@ -21,7 +21,6 @@ import { SimpleContractArtifact } from '@0x/types';
|
||||
import { Web3Wrapper } from '@0x/web3-wrapper';
|
||||
import { assert } from '@0x/assert';
|
||||
import * as ethers from 'ethers';
|
||||
import * as _ from 'lodash';
|
||||
// tslint:enable:no-unused-variable
|
||||
|
||||
/* istanbul ignore next */
|
||||
@@ -710,7 +709,7 @@ export class IAssetProxyContract extends BaseContract {
|
||||
artifact: ContractArtifact | SimpleContractArtifact,
|
||||
supportedProvider: SupportedProvider,
|
||||
txDefaults: Partial<TxData>,
|
||||
artifactDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact },
|
||||
logDecodeDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact },
|
||||
): Promise<IAssetProxyContract> {
|
||||
assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [
|
||||
schemas.addressSchema,
|
||||
@@ -723,20 +722,18 @@ export class IAssetProxyContract extends BaseContract {
|
||||
const provider = providerUtils.standardizeOrThrow(supportedProvider);
|
||||
const bytecode = artifact.compilerOutput.evm.bytecode.object;
|
||||
const abi = artifact.compilerOutput.abi;
|
||||
const abiDependencies = _.mapValues(
|
||||
artifactDependencies,
|
||||
(artifactDependency: ContractArtifact | SimpleContractArtifact) => {
|
||||
return artifactDependency.compilerOutput.abi;
|
||||
},
|
||||
const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce(
|
||||
(accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }),
|
||||
{},
|
||||
);
|
||||
return IAssetProxyContract.deployAsync(bytecode, abi, provider, txDefaults, abiDependencies);
|
||||
return IAssetProxyContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly);
|
||||
}
|
||||
public static async deployAsync(
|
||||
bytecode: string,
|
||||
abi: ContractAbi,
|
||||
supportedProvider: SupportedProvider,
|
||||
txDefaults: Partial<TxData>,
|
||||
abiDependencies: { [contractName: string]: ContractAbi },
|
||||
logDecodeDependencies: { [contractName: string]: ContractAbi },
|
||||
): Promise<IAssetProxyContract> {
|
||||
assert.isHexString('bytecode', bytecode);
|
||||
assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [
|
||||
@@ -764,7 +761,7 @@ export class IAssetProxyContract extends BaseContract {
|
||||
txReceipt.contractAddress as string,
|
||||
provider,
|
||||
txDefaults,
|
||||
abiDependencies,
|
||||
logDecodeDependencies,
|
||||
);
|
||||
contractInstance.constructorArgs = [];
|
||||
return contractInstance;
|
||||
|
||||
@@ -21,7 +21,6 @@ import { SimpleContractArtifact } from '@0x/types';
|
||||
import { Web3Wrapper } from '@0x/web3-wrapper';
|
||||
import { assert } from '@0x/assert';
|
||||
import * as ethers from 'ethers';
|
||||
import * as _ from 'lodash';
|
||||
// tslint:enable:no-unused-variable
|
||||
|
||||
/* istanbul ignore next */
|
||||
@@ -90,7 +89,7 @@ export class IValidatorContract extends BaseContract {
|
||||
artifact: ContractArtifact | SimpleContractArtifact,
|
||||
supportedProvider: SupportedProvider,
|
||||
txDefaults: Partial<TxData>,
|
||||
artifactDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact },
|
||||
logDecodeDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact },
|
||||
): Promise<IValidatorContract> {
|
||||
assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [
|
||||
schemas.addressSchema,
|
||||
@@ -103,20 +102,18 @@ export class IValidatorContract extends BaseContract {
|
||||
const provider = providerUtils.standardizeOrThrow(supportedProvider);
|
||||
const bytecode = artifact.compilerOutput.evm.bytecode.object;
|
||||
const abi = artifact.compilerOutput.abi;
|
||||
const abiDependencies = _.mapValues(
|
||||
artifactDependencies,
|
||||
(artifactDependency: ContractArtifact | SimpleContractArtifact) => {
|
||||
return artifactDependency.compilerOutput.abi;
|
||||
},
|
||||
const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce(
|
||||
(accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }),
|
||||
{},
|
||||
);
|
||||
return IValidatorContract.deployAsync(bytecode, abi, provider, txDefaults, abiDependencies);
|
||||
return IValidatorContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly);
|
||||
}
|
||||
public static async deployAsync(
|
||||
bytecode: string,
|
||||
abi: ContractAbi,
|
||||
supportedProvider: SupportedProvider,
|
||||
txDefaults: Partial<TxData>,
|
||||
abiDependencies: { [contractName: string]: ContractAbi },
|
||||
logDecodeDependencies: { [contractName: string]: ContractAbi },
|
||||
): Promise<IValidatorContract> {
|
||||
assert.isHexString('bytecode', bytecode);
|
||||
assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [
|
||||
@@ -144,7 +141,7 @@ export class IValidatorContract extends BaseContract {
|
||||
txReceipt.contractAddress as string,
|
||||
provider,
|
||||
txDefaults,
|
||||
abiDependencies,
|
||||
logDecodeDependencies,
|
||||
);
|
||||
contractInstance.constructorArgs = [];
|
||||
return contractInstance;
|
||||
|
||||
@@ -21,7 +21,6 @@ import { SimpleContractArtifact } from '@0x/types';
|
||||
import { Web3Wrapper } from '@0x/web3-wrapper';
|
||||
import { assert } from '@0x/assert';
|
||||
import * as ethers from 'ethers';
|
||||
import * as _ from 'lodash';
|
||||
// tslint:enable:no-unused-variable
|
||||
|
||||
/* istanbul ignore next */
|
||||
@@ -82,7 +81,7 @@ export class IWalletContract extends BaseContract {
|
||||
artifact: ContractArtifact | SimpleContractArtifact,
|
||||
supportedProvider: SupportedProvider,
|
||||
txDefaults: Partial<TxData>,
|
||||
artifactDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact },
|
||||
logDecodeDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact },
|
||||
): Promise<IWalletContract> {
|
||||
assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [
|
||||
schemas.addressSchema,
|
||||
@@ -95,20 +94,18 @@ export class IWalletContract extends BaseContract {
|
||||
const provider = providerUtils.standardizeOrThrow(supportedProvider);
|
||||
const bytecode = artifact.compilerOutput.evm.bytecode.object;
|
||||
const abi = artifact.compilerOutput.abi;
|
||||
const abiDependencies = _.mapValues(
|
||||
artifactDependencies,
|
||||
(artifactDependency: ContractArtifact | SimpleContractArtifact) => {
|
||||
return artifactDependency.compilerOutput.abi;
|
||||
},
|
||||
const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce(
|
||||
(accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }),
|
||||
{},
|
||||
);
|
||||
return IWalletContract.deployAsync(bytecode, abi, provider, txDefaults, abiDependencies);
|
||||
return IWalletContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly);
|
||||
}
|
||||
public static async deployAsync(
|
||||
bytecode: string,
|
||||
abi: ContractAbi,
|
||||
supportedProvider: SupportedProvider,
|
||||
txDefaults: Partial<TxData>,
|
||||
abiDependencies: { [contractName: string]: ContractAbi },
|
||||
logDecodeDependencies: { [contractName: string]: ContractAbi },
|
||||
): Promise<IWalletContract> {
|
||||
assert.isHexString('bytecode', bytecode);
|
||||
assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [
|
||||
@@ -136,7 +133,7 @@ export class IWalletContract extends BaseContract {
|
||||
txReceipt.contractAddress as string,
|
||||
provider,
|
||||
txDefaults,
|
||||
abiDependencies,
|
||||
logDecodeDependencies,
|
||||
);
|
||||
contractInstance.constructorArgs = [];
|
||||
return contractInstance;
|
||||
|
||||
@@ -29,7 +29,6 @@ import { SimpleContractArtifact } from '@0x/types';
|
||||
import { Web3Wrapper } from '@0x/web3-wrapper';
|
||||
import { assert } from '@0x/assert';
|
||||
import * as ethers from 'ethers';
|
||||
import * as _ from 'lodash';
|
||||
// tslint:enable:no-unused-variable
|
||||
|
||||
export type MultiAssetProxyEventArgs =
|
||||
@@ -902,7 +901,7 @@ export class MultiAssetProxyContract extends BaseContract {
|
||||
artifact: ContractArtifact | SimpleContractArtifact,
|
||||
supportedProvider: SupportedProvider,
|
||||
txDefaults: Partial<TxData>,
|
||||
artifactDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact },
|
||||
logDecodeDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact },
|
||||
): Promise<MultiAssetProxyContract> {
|
||||
assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [
|
||||
schemas.addressSchema,
|
||||
@@ -915,20 +914,18 @@ export class MultiAssetProxyContract extends BaseContract {
|
||||
const provider = providerUtils.standardizeOrThrow(supportedProvider);
|
||||
const bytecode = artifact.compilerOutput.evm.bytecode.object;
|
||||
const abi = artifact.compilerOutput.abi;
|
||||
const abiDependencies = _.mapValues(
|
||||
artifactDependencies,
|
||||
(artifactDependency: ContractArtifact | SimpleContractArtifact) => {
|
||||
return artifactDependency.compilerOutput.abi;
|
||||
},
|
||||
const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce(
|
||||
(accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }),
|
||||
{},
|
||||
);
|
||||
return MultiAssetProxyContract.deployAsync(bytecode, abi, provider, txDefaults, abiDependencies);
|
||||
return MultiAssetProxyContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly);
|
||||
}
|
||||
public static async deployAsync(
|
||||
bytecode: string,
|
||||
abi: ContractAbi,
|
||||
supportedProvider: SupportedProvider,
|
||||
txDefaults: Partial<TxData>,
|
||||
abiDependencies: { [contractName: string]: ContractAbi },
|
||||
logDecodeDependencies: { [contractName: string]: ContractAbi },
|
||||
): Promise<MultiAssetProxyContract> {
|
||||
assert.isHexString('bytecode', bytecode);
|
||||
assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [
|
||||
@@ -956,7 +953,7 @@ export class MultiAssetProxyContract extends BaseContract {
|
||||
txReceipt.contractAddress as string,
|
||||
provider,
|
||||
txDefaults,
|
||||
abiDependencies,
|
||||
logDecodeDependencies,
|
||||
);
|
||||
contractInstance.constructorArgs = [];
|
||||
return contractInstance;
|
||||
|
||||
@@ -21,7 +21,6 @@ import { SimpleContractArtifact } from '@0x/types';
|
||||
import { Web3Wrapper } from '@0x/web3-wrapper';
|
||||
import { assert } from '@0x/assert';
|
||||
import * as ethers from 'ethers';
|
||||
import * as _ from 'lodash';
|
||||
// tslint:enable:no-unused-variable
|
||||
|
||||
/* istanbul ignore next */
|
||||
@@ -619,7 +618,7 @@ export class OrderValidatorContract extends BaseContract {
|
||||
artifact: ContractArtifact | SimpleContractArtifact,
|
||||
supportedProvider: SupportedProvider,
|
||||
txDefaults: Partial<TxData>,
|
||||
artifactDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact },
|
||||
logDecodeDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact },
|
||||
_exchange: string,
|
||||
_zrxAssetData: string,
|
||||
): Promise<OrderValidatorContract> {
|
||||
@@ -634,18 +633,16 @@ export class OrderValidatorContract extends BaseContract {
|
||||
const provider = providerUtils.standardizeOrThrow(supportedProvider);
|
||||
const bytecode = artifact.compilerOutput.evm.bytecode.object;
|
||||
const abi = artifact.compilerOutput.abi;
|
||||
const abiDependencies = _.mapValues(
|
||||
artifactDependencies,
|
||||
(artifactDependency: ContractArtifact | SimpleContractArtifact) => {
|
||||
return artifactDependency.compilerOutput.abi;
|
||||
},
|
||||
const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce(
|
||||
(accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }),
|
||||
{},
|
||||
);
|
||||
return OrderValidatorContract.deployAsync(
|
||||
bytecode,
|
||||
abi,
|
||||
provider,
|
||||
txDefaults,
|
||||
abiDependencies,
|
||||
logDecodeDependenciesAbiOnly,
|
||||
_exchange,
|
||||
_zrxAssetData,
|
||||
);
|
||||
@@ -655,7 +652,7 @@ export class OrderValidatorContract extends BaseContract {
|
||||
abi: ContractAbi,
|
||||
supportedProvider: SupportedProvider,
|
||||
txDefaults: Partial<TxData>,
|
||||
abiDependencies: { [contractName: string]: ContractAbi },
|
||||
logDecodeDependencies: { [contractName: string]: ContractAbi },
|
||||
_exchange: string,
|
||||
_zrxAssetData: string,
|
||||
): Promise<OrderValidatorContract> {
|
||||
@@ -689,7 +686,7 @@ export class OrderValidatorContract extends BaseContract {
|
||||
txReceipt.contractAddress as string,
|
||||
provider,
|
||||
txDefaults,
|
||||
abiDependencies,
|
||||
logDecodeDependencies,
|
||||
);
|
||||
contractInstance.constructorArgs = [_exchange, _zrxAssetData];
|
||||
return contractInstance;
|
||||
|
||||
@@ -29,7 +29,6 @@ import { SimpleContractArtifact } from '@0x/types';
|
||||
import { Web3Wrapper } from '@0x/web3-wrapper';
|
||||
import { assert } from '@0x/assert';
|
||||
import * as ethers from 'ethers';
|
||||
import * as _ from 'lodash';
|
||||
// tslint:enable:no-unused-variable
|
||||
|
||||
export type WETH9EventArgs =
|
||||
@@ -898,7 +897,7 @@ export class WETH9Contract extends BaseContract {
|
||||
artifact: ContractArtifact | SimpleContractArtifact,
|
||||
supportedProvider: SupportedProvider,
|
||||
txDefaults: Partial<TxData>,
|
||||
artifactDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact },
|
||||
logDecodeDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact },
|
||||
): Promise<WETH9Contract> {
|
||||
assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [
|
||||
schemas.addressSchema,
|
||||
@@ -911,20 +910,18 @@ export class WETH9Contract extends BaseContract {
|
||||
const provider = providerUtils.standardizeOrThrow(supportedProvider);
|
||||
const bytecode = artifact.compilerOutput.evm.bytecode.object;
|
||||
const abi = artifact.compilerOutput.abi;
|
||||
const abiDependencies = _.mapValues(
|
||||
artifactDependencies,
|
||||
(artifactDependency: ContractArtifact | SimpleContractArtifact) => {
|
||||
return artifactDependency.compilerOutput.abi;
|
||||
},
|
||||
const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce(
|
||||
(accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }),
|
||||
{},
|
||||
);
|
||||
return WETH9Contract.deployAsync(bytecode, abi, provider, txDefaults, abiDependencies);
|
||||
return WETH9Contract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly);
|
||||
}
|
||||
public static async deployAsync(
|
||||
bytecode: string,
|
||||
abi: ContractAbi,
|
||||
supportedProvider: SupportedProvider,
|
||||
txDefaults: Partial<TxData>,
|
||||
abiDependencies: { [contractName: string]: ContractAbi },
|
||||
logDecodeDependencies: { [contractName: string]: ContractAbi },
|
||||
): Promise<WETH9Contract> {
|
||||
assert.isHexString('bytecode', bytecode);
|
||||
assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [
|
||||
@@ -952,7 +949,7 @@ export class WETH9Contract extends BaseContract {
|
||||
txReceipt.contractAddress as string,
|
||||
provider,
|
||||
txDefaults,
|
||||
abiDependencies,
|
||||
logDecodeDependencies,
|
||||
);
|
||||
contractInstance.constructorArgs = [];
|
||||
return contractInstance;
|
||||
|
||||
@@ -29,7 +29,6 @@ import { SimpleContractArtifact } from '@0x/types';
|
||||
import { Web3Wrapper } from '@0x/web3-wrapper';
|
||||
import { assert } from '@0x/assert';
|
||||
import * as ethers from 'ethers';
|
||||
import * as _ from 'lodash';
|
||||
// tslint:enable:no-unused-variable
|
||||
|
||||
export type ZRXTokenEventArgs = ZRXTokenTransferEventArgs | ZRXTokenApprovalEventArgs;
|
||||
@@ -707,7 +706,7 @@ export class ZRXTokenContract extends BaseContract {
|
||||
artifact: ContractArtifact | SimpleContractArtifact,
|
||||
supportedProvider: SupportedProvider,
|
||||
txDefaults: Partial<TxData>,
|
||||
artifactDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact },
|
||||
logDecodeDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact },
|
||||
): Promise<ZRXTokenContract> {
|
||||
assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [
|
||||
schemas.addressSchema,
|
||||
@@ -720,20 +719,18 @@ export class ZRXTokenContract extends BaseContract {
|
||||
const provider = providerUtils.standardizeOrThrow(supportedProvider);
|
||||
const bytecode = artifact.compilerOutput.evm.bytecode.object;
|
||||
const abi = artifact.compilerOutput.abi;
|
||||
const abiDependencies = _.mapValues(
|
||||
artifactDependencies,
|
||||
(artifactDependency: ContractArtifact | SimpleContractArtifact) => {
|
||||
return artifactDependency.compilerOutput.abi;
|
||||
},
|
||||
const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce(
|
||||
(accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }),
|
||||
{},
|
||||
);
|
||||
return ZRXTokenContract.deployAsync(bytecode, abi, provider, txDefaults, abiDependencies);
|
||||
return ZRXTokenContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly);
|
||||
}
|
||||
public static async deployAsync(
|
||||
bytecode: string,
|
||||
abi: ContractAbi,
|
||||
supportedProvider: SupportedProvider,
|
||||
txDefaults: Partial<TxData>,
|
||||
abiDependencies: { [contractName: string]: ContractAbi },
|
||||
logDecodeDependencies: { [contractName: string]: ContractAbi },
|
||||
): Promise<ZRXTokenContract> {
|
||||
assert.isHexString('bytecode', bytecode);
|
||||
assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [
|
||||
@@ -761,7 +758,7 @@ export class ZRXTokenContract extends BaseContract {
|
||||
txReceipt.contractAddress as string,
|
||||
provider,
|
||||
txDefaults,
|
||||
abiDependencies,
|
||||
logDecodeDependencies,
|
||||
);
|
||||
contractInstance.constructorArgs = [];
|
||||
return contractInstance;
|
||||
|
||||
@@ -180,13 +180,20 @@ export class BaseContract {
|
||||
const abiEncodedArguments = abiEncoder.encode(functionArguments);
|
||||
return abiEncodedArguments;
|
||||
}
|
||||
/// @dev Constructs a contract wrapper.
|
||||
/// @param contractName Name of contract.
|
||||
/// @param abi of the contract.
|
||||
/// @param address of the deployed contract.
|
||||
/// @param supportedProvider for communicating with an ethereum node.
|
||||
/// @param logDecodeDependencies the name and ABI of contracts whose event logs are
|
||||
/// decoded by this wrapper.
|
||||
constructor(
|
||||
contractName: string,
|
||||
abi: ContractAbi,
|
||||
address: string,
|
||||
supportedProvider: SupportedProvider,
|
||||
callAndTxnDefaults?: Partial<CallData>,
|
||||
abiDependencies?: { [contractName: string]: ContractAbi },
|
||||
logDecodeDependencies?: { [contractName: string]: ContractAbi },
|
||||
) {
|
||||
assert.isString('contractName', contractName);
|
||||
assert.isETHAddressHex('address', address);
|
||||
@@ -212,8 +219,8 @@ export class BaseContract {
|
||||
this._abiEncoderByFunctionSignature[functionSignature] = abiEncoder;
|
||||
this._web3Wrapper.abiDecoder.addABI(abi, contractName);
|
||||
});
|
||||
_.each(abiDependencies, (abiDependency, contractDependencyName) => {
|
||||
this._web3Wrapper.abiDecoder.addABI(abiDependency, contractDependencyName);
|
||||
_.each(logDecodeDependencies, (dependencyAbi, dependencyName) => {
|
||||
this._web3Wrapper.abiDecoder.addABI(dependencyAbi, dependencyName);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user