aboutsummaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2018-08-22 06:58:06 +0800
committerFabio Berger <me@fabioberger.com>2018-08-22 06:58:06 +0800
commit301cb296ec77e8af5c1722679e04cb983c848153 (patch)
treec4f3c94c2f76e47d7b12d3761af57c15819c9cc2 /packages
parent1bbd7bf870730dfe2146819e3740522990eb83ca (diff)
downloaddexon-0x-contracts-301cb296ec77e8af5c1722679e04cb983c848153.tar
dexon-0x-contracts-301cb296ec77e8af5c1722679e04cb983c848153.tar.gz
dexon-0x-contracts-301cb296ec77e8af5c1722679e04cb983c848153.tar.bz2
dexon-0x-contracts-301cb296ec77e8af5c1722679e04cb983c848153.tar.lz
dexon-0x-contracts-301cb296ec77e8af5c1722679e04cb983c848153.tar.xz
dexon-0x-contracts-301cb296ec77e8af5c1722679e04cb983c848153.tar.zst
dexon-0x-contracts-301cb296ec77e8af5c1722679e04cb983c848153.zip
Move types from sol-compiler to types so they can be used in other places without requiring sol-compiler as a dep
Diffstat (limited to 'packages')
-rw-r--r--packages/0x.js/package.json1
-rw-r--r--packages/0x.js/src/index.ts13
-rw-r--r--packages/contract-wrappers/package.json1
-rw-r--r--packages/contract-wrappers/src/artifacts.ts2
-rw-r--r--packages/contract-wrappers/src/contract_wrappers/contract_wrapper.ts2
-rw-r--r--packages/contract-wrappers/src/index.ts5
-rw-r--r--packages/contract_templates/contract.handlebars2
-rw-r--r--packages/contracts/package.json2
-rw-r--r--packages/contracts/test/utils/artifacts.ts2
-rw-r--r--packages/contracts/test/utils/log_decoder.ts2
-rw-r--r--packages/ethereum-types/CHANGELOG.json3
-rw-r--r--packages/ethereum-types/src/index.ts161
-rw-r--r--packages/fill-scenarios/package.json1
-rw-r--r--packages/fill-scenarios/src/artifacts.ts2
-rw-r--r--packages/metacoin/package.json2
-rw-r--r--packages/metacoin/test/metacoin_test.ts2
-rw-r--r--packages/migrations/package.json1
-rw-r--r--packages/migrations/src/1.0.0/artifacts.ts2
-rw-r--r--packages/migrations/src/2.0.0-beta-testnet/artifacts.ts2
-rw-r--r--packages/migrations/src/2.0.0/artifacts.ts2
-rw-r--r--packages/migrations/src/utils/artifact_writer.ts2
-rw-r--r--packages/order-utils/package.json1
-rw-r--r--packages/order-utils/src/artifacts.ts2
-rw-r--r--packages/order-watcher/package.json1
-rw-r--r--packages/sol-compiler/src/compiler.ts2
-rw-r--r--packages/sol-compiler/src/index.ts3
-rw-r--r--packages/sol-compiler/src/utils/compiler.ts2
-rw-r--r--packages/sol-compiler/src/utils/types.ts74
-rw-r--r--packages/sol-compiler/test/compiler_test.ts2
-rw-r--r--packages/sol-cov/src/artifact_adapters/sol_compiler_artifact_adapter.ts2
30 files changed, 190 insertions, 111 deletions
diff --git a/packages/0x.js/package.json b/packages/0x.js/package.json
index 5b1b49510..5911125ed 100644
--- a/packages/0x.js/package.json
+++ b/packages/0x.js/package.json
@@ -79,7 +79,6 @@
"@0xproject/contract-wrappers": "^1.0.1-rc.3",
"@0xproject/order-utils": "^1.0.1-rc.3",
"@0xproject/order-watcher": "1.0.1-rc.3",
- "@0xproject/sol-compiler": "^1.0.5",
"@0xproject/subproviders": "^1.0.5",
"@0xproject/types": "^1.0.1-rc.4",
"@0xproject/typescript-typings": "^1.0.4",
diff --git a/packages/0x.js/src/index.ts b/packages/0x.js/src/index.ts
index 748662c39..ec5581a5c 100644
--- a/packages/0x.js/src/index.ts
+++ b/packages/0x.js/src/index.ts
@@ -72,14 +72,6 @@ export {
} from '@0xproject/types';
export {
- ContractArtifact,
- GeneratedCompilerOptions,
- ContractNetworks,
- ContractNetworkData,
- Source,
-} from '@0xproject/sol-compiler';
-
-export {
BlockParamLiteral,
ContractAbi,
BlockParam,
@@ -105,4 +97,9 @@ export {
DataItem,
ConstructorStateMutability,
StateMutability,
+ ContractArtifact,
+ GeneratedCompilerOptions,
+ ContractNetworks,
+ ContractNetworkData,
+ Source,
} from 'ethereum-types';
diff --git a/packages/contract-wrappers/package.json b/packages/contract-wrappers/package.json
index 86ffa1114..6ce7a775b 100644
--- a/packages/contract-wrappers/package.json
+++ b/packages/contract-wrappers/package.json
@@ -80,7 +80,6 @@
"@0xproject/fill-scenarios": "^1.0.1-rc.3",
"@0xproject/json-schemas": "^1.0.1-rc.4",
"@0xproject/order-utils": "^1.0.1-rc.3",
- "@0xproject/sol-compiler": "^1.0.5",
"@0xproject/types": "^1.0.1-rc.4",
"@0xproject/typescript-typings": "^1.0.4",
"@0xproject/utils": "^1.0.5",
diff --git a/packages/contract-wrappers/src/artifacts.ts b/packages/contract-wrappers/src/artifacts.ts
index 2481b311a..7e67544d2 100644
--- a/packages/contract-wrappers/src/artifacts.ts
+++ b/packages/contract-wrappers/src/artifacts.ts
@@ -1,4 +1,4 @@
-import { ContractArtifact } from '@0xproject/sol-compiler';
+import { ContractArtifact } from 'ethereum-types';
import * as DummyERC20Token from './artifacts/DummyERC20Token.json';
import * as DummyERC721Token from './artifacts/DummyERC721Token.json';
diff --git a/packages/contract-wrappers/src/contract_wrappers/contract_wrapper.ts b/packages/contract-wrappers/src/contract_wrappers/contract_wrapper.ts
index daf70253a..490a6c50a 100644
--- a/packages/contract-wrappers/src/contract_wrappers/contract_wrapper.ts
+++ b/packages/contract-wrappers/src/contract_wrappers/contract_wrapper.ts
@@ -1,6 +1,6 @@
-import { ContractArtifact } from '@0xproject/sol-compiler';
import { AbiDecoder, intervalUtils, logUtils } from '@0xproject/utils';
import { Web3Wrapper } from '@0xproject/web3-wrapper';
+import { ContractArtifact } from 'ethereum-types';
import { BlockParamLiteral, ContractAbi, FilterObject, LogEntry, LogWithDecodedArgs, RawLog } from 'ethereum-types';
import { Block, BlockAndLogStreamer, Log } from 'ethereumjs-blockstream';
import * as _ from 'lodash';
diff --git a/packages/contract-wrappers/src/index.ts b/packages/contract-wrappers/src/index.ts
index f7c10dcce..7b9f3cd12 100644
--- a/packages/contract-wrappers/src/index.ts
+++ b/packages/contract-wrappers/src/index.ts
@@ -51,15 +51,12 @@ export {
DataItem,
ConstructorStateMutability,
StateMutability,
-} from 'ethereum-types';
-
-export {
ContractArtifact,
GeneratedCompilerOptions,
ContractNetworks,
Source,
ContractNetworkData,
-} from '@0xproject/sol-compiler';
+} from 'ethereum-types';
export {
WETH9Events,
diff --git a/packages/contract_templates/contract.handlebars b/packages/contract_templates/contract.handlebars
index 0810c4d90..7fd96f4e0 100644
--- a/packages/contract_templates/contract.handlebars
+++ b/packages/contract_templates/contract.handlebars
@@ -1,7 +1,7 @@
// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma whitespace class-name
// tslint:disable:no-unused-variable
import { BaseContract } from '@0xproject/base-contract';
-import { ContractArtifact } from '@0xproject/sol-compiler';
+import { ContractArtifact } from 'ethereum-types';
import { BlockParam, BlockParamLiteral, CallData, ContractAbi, DataItem, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
import { BigNumber, classUtils, logUtils, promisify } from '@0xproject/utils';
import { Web3Wrapper } from '@0xproject/web3-wrapper';
diff --git a/packages/contracts/package.json b/packages/contracts/package.json
index 8bd808a27..3c3ce6792 100644
--- a/packages/contracts/package.json
+++ b/packages/contracts/package.json
@@ -51,6 +51,7 @@
"@0xproject/sol-cov": "^2.0.0",
"@0xproject/subproviders": "^1.0.5",
"@0xproject/tslint-config": "^1.0.5",
+ "@0xproject/sol-compiler": "^1.0.5",
"@types/bn.js": "^4.11.0",
"@types/ethereumjs-abi": "^0.6.0",
"@types/lodash": "4.14.104",
@@ -74,7 +75,6 @@
"dependencies": {
"@0xproject/base-contract": "^2.0.0-rc.1",
"@0xproject/order-utils": "^1.0.1-rc.3",
- "@0xproject/sol-compiler": "^1.0.5",
"@0xproject/types": "^1.0.1-rc.4",
"@0xproject/typescript-typings": "^1.0.4",
"@0xproject/utils": "^1.0.5",
diff --git a/packages/contracts/test/utils/artifacts.ts b/packages/contracts/test/utils/artifacts.ts
index e608ee174..1d5728cba 100644
--- a/packages/contracts/test/utils/artifacts.ts
+++ b/packages/contracts/test/utils/artifacts.ts
@@ -1,4 +1,4 @@
-import { ContractArtifact } from '@0xproject/sol-compiler';
+import { ContractArtifact } from 'ethereum-types';
import * as AssetProxyOwner from '../../artifacts/AssetProxyOwner.json';
import * as DummyERC20Token from '../../artifacts/DummyERC20Token.json';
diff --git a/packages/contracts/test/utils/log_decoder.ts b/packages/contracts/test/utils/log_decoder.ts
index 5a4801319..92e9185d8 100644
--- a/packages/contracts/test/utils/log_decoder.ts
+++ b/packages/contracts/test/utils/log_decoder.ts
@@ -1,4 +1,4 @@
-import { ContractArtifact } from '@0xproject/sol-compiler';
+import { ContractArtifact } from 'ethereum-types';
import { AbiDecoder, BigNumber } from '@0xproject/utils';
import { Web3Wrapper } from '@0xproject/web3-wrapper';
import {
diff --git a/packages/ethereum-types/CHANGELOG.json b/packages/ethereum-types/CHANGELOG.json
index e67d68648..b001f6af3 100644
--- a/packages/ethereum-types/CHANGELOG.json
+++ b/packages/ethereum-types/CHANGELOG.json
@@ -46,6 +46,9 @@
{
"note": "Add `TransactionReceiptStatus` type",
"pr": 812
+ },
+ {
+ "note": "Add Artifact types: `CompilerSettings`, `CompilerOptions`, `OutputField`"
}
]
},
diff --git a/packages/ethereum-types/src/index.ts b/packages/ethereum-types/src/index.ts
index b2af028fb..5ace18452 100644
--- a/packages/ethereum-types/src/index.ts
+++ b/packages/ethereum-types/src/index.ts
@@ -287,3 +287,164 @@ export interface TraceParams {
disableStack?: boolean;
disableStorage?: boolean;
}
+
+export type OutputField =
+ | '*'
+ | 'ast'
+ | 'legacyAST'
+ | 'abi'
+ | 'devdoc'
+ | 'userdoc'
+ | 'metadata'
+ | 'ir'
+ | 'evm.assembly'
+ | 'evm.legacyAssembly'
+ | 'evm.bytecode.object'
+ | 'evm.bytecode.opcodes'
+ | 'evm.bytecode.sourceMap'
+ | 'evm.bytecode.linkReferences'
+ | 'evm.deployedBytecode.object'
+ | 'evm.deployedBytecode.opcodes'
+ | 'evm.deployedBytecode.sourceMap'
+ | 'evm.deployedBytecode.linkReferences'
+ | 'evm.methodIdentifiers'
+ | 'evm.gasEstimates'
+ | 'ewasm.wast'
+ | 'ewasm.wasm';
+
+export interface CompilerSettings {
+ remappings?: string[];
+ optimizer?: {
+ enabled: boolean;
+ runs?: number;
+ };
+ evmVersion?: 'homestead' | 'tangerineWhistle' | 'spuriousDragon' | 'byzantium' | 'constantinople';
+ metadata?: {
+ useLiteralContent: true;
+ };
+ libraries?: {
+ [fileName: string]: {
+ [libName: string]: string;
+ };
+ };
+ outputSelection: {
+ [fileName: string]: {
+ [contractName: string]: OutputField[];
+ };
+ };
+}
+
+export interface ContractNetworks {
+ [networkId: number]: ContractNetworkData;
+}
+
+export interface ContractNetworkData {
+ address: string;
+ links: {
+ [linkName: string]: string;
+ };
+ constructorArgs: string;
+}
+
+export interface StandardContractOutput {
+ abi: ContractAbi;
+ evm: {
+ bytecode: {
+ object: string;
+ sourceMap: string;
+ };
+ deployedBytecode: {
+ object: string;
+ sourceMap: string;
+ };
+ };
+}
+
+export interface ContractVersionData {
+ compiler: {
+ name: 'solc';
+ version: string;
+ settings: CompilerSettings;
+ };
+ sources: {
+ [sourceName: string]: {
+ id: number;
+ };
+ };
+ sourceCodes: {
+ [sourceName: string]: string;
+ };
+ sourceTreeHashHex: string;
+ compilerOutput: StandardContractOutput;
+}
+
+/**
+ * This type defines the schema of the artifact.json file generated by Sol-compiler
+ * schemaVersion: The version of the artifact schema
+ * contractName: The contract name it represents
+ * networks: Network specific information by network (address, id, constructor args, etc...)
+ * compilerOutput: The Solidity compiler output generated from the specified compiler input
+ * description (http://solidity.readthedocs.io/en/v0.4.24/using-the-compiler.html#compiler-input-and-output-json-description)
+ * compiler: The compiler settings used
+ * sourceCodes: The source code of the contract and all it's dependencies
+ * sources: A mapping from source filePath to sourceMap id
+ * sourceTreeHashHex: A unique hash generated from the contract source and that of it's dependencies.
+ * If any of the sources change, the hash would change notifying us that a re-compilation is necessary
+ */
+export interface ContractArtifact extends ContractVersionData {
+ schemaVersion: string;
+ contractName: string;
+ networks: ContractNetworks;
+}
+
+export interface GeneratedCompilerOptions {
+ name: 'solc';
+ version: string;
+ settings: CompilerSettings;
+}
+
+// Copied from the solc.js library types
+export interface CompilerSettings {
+ remappings?: string[];
+ optimizer?: {
+ enabled: boolean;
+ runs?: number;
+ };
+ evmVersion?: 'homestead' | 'tangerineWhistle' | 'spuriousDragon' | 'byzantium' | 'constantinople';
+ metadata?: {
+ useLiteralContent: true;
+ };
+ libraries?: {
+ [fileName: string]: {
+ [libName: string]: string;
+ };
+ };
+ outputSelection: {
+ [fileName: string]: {
+ [contractName: string]: OutputField[];
+ };
+ };
+}
+
+export interface Source {
+ id: number;
+}
+
+/**
+ * Options you can specify (as flags or in a compiler.json file) when invoking sol-compiler
+ * contractsDir: Directory containing your project's Solidity contracts. Can contain nested directories.
+ * artifactsDir: Directory where you want the generated artifacts.json written to
+ * compilerSettings: Desired settings to pass to the Solidity compiler during compilation.
+ * (http://solidity.readthedocs.io/en/v0.4.24/using-the-compiler.html#compiler-input-and-output-json-description)
+ * contracts: List of contract names you wish to compile, or alternatively ['*'] to compile all contracts in the
+ * specified directory.
+ * solcVersion: If you don't want to compile each contract with the Solidity version specified in-file, you can force all
+ * contracts to compile with the the version specified here.
+ */
+export interface CompilerOptions {
+ contractsDir?: string;
+ artifactsDir?: string;
+ compilerSettings?: CompilerSettings;
+ contracts?: string[] | '*';
+ solcVersion?: string;
+}
diff --git a/packages/fill-scenarios/package.json b/packages/fill-scenarios/package.json
index 122499db6..767032e41 100644
--- a/packages/fill-scenarios/package.json
+++ b/packages/fill-scenarios/package.json
@@ -28,7 +28,6 @@
"homepage": "https://github.com/0xProject/0x-monorepo/packages/fill-scenarios/README.md",
"devDependencies": {
"@0xproject/abi-gen": "^1.0.5",
- "@0xproject/sol-compiler": "^1.0.5",
"@0xproject/tslint-config": "^1.0.5",
"@types/lodash": "4.14.104",
"copyfiles": "^2.0.0",
diff --git a/packages/fill-scenarios/src/artifacts.ts b/packages/fill-scenarios/src/artifacts.ts
index 7f68ae26a..b78ca0cc2 100644
--- a/packages/fill-scenarios/src/artifacts.ts
+++ b/packages/fill-scenarios/src/artifacts.ts
@@ -1,4 +1,4 @@
-import { ContractArtifact } from '@0xproject/sol-compiler';
+import { ContractArtifact } from 'ethereum-types';
import * as DummyERC20Token from './artifacts/DummyERC20Token.json';
import * as DummyERC721Token from './artifacts/DummyERC721Token.json';
diff --git a/packages/metacoin/package.json b/packages/metacoin/package.json
index 322708b50..3337570b6 100644
--- a/packages/metacoin/package.json
+++ b/packages/metacoin/package.json
@@ -31,7 +31,6 @@
"dependencies": {
"@0xproject/abi-gen": "^1.0.5",
"@0xproject/base-contract": "^2.0.0-rc.1",
- "@0xproject/sol-compiler": "^1.0.5",
"@0xproject/sol-cov": "^2.0.0",
"@0xproject/subproviders": "^1.0.5",
"@0xproject/tslint-config": "^1.0.5",
@@ -48,6 +47,7 @@
},
"devDependencies": {
"@0xproject/dev-utils": "^1.0.4",
+ "@0xproject/sol-compiler": "^1.0.5",
"chai": "^4.0.1",
"chai-as-promised": "^7.1.0",
"chai-bignumber": "^2.0.1",
diff --git a/packages/metacoin/test/metacoin_test.ts b/packages/metacoin/test/metacoin_test.ts
index 803e5f786..f112ac060 100644
--- a/packages/metacoin/test/metacoin_test.ts
+++ b/packages/metacoin/test/metacoin_test.ts
@@ -1,5 +1,5 @@
import { BlockchainLifecycle, devConstants } from '@0xproject/dev-utils';
-import { ContractArtifact } from '@0xproject/sol-compiler';
+import { ContractArtifact } from 'ethereum-types';
import { BigNumber } from '@0xproject/utils';
import * as chai from 'chai';
import { LogWithDecodedArgs } from 'ethereum-types';
diff --git a/packages/migrations/package.json b/packages/migrations/package.json
index f196ffad6..ae29cce4e 100644
--- a/packages/migrations/package.json
+++ b/packages/migrations/package.json
@@ -41,6 +41,7 @@
"@0xproject/dev-utils": "^1.0.4",
"@0xproject/tslint-config": "^1.0.5",
"@0xproject/types": "^1.0.1-rc.4",
+ "@0xproject/sol-compiler": "^1.0.5",
"@types/yargs": "^10.0.0",
"copyfiles": "^2.0.0",
"make-promises-safe": "^1.1.0",
diff --git a/packages/migrations/src/1.0.0/artifacts.ts b/packages/migrations/src/1.0.0/artifacts.ts
index d0a9f735a..f5226e174 100644
--- a/packages/migrations/src/1.0.0/artifacts.ts
+++ b/packages/migrations/src/1.0.0/artifacts.ts
@@ -1,4 +1,4 @@
-import { ContractArtifact } from '@0xproject/sol-compiler';
+import { ContractArtifact } from 'ethereum-types';
import * as DummyERC20Token from '../../artifacts/1.0.0/DummyERC20Token.json';
import * as Exchange from '../../artifacts/1.0.0/Exchange_v1.json';
diff --git a/packages/migrations/src/2.0.0-beta-testnet/artifacts.ts b/packages/migrations/src/2.0.0-beta-testnet/artifacts.ts
index c9a341eb3..1c9ffd2d6 100644
--- a/packages/migrations/src/2.0.0-beta-testnet/artifacts.ts
+++ b/packages/migrations/src/2.0.0-beta-testnet/artifacts.ts
@@ -1,4 +1,4 @@
-import { ContractArtifact } from '@0xproject/sol-compiler';
+import { ContractArtifact } from 'ethereum-types';
import * as AssetProxyOwner from '../../artifacts/2.0.0-beta-testnet/AssetProxyOwner.json';
import * as ERC20Proxy from '../../artifacts/2.0.0-beta-testnet/ERC20Proxy.json';
diff --git a/packages/migrations/src/2.0.0/artifacts.ts b/packages/migrations/src/2.0.0/artifacts.ts
index 8bbd1fcd9..8d66e3b63 100644
--- a/packages/migrations/src/2.0.0/artifacts.ts
+++ b/packages/migrations/src/2.0.0/artifacts.ts
@@ -1,4 +1,4 @@
-import { ContractArtifact } from '@0xproject/sol-compiler';
+import { ContractArtifact } from 'ethereum-types';
import * as AssetProxyOwner from '../../artifacts/2.0.0/AssetProxyOwner.json';
import * as DummyERC20Token from '../../artifacts/2.0.0/DummyERC20Token.json';
diff --git a/packages/migrations/src/utils/artifact_writer.ts b/packages/migrations/src/utils/artifact_writer.ts
index b7522df05..ea9c7952d 100644
--- a/packages/migrations/src/utils/artifact_writer.ts
+++ b/packages/migrations/src/utils/artifact_writer.ts
@@ -1,5 +1,5 @@
import { BaseContract } from '@0xproject/base-contract';
-import { ContractArtifact } from '@0xproject/sol-compiler';
+import { ContractArtifact } from 'ethereum-types';
import * as fs from 'fs';
import * as path from 'path';
diff --git a/packages/order-utils/package.json b/packages/order-utils/package.json
index fd55f3486..6e5007343 100644
--- a/packages/order-utils/package.json
+++ b/packages/order-utils/package.json
@@ -66,7 +66,6 @@
"@0xproject/assert": "^1.0.5",
"@0xproject/base-contract": "^2.0.0-rc.1",
"@0xproject/json-schemas": "^1.0.1-rc.4",
- "@0xproject/sol-compiler": "^1.0.5",
"@0xproject/types": "^1.0.1-rc.4",
"@0xproject/typescript-typings": "^1.0.4",
"@0xproject/utils": "^1.0.5",
diff --git a/packages/order-utils/src/artifacts.ts b/packages/order-utils/src/artifacts.ts
index 3d2d1e953..735cc2403 100644
--- a/packages/order-utils/src/artifacts.ts
+++ b/packages/order-utils/src/artifacts.ts
@@ -1,4 +1,4 @@
-import { ContractArtifact } from '@0xproject/sol-compiler';
+import { ContractArtifact } from 'ethereum-types';
import * as DummyERC20Token from './artifacts/DummyERC20Token.json';
import * as ERC20Proxy from './artifacts/ERC20Proxy.json';
diff --git a/packages/order-watcher/package.json b/packages/order-watcher/package.json
index 073c25615..1765d7cad 100644
--- a/packages/order-watcher/package.json
+++ b/packages/order-watcher/package.json
@@ -47,7 +47,6 @@
"@0xproject/abi-gen": "^1.0.5",
"@0xproject/dev-utils": "^1.0.4",
"@0xproject/migrations": "^1.0.4",
- "@0xproject/sol-compiler": "^1.0.5",
"@0xproject/tslint-config": "^1.0.5",
"@types/bintrees": "^1.0.2",
"@types/lodash": "4.14.104",
diff --git a/packages/sol-compiler/src/compiler.ts b/packages/sol-compiler/src/compiler.ts
index 2503f7315..eb4ff3be6 100644
--- a/packages/sol-compiler/src/compiler.ts
+++ b/packages/sol-compiler/src/compiler.ts
@@ -10,6 +10,7 @@ import {
} from '@0xproject/sol-resolver';
import { fetchAsync, logUtils } from '@0xproject/utils';
import chalk from 'chalk';
+import { CompilerOptions, ContractArtifact, ContractVersionData } from 'ethereum-types';
import * as ethUtil from 'ethereumjs-util';
import * as fs from 'fs';
import * as _ from 'lodash';
@@ -29,7 +30,6 @@ import {
} from './utils/compiler';
import { constants } from './utils/constants';
import { fsWrapper } from './utils/fs_wrapper';
-import { CompilerOptions, ContractArtifact, ContractVersionData } from './utils/types';
import { utils } from './utils/utils';
type TYPE_ALL_FILES_IDENTIFIER = '*';
diff --git a/packages/sol-compiler/src/index.ts b/packages/sol-compiler/src/index.ts
index 570de931b..74c2b80d5 100644
--- a/packages/sol-compiler/src/index.ts
+++ b/packages/sol-compiler/src/index.ts
@@ -1,3 +1,2 @@
export { Compiler } from './compiler';
-
-export { CompilerOptions } from './utils/types';
+export { ContractArtifact, CompilerOptions, ContractNetworks } from 'ethereum-types';
diff --git a/packages/sol-compiler/src/utils/compiler.ts b/packages/sol-compiler/src/utils/compiler.ts
index 968fcc5b2..c918ed1f3 100644
--- a/packages/sol-compiler/src/utils/compiler.ts
+++ b/packages/sol-compiler/src/utils/compiler.ts
@@ -1,10 +1,10 @@
import { ContractSource } from '@0xproject/sol-resolver';
import { logUtils } from '@0xproject/utils';
+import { ContractArtifact } from 'ethereum-types';
import * as _ from 'lodash';
import * as path from 'path';
import { fsWrapper } from './fs_wrapper';
-import { ContractArtifact } from './types';
/**
* Gets contract data on network or returns if an artifact does not exist.
diff --git a/packages/sol-compiler/src/utils/types.ts b/packages/sol-compiler/src/utils/types.ts
index e2e7a4e53..b211cfcbc 100644
--- a/packages/sol-compiler/src/utils/types.ts
+++ b/packages/sol-compiler/src/utils/types.ts
@@ -1,5 +1,3 @@
-import * as solc from 'solc';
-
export enum AbiType {
Function = 'function',
Constructor = 'constructor',
@@ -7,82 +5,10 @@ export enum AbiType {
Fallback = 'fallback',
}
-/**
- * This type defines the schema of the artifact.json file generated by Sol-compiler
- * schemaVersion: The version of the artifact schema
- * contractName: The contract name it represents
- * networks: Network specific information by network (address, id, constructor args, etc...)
- * compilerOutput: The Solidity compiler output generated from the specified compiler input
- * description (http://solidity.readthedocs.io/en/v0.4.24/using-the-compiler.html#compiler-input-and-output-json-description)
- * compiler: The compiler settings used
- * sourceCodes: The source code of the contract and all it's dependencies
- * sources: A mapping from source filePath to sourceMap id
- * sourceTreeHashHex: A unique hash generated from the contract source and that of it's dependencies.
- * If any of the sources change, the hash would change notifying us that a re-compilation is necessary
- */
-export interface ContractArtifact extends ContractVersionData {
- schemaVersion: string;
- contractName: string;
- networks: ContractNetworks;
-}
-
-export interface GeneratedCompilerOptions {
- name: 'solc';
- version: string;
- settings: solc.CompilerSettings;
-}
-
-export interface Source {
- id: number;
-}
-
-export interface ContractVersionData {
- compiler: GeneratedCompilerOptions;
- sources: {
- [sourceName: string]: Source;
- };
- sourceCodes: {
- [sourceName: string]: string;
- };
- sourceTreeHashHex: string;
- compilerOutput: solc.StandardContractOutput;
-}
-
-export interface ContractNetworks {
- [networkId: number]: ContractNetworkData;
-}
-
-export interface ContractNetworkData {
- address: string;
- links: {
- [linkName: string]: string;
- };
- constructorArgs: string;
-}
-
export interface SolcErrors {
[key: string]: boolean;
}
-/**
- * Options you can specify (as flags or in a compiler.json file) when invoking sol-compiler
- * contractsDir: Directory containing your project's Solidity contracts. Can contain nested directories.
- * artifactsDir: Directory where you want the generated artifacts.json written to
- * compilerSettings: Desired settings to pass to the Solidity compiler during compilation.
- * (http://solidity.readthedocs.io/en/v0.4.24/using-the-compiler.html#compiler-input-and-output-json-description)
- * contracts: List of contract names you wish to compile, or alternatively ['*'] to compile all contracts in the
- * specified directory.
- * solcVersion: If you don't want to compile each contract with the Solidity version specified in-file, you can force all
- * contracts to compile with the the version specified here.
- */
-export interface CompilerOptions {
- contractsDir?: string;
- artifactsDir?: string;
- compilerSettings?: solc.CompilerSettings;
- contracts?: string[] | '*';
- solcVersion?: string;
-}
-
export interface ContractSourceData {
[contractName: string]: ContractSpecificSourceData;
}
diff --git a/packages/sol-compiler/test/compiler_test.ts b/packages/sol-compiler/test/compiler_test.ts
index c9e141ee9..46853e882 100644
--- a/packages/sol-compiler/test/compiler_test.ts
+++ b/packages/sol-compiler/test/compiler_test.ts
@@ -1,10 +1,10 @@
import { DoneCallback } from '@0xproject/types';
import * as chai from 'chai';
+import { CompilerOptions, ContractArtifact } from 'ethereum-types';
import 'mocha';
import { Compiler } from '../src/compiler';
import { fsWrapper } from '../src/utils/fs_wrapper';
-import { CompilerOptions, ContractArtifact } from '../src/utils/types';
import { exchange_binary } from './fixtures/exchange_bin';
import { constants } from './util/constants';
diff --git a/packages/sol-cov/src/artifact_adapters/sol_compiler_artifact_adapter.ts b/packages/sol-cov/src/artifact_adapters/sol_compiler_artifact_adapter.ts
index 0601c5729..8a74022bf 100644
--- a/packages/sol-cov/src/artifact_adapters/sol_compiler_artifact_adapter.ts
+++ b/packages/sol-cov/src/artifact_adapters/sol_compiler_artifact_adapter.ts
@@ -1,5 +1,5 @@
-import { CompilerOptions, ContractArtifact } from '@0xproject/sol-compiler';
import { logUtils } from '@0xproject/utils';
+import { CompilerOptions, ContractArtifact } from 'ethereum-types';
import * as fs from 'fs';
import * as glob from 'glob';
import * as _ from 'lodash';