processid

package
v1.10.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 30, 2023 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ProcessID

type ProcessID struct {
	// contains filtered or unexported fields
}

ProcessID is a 32 bytes identifier that holds the following information about the voting process:

- chainID: a 6 bytes trunked hash of the blockchain identifier

- organization: hex address of the wallet creating the process

- census origin: kind of census used for the process (from protobuf models)

- envelope type: ballot properties configuration

- nonce: an incremental uint32 number

processID: 395b41cc9abcd8da6bf26964af9d7eed9e03e53415d37aa96045000600000001 represents chID:vocdoni-bizono addr:0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045 pt:arbo nc:1

func BuildProcessID

func BuildProcessID(proc *models.Process, state *state.State) (*ProcessID, error)

BuildProcessID returns a ProcessID constructed in a deterministic way

func (*ProcessID) Addr

func (p *ProcessID) Addr() common.Address

Addr returns the organizer address

func (*ProcessID) CensusOrigin

func (p *ProcessID) CensusOrigin() models.CensusOrigin

CensusOrigin returns the encoded census origin

func (*ProcessID) ChainID

func (p *ProcessID) ChainID() string

ChainID returns the process blockchain identifier

func (*ProcessID) EnvelopeType

func (p *ProcessID) EnvelopeType() *models.EnvelopeType

EnvelopeType returns the envelope type encoded into the process ID

func (*ProcessID) Marshal

func (p *ProcessID) Marshal() []byte

Marshal encodes to bytes

func (*ProcessID) MarshalBinary

func (p *ProcessID) MarshalBinary() (data []byte, err error)

MarshalBinary implements the BinaryMarshaler interface

func (*ProcessID) Nonce

func (p *ProcessID) Nonce() uint32

Nonce returns the process ID identifier number

func (*ProcessID) SetAddr

func (p *ProcessID) SetAddr(addr common.Address)

SetAddr sets the organizer address (20 bytes)

func (*ProcessID) SetCensusOrigin

func (p *ProcessID) SetCensusOrigin(csOrg models.CensusOrigin) error

SetCensusOrigin sets the census origin type

func (*ProcessID) SetChainID

func (p *ProcessID) SetChainID(chID string)

SetChainID sets the process blockchain identifier

func (*ProcessID) SetEnvelopeType

func (p *ProcessID) SetEnvelopeType(et *models.EnvelopeType) error

SetEnvelopeType sets the envelope type for the process

func (*ProcessID) SetNonce

func (p *ProcessID) SetNonce(nonce uint32)

SetNonce sets the nonce number that identifies the process

func (*ProcessID) String

func (p *ProcessID) String() string

String returns a human readable representation of process ID

func (*ProcessID) Unmarshal

func (p *ProcessID) Unmarshal(pid []byte) error

Unmarshal decodes a 32 byte payload into the process ID fields

func (*ProcessID) UnmarshalBinary

func (p *ProcessID) UnmarshalBinary(data []byte) error

UnmarshalBinary implements the BinaryMarshaler interface

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL