hardhat
Version:
Hardhat is an extensible developer tool that helps smart contract developers increase productivity by reliably bringing together the tools they want.
60 lines • 2.02 kB
TypeScript
import type { GasAnalyticsManager, GasMeasurement, GasStatsJson } from "./types.js";
interface DeploymentGasStats extends GasStats {
runtimeSize: number;
}
interface ContractGasStats {
proxyChain: string[];
deployment?: DeploymentGasStats;
functions: Map<string, // function name or signature (if overloaded)
GasStats>;
}
type GasStatsByContract = Map<string, ContractGasStats>;
interface GasStats {
min: number;
max: number;
avg: number;
median: number;
count: number;
}
type GasMeasurementsByContract = Map<string, ContractGasMeasurements>;
interface ContractGasMeasurements {
proxyChain: string[];
deployments: number[];
deploymentRuntimeSize?: number;
functions: Map<string, // functionSig
number[]>;
}
export declare class GasAnalyticsManagerImplementation implements GasAnalyticsManager {
#private;
gasMeasurements: GasMeasurement[];
constructor(gasStatsRootPath: string);
addGasMeasurement(gasMeasurement: GasMeasurement): void;
clearGasMeasurements(id: string): Promise<void>;
saveGasMeasurements(id: string): Promise<void>;
reportGasStats(...ids: string[]): Promise<void>;
writeGasStatsJson(outputPath: string, ...ids: string[]): Promise<void>;
enableReport(): void;
disableReport(): void;
/**
* @private exposed for testing purposes only
*/
_loadGasMeasurements(...ids: string[]): Promise<void>;
/**
* @private exposed for testing purposes only
*/
_calculateGasStats(): GasStatsByContract;
/**
* @private exposed for testing purposes only
*/
_aggregateGasMeasurements(): GasMeasurementsByContract;
/**
* @private exposed for testing purposes only
*/
_generateGasStatsReport(gasStatsByContract: GasStatsByContract): string;
/**
* @private exposed for testing purposes only
*/
_generateGasStatsJson(gasStatsByContract: GasStatsByContract): GasStatsJson;
}
export {};
//# sourceMappingURL=gas-analytics-manager.d.ts.map