aboutsummaryrefslogtreecommitdiffstats
path: root/packages/deployer/src/utils/types.ts
blob: 7cb3958cb367f22c9eb140edf469aa5befdbf723 (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
import { ContractAbi, TxData } from '@0xproject/types';
import * as Web3 from 'web3';
import * as yargs from 'yargs';

export enum AbiType {
    Function = 'function',
    Constructor = 'constructor',
    Event = 'event',
    Fallback = 'fallback',
}

export interface ContractArtifact {
    contract_name: string;
    networks: ContractNetworks;
}

export interface ContractNetworks {
    [key: number]: ContractNetworkData;
}

export interface ContractNetworkData {
    solc_version: string;
    optimizer_enabled: boolean;
    keccak256: string;
    source_tree_hash: string;
    abi: ContractAbi;
    bytecode: string;
    runtime_bytecode: string;
    address?: string;
    constructor_args?: string;
    updated_at: number;
    source_map: string;
    source_map_runtime: string;
    sources: string[];
}

export interface SolcErrors {
    [key: string]: boolean;
}

export interface CliOptions extends yargs.Arguments {
    artifactsDir: string;
    contractsDir: string;
    jsonrpcUrl: string;
    networkId: number;
    shouldOptimize: boolean;
    gasPrice: string;
    account?: string;
    contract?: string;
    args?: string;
}

export interface CompilerOptions {
    contractsDir: string;
    networkId: number;
    optimizerEnabled: boolean;
    artifactsDir: string;
    specifiedContracts: Set<string>;
}

export interface BaseDeployerOptions {
    artifactsDir: string;
    networkId: number;
    defaults: Partial<TxData>;
}

export interface ProviderDeployerOptions extends BaseDeployerOptions {
    web3Provider: Web3.Provider;
}

export interface UrlDeployerOptions extends BaseDeployerOptions {
    jsonrpcUrl: string;
}

export type DeployerOptions = UrlDeployerOptions | ProviderDeployerOptions;

export interface ContractSources {
    [key: string]: string;
}

export interface ContractSourceData {
    [key: string]: ContractSpecificSourceData;
}

export interface ContractSpecificSourceData {
    dependencies: string[];
    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;