dop-stick
Version:
Source control tooling for versionable-upgradeable smart contracts
101 lines • 4.03 kB
TypeScript
import { ethers } from 'ethers';
import { ExtendedFacetCut, PreDeploymentCheck } from '../../../types/upgrade';
import { DopStickConfig } from '../../../types/config';
export interface NetworkInfo {
name: string;
chainId: number;
gasPrice: number;
}
export interface DeploymentProgress {
moduleName: string;
bytecodeSize?: number;
txHash?: string;
address?: string;
gasUsed?: ethers.BigNumber;
error?: string;
stage?: 'bytecode' | 'transaction' | 'pending' | 'deployed' | 'error' | 'linking';
blockNumber?: number;
details?: string;
}
export interface DeploymentResult {
moduleName: string;
status: 'success' | 'failed';
address?: string;
gasUsed?: ethers.BigNumber;
error?: string;
bytecodeSize?: number;
}
export interface IDeploymentTimelineAdapter {
startDeployment(networkInfo: NetworkInfo): void;
logPreDeploymentChecks(checks: PreDeploymentCheck[]): void;
setTotalModules(total: number): void;
startModuleDeployment(moduleName: string, index: number): void;
updateModuleProgress(progress: DeploymentProgress): void;
displaySummary(results: DeploymentResult[], duration: number): void;
}
export interface IParallelDeploymentTimelineAdapter extends IDeploymentTimelineAdapter {
logWalletGeneration(wallets: WalletInfo[]): void;
handleDeploymentEvent(event: DeploymentEvent): void;
getDeploymentState(): ParallelDeploymentState;
displayCurrentProgress(): void;
startModuleDeployment(moduleName: string, index: number): void;
logTransactionSent(moduleName: string, txHash: string): void;
logDeploymentSuccess(moduleName: string, address: string, gasUsed: ethers.BigNumber, blockNumber: number): void;
logDeploymentError(moduleName: string, error: string): void;
updateModuleProgress(progress: DeploymentProgress): void;
displaySummary(results: DeploymentResult[], duration: number): void;
}
export type DeploymentStatus = 'pending' | 'compiling' | 'preparing' | 'deploying' | 'sent' | 'confirmed' | 'failed' | 'linking';
export interface ModuleState {
status: DeploymentStatus;
bytecodeSize?: number;
address?: string;
gasUsed?: ethers.BigNumber;
blockNumber?: number;
txHash?: string;
error?: string;
details?: DeploymentDetails;
}
export interface ParallelDeploymentState {
modules: Map<string, ModuleState>;
}
export type DeploymentEventType = 'bytecode' | 'compile' | 'prepare' | 'send' | 'confirmation' | 'error' | 'deploy' | 'transaction';
export interface DeploymentDetails {
deployTime?: string;
gasPrice?: string;
totalCost?: string;
}
export type DeploymentEvent = {
moduleName: string;
type: DeploymentEventType;
data: {
address?: string;
gasUsed?: ethers.BigNumber;
blockNumber?: number;
bytecodeSize?: number;
txHash?: string;
error?: string;
details?: DeploymentDetails;
};
};
export interface WalletInfo {
moduleName: string;
address: string;
}
export type TimelineLogger = IDeploymentTimelineAdapter | IParallelDeploymentTimelineAdapter;
export interface IModuleProcessor {
processModuleGroups(cuts: ExtendedFacetCut[], config: DopStickConfig, deploymentLogger: TimelineLogger): Promise<void>;
}
export interface IMiningTimelineAdapter {
startMining(networkInfo: NetworkInfo): void;
logUpgradeConfigStatus(found: boolean, path: string): void;
logModuleCutsProgress(coreFacets: number, moduleFacets: number): void;
logCacheStatus(enabled: boolean, status: 'found' | 'not-found' | 'invalid'): void;
logDeploymentMode(mode: 'sequential' | 'parallel'): void;
logDiamondDeployment(standard: string): void;
updateDiamondStatus(status: 'pending' | 'success' | 'failed', address?: string): void;
logPostDeployment(required: boolean): void;
updatePostDeploymentStatus(status: 'complete' | 'skipped' | 'failed', error?: string): void;
completeMining(duration: number): void;
}
//# sourceMappingURL=types.d.ts.map