Documentation ¶
Overview ¶
Package compiler wraps the Solidity compiler executable (solc).
Index ¶
- func CompileSolidity(solc string, sourcefiles ...string) (map[string]*Contract, error)
- func CompileSolidityString(solc, source string) (map[string]*Contract, error)
- func ParseCombinedJSON(combinedJSON []byte, source string, languageVersion string, ...) (map[string]*Contract, error)
- type Contract
- type ContractInfo
- type Solidity
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CompileSolidity ¶
CompileSolidity compiles all given Solidity source files.
func CompileSolidityString ¶
CompileSolidityString builds and returns all the contracts contained within a source string.
func ParseCombinedJSON ¶ added in v0.3.3
func ParseCombinedJSON(combinedJSON []byte, source string, languageVersion string, compilerVersion string, compilerOptions string) (map[string]*Contract, error)
ParseCombinedJSON takes the direct output of a solc --combined-output run and parses it into a map of string contract name to Contract structs. The provided source, language and compiler version, and compiler options are all passed through into the Contract structs.
The solc output is expected to contain ABI, user docs, and dev docs.
Returns an error if the JSON is malformed or missing data, or if the JSON embedded within the JSON is malformed.
Types ¶
type Contract ¶
type Contract struct { Code string `json:"code"` Info ContractInfo `json:"info"` }
Contract contains information about a compiled contract, alongside its code.
type ContractInfo ¶
type ContractInfo struct { Source string `json:"source"` Language string `json:"language"` LanguageVersion string `json:"languageVersion"` CompilerVersion string `json:"compilerVersion"` CompilerOptions string `json:"compilerOptions"` AbiDefinition interface{} `json:"abiDefinition"` UserDoc interface{} `json:"userDoc"` DeveloperDoc interface{} `json:"developerDoc"` Metadata string `json:"metadata"` }
ContractInfo contains information about a compiled contract, including access to the ABI definition, user and developer docs, and metadata.
Depending on the source, language version, compiler version, and compiler options will provide information about how the contract was compiled.