UNPKG

@vocdoni/davinci-contracts

Version:

Smart contracts powering DAVINCI's digital voting protocol

446 lines (445 loc) 21.4 kB
import type { BaseContract, BigNumberish, BytesLike, FunctionFragment, Result, Interface, EventFragment, AddressLike, ContractRunner, ContractMethod, Listener } from "ethers"; import type { TypedContractEvent, TypedDeferredTopicFilter, TypedEventLog, TypedLogDescription, TypedListener, TypedContractMethod } from "../../common"; export declare namespace IProcessRegistry { type EncryptionKeyStruct = { x: BigNumberish; y: BigNumberish; }; type EncryptionKeyStructOutput = [x: bigint, y: bigint] & { x: bigint; y: bigint; }; type BallotModeStruct = { costFromWeight: boolean; forceUniqueness: boolean; maxCount: BigNumberish; costExponent: BigNumberish; maxValue: BigNumberish; minValue: BigNumberish; maxTotalCost: BigNumberish; minTotalCost: BigNumberish; }; type BallotModeStructOutput = [ costFromWeight: boolean, forceUniqueness: boolean, maxCount: bigint, costExponent: bigint, maxValue: bigint, minValue: bigint, maxTotalCost: bigint, minTotalCost: bigint ] & { costFromWeight: boolean; forceUniqueness: boolean; maxCount: bigint; costExponent: bigint; maxValue: bigint; minValue: bigint; maxTotalCost: bigint; minTotalCost: bigint; }; type CensusStruct = { censusOrigin: BigNumberish; maxVotes: BigNumberish; censusRoot: BytesLike; censusURI: string; }; type CensusStructOutput = [ censusOrigin: bigint, maxVotes: bigint, censusRoot: string, censusURI: string ] & { censusOrigin: bigint; maxVotes: bigint; censusRoot: string; censusURI: string; }; type ProcessStruct = { status: BigNumberish; organizationId: AddressLike; encryptionKey: IProcessRegistry.EncryptionKeyStruct; latestStateRoot: BigNumberish; result: BigNumberish[]; startTime: BigNumberish; duration: BigNumberish; voteCount: BigNumberish; voteOverwriteCount: BigNumberish; metadataURI: string; ballotMode: IProcessRegistry.BallotModeStruct; census: IProcessRegistry.CensusStruct; }; type ProcessStructOutput = [ status: bigint, organizationId: string, encryptionKey: IProcessRegistry.EncryptionKeyStructOutput, latestStateRoot: bigint, result: bigint[], startTime: bigint, duration: bigint, voteCount: bigint, voteOverwriteCount: bigint, metadataURI: string, ballotMode: IProcessRegistry.BallotModeStructOutput, census: IProcessRegistry.CensusStructOutput ] & { status: bigint; organizationId: string; encryptionKey: IProcessRegistry.EncryptionKeyStructOutput; latestStateRoot: bigint; result: bigint[]; startTime: bigint; duration: bigint; voteCount: bigint; voteOverwriteCount: bigint; metadataURI: string; ballotMode: IProcessRegistry.BallotModeStructOutput; census: IProcessRegistry.CensusStructOutput; }; } export interface ProcessRegistryInterface extends Interface { getFunction(nameOrSignature: "MAX_CENSUS_ORIGIN" | "MAX_STATUS" | "chainID" | "getProcess" | "getRVerifierVKeyHash" | "getSTVerifierVKeyHash" | "newProcess" | "organizationRegistryAddress" | "processCount" | "processes" | "rVerifier" | "setProcessCensus" | "setProcessDuration" | "setProcessResults" | "setProcessStatus" | "stVerifier" | "submitStateTransition"): FunctionFragment; getEvent(nameOrSignatureOrTopic: "CensusUpdated" | "ProcessCreated" | "ProcessDurationChanged" | "ProcessResultsSet" | "ProcessStateRootUpdated" | "ProcessStatusChanged"): EventFragment; encodeFunctionData(functionFragment: "MAX_CENSUS_ORIGIN", values?: undefined): string; encodeFunctionData(functionFragment: "MAX_STATUS", values?: undefined): string; encodeFunctionData(functionFragment: "chainID", values?: undefined): string; encodeFunctionData(functionFragment: "getProcess", values: [BytesLike]): string; encodeFunctionData(functionFragment: "getRVerifierVKeyHash", values?: undefined): string; encodeFunctionData(functionFragment: "getSTVerifierVKeyHash", values?: undefined): string; encodeFunctionData(functionFragment: "newProcess", values: [ BigNumberish, BigNumberish, BigNumberish, IProcessRegistry.BallotModeStruct, IProcessRegistry.CensusStruct, string, AddressLike, BytesLike, IProcessRegistry.EncryptionKeyStruct, BigNumberish ]): string; encodeFunctionData(functionFragment: "organizationRegistryAddress", values?: undefined): string; encodeFunctionData(functionFragment: "processCount", values?: undefined): string; encodeFunctionData(functionFragment: "processes", values: [BytesLike]): string; encodeFunctionData(functionFragment: "rVerifier", values?: undefined): string; encodeFunctionData(functionFragment: "setProcessCensus", values: [BytesLike, IProcessRegistry.CensusStruct]): string; encodeFunctionData(functionFragment: "setProcessDuration", values: [BytesLike, BigNumberish]): string; encodeFunctionData(functionFragment: "setProcessResults", values: [BytesLike, BytesLike, BytesLike]): string; encodeFunctionData(functionFragment: "setProcessStatus", values: [BytesLike, BigNumberish]): string; encodeFunctionData(functionFragment: "stVerifier", values?: undefined): string; encodeFunctionData(functionFragment: "submitStateTransition", values: [BytesLike, BytesLike, BytesLike]): string; decodeFunctionResult(functionFragment: "MAX_CENSUS_ORIGIN", data: BytesLike): Result; decodeFunctionResult(functionFragment: "MAX_STATUS", data: BytesLike): Result; decodeFunctionResult(functionFragment: "chainID", data: BytesLike): Result; decodeFunctionResult(functionFragment: "getProcess", data: BytesLike): Result; decodeFunctionResult(functionFragment: "getRVerifierVKeyHash", data: BytesLike): Result; decodeFunctionResult(functionFragment: "getSTVerifierVKeyHash", data: BytesLike): Result; decodeFunctionResult(functionFragment: "newProcess", data: BytesLike): Result; decodeFunctionResult(functionFragment: "organizationRegistryAddress", data: BytesLike): Result; decodeFunctionResult(functionFragment: "processCount", data: BytesLike): Result; decodeFunctionResult(functionFragment: "processes", data: BytesLike): Result; decodeFunctionResult(functionFragment: "rVerifier", data: BytesLike): Result; decodeFunctionResult(functionFragment: "setProcessCensus", data: BytesLike): Result; decodeFunctionResult(functionFragment: "setProcessDuration", data: BytesLike): Result; decodeFunctionResult(functionFragment: "setProcessResults", data: BytesLike): Result; decodeFunctionResult(functionFragment: "setProcessStatus", data: BytesLike): Result; decodeFunctionResult(functionFragment: "stVerifier", data: BytesLike): Result; decodeFunctionResult(functionFragment: "submitStateTransition", data: BytesLike): Result; } export declare namespace CensusUpdatedEvent { type InputTuple = [ processId: BytesLike, censusRoot: BytesLike, censusURI: string, maxVotes: BigNumberish ]; type OutputTuple = [ processId: string, censusRoot: string, censusURI: string, maxVotes: bigint ]; interface OutputObject { processId: string; censusRoot: string; censusURI: string; maxVotes: bigint; } type Event = TypedContractEvent<InputTuple, OutputTuple, OutputObject>; type Filter = TypedDeferredTopicFilter<Event>; type Log = TypedEventLog<Event>; type LogDescription = TypedLogDescription<Event>; } export declare namespace ProcessCreatedEvent { type InputTuple = [processId: BytesLike, creator: AddressLike]; type OutputTuple = [processId: string, creator: string]; interface OutputObject { processId: string; creator: string; } type Event = TypedContractEvent<InputTuple, OutputTuple, OutputObject>; type Filter = TypedDeferredTopicFilter<Event>; type Log = TypedEventLog<Event>; type LogDescription = TypedLogDescription<Event>; } export declare namespace ProcessDurationChangedEvent { type InputTuple = [processId: BytesLike, duration: BigNumberish]; type OutputTuple = [processId: string, duration: bigint]; interface OutputObject { processId: string; duration: bigint; } type Event = TypedContractEvent<InputTuple, OutputTuple, OutputObject>; type Filter = TypedDeferredTopicFilter<Event>; type Log = TypedEventLog<Event>; type LogDescription = TypedLogDescription<Event>; } export declare namespace ProcessResultsSetEvent { type InputTuple = [processId: BytesLike, result: BigNumberish[]]; type OutputTuple = [processId: string, result: bigint[]]; interface OutputObject { processId: string; result: bigint[]; } type Event = TypedContractEvent<InputTuple, OutputTuple, OutputObject>; type Filter = TypedDeferredTopicFilter<Event>; type Log = TypedEventLog<Event>; type LogDescription = TypedLogDescription<Event>; } export declare namespace ProcessStateRootUpdatedEvent { type InputTuple = [processId: BytesLike, newStateRoot: BigNumberish]; type OutputTuple = [processId: string, newStateRoot: bigint]; interface OutputObject { processId: string; newStateRoot: bigint; } type Event = TypedContractEvent<InputTuple, OutputTuple, OutputObject>; type Filter = TypedDeferredTopicFilter<Event>; type Log = TypedEventLog<Event>; type LogDescription = TypedLogDescription<Event>; } export declare namespace ProcessStatusChangedEvent { type InputTuple = [processId: BytesLike, newStatus: BigNumberish]; type OutputTuple = [processId: string, newStatus: bigint]; interface OutputObject { processId: string; newStatus: bigint; } type Event = TypedContractEvent<InputTuple, OutputTuple, OutputObject>; type Filter = TypedDeferredTopicFilter<Event>; type Log = TypedEventLog<Event>; type LogDescription = TypedLogDescription<Event>; } export interface ProcessRegistry extends BaseContract { connect(runner?: ContractRunner | null): ProcessRegistry; waitForDeployment(): Promise<this>; interface: ProcessRegistryInterface; queryFilter<TCEvent extends TypedContractEvent>(event: TCEvent, fromBlockOrBlockhash?: string | number | undefined, toBlock?: string | number | undefined): Promise<Array<TypedEventLog<TCEvent>>>; queryFilter<TCEvent extends TypedContractEvent>(filter: TypedDeferredTopicFilter<TCEvent>, fromBlockOrBlockhash?: string | number | undefined, toBlock?: string | number | undefined): Promise<Array<TypedEventLog<TCEvent>>>; on<TCEvent extends TypedContractEvent>(event: TCEvent, listener: TypedListener<TCEvent>): Promise<this>; on<TCEvent extends TypedContractEvent>(filter: TypedDeferredTopicFilter<TCEvent>, listener: TypedListener<TCEvent>): Promise<this>; once<TCEvent extends TypedContractEvent>(event: TCEvent, listener: TypedListener<TCEvent>): Promise<this>; once<TCEvent extends TypedContractEvent>(filter: TypedDeferredTopicFilter<TCEvent>, listener: TypedListener<TCEvent>): Promise<this>; listeners<TCEvent extends TypedContractEvent>(event: TCEvent): Promise<Array<TypedListener<TCEvent>>>; listeners(eventName?: string): Promise<Array<Listener>>; removeAllListeners<TCEvent extends TypedContractEvent>(event?: TCEvent): Promise<this>; MAX_CENSUS_ORIGIN: TypedContractMethod<[], [bigint], "view">; MAX_STATUS: TypedContractMethod<[], [bigint], "view">; chainID: TypedContractMethod<[], [string], "view">; getProcess: TypedContractMethod<[ processId: BytesLike ], [ IProcessRegistry.ProcessStructOutput ], "view">; getRVerifierVKeyHash: TypedContractMethod<[], [string], "view">; getSTVerifierVKeyHash: TypedContractMethod<[], [string], "view">; newProcess: TypedContractMethod<[ status: BigNumberish, startTime: BigNumberish, duration: BigNumberish, ballotMode: IProcessRegistry.BallotModeStruct, census: IProcessRegistry.CensusStruct, metadata: string, organizationId: AddressLike, processId: BytesLike, encryptionKey: IProcessRegistry.EncryptionKeyStruct, initStateRoot: BigNumberish ], [ void ], "nonpayable">; organizationRegistryAddress: TypedContractMethod<[], [string], "view">; processCount: TypedContractMethod<[], [bigint], "view">; processes: TypedContractMethod<[ arg0: BytesLike ], [ [ bigint, string, IProcessRegistry.EncryptionKeyStructOutput, bigint, bigint, bigint, bigint, bigint, string, IProcessRegistry.BallotModeStructOutput, IProcessRegistry.CensusStructOutput ] & { status: bigint; organizationId: string; encryptionKey: IProcessRegistry.EncryptionKeyStructOutput; latestStateRoot: bigint; startTime: bigint; duration: bigint; voteCount: bigint; voteOverwriteCount: bigint; metadataURI: string; ballotMode: IProcessRegistry.BallotModeStructOutput; census: IProcessRegistry.CensusStructOutput; } ], "view">; rVerifier: TypedContractMethod<[], [string], "view">; setProcessCensus: TypedContractMethod<[ processId: BytesLike, census: IProcessRegistry.CensusStruct ], [ void ], "nonpayable">; setProcessDuration: TypedContractMethod<[ processId: BytesLike, _duration: BigNumberish ], [ void ], "nonpayable">; setProcessResults: TypedContractMethod<[ processId: BytesLike, proof: BytesLike, input: BytesLike ], [ void ], "nonpayable">; setProcessStatus: TypedContractMethod<[ processId: BytesLike, newStatus: BigNumberish ], [ void ], "nonpayable">; stVerifier: TypedContractMethod<[], [string], "view">; submitStateTransition: TypedContractMethod<[ processId: BytesLike, proof: BytesLike, input: BytesLike ], [ void ], "nonpayable">; getFunction<T extends ContractMethod = ContractMethod>(key: string | FunctionFragment): T; getFunction(nameOrSignature: "MAX_CENSUS_ORIGIN"): TypedContractMethod<[], [bigint], "view">; getFunction(nameOrSignature: "MAX_STATUS"): TypedContractMethod<[], [bigint], "view">; getFunction(nameOrSignature: "chainID"): TypedContractMethod<[], [string], "view">; getFunction(nameOrSignature: "getProcess"): TypedContractMethod<[ processId: BytesLike ], [ IProcessRegistry.ProcessStructOutput ], "view">; getFunction(nameOrSignature: "getRVerifierVKeyHash"): TypedContractMethod<[], [string], "view">; getFunction(nameOrSignature: "getSTVerifierVKeyHash"): TypedContractMethod<[], [string], "view">; getFunction(nameOrSignature: "newProcess"): TypedContractMethod<[ status: BigNumberish, startTime: BigNumberish, duration: BigNumberish, ballotMode: IProcessRegistry.BallotModeStruct, census: IProcessRegistry.CensusStruct, metadata: string, organizationId: AddressLike, processId: BytesLike, encryptionKey: IProcessRegistry.EncryptionKeyStruct, initStateRoot: BigNumberish ], [ void ], "nonpayable">; getFunction(nameOrSignature: "organizationRegistryAddress"): TypedContractMethod<[], [string], "view">; getFunction(nameOrSignature: "processCount"): TypedContractMethod<[], [bigint], "view">; getFunction(nameOrSignature: "processes"): TypedContractMethod<[ arg0: BytesLike ], [ [ bigint, string, IProcessRegistry.EncryptionKeyStructOutput, bigint, bigint, bigint, bigint, bigint, string, IProcessRegistry.BallotModeStructOutput, IProcessRegistry.CensusStructOutput ] & { status: bigint; organizationId: string; encryptionKey: IProcessRegistry.EncryptionKeyStructOutput; latestStateRoot: bigint; startTime: bigint; duration: bigint; voteCount: bigint; voteOverwriteCount: bigint; metadataURI: string; ballotMode: IProcessRegistry.BallotModeStructOutput; census: IProcessRegistry.CensusStructOutput; } ], "view">; getFunction(nameOrSignature: "rVerifier"): TypedContractMethod<[], [string], "view">; getFunction(nameOrSignature: "setProcessCensus"): TypedContractMethod<[ processId: BytesLike, census: IProcessRegistry.CensusStruct ], [ void ], "nonpayable">; getFunction(nameOrSignature: "setProcessDuration"): TypedContractMethod<[ processId: BytesLike, _duration: BigNumberish ], [ void ], "nonpayable">; getFunction(nameOrSignature: "setProcessResults"): TypedContractMethod<[ processId: BytesLike, proof: BytesLike, input: BytesLike ], [ void ], "nonpayable">; getFunction(nameOrSignature: "setProcessStatus"): TypedContractMethod<[ processId: BytesLike, newStatus: BigNumberish ], [ void ], "nonpayable">; getFunction(nameOrSignature: "stVerifier"): TypedContractMethod<[], [string], "view">; getFunction(nameOrSignature: "submitStateTransition"): TypedContractMethod<[ processId: BytesLike, proof: BytesLike, input: BytesLike ], [ void ], "nonpayable">; getEvent(key: "CensusUpdated"): TypedContractEvent<CensusUpdatedEvent.InputTuple, CensusUpdatedEvent.OutputTuple, CensusUpdatedEvent.OutputObject>; getEvent(key: "ProcessCreated"): TypedContractEvent<ProcessCreatedEvent.InputTuple, ProcessCreatedEvent.OutputTuple, ProcessCreatedEvent.OutputObject>; getEvent(key: "ProcessDurationChanged"): TypedContractEvent<ProcessDurationChangedEvent.InputTuple, ProcessDurationChangedEvent.OutputTuple, ProcessDurationChangedEvent.OutputObject>; getEvent(key: "ProcessResultsSet"): TypedContractEvent<ProcessResultsSetEvent.InputTuple, ProcessResultsSetEvent.OutputTuple, ProcessResultsSetEvent.OutputObject>; getEvent(key: "ProcessStateRootUpdated"): TypedContractEvent<ProcessStateRootUpdatedEvent.InputTuple, ProcessStateRootUpdatedEvent.OutputTuple, ProcessStateRootUpdatedEvent.OutputObject>; getEvent(key: "ProcessStatusChanged"): TypedContractEvent<ProcessStatusChangedEvent.InputTuple, ProcessStatusChangedEvent.OutputTuple, ProcessStatusChangedEvent.OutputObject>; filters: { "CensusUpdated(bytes32,bytes32,string,uint256)": TypedContractEvent<CensusUpdatedEvent.InputTuple, CensusUpdatedEvent.OutputTuple, CensusUpdatedEvent.OutputObject>; CensusUpdated: TypedContractEvent<CensusUpdatedEvent.InputTuple, CensusUpdatedEvent.OutputTuple, CensusUpdatedEvent.OutputObject>; "ProcessCreated(bytes32,address)": TypedContractEvent<ProcessCreatedEvent.InputTuple, ProcessCreatedEvent.OutputTuple, ProcessCreatedEvent.OutputObject>; ProcessCreated: TypedContractEvent<ProcessCreatedEvent.InputTuple, ProcessCreatedEvent.OutputTuple, ProcessCreatedEvent.OutputObject>; "ProcessDurationChanged(bytes32,uint256)": TypedContractEvent<ProcessDurationChangedEvent.InputTuple, ProcessDurationChangedEvent.OutputTuple, ProcessDurationChangedEvent.OutputObject>; ProcessDurationChanged: TypedContractEvent<ProcessDurationChangedEvent.InputTuple, ProcessDurationChangedEvent.OutputTuple, ProcessDurationChangedEvent.OutputObject>; "ProcessResultsSet(bytes32,uint256[])": TypedContractEvent<ProcessResultsSetEvent.InputTuple, ProcessResultsSetEvent.OutputTuple, ProcessResultsSetEvent.OutputObject>; ProcessResultsSet: TypedContractEvent<ProcessResultsSetEvent.InputTuple, ProcessResultsSetEvent.OutputTuple, ProcessResultsSetEvent.OutputObject>; "ProcessStateRootUpdated(bytes32,uint256)": TypedContractEvent<ProcessStateRootUpdatedEvent.InputTuple, ProcessStateRootUpdatedEvent.OutputTuple, ProcessStateRootUpdatedEvent.OutputObject>; ProcessStateRootUpdated: TypedContractEvent<ProcessStateRootUpdatedEvent.InputTuple, ProcessStateRootUpdatedEvent.OutputTuple, ProcessStateRootUpdatedEvent.OutputObject>; "ProcessStatusChanged(bytes32,uint8)": TypedContractEvent<ProcessStatusChangedEvent.InputTuple, ProcessStatusChangedEvent.OutputTuple, ProcessStatusChangedEvent.OutputObject>; ProcessStatusChanged: TypedContractEvent<ProcessStatusChangedEvent.InputTuple, ProcessStatusChangedEvent.OutputTuple, ProcessStatusChangedEvent.OutputObject>; }; }