UNPKG

l1-lottery-contracts

Version:

This repo contains smart contracts and related scripts for ZkNoid L1 Lottery proposed [here](https://forums.minaprotocol.com/t/zknoid-l1-lottery/6269)

383 lines (382 loc) 13.9 kB
import { Field, InferProvable, UInt32, UInt64 } from 'o1js'; export declare function PackingPlant<A, T extends InferProvable<A> = InferProvable<A>>(elementType: A, l: number, bitSize: bigint): (abstract new (packed: Field) => { /** * @returns array of single Field element which constitute the packed object */ toFields(): Array<Field>; assertEquals(other: any): void; packed: import("o1js/dist/node/lib/provable/field.js").Field; }) & { type: import("o1js/dist/node/bindings/lib/generic.js").GenericProvableExtendedPure<{ packed: import("o1js/dist/node/lib/provable/field.js").Field; }, { packed: bigint; }, { packed: string; }, import("o1js/dist/node/lib/provable/field.js").Field>; l: number; bitSize: bigint; extractField(input: T): Field; sizeInBits(): bigint; unpack(f: Field): Array<T>; /** * * @param unpacked Array of the implemented packed type * @throws if the length of the array is longer than the length of the implementing factory config */ checkPack(unpacked: Array<T>): void; /** * * @param unpacked Array of the implemented packed type, must be shorter than the max allowed, which varies by type, will throw if the input is too long * @returns Field, packed with the information from the unpacked input */ pack(unpacked: Array<T>): Field; /** * * @param f Field, packed with the information, as returned by #pack * @returns Array of bigints, which can be decoded by the implementing class into the final type */ unpackToBigints(f: Field): Array<bigint>; _isStruct: true; toFields: (value: { packed: import("o1js/dist/node/lib/provable/field.js").Field; }) => import("o1js/dist/node/lib/provable/field.js").Field[]; toAuxiliary: (value?: { packed: import("o1js/dist/node/lib/provable/field.js").Field; } | undefined) => any[]; sizeInFields: () => number; check: (value: { packed: import("o1js/dist/node/lib/provable/field.js").Field; }) => void; toValue: (x: { packed: import("o1js/dist/node/lib/provable/field.js").Field; }) => { packed: bigint; }; fromValue: ((x: { packed: import("o1js/dist/node/lib/provable/field.js").Field; } | { packed: bigint; }) => { packed: import("o1js/dist/node/lib/provable/field.js").Field; }) & ((value: { packed: string | number | bigint | import("o1js/dist/node/lib/provable/field.js").Field; }) => { packed: import("o1js/dist/node/lib/provable/field.js").Field; }); fromFields: (fields: import("o1js/dist/node/lib/provable/field.js").Field[]) => { packed: import("o1js/dist/node/lib/provable/field.js").Field; }; toInput: (x: { packed: import("o1js/dist/node/lib/provable/field.js").Field; }) => { fields?: Field[] | undefined; packed?: [Field, number][] | undefined; }; toJSON: (x: { packed: import("o1js/dist/node/lib/provable/field.js").Field; }) => { packed: string; }; fromJSON: (x: { packed: string; }) => { packed: import("o1js/dist/node/lib/provable/field.js").Field; }; empty: () => { packed: import("o1js/dist/node/lib/provable/field.js").Field; }; }; export declare function PackedUInt32Factory(l?: number): { new (packed: Field): { toBigInts(): Array<bigint>; /** * @returns array of single Field element which constitute the packed object */ toFields(): Array<Field>; assertEquals(other: { /** * @returns array of single Field element which constitute the packed object */ toFields(): Array<Field>; assertEquals(other: any): void; packed: import("o1js/dist/node/lib/provable/field.js").Field; }): void; packed: import("o1js/dist/node/lib/provable/field.js").Field; }; extractField(input: UInt32): Field; sizeInBits(): bigint; /** * * @param f Field, packed with the information, as returned by #pack * @returns Array of UInt32 */ unpack(f: Field): UInt32[]; /** * * @param uint32s Array of UInt32s to be packed * @returns Instance of the implementing class */ fromUInt32s(uint32s: Array<UInt32>): { toBigInts(): Array<bigint>; /** * @returns array of single Field element which constitute the packed object */ toFields(): Array<Field>; assertEquals(other: { /** * @returns array of single Field element which constitute the packed object */ toFields(): Array<Field>; assertEquals(other: any): void; packed: import("o1js/dist/node/lib/provable/field.js").Field; }): void; packed: import("o1js/dist/node/lib/provable/field.js").Field; }; /** * * @param bigints Array of bigints to be packed * @returns Instance of the implementing class */ fromBigInts(bigints: Array<bigint>): { toBigInts(): Array<bigint>; /** * @returns array of single Field element which constitute the packed object */ toFields(): Array<Field>; assertEquals(other: { /** * @returns array of single Field element which constitute the packed object */ toFields(): Array<Field>; assertEquals(other: any): void; packed: import("o1js/dist/node/lib/provable/field.js").Field; }): void; packed: import("o1js/dist/node/lib/provable/field.js").Field; }; type: import("o1js/dist/node/bindings/lib/generic.js").GenericProvableExtendedPure<{ packed: import("o1js/dist/node/lib/provable/field.js").Field; }, { packed: bigint; }, { packed: string; }, import("o1js/dist/node/lib/provable/field.js").Field>; l: number; bitSize: bigint; /** * * @param unpacked Array of the implemented packed type * @throws if the length of the array is longer than the length of the implementing factory config */ checkPack(unpacked: UInt32[]): void; /** * * @param unpacked Array of the implemented packed type, must be shorter than the max allowed, which varies by type, will throw if the input is too long * @returns Field, packed with the information from the unpacked input */ pack(unpacked: UInt32[]): Field; /** * * @param f Field, packed with the information, as returned by #pack * @returns Array of bigints, which can be decoded by the implementing class into the final type */ unpackToBigints(f: Field): Array<bigint>; _isStruct: true; toFields: (value: { packed: import("o1js/dist/node/lib/provable/field.js").Field; }) => import("o1js/dist/node/lib/provable/field.js").Field[]; toAuxiliary: (value?: { packed: import("o1js/dist/node/lib/provable/field.js").Field; } | undefined) => any[]; sizeInFields: () => number; check: (value: { packed: import("o1js/dist/node/lib/provable/field.js").Field; }) => void; toValue: (x: { packed: import("o1js/dist/node/lib/provable/field.js").Field; }) => { packed: bigint; }; fromValue: ((x: { packed: import("o1js/dist/node/lib/provable/field.js").Field; } | { packed: bigint; }) => { packed: import("o1js/dist/node/lib/provable/field.js").Field; }) & ((value: { packed: string | number | bigint | import("o1js/dist/node/lib/provable/field.js").Field; }) => { packed: import("o1js/dist/node/lib/provable/field.js").Field; }); fromFields: (fields: import("o1js/dist/node/lib/provable/field.js").Field[]) => { packed: import("o1js/dist/node/lib/provable/field.js").Field; }; toInput: (x: { packed: import("o1js/dist/node/lib/provable/field.js").Field; }) => { fields?: Field[] | undefined; packed?: [Field, number][] | undefined; }; toJSON: (x: { packed: import("o1js/dist/node/lib/provable/field.js").Field; }) => { packed: string; }; fromJSON: (x: { packed: string; }) => { packed: import("o1js/dist/node/lib/provable/field.js").Field; }; empty: () => { packed: import("o1js/dist/node/lib/provable/field.js").Field; }; }; declare const NumberPacked_base: { new (packed: Field): { toBigInts(): Array<bigint>; /** * @returns array of single Field element which constitute the packed object */ toFields(): Array<Field>; assertEquals(other: { /** * @returns array of single Field element which constitute the packed object */ toFields(): Array<Field>; assertEquals(other: any): void; packed: import("o1js/dist/node/lib/provable/field.js").Field; }): void; packed: import("o1js/dist/node/lib/provable/field.js").Field; }; extractField(input: UInt32): Field; sizeInBits(): bigint; /** * * @param f Field, packed with the information, as returned by #pack * @returns Array of UInt32 */ unpack(f: Field): UInt32[]; /** * * @param uint32s Array of UInt32s to be packed * @returns Instance of the implementing class */ fromUInt32s(uint32s: Array<UInt32>): { toBigInts(): Array<bigint>; /** * @returns array of single Field element which constitute the packed object */ toFields(): Array<Field>; assertEquals(other: { /** * @returns array of single Field element which constitute the packed object */ toFields(): Array<Field>; assertEquals(other: any): void; packed: import("o1js/dist/node/lib/provable/field.js").Field; }): void; packed: import("o1js/dist/node/lib/provable/field.js").Field; }; /** * * @param bigints Array of bigints to be packed * @returns Instance of the implementing class */ fromBigInts(bigints: Array<bigint>): { toBigInts(): Array<bigint>; /** * @returns array of single Field element which constitute the packed object */ toFields(): Array<Field>; assertEquals(other: { /** * @returns array of single Field element which constitute the packed object */ toFields(): Array<Field>; assertEquals(other: any): void; packed: import("o1js/dist/node/lib/provable/field.js").Field; }): void; packed: import("o1js/dist/node/lib/provable/field.js").Field; }; type: import("o1js/dist/node/bindings/lib/generic.js").GenericProvableExtendedPure<{ packed: import("o1js/dist/node/lib/provable/field.js").Field; }, { packed: bigint; }, { packed: string; }, import("o1js/dist/node/lib/provable/field.js").Field>; l: number; bitSize: bigint; /** * * @param unpacked Array of the implemented packed type * @throws if the length of the array is longer than the length of the implementing factory config */ checkPack(unpacked: UInt32[]): void; /** * * @param unpacked Array of the implemented packed type, must be shorter than the max allowed, which varies by type, will throw if the input is too long * @returns Field, packed with the information from the unpacked input */ pack(unpacked: UInt32[]): Field; /** * * @param f Field, packed with the information, as returned by #pack * @returns Array of bigints, which can be decoded by the implementing class into the final type */ unpackToBigints(f: Field): Array<bigint>; _isStruct: true; toFields: (value: { packed: import("o1js/dist/node/lib/provable/field.js").Field; }) => import("o1js/dist/node/lib/provable/field.js").Field[]; toAuxiliary: (value?: { packed: import("o1js/dist/node/lib/provable/field.js").Field; } | undefined) => any[]; sizeInFields: () => number; check: (value: { packed: import("o1js/dist/node/lib/provable/field.js").Field; }) => void; toValue: (x: { packed: import("o1js/dist/node/lib/provable/field.js").Field; }) => { packed: bigint; }; fromValue: ((x: { packed: import("o1js/dist/node/lib/provable/field.js").Field; } | { packed: bigint; }) => { packed: import("o1js/dist/node/lib/provable/field.js").Field; }) & ((value: { packed: string | number | bigint | import("o1js/dist/node/lib/provable/field.js").Field; }) => { packed: import("o1js/dist/node/lib/provable/field.js").Field; }); fromFields: (fields: import("o1js/dist/node/lib/provable/field.js").Field[]) => { packed: import("o1js/dist/node/lib/provable/field.js").Field; }; toInput: (x: { packed: import("o1js/dist/node/lib/provable/field.js").Field; }) => { fields?: Field[] | undefined; packed?: [Field, number][] | undefined; }; toJSON: (x: { packed: import("o1js/dist/node/lib/provable/field.js").Field; }) => { packed: string; }; fromJSON: (x: { packed: string; }) => { packed: import("o1js/dist/node/lib/provable/field.js").Field; }; empty: () => { packed: import("o1js/dist/node/lib/provable/field.js").Field; }; }; export declare class NumberPacked extends NumberPacked_base { } export declare function convertToUInt64(value: Field): UInt64; export declare function convertToUInt32(value: Field): UInt32; export {};