Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python/staking feature #1196

Merged
merged 6 commits into from
Sep 11, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 29 additions & 5 deletions bindings/python/iota_sdk/types/feature.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@ class FeatureType(IntEnum):
Metadata (2): The metadata feature.
Tag (3): The tag feature.
BlockIssuer (4): The block issuer feature.
Staking (5): The staking feature.
"""
Sender = 0
Issuer = 1
Metadata = 2
Tag = 3
BlockIssuer = 4
Staking = 5


@json
Expand All @@ -38,7 +40,7 @@ class Feature():
@json
@dataclass
class SenderFeature(Feature):
"""Sender feature.
"""Identifies the validated sender of an output.
Attributes:
address: A given sender address.
"""
Expand All @@ -52,7 +54,7 @@ class SenderFeature(Feature):
@json
@dataclass
class IssuerFeature(Feature):
"""Issuer feature.
"""Identifies the validated issuer of the UTXO state machine.
Attributes:
address: A given issuer address.
"""
Expand All @@ -66,7 +68,7 @@ class IssuerFeature(Feature):
@json
@dataclass
class MetadataFeature(Feature):
"""Metadata feature.
"""Defines metadata, arbitrary binary data, that will be stored in the output.
Attributes:
data: Some hex encoded metadata.
"""
Expand All @@ -80,7 +82,7 @@ class MetadataFeature(Feature):
@json
@dataclass
class TagFeature(Feature):
"""Tag feature.
"""Makes it possible to tag outputs with an index, so they can be retrieved through an indexer API.
Attributes:
tag: A hex encoded tag used to index the output.
"""
Expand All @@ -91,7 +93,7 @@ class TagFeature(Feature):
@json
@dataclass
class BlockIssuer(Feature):
"""Block issuer feature.
"""Contains the public keys to verify block signatures and allows for unbonding the issuer deposit.
Attributes:
expiry_slot: The slot index at which the Block Issuer Feature expires and can be removed.
public_keys: The Block Issuer Keys.
Expand All @@ -104,3 +106,25 @@ class BlockIssuer(Feature):
default_factory=lambda: int(
FeatureType.BlockIssuer),
init=False)


@json
@dataclass
class StakingFeature(Feature):
"""Stakes IOTA coins to become eligible for committee selection, validate the network and receive Mana rewards.
Attributes:
staked_amount: The amount of IOTA coins that are locked and staked in the containing account.
fixed_cost: The fixed cost of the validator, which it receives as part of its Mana rewards.
start_epoch: The epoch index in which the staking started.
end_epoch: The epoch index in which the staking ends.
"""
staked_amount: str
fixed_cost: str
# TODO Replace with an EpochIndex type
start_epoch: HexStr
# TODO Replace with an EpochIndex type
end_epoch: HexStr
type: int = field(
default_factory=lambda: int(
FeatureType.Staking),
init=False)