@devtion/actions
Version:
A set of actions and helpers for CLI commands
57 lines • 2.73 kB
TypeScript
import { Contract, Signer } from "ethers";
import { Firestore } from "firebase/firestore";
import { Functions } from "firebase/functions";
/**
* Formats part of a GROTH16 SNARK proof
* @link adapted from SNARKJS p256 function
* @param proofPart <any> a part of a proof to be formatted
* @returns <string> the formatted proof part
*/
export declare const p256: (proofPart: any) => any;
/**
* This function formats the calldata for Solidity
* @link adapted from SNARKJS formatSolidityCalldata function
* @dev this function is supposed to be called with
* @dev the output of generateGROTH16Proof
* @param circuitInput <string[]> Inputs to the circuit
* @param _proof <object> Proof
* @returns <SolidityCalldata> The calldata formatted for Solidity
*/
export declare const formatSolidityCalldata: (circuitInput: string[], _proof: any) => any;
/**
* Verify a GROTH16 SNARK proof on chain
* @param contract <Contract> The contract instance
* @param proof <SolidityCalldata> The calldata formatted for Solidity
* @returns <Promise<boolean>> Whether the proof is valid or not
*/
export declare const verifyGROTH16ProofOnChain: (contract: any, proof: any) => Promise<boolean>;
/**
* Compiles a contract given a path
* @param contractPath <string> path to the verifier contract
* @returns <Promise<any>> the compiled contract
*/
export declare const compileContract: (contractPath: string) => Promise<any>;
/**
* Deploy the verifier contract
* @param contractFactory <ContractFactory> The contract factory
* @returns <Promise<Contract>> The contract instance
*/
export declare const deployVerifierContract: (contractPath: string, signer: Signer) => Promise<Contract>;
/**
* Verify a ceremony validity
* 1. Download all artifacts
* 2. Verify that the zkeys are valid
* 3. Extract the verifier and the vKey
* 4. Generate a proof and verify it locally
* 5. Deploy Verifier contract and verify the proof on-chain
* @param functions <Functions> firebase functions instance
* @param firestore <Firestore> firebase firestore instance
* @param ceremonyPrefix <string> ceremony prefix
* @param outputDirectory <string> output directory where to store the ceremony artifacts
* @param circuitInputsPath <string> path to the circuit inputs file
* @param verifierTemplatePath <string> path to the verifier template file
* @param signer <Signer> signer for contract interaction
* @param logger <any> logger for printing snarkjs output
*/
export declare const verifyCeremony: (functions: Functions, firestore: Firestore, ceremonyPrefix: string, outputDirectory: string, circuitInputsPath: string, verifierTemplatePath: string, signer: Signer, logger?: any) => Promise<void>;
//# sourceMappingURL=contracts.d.ts.map