Skip to main content

Crate tribewarez_staking

Crate tribewarez_staking 

Source
Expand description

§tribewarez-staking

PTtC (Power-to-Trust-to-Collaborate) Staking Program for Tribewarez DeFi.

This crate implements a staking program that allows users to stake PTtC tokens and earn rewards over time. It supports flexible staking strategies with v0.2.0 introducing tensor network entanglement for cooperative staking with entropy-based unlock probabilities and efficiency bonuses.

§Core Features

  • Token Staking: Secure staking of PTtC tokens with time-based rewards
  • Reward Distribution: Distribute rewards to stakers based on stake amount and duration
  • Staking Pools: Multiple pools with different reward rates and lock durations
  • Tensor Entanglement: v0.2.0 feature enabling cooperative staking with quantum-like entanglement
  • Unlock Mechanics: Entropy-based unlock probabilities for enhanced security

§Key Instructions

  • initialize_pool: Create a new staking pool with specific parameters
  • stake: Stake tokens into a pool
  • unstake: Withdraw staked tokens (subject to lock duration)
  • claim_rewards: Claim accumulated rewards
  • entangle_stakes: Link stakes in tensor network for cooperative rewards (v0.2.0)

§Events

This program emits events for stake deposits, withdrawals, reward claims, and pool configuration changes. See the events module for detailed event documentation.

§Security Considerations

  • Staking locks are enforced via timestamp checks
  • Token transfers use SPL Token program via CPI for security
  • Admin-only operations are protected via Anchor’s access control

Modules§

accounts
An Anchor generated module, providing a set of structs mirroring the structs deriving Accounts, where each field is a Pubkey. This is useful for specifying accounts for a client.
events
instruction
An Anchor generated module containing the program’s set of instructions, where each method handler in the #[program] mod is associated with a struct defining the input arguments to the method. These should be used directly, when one wants to serialize Anchor instruction data, for example, when speciying instructions on a client.
program
Module representing the program.
services
tribewarez_staking
Tribewarez Staking Program Allows users to stake PTtC tokens and earn rewards over time. Using native SPL token CPI calls for compatibility.

Structs§

ClaimRewards
ClaimRewardsBumps
InitializePool
InitializePoolBumps
Stake
StakeAccount
Individual stake account tracking one user’s stake in a pool. Each staker has one account per pool they’re participating in.
StakeBumps
StakingPool
A staking pool that holds staked tokens and distributes rewards. Each pool has its own configuration, token accounts, and reward parameters.
Unstake
UnstakeBumps
UpdatePool
UpdatePoolBumps

Enums§

StakingError

Statics§

ID
The static program ID

Functions§

check_id
Confirms that a given pubkey is equivalent to the program ID
entry
The Anchor codegen exposes a programming model where a user defines a set of methods inside of a #[program] module in a way similar to writing RPC request handlers. The macro then generates a bunch of code wrapping these user defined methods into something that can be executed on Solana.
entrypoint
Safety
id
Returns the program ID