Skip to main content
Version: v1.2

Core Module

Table of contents​

Classes​

Interfaces​

Type Aliases​

Variables​

Functions​

Type Aliases​

CircuitInputs​

Ƭ CircuitInputs: Record<string, string | bigint | bigint[] | bigint[][] | string[] | bigint[][][]>

A circuit inputs for the circom circuit

Defined in​

utils/types.ts:22

Variables​

STATE_TREE_ARITY​

• Const STATE_TREE_ARITY: 5

Defined in​

utils/constants.ts:2

Functions​

genProcessVkSig​

▸ genProcessVkSig(stateTreeDepth, messageTreeDepth, voteOptionTreeDepth, batchSize): bigint

This function generates the signature of a ProcessMessage Verifying Key(VK). This can be used to check if a ProcessMessages' circuit VK is registered in a smart contract that holds several VKs.

Parameters​

NameTypeDescription
stateTreeDepthnumberThe depth of the state tree.
messageTreeDepthnumberThe depth of the message tree.
voteOptionTreeDepthnumberThe depth of the vote option tree.
batchSizenumberThe size of the batch.

Returns​

bigint

Returns a signature for querying if a verifying key with the given parameters is already registered in the contract.

Defined in​

utils/utils.ts:14


genSubsidyVkSig​

▸ genSubsidyVkSig(_stateTreeDepth, _intStateTreeDepth, _voteOptionTreeDepth): bigint

This function generates the signature of a Subsidy Verifying Key(VK). This can be used to check if a SubsidyCalculations' circuit VK is registered in a smart contract that holds several VKs.

Parameters​

NameTypeDescription
_stateTreeDepthnumberThe depth of the state tree.
_intStateTreeDepthnumberThe depth of the intermediate state tree.
_voteOptionTreeDepthnumberThe depth of the vote option tree.

Returns​

bigint

Returns a signature for querying if a verifying key with the given parameters is already registered in the contract.

Defined in​

utils/utils.ts:51


genTallyVkSig​

▸ genTallyVkSig(_stateTreeDepth, _intStateTreeDepth, _voteOptionTreeDepth): bigint

This function generates the signature of a Tally Verifying Key(VK). This can be used to check if a TallyVotes' circuit VK is registered in a smart contract that holds several VKs.

Parameters​

NameTypeDescription
_stateTreeDepthnumberThe depth of the state tree.
_intStateTreeDepthnumberThe depth of the intermediate state tree.
_voteOptionTreeDepthnumberThe depth of the vote option tree.

Returns​

bigint

Returns a signature for querying if a verifying key with the given parameters is already registered in the contract.

Defined in​

utils/utils.ts:35


packProcessMessageSmallVals​

▸ packProcessMessageSmallVals(maxVoteOptions, numUsers, batchStartIndex, batchEndIndex): bigint

This function packs it's parameters into a single bigint.

Parameters​

NameTypeDescription
maxVoteOptionsbigintThe maximum number of vote options.
numUsersbigintThe number of users.
batchStartIndexnumberThe start index of the batch.
batchEndIndexnumberThe end index of the batch.

Returns​

bigint

Returns a single bigint that contains the packed values.

Defined in​

utils/utils.ts:65


packSubsidySmallVals​

▸ packSubsidySmallVals(row, col, numSignUps): bigint

This function packs it's parameters into a single bigint.

Parameters​

NameTypeDescription
rownumberThe row.
colnumberThe column.
numSignUpsnumberThe number of signups.

Returns​

bigint

Returns a single bigint that contains the packed values.

Defined in​

utils/utils.ts:150


packTallyVotesSmallVals​

▸ packTallyVotesSmallVals(batchStartIndex, batchSize, numSignUps): bigint

This function packs it's parameters into a single bigint.

Parameters​

NameTypeDescription
batchStartIndexnumberThe start index of the batch.
batchSizenumberThe size of the batch.
numSignUpsnumberThe number of signups.

Returns​

bigint

Returns a single bigint that contains the packed values.

Defined in​

utils/utils.ts:119


unpackProcessMessageSmallVals​

▸ unpackProcessMessageSmallVals(packedVals): Object

This function unpacks partial values for the ProcessMessages circuit from a single bigint.

Parameters​

NameTypeDescription
packedValsbigintThe single bigint that contains the packed values.

Returns​

Object

Returns an object that contains the unpacked values.

NameType
batchEndIndexbigint
batchStartIndexbigint
maxVoteOptionsbigint
numUsersbigint

Defined in​

utils/utils.ts:86


unpackTallyVotesSmallVals​

▸ unpackTallyVotesSmallVals(packedVals): Object

This function unpacks partial values for the TallyVotes circuit from a single bigint.

Parameters​

NameTypeDescription
packedValsbigintThe single bigint that contains the packed values.

Returns​

Object

Returns an object that contains the unpacked values.

NameType
batchStartIndexbigint
numSignUpsbigint

Defined in​

utils/utils.ts:131