Deep Dive Into
PrimalFi Protocol
2
Core Contracts
prAPE
Liquid Asset
Index
Yield Model
Documentation
Protocol Architecture
Core system architecture and liquidity index mechanics.
Dual Contract System
PrimalProtocol manages staking, accounting, rewards, penalties and withdraw queues.
PrimalApe (prAPE) manages transferable liquid staking balances.
Both contracts operate together using scaled accounting architecture.
Liquidity Index Model
Yield accrues through liquidityIndex growth.
prAPE redemption value increases automatically over time.
No rebasing transactions or user interactions are required.
Documentation
PrimalProtocol Contract
Main staking engine, reward system and accounting layer.
Stake Flow
Users deposit native APE using stake(period).
Protocol fees are split between treasury and reward reserve.
Scaled staking positions are created internally.
prAPE is minted to the user instantly.
Stake Accounting
Every position stores owner, deposited amount and scaledAmount.
unlockTime defines penalty-free withdrawals.
Positions remain transferable while active.
Reward Distribution
injectRewards() increases rewardReserve.
distributeRewards() expands liquidityIndex.
All holders benefit proportionally without loops.
Withdraw Queue
Withdrawals are asynchronous.
Users enter a 7 day queue before claiming.
prAPE is burned immediately on withdrawal request.
Transferable Stake Positions
Stake ownership follows prAPE transfers.
Partial transfers create split stake positions.
Enables liquid secondary staking markets.
Documentation
prAPE Token
Liquid staking asset powered by scaled balances.
Scaled Balances
Internal balances are stored as scaled values.
Visible balances are derived from liquidityIndex.
Creates automatic compounding yield behavior.
Mint & Burn
Only protocol contract can mint or burn prAPE.
Minting converts deposits into scaled balances.
Burning occurs during withdrawal requests.
Transfer Synchronization
Transfers trigger handleTransfer().
Stake ownership remains synchronized.
Yield rights move with the token.
Documentation
Security Model
Protection systems and protocol safety mechanisms.
Reentrancy Protection
Critical functions use ReentrancyGuard.
Protects withdrawals and staking operations.
Prevents recursive callback exploits.
Owner Controls
Owner can pause protocol operations.
Protocol fee and penalties are configurable.
Distribution settings remain adjustable.
Protocol Limits
Maximum fee capped at 10%.
Maximum penalty capped at 30%.
All critical addresses validated.
Documentation
Staking Mechanics
How yield accrual and exchange rates function.
Yield Accrual
Yield is backed by protocol reserves.
Rewards increase liquidityIndex globally.
Every prAPE token appreciates automatically.
Exchange Rate
Exchange rate represents APE backing per prAPE.
Rate increases after reward distributions.
Growth reflects protocol performance.
Reward Reserve
Protocol fees accumulate in reserve.
Penalties recycle value back into protocol yield.
Rewards are distributed progressively.
Documentation
Technical Advantages
Core advantages of PrimalFi architecture.
Gas Efficiency
No per-user reward updates.
No expensive reward loops.
Global index accounting minimizes gas.
Composable DeFi Asset
prAPE remains fully ERC20 compatible.
Can integrate with lending and LP protocols.
Enables external DeFi composability.
Liquid Staking
Users maintain liquidity while staking.
Positions remain transferable.
Supports secondary markets.