UNPKG

@vocdoni/davinci-contracts

Version:

Smart contracts powering DAVINCI's digital voting protocol

110 lines (109 loc) 4.74 kB
import type { BaseContract, BigNumberish, BytesLike, FunctionFragment, Result, Interface, ContractRunner, ContractMethod, Listener } from "ethers"; import type { TypedContractEvent, TypedDeferredTopicFilter, TypedEventLog, TypedListener, TypedContractMethod } from "../../common"; export declare namespace DAVINCITypes { type BallotModeStruct = { uniqueValues: boolean; numFields: BigNumberish; groupSize: BigNumberish; costExponent: BigNumberish; maxValue: BigNumberish; minValue: BigNumberish; maxValueSum: BigNumberish; minValueSum: BigNumberish; }; type BallotModeStructOutput = [ uniqueValues: boolean, numFields: bigint, groupSize: bigint, costExponent: bigint, maxValue: bigint, minValue: bigint, maxValueSum: bigint, minValueSum: bigint ] & { uniqueValues: boolean; numFields: bigint; groupSize: bigint; costExponent: bigint; maxValue: bigint; minValue: bigint; maxValueSum: bigint; minValueSum: bigint; }; type EncryptionKeyStruct = { x: BigNumberish; y: BigNumberish; }; type EncryptionKeyStructOutput = [x: bigint, y: bigint] & { x: bigint; y: bigint; }; } export interface StateRootLibInterface extends Interface { getFunction(nameOrSignature: "computeStateRoot" | "verifyStateRoot"): FunctionFragment; encodeFunctionData(functionFragment: "computeStateRoot", values: [ BytesLike, BigNumberish, DAVINCITypes.BallotModeStruct, DAVINCITypes.EncryptionKeyStruct ]): string; encodeFunctionData(functionFragment: "verifyStateRoot", values: [ BigNumberish, BytesLike, BigNumberish, DAVINCITypes.BallotModeStruct, DAVINCITypes.EncryptionKeyStruct ]): string; decodeFunctionResult(functionFragment: "computeStateRoot", data: BytesLike): Result; decodeFunctionResult(functionFragment: "verifyStateRoot", data: BytesLike): Result; } export interface StateRootLib extends BaseContract { connect(runner?: ContractRunner | null): StateRootLib; waitForDeployment(): Promise<this>; interface: StateRootLibInterface; 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>; computeStateRoot: TypedContractMethod<[ processId: BytesLike, censusOrigin: BigNumberish, ballotMode: DAVINCITypes.BallotModeStruct, encryptionKey: DAVINCITypes.EncryptionKeyStruct ], [ bigint ], "view">; verifyStateRoot: TypedContractMethod<[ expectedRoot: BigNumberish, processId: BytesLike, censusOrigin: BigNumberish, ballotMode: DAVINCITypes.BallotModeStruct, encryptionKey: DAVINCITypes.EncryptionKeyStruct ], [ boolean ], "view">; getFunction<T extends ContractMethod = ContractMethod>(key: string | FunctionFragment): T; getFunction(nameOrSignature: "computeStateRoot"): TypedContractMethod<[ processId: BytesLike, censusOrigin: BigNumberish, ballotMode: DAVINCITypes.BallotModeStruct, encryptionKey: DAVINCITypes.EncryptionKeyStruct ], [ bigint ], "view">; getFunction(nameOrSignature: "verifyStateRoot"): TypedContractMethod<[ expectedRoot: BigNumberish, processId: BytesLike, censusOrigin: BigNumberish, ballotMode: DAVINCITypes.BallotModeStruct, encryptionKey: DAVINCITypes.EncryptionKeyStruct ], [ boolean ], "view">; filters: {}; }