UNPKG

dop-stick

Version:

Source control tooling for versionable-upgradeable smart contracts

258 lines 6.68 kB
import { ethers } from "ethers"; import { Fragment } from 'ethers/lib/utils'; import { RollbackConfig } from "./rollback"; import { ParallelizationConfig } from './parallelTypes'; import { DiamondStandardType } from '../types/diamond'; export interface BaseUpgradeConfig { fail_all_if_one_fails: boolean; add_or_replace: boolean; } export interface ParamConfig { envKey: string; name: string; type: string; } export interface UpgradeModule { module: string; add?: string[]; replace?: string[]; remove?: string[]; } export interface InitializationConfig { enabled?: boolean; initializerContract?: string; initializerFunction?: string; initializerArgs?: any[]; deployNew?: boolean; existingAddress?: string; gasLimit?: number; } export interface DiamondLoupeFunctionConfig { name: string; abi?: string | Fragment; additionalParams?: { name: string; type: string; envKey: string; }[]; } export interface DiamondLoupeConfig { functions?: { facets?: string | DiamondLoupeFunctionConfig; facetSelectors?: string | DiamondLoupeFunctionConfig; facetAddresses?: string | DiamondLoupeFunctionConfig; facetAddress?: string | DiamondLoupeFunctionConfig; owner?: string | DiamondLoupeFunctionConfig; version?: string | DiamondLoupeFunctionConfig; }; returnTypes?: { facets?: string; selectors?: string; addresses?: string; address?: string; }; } export interface CoreFacetParamConfig { name: string; type: string; key: string; location: 'config' | 'env'; } export interface CoreFacetFunctionConfig { abi?: string | Fragment; additionalParams?: CoreFacetParamConfig[]; } export interface CoreFacetConfig { name?: string; customFunctions?: { [functionName: string]: string | CoreFacetFunctionConfig; }; } export interface DiamondStandardsConfig { type?: DiamondStandardType; versioning?: { enabled?: boolean; strategy?: 'semver' | 'incremental' | 'custom'; format?: string; functions?: { getVersion?: string; getVersionHistory?: string; }; }; loupe?: CoreFacetConfig & { returnTypes?: { facets?: string; selectors?: string; addresses?: string; address?: string; }; }; cut?: CoreFacetConfig & { params?: { facetCutStructName?: string; actionEnumName?: string; }; actions?: { add?: number; replace?: number; remove?: number; }; batchSize?: number; retryStrategy?: { enabled?: boolean; maxAttempts?: number; backoffMs?: number; }; }; init?: CoreFacetConfig & { fallbackAddress?: string; validation?: { validateInit?: boolean; requireSuccess?: boolean; }; }; ownership?: CoreFacetConfig & { type?: 'single-step' | 'two-step'; multiSig?: { enabled?: boolean; threshold?: number; owners?: string[]; }; }; erc165?: CoreFacetConfig & { interfaces?: { IDiamondCut?: string; IDiamondLoupe?: string; IERC165?: string; IERC173?: string; }; validation?: { requireSupport?: string[]; }; }; access?: CoreFacetConfig & { type?: 'ownership' | 'roles'; roles?: { admin?: string; upgrader?: string; pauser?: string; }; }; emergency?: CoreFacetConfig & { enabled?: boolean; pausable?: { selective?: boolean; timeout?: number; }; }; additionalCoreFacets?: { [facetName: string]: CoreFacetConfig & { customConfig?: Record<string, any>; }; }; } export interface CustomFunctionConfig { name: string; additionalParams?: { name: string; type: string; envKey: string; }[]; } export interface UpgradeServiceConfig { name?: string; path?: string; abi?: Array<string | Fragment>; customFunctions?: { diamondCut?: string | CustomFunctionConfig; }; } export type UpgradeMode = 'basic' | 'strict' | 'auto-pilot-beta' | 'copilot-beta'; export interface RetryConfig { enabled?: boolean; maxRetries?: number; retryDelay?: number; exponentialBackoff?: boolean; maxDelay?: number; shouldRetry?: (error: Error) => boolean; } export interface ReportConfig { includeFailedReports?: boolean; outputDir?: string; } export interface CompilerConfig { version?: string; name?: string; compileCommand?: string; skip?: boolean; optimization?: { enabled?: boolean; runs?: number; }; } export interface DopStickConfig { compiler?: CompilerConfig; mode?: UpgradeMode; rollback?: RollbackConfig; paths: { upgrades: string; typechain?: string; contracts?: string; artifacts?: string; cache?: string; reports?: string; }; initialization?: InitializationConfig; contracts?: { diamond?: { name?: string; standards?: DiamondStandardsConfig; compiler?: CompilerConfig; }; upgradeService?: UpgradeServiceConfig; }; security?: { ownershipValidation?: boolean; selectorCollisionCheck?: boolean; facetAddressValidation?: boolean; estimateGasBeforeUpgrade?: boolean; verifyContracts?: boolean; }; gas?: { maxRetries?: number; maxFeePerGas?: string; maxPriorityFeePerGas?: string; }; parallelization?: ParallelizationConfig; retry?: RetryConfig; report?: ReportConfig; cache?: { enabled?: boolean; }; verification?: { enabled?: boolean; etherscan?: { apiKey: string; delay?: number; }; sourcify?: { enabled: boolean; }; }; } export interface DiamondConfig { provider?: ethers.providers.Provider; address?: string; network?: string; rpcUrl?: string; } export interface UpgradeConfig extends BaseUpgradeConfig { modules: (string | UpgradeModule)[]; upgrades?: (string | UpgradeModule)[]; additionalParams?: { [moduleName: string]: { [paramKey: string]: any; }; }; } //# sourceMappingURL=config.d.ts.map