Skip to content

feat(tri27): TRI-27 Staking Module #443

@gHashTag

Description

@gHashTag

Sub-Issue #438: TRI-27 Staking Module

Files: src/tri27/staking.zig (NEW, ~400 LOC)

Tasks:

  • Create spec/staking.tri
  • Generate staking.zig via tri gen
  • Define StakingState:
    • total_staked: u128
    • stakers: AutoHashMap([32]u8 -> StakeInfo)
    • reward_pool: u128
    • apy: f64
  • Implement functions:
    • stakeTokens(amount, lock_period)
    • unstakeTokens()
    • calculateReward(compute_units) -> u128
    • distributeRewards(epoch)
  • Add Coptic mapping:
    • t21: Total staked
    • t22: Current APY
  • Add slashing:
    • Manipulation: -50% stake
    • Theft: -100% stake

Parent: #435

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions