UNPKG

dop-stick

Version:

Source control tooling for versionable-upgradeable smart contracts

93 lines 2.88 kB
import { FacetCut } from './diamond'; /** * Represents the state of a diamond at a specific point in time * @interface DiamondState */ export interface DiamondState { /** Mapping of facet addresses to their function selectors */ selectors: { [facetAddress: string]: string[]; }; /** List of all active facet addresses */ facets: string[]; /** Timestamp when the state was captured */ timestamp: number; /** Block number when the state was captured */ blockNumber: number; } /** * Represents a snapshot of a diamond upgrade * @interface UpgradeSnapshot */ export interface UpgradeSnapshot { /** Timestamp when snapshot was taken */ timestamp: number; /** Original upgrade cuts that were applied */ cuts: FacetCut[]; /** State of the diamond before the upgrade */ previousState: DiamondState; /** Metadata about the upgrade */ metadata: { /** Hash of the transaction that performed the upgrade */ upgradeTxHash?: string; /** Block number where the upgrade occurred */ upgradeBlockNumber?: number; /** Additional custom metadata */ [key: string]: any; }; } /** * Configuration options for rollback functionality * @interface RollbackConfig */ export interface RollbackConfig { /** Whether rollback functionality is enabled */ enabled: boolean; /** Strategy to use for rollbacks */ strategy: 'snapshot' | 'reverse' | 'custom'; /** Automatically rollback on upgrade failure */ autoRollback?: boolean; /** Take state snapshot before upgrade */ snapshotBefore?: boolean; /** Validate diamond state after rollback */ validateAfter?: boolean; /** Path to custom rollback handler */ customHandler?: string; /** Maximum number of snapshots to keep */ maxSnapshots?: number; /** Custom functions to execute during rollback */ customFunctions?: { diamondCut?: string; }; /** Validation options */ validation?: { /** Timeout for validation in milliseconds */ timeout?: number; /** Whether to verify function selectors after rollback */ verifySelectors?: boolean; /** Whether to verify facet addresses after rollback */ verifyFacets?: boolean; }; } /** * Result of a rollback operation * @interface RollbackResult */ export interface RollbackResult { /** Whether the rollback was successful */ success: boolean; /** Transaction hash of the rollback */ txHash?: string; /** Gas used by the rollback */ gasUsed?: string; /** Time taken for rollback in milliseconds */ duration: number; /** Any errors that occurred */ error?: string; /** Validation results */ validation?: { passed: boolean; errors: string[]; }; } //# sourceMappingURL=rollback.d.ts.map