Skip to main content
Version: v3.x

Minimal Anti Collusion Infrastructure (MACI) / MaciState

Class: MaciState

Defined in: MaciState.ts:12

A representation of the MACI contract.

Implements

  • IMaciState

Constructors

Constructor

new MaciState(stateTreeDepth): MaciState

Defined in: MaciState.ts:36

Constructs a new MaciState object.

Parameters

stateTreeDepth

number

The depth of the state tree.

Returns

MaciState

Properties

currentPollBeingProcessed?

optional currentPollBeingProcessed: bigint

Defined in: MaciState.ts:30


pollBeingProcessed?

optional pollBeingProcessed: boolean

Defined in: MaciState.ts:28


polls

polls: Map<bigint, Poll>

Defined in: MaciState.ts:14


publicKeys

publicKeys: PublicKey[] = []

Defined in: MaciState.ts:17


stateTree?

optional stateTree: IncrementalQuinTree

Defined in: MaciState.ts:23


stateTreeDepth

stateTreeDepth: number

Defined in: MaciState.ts:20


totalSignups

totalSignups: number = 0

Defined in: MaciState.ts:25

Methods

copy()

copy(): MaciState

Defined in: MaciState.ts:104

Create a deep copy of the MaciState object.

Returns

MaciState

A new instance of the MaciState object with the same properties.

Implementation of

IMaciState.copy


deployNullPoll()

deployNullPoll(): void

Defined in: MaciState.ts:96

Deploy a null poll.

Returns

void

Implementation of

IMaciState.deployNullPoll


deployPoll()

deployPoll(pollEndTimestamp, treeDepths, messageBatchSize, coordinatorKeypair, voteOptions, mode): bigint

Defined in: MaciState.ts:68

Deploy a new poll with the given parameters.

Parameters

pollEndTimestamp

bigint

The Unix timestamp at which the poll ends.

treeDepths

ITreeDepths

The depths of the tree.

messageBatchSize

number

The batch size for processing messages.

coordinatorKeypair

Keypair

The keypair of the MACI round coordinator.

voteOptions

bigint

The number of vote options for this poll.

mode

EMode

The voting mode

Returns

bigint

The index of the newly deployed poll.

Implementation of

IMaciState.deployPoll


equals()

equals(m): boolean

Defined in: MaciState.ts:119

Check if the MaciState object is equal to another MaciState object.

Parameters

m

MaciState

The MaciState object to compare.

Returns

boolean

True if the two MaciState objects are equal, false otherwise.

Implementation of

IMaciState.equals


signUp()

signUp(publicKey): number

Defined in: MaciState.ts:51

Sign up a user with the given public key.

Parameters

publicKey

PublicKey

The public key of the user.

Returns

number

The index of the newly signed-up user in the state tree.

Implementation of

IMaciState.signUp


toJSON()

toJSON(): IJsonMaciState

Defined in: MaciState.ts:147

Serialize the MaciState object to a JSON object.

Returns

IJsonMaciState

A JSON object representing the MaciState object.

Implementation of

IMaciState.toJSON


fromJSON()

static fromJSON(json): MaciState

Defined in: MaciState.ts:163

Create a new MaciState object from a JSON object.

Parameters

json

IJsonMaciState

The JSON object representing the MaciState object.

Returns

MaciState

A new instance of the MaciState object with the properties from the JSON object.