An on-chain staking protocol that locks non-fungible tokens (NFTs) into a secure, non-custodial state machine to generate dynamic tokenized rewards over time. The system utilizes deterministic reward accumulation equations based on time deltas to secure decentralized assets while enabling automated yield scaling.
initialize_config: Provisions the global protocol state, defining reward emission rates per slot/epoch, freezing penalty timelines, and initializing the native reward token mint authority via a dedicated PDA wrapper.initialize_user: Registers a unique, deterministic user state profile account (UserAccount) to track total staked assets, reward points balances, and generalized account metadata.stake: Transfers or locks the target NFT into a program-derived vault. It records a high-precision block timestamp snapshot to establish the baseline staking velocity and updates user registry counts.unstake: Checks active lock-up boundaries, calculates final accrued token rewards, unlocks the specific NFT asset back to the owner, and resets the individual staking record data parameters.claim_rewards: Triggers an atomic token mint operation. It evaluates elapsed block time using the protocol's mathematical yield engine, updates the user's reward history, and executes a CPI to mint newly generated reward tokens to the user's Associated Token Account (ATA).The protocol establishes strict account isolation vectors using explicit Anchor constraints and Program Derived Addresses (PDAs):
StakeConfig: A global configuration account handling administrative variables, reward mint control addresses, and base system settings.UserAccount: Derived via seeds [b"user", user_pubkey], maintaining isolated state lines for individual depositors.StakeAccount: Individual asset states derived via seeds [b"stake", nft_mint_pubkey], ensuring no collision vectors exist between discrete staked items.