Voter

class cometa.voting_procedures.voter.Voter(ptr)[source]

Bases: object

Represents a voter in the Cardano governance system.

A voter is any participant with an eligible role who either has a direct stake or has delegated their stake, and they exercise their rights by casting votes on governance actions. The weight or influence of their vote is determined by the amount of their active stake or the stake that’s been delegated to them.

Various roles in the Cardano ecosystem can participate in voting: - Constitutional committee members - DReps (Delegation Representatives) - SPOs (Stake Pool Operators)

__init__(ptr)[source]
Return type:

None

__enter__()[source]
Return type:

Voter

__exit__(exc_type, exc_val, exc_tb)[source]
Return type:

None

__repr__()[source]

Return repr(self).

Return type:

str

__eq__(other)[source]

Return self==value.

Parameters:

other (object)

Return type:

bool

__hash__()[source]

Return hash(self).

Return type:

int

classmethod new(voter_type, credential)[source]

Creates a new voter.

Parameters:
  • voter_type (VoterType) – The type of voter (CC, DRep, or SPO).

  • credential (Credential) – The credential identifying the voter.

Returns:

A new Voter instance.

Raises:

CardanoError – If creation fails.

Return type:

Voter

Example

>>> cred = Credential.from_key_hash(key_hash)
>>> voter = Voter.new(VoterType.DREP_KEY_HASH, cred)
classmethod from_cbor(reader)[source]

Deserializes a Voter from CBOR data.

Parameters:

reader (CborReader) – A CborReader positioned at the voter data.

Returns:

A new Voter deserialized from the CBOR data.

Raises:

CardanoError – If deserialization fails.

Return type:

Voter

to_cbor(writer)[source]

Serializes the voter to CBOR format.

Parameters:

writer (CborWriter) – A CborWriter to write the serialized data to.

Raises:

CardanoError – If serialization fails.

Return type:

None

property voter_type: VoterType

Returns the type of this voter.

property credential: Credential

Returns the credential associated with this voter.

to_cip116_json(writer)[source]

Serializes this object to CIP-116 compliant JSON.

Parameters:

writer (JsonWriter) – The JsonWriter to write the JSON to.

Raises:

CardanoError – If serialization fails.

Return type:

None