# Class: Compiler

The Compiler facilitates compiling Solidity smart contracts and saves the results
to artifact files.


##   Constructors



\+ **new Compiler**(`opts?`: [CompilerOptions](#interface-compileroptions)): *[Compiler](#class-compiler)*

*Defined in [sol-compiler/src/compiler.ts:97](https://github.com/0xProject/0x-monorepo/blob/c93b02d55/packages/sol-compiler/src/compiler.ts#L97)*

Instantiates a new instance of the Compiler class.

**Parameters:**

Name | Type | Description |
------ | ------ | ------ |
`opts?` | [CompilerOptions](#interface-compileroptions) | Optional compiler options |

**Returns:** *[Compiler](#class-compiler)*

An instance of the Compiler class.

## Methods

###  compileAsync

▸ **compileAsync**(): *`Promise<void>`*

*Defined in [sol-compiler/src/compiler.ts:138](https://github.com/0xProject/0x-monorepo/blob/c93b02d55/packages/sol-compiler/src/compiler.ts#L138)*

Compiles selected Solidity files found in `contractsDir` and writes JSON artifacts to `artifactsDir`.

**Returns:** *`Promise<void>`*

___

###  getCompilerOutputsAsync

▸ **getCompilerOutputsAsync**(): *`Promise<StandardOutput[]>`*

*Defined in [sol-compiler/src/compiler.ts:151](https://github.com/0xProject/0x-monorepo/blob/c93b02d55/packages/sol-compiler/src/compiler.ts#L151)*

Compiles Solidity files specified during instantiation, and returns the
compiler output given by solc.  Return value is an array of outputs:
Solidity modules are batched together by version required, and each
element of the returned array corresponds to a compiler version, and
each element contains the output for all of the modules compiled with
that version.

**Returns:** *`Promise<StandardOutput[]>`*

___

###  getContractNamesToCompile

▸ **getContractNamesToCompile**(): *string[]*

*Defined in [sol-compiler/src/compiler.ts:192](https://github.com/0xProject/0x-monorepo/blob/c93b02d55/packages/sol-compiler/src/compiler.ts#L192)*

Gets a list of contracts to compile.

**Returns:** *string[]*

___

###  watchAsync

▸ **watchAsync**(): *`Promise<void>`*

*Defined in [sol-compiler/src/compiler.ts:155](https://github.com/0xProject/0x-monorepo/blob/c93b02d55/packages/sol-compiler/src/compiler.ts#L155)*

**Returns:** *`Promise<void>`*

<hr />





















# Interface: CompilerOptions

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.
useDockerisedSolc: If set to true - sol-compiler will try calling a dockerized installations of solc to achieve faster compilation times. Otherwise and by default - solcjs will be used. Defaults to false.
isOfflineMode: If set to true - sol-compiler will not fetch the list of solc releases from github. It will use the hardcoded list. Defaults to false.
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.


##   Properties

### `Optional` artifactsDir

• **artifactsDir**? : *undefined | string*

*Defined in [ethereum-types/src/index.ts:731](https://github.com/0xProject/0x-monorepo/blob/c93b02d55/packages/ethereum-types/src/index.ts#L731)*

___

### `Optional` compilerSettings

• **compilerSettings**? : *[CompilerSettings](#class-compilersettings)*

*Defined in [ethereum-types/src/index.ts:732](https://github.com/0xProject/0x-monorepo/blob/c93b02d55/packages/ethereum-types/src/index.ts#L732)*

___

### `Optional` contracts

• **contracts**? : *string[] | "*"*

*Defined in [ethereum-types/src/index.ts:733](https://github.com/0xProject/0x-monorepo/blob/c93b02d55/packages/ethereum-types/src/index.ts#L733)*

___

### `Optional` contractsDir

• **contractsDir**? : *undefined | string*

*Defined in [ethereum-types/src/index.ts:730](https://github.com/0xProject/0x-monorepo/blob/c93b02d55/packages/ethereum-types/src/index.ts#L730)*

___

### `Optional` isOfflineMode

• **isOfflineMode**? : *undefined | false | true*

*Defined in [ethereum-types/src/index.ts:735](https://github.com/0xProject/0x-monorepo/blob/c93b02d55/packages/ethereum-types/src/index.ts#L735)*

___

### `Optional` solcVersion

• **solcVersion**? : *undefined | string*

*Defined in [ethereum-types/src/index.ts:736](https://github.com/0xProject/0x-monorepo/blob/c93b02d55/packages/ethereum-types/src/index.ts#L736)*

___

### `Optional` useDockerisedSolc

• **useDockerisedSolc**? : *undefined | false | true*

*Defined in [ethereum-types/src/index.ts:734](https://github.com/0xProject/0x-monorepo/blob/c93b02d55/packages/ethereum-types/src/index.ts#L734)*

<hr />



# Interface: CompilerSettings


##   Properties

### `Optional` evmVersion

• **evmVersion**? : *"homestead" | "tangerineWhistle" | "spuriousDragon" | "byzantium" | "constantinople"*

*Defined in [ethereum-types/src/index.ts:689](https://github.com/0xProject/0x-monorepo/blob/c93b02d55/packages/ethereum-types/src/index.ts#L689)*

___

### `Optional` libraries

• **libraries**? : *undefined | object*

*Defined in [ethereum-types/src/index.ts:691](https://github.com/0xProject/0x-monorepo/blob/c93b02d55/packages/ethereum-types/src/index.ts#L691)*

___

### `Optional` metadata

• **metadata**? : *[CompilerSettingsMetadata](#class-compilersettingsmetadata)*

*Defined in [ethereum-types/src/index.ts:690](https://github.com/0xProject/0x-monorepo/blob/c93b02d55/packages/ethereum-types/src/index.ts#L690)*

___

### `Optional` optimizer

• **optimizer**? : *[OptimizerSettings](#class-optimizersettings)*

*Defined in [ethereum-types/src/index.ts:688](https://github.com/0xProject/0x-monorepo/blob/c93b02d55/packages/ethereum-types/src/index.ts#L688)*

___

###  outputSelection

• **outputSelection**: *object*

*Defined in [ethereum-types/src/index.ts:696](https://github.com/0xProject/0x-monorepo/blob/c93b02d55/packages/ethereum-types/src/index.ts#L696)*

#### Type declaration:

● \[▪ **fileName**: *string*\]: object

● \[▪ **contractName**: *string*\]: [OutputField](#outputfield)[]

___

### `Optional` remappings

• **remappings**? : *string[]*

*Defined in [ethereum-types/src/index.ts:687](https://github.com/0xProject/0x-monorepo/blob/c93b02d55/packages/ethereum-types/src/index.ts#L687)*

<hr />

# Interface: CompilerSettingsMetadata


##   Properties

###  useLiteralContent

• **useLiteralContent**: *true*

*Defined in [ethereum-types/src/index.ts:704](https://github.com/0xProject/0x-monorepo/blob/c93b02d55/packages/ethereum-types/src/index.ts#L704)*

<hr />

# Interface: ConstructorAbi


##   Properties

###  inputs

• **inputs**: *[DataItem](#class-dataitem)[]*

*Defined in [ethereum-types/src/index.ts:103](https://github.com/0xProject/0x-monorepo/blob/c93b02d55/packages/ethereum-types/src/index.ts#L103)*

___

###  payable

• **payable**: *boolean*

*Defined in [ethereum-types/src/index.ts:104](https://github.com/0xProject/0x-monorepo/blob/c93b02d55/packages/ethereum-types/src/index.ts#L104)*

___

###  stateMutability

• **stateMutability**: *[ConstructorStateMutability](#constructorstatemutability)*

*Defined in [ethereum-types/src/index.ts:105](https://github.com/0xProject/0x-monorepo/blob/c93b02d55/packages/ethereum-types/src/index.ts#L105)*

___

###  type

• **type**: *string*

*Defined in [ethereum-types/src/index.ts:102](https://github.com/0xProject/0x-monorepo/blob/c93b02d55/packages/ethereum-types/src/index.ts#L102)*

<hr />







# Interface: DataItem


##   Properties

### `Optional` components

• **components**? : *[DataItem](#class-dataitem)[]*

*Defined in [ethereum-types/src/index.ts:137](https://github.com/0xProject/0x-monorepo/blob/c93b02d55/packages/ethereum-types/src/index.ts#L137)*

___

###  name

• **name**: *string*

*Defined in [ethereum-types/src/index.ts:135](https://github.com/0xProject/0x-monorepo/blob/c93b02d55/packages/ethereum-types/src/index.ts#L135)*

___

###  type

• **type**: *string*

*Defined in [ethereum-types/src/index.ts:136](https://github.com/0xProject/0x-monorepo/blob/c93b02d55/packages/ethereum-types/src/index.ts#L136)*

<hr />





# Interface: DevdocOutput


##   Properties

### `Optional` author

• **author**? : *undefined | string*

*Defined in [ethereum-types/src/index.ts:628](https://github.com/0xProject/0x-monorepo/blob/c93b02d55/packages/ethereum-types/src/index.ts#L628)*

___

###  methods

• **methods**: *object*

*Defined in [ethereum-types/src/index.ts:629](https://github.com/0xProject/0x-monorepo/blob/c93b02d55/packages/ethereum-types/src/index.ts#L629)*

#### Type declaration:

● \[▪ **signature**: *string*\]: object

___

### `Optional` title

• **title**? : *undefined | string*

*Defined in [ethereum-types/src/index.ts:627](https://github.com/0xProject/0x-monorepo/blob/c93b02d55/packages/ethereum-types/src/index.ts#L627)*

<hr />



# Interface: EventAbi


##   Properties

###  anonymous

• **anonymous**: *boolean*

*Defined in [ethereum-types/src/index.ts:131](https://github.com/0xProject/0x-monorepo/blob/c93b02d55/packages/ethereum-types/src/index.ts#L131)*

___

###  inputs

• **inputs**: *[EventParameter](#class-eventparameter)[]*

*Defined in [ethereum-types/src/index.ts:130](https://github.com/0xProject/0x-monorepo/blob/c93b02d55/packages/ethereum-types/src/index.ts#L130)*

___

###  name

• **name**: *string*

*Defined in [ethereum-types/src/index.ts:129](https://github.com/0xProject/0x-monorepo/blob/c93b02d55/packages/ethereum-types/src/index.ts#L129)*

___

###  type

• **type**: *string*

*Defined in [ethereum-types/src/index.ts:128](https://github.com/0xProject/0x-monorepo/blob/c93b02d55/packages/ethereum-types/src/index.ts#L128)*

<hr />

# Interface: EventParameter


##   Properties

### `Optional` components

• **components**? : *[DataItem](#class-dataitem)[]*

*Inherited from [DataItem](#interface-dataitem).[components](#optional-components)*

*Defined in [ethereum-types/src/index.ts:137](https://github.com/0xProject/0x-monorepo/blob/c93b02d55/packages/ethereum-types/src/index.ts#L137)*

___

###  indexed

• **indexed**: *boolean*

*Defined in [ethereum-types/src/index.ts:116](https://github.com/0xProject/0x-monorepo/blob/c93b02d55/packages/ethereum-types/src/index.ts#L116)*

___

###  name

• **name**: *string*

*Inherited from [DataItem](#interface-dataitem).[name](#name)*

*Defined in [ethereum-types/src/index.ts:135](https://github.com/0xProject/0x-monorepo/blob/c93b02d55/packages/ethereum-types/src/index.ts#L135)*

___

###  type

• **type**: *string*

*Inherited from [DataItem](#interface-dataitem).[type](#type)*

*Defined in [ethereum-types/src/index.ts:136](https://github.com/0xProject/0x-monorepo/blob/c93b02d55/packages/ethereum-types/src/index.ts#L136)*

<hr />

# Interface: EvmBytecodeOutput


##   Properties

###  object

• **object**: *string*

*Defined in [ethereum-types/src/index.ts:622](https://github.com/0xProject/0x-monorepo/blob/c93b02d55/packages/ethereum-types/src/index.ts#L622)*

___

###  sourceMap

• **sourceMap**: *string*

*Defined in [ethereum-types/src/index.ts:623](https://github.com/0xProject/0x-monorepo/blob/c93b02d55/packages/ethereum-types/src/index.ts#L623)*

<hr />

# Interface: EvmOutput


##   Properties

###  bytecode

• **bytecode**: *[EvmBytecodeOutput](#class-evmbytecodeoutput)*

*Defined in [ethereum-types/src/index.ts:617](https://github.com/0xProject/0x-monorepo/blob/c93b02d55/packages/ethereum-types/src/index.ts#L617)*

___

###  deployedBytecode

• **deployedBytecode**: *[EvmBytecodeOutput](#class-evmbytecodeoutput)*

*Defined in [ethereum-types/src/index.ts:618](https://github.com/0xProject/0x-monorepo/blob/c93b02d55/packages/ethereum-types/src/index.ts#L618)*

<hr />

# Interface: FallbackAbi


##   Properties

###  payable

• **payable**: *boolean*

*Defined in [ethereum-types/src/index.ts:112](https://github.com/0xProject/0x-monorepo/blob/c93b02d55/packages/ethereum-types/src/index.ts#L112)*

___

###  type

• **type**: *string*

*Defined in [ethereum-types/src/index.ts:111](https://github.com/0xProject/0x-monorepo/blob/c93b02d55/packages/ethereum-types/src/index.ts#L111)*

<hr />



















# Interface: MethodAbi


##   Properties

###  constant

• **constant**: *boolean*

*Defined in [ethereum-types/src/index.ts:94](https://github.com/0xProject/0x-monorepo/blob/c93b02d55/packages/ethereum-types/src/index.ts#L94)*

___

###  inputs

• **inputs**: *[DataItem](#class-dataitem)[]*

*Defined in [ethereum-types/src/index.ts:92](https://github.com/0xProject/0x-monorepo/blob/c93b02d55/packages/ethereum-types/src/index.ts#L92)*

___

###  name

• **name**: *string*

*Defined in [ethereum-types/src/index.ts:91](https://github.com/0xProject/0x-monorepo/blob/c93b02d55/packages/ethereum-types/src/index.ts#L91)*

___

###  outputs

• **outputs**: *[DataItem](#class-dataitem)[]*

*Defined in [ethereum-types/src/index.ts:93](https://github.com/0xProject/0x-monorepo/blob/c93b02d55/packages/ethereum-types/src/index.ts#L93)*

___

###  payable

• **payable**: *boolean*

*Defined in [ethereum-types/src/index.ts:96](https://github.com/0xProject/0x-monorepo/blob/c93b02d55/packages/ethereum-types/src/index.ts#L96)*

___

###  stateMutability

• **stateMutability**: *[StateMutability](#statemutability)*

*Defined in [ethereum-types/src/index.ts:95](https://github.com/0xProject/0x-monorepo/blob/c93b02d55/packages/ethereum-types/src/index.ts#L95)*

___

###  type

• **type**: *string*

*Defined in [ethereum-types/src/index.ts:90](https://github.com/0xProject/0x-monorepo/blob/c93b02d55/packages/ethereum-types/src/index.ts#L90)*

<hr />

# Interface: OptimizerSettings


##   Properties

###  enabled

• **enabled**: *boolean*

*Defined in [ethereum-types/src/index.ts:708](https://github.com/0xProject/0x-monorepo/blob/c93b02d55/packages/ethereum-types/src/index.ts#L708)*

___

### `Optional` runs

• **runs**? : *undefined | number*

*Defined in [ethereum-types/src/index.ts:709](https://github.com/0xProject/0x-monorepo/blob/c93b02d55/packages/ethereum-types/src/index.ts#L709)*

<hr />





# Interface: RevertErrorAbi


##   Properties

### `Optional` arguments

• **arguments**? : *[DataItem](#class-dataitem)[]*

*Defined in [ethereum-types/src/index.ts:122](https://github.com/0xProject/0x-monorepo/blob/c93b02d55/packages/ethereum-types/src/index.ts#L122)*

___

###  name

• **name**: *string*

*Defined in [ethereum-types/src/index.ts:121](https://github.com/0xProject/0x-monorepo/blob/c93b02d55/packages/ethereum-types/src/index.ts#L121)*

___

###  type

• **type**: *"error"*

*Defined in [ethereum-types/src/index.ts:120](https://github.com/0xProject/0x-monorepo/blob/c93b02d55/packages/ethereum-types/src/index.ts#L120)*

<hr />

# Interface: SolcError


##   Properties

###  component

• **component**: *"general" | "ewasm"*

*Defined in [ethereum-types/src/index.ts:604](https://github.com/0xProject/0x-monorepo/blob/c93b02d55/packages/ethereum-types/src/index.ts#L604)*

___

### `Optional` formattedMessage

• **formattedMessage**? : *undefined | string*

*Defined in [ethereum-types/src/index.ts:607](https://github.com/0xProject/0x-monorepo/blob/c93b02d55/packages/ethereum-types/src/index.ts#L607)*

___

###  message

• **message**: *string*

*Defined in [ethereum-types/src/index.ts:606](https://github.com/0xProject/0x-monorepo/blob/c93b02d55/packages/ethereum-types/src/index.ts#L606)*

___

###  severity

• **severity**: *[ErrorSeverity](#errorseverity)*

*Defined in [ethereum-types/src/index.ts:605](https://github.com/0xProject/0x-monorepo/blob/c93b02d55/packages/ethereum-types/src/index.ts#L605)*

___

### `Optional` sourceLocation

• **sourceLocation**? : *[SourceLocation](#class-sourcelocation)*

*Defined in [ethereum-types/src/index.ts:602](https://github.com/0xProject/0x-monorepo/blob/c93b02d55/packages/ethereum-types/src/index.ts#L602)*

___

###  type

• **type**: *[ErrorType](#errortype)*

*Defined in [ethereum-types/src/index.ts:603](https://github.com/0xProject/0x-monorepo/blob/c93b02d55/packages/ethereum-types/src/index.ts#L603)*

<hr />





# Interface: StandardContractOutput


##   Properties

###  abi

• **abi**: *[ContractAbi](#contractabi)*

*Defined in [ethereum-types/src/index.ts:564](https://github.com/0xProject/0x-monorepo/blob/c93b02d55/packages/ethereum-types/src/index.ts#L564)*

___

### `Optional` devdoc

• **devdoc**? : *[DevdocOutput](#class-devdocoutput)*

*Defined in [ethereum-types/src/index.ts:566](https://github.com/0xProject/0x-monorepo/blob/c93b02d55/packages/ethereum-types/src/index.ts#L566)*

___

###  evm

• **evm**: *[EvmOutput](#class-evmoutput)*

*Defined in [ethereum-types/src/index.ts:565](https://github.com/0xProject/0x-monorepo/blob/c93b02d55/packages/ethereum-types/src/index.ts#L565)*

<hr />

# Interface: StandardOutput


##   Properties

###  contracts

• **contracts**: *object*

*Defined in [ethereum-types/src/index.ts:578](https://github.com/0xProject/0x-monorepo/blob/c93b02d55/packages/ethereum-types/src/index.ts#L578)*

#### Type declaration:

● \[▪ **fileName**: *string*\]: object

● \[▪ **contractName**: *string*\]: [StandardContractOutput](#class-standardcontractoutput)

___

###  errors

• **errors**: *[SolcError](#class-solcerror)[]*

*Defined in [ethereum-types/src/index.ts:570](https://github.com/0xProject/0x-monorepo/blob/c93b02d55/packages/ethereum-types/src/index.ts#L570)*

___

###  sources

• **sources**: *object*

*Defined in [ethereum-types/src/index.ts:571](https://github.com/0xProject/0x-monorepo/blob/c93b02d55/packages/ethereum-types/src/index.ts#L571)*

#### Type declaration:

● \[▪ **fileName**: *string*\]: object

<hr />













# Interface: TupleDataItem


##   Properties

###  components

• **components**: *[DataItem](#class-dataitem)[]*

*Overrides [DataItem](_ethereum_types_src_index_.dataitem.md).[components](#optional-components)*

*Defined in [ethereum-types/src/index.ts:141](https://github.com/0xProject/0x-monorepo/blob/c93b02d55/packages/ethereum-types/src/index.ts#L141)*

___

###  name

• **name**: *string*

*Inherited from [DataItem](#interface-dataitem).[name](#name)*

*Defined in [ethereum-types/src/index.ts:135](https://github.com/0xProject/0x-monorepo/blob/c93b02d55/packages/ethereum-types/src/index.ts#L135)*

___

###  type

• **type**: *string*

*Inherited from [DataItem](#interface-dataitem).[type](#type)*

*Defined in [ethereum-types/src/index.ts:136](https://github.com/0xProject/0x-monorepo/blob/c93b02d55/packages/ethereum-types/src/index.ts#L136)*

<hr />
















##  Type aliases

###  AbiDefinition

Ƭ **AbiDefinition**: *[FunctionAbi](_ethereum_types_src_index_.md#functionabi) | [EventAbi](#interface-eventabi) | [RevertErrorAbi](#interface-reverterrorabi)*

*Defined in [ethereum-types/src/index.ts:80](https://github.com/0xProject/0x-monorepo/blob/c93b02d55/packages/ethereum-types/src/index.ts#L80)*

___



###  ConstructorStateMutability

Ƭ **ConstructorStateMutability**: *"nonpayable" | "payable"*

*Defined in [ethereum-types/src/index.ts:84](https://github.com/0xProject/0x-monorepo/blob/c93b02d55/packages/ethereum-types/src/index.ts#L84)*

___

###  ContractAbi

Ƭ **ContractAbi**: *[AbiDefinition](#abidefinition)[]*

*Defined in [ethereum-types/src/index.ts:78](https://github.com/0xProject/0x-monorepo/blob/c93b02d55/packages/ethereum-types/src/index.ts#L78)*

___







###  ErrorSeverity

Ƭ **ErrorSeverity**: *"error" | "warning"*

*Defined in [ethereum-types/src/index.ts:599](https://github.com/0xProject/0x-monorepo/blob/c93b02d55/packages/ethereum-types/src/index.ts#L599)*

___

###  ErrorType

Ƭ **ErrorType**: *"JSONError" | "IOError" | "ParserError" | "DocstringParsingError" | "SyntaxError" | "DeclarationError" | "TypeError" | "UnimplementedFeatureError" | "InternalCompilerError" | "Exception" | "CompilerError" | "FatalError" | "Warning"*

*Defined in [ethereum-types/src/index.ts:585](https://github.com/0xProject/0x-monorepo/blob/c93b02d55/packages/ethereum-types/src/index.ts#L585)*

___

###  FunctionAbi

Ƭ **FunctionAbi**: *[MethodAbi](#interface-methodabi) | [ConstructorAbi](#interface-constructorabi) | [FallbackAbi](#interface-fallbackabi)*

*Defined in [ethereum-types/src/index.ts:82](https://github.com/0xProject/0x-monorepo/blob/c93b02d55/packages/ethereum-types/src/index.ts#L82)*

___





###  OutputField

Ƭ **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"*

*Defined in [ethereum-types/src/index.ts:525](https://github.com/0xProject/0x-monorepo/blob/c93b02d55/packages/ethereum-types/src/index.ts#L525)*

___

###  ParamDescription

Ƭ **ParamDescription**: *string*

*Defined in [ethereum-types/src/index.ts:561](https://github.com/0xProject/0x-monorepo/blob/c93b02d55/packages/ethereum-types/src/index.ts#L561)*

___



###  StateMutability

Ƭ **StateMutability**: *"pure" | "view" | [ConstructorStateMutability](#constructorstatemutability)*

*Defined in [ethereum-types/src/index.ts:85](https://github.com/0xProject/0x-monorepo/blob/c93b02d55/packages/ethereum-types/src/index.ts#L85)*

___











<hr /> 

