When to Use This Pattern
Ensures harvest operations in yield farming protocols maintain integrity by preventing balance decreases and price per share manipulation. Critical for yield farming protocols (Beefy, Yearn, Harvest), liquidity mining programs, staking protocols with reward distribution, and auto-compounding vaults. Incorrect harvest implementations could lead to loss of user funds, price per share manipulation enabling flash loan attacks, or protocol insolvency through improper reward distribution.What This Pattern Checks
Implements multi-layered approach to verify harvest operations:_preTx()/_postTx()with Reshiram snapshot reads: Capture vault balance and price per share before/after harvestph.loadStateAt(): Read balance and price-per-share slots before and after the harvest callregisterFnCallTrigger(): Trigger on harvest function calls- Ensures balance hasn’t decreased (can stay same if harvested recently)
- Confirms price per share hasn’t decreased
- Prevents manipulation through multiple harvest calls
Assertion Pattern
Full examples and mock protocol code are available in credible-std.

