blob: e2e7a4e534eabbc08fd9f158329448fc368eae3e (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
|
import * as solc from 'solc';
export enum AbiType {
Function = 'function',
Constructor = 'constructor',
Event = 'event',
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;
}
export interface ContractSpecificSourceData {
solcVersionRange: string;
sourceHash: Buffer;
sourceTreeHash: Buffer;
}
export interface Token {
address?: string;
name: string;
symbol: string;
decimals: number;
ipfsHash: string;
swarmHash: string;
}
export type DoneCallback = (err?: Error) => void;
|