Practical overview
When it fits
Use it when extending a Slice product's purchase flow with custom Solidity pricing, eligibility rules or on-chain actions.
Who it is for
- Solidity developers building custom pricing or purchase actions for Slice products.
- Teams implementing reusable hooks across products or contracts tailored to an individual product.
Documented uses
- Calculate product prices using buyer-specific or other custom logic before a purchase.
- Check purchase eligibility and run custom logic during purchase execution.
- Add purchase-time effects such as rewards or gating.
- Create reusable registry hooks or product-specific hook contracts.
Requirements & limits
The public GitHub repository declares an MIT license. Its documented development workflow requires Foundry.
- Pricing hooks calculate prices before purchase execution; action hooks check eligibility and run logic during the purchase transaction.
- Registry hooks are designed for reuse across products, while product-specific hooks target individual products.
- The generator supplies scaffolding, but developers must implement custom logic and write tests.
Check current requirements in the official documentation. Source-based guidance does not mean OpenViST has run or independently tested this project.
Generate a hook contract template
Create a starter contract template for a registry or product-specific Slice hook.
Before you start
- A local copy of the repository.
- Foundry installed.
Steps
Run
./script/generate-hook.sh.Choose Registry or Product-specific scope.
Select Action, Pricing Strategy or Pricing Action, then name the contract and optionally set authorship.
Expected outcome
The generator creates a contract file with a suitable template; registry hooks also receive aggregator imports and test-file scaffolding.
Guide limitations
- The generated template does not implement the desired custom behavior; add the contract logic and write tests.
- This guide covers generation only, not compilation, testing or deployment.
Install dependencies, build and run the test suite
Use the repository's documented Foundry commands to prepare, compile and test the contracts.
Before you start
- Foundry installed.
- A local copy of the repository.
Steps
Run
forge soldeer installto install dependencies.Run
forge buildto compile the contracts.Run
forge testto run the test suite.
Expected outcome
The documented workflow installs project dependencies, compiles the contracts and invokes the repository test suite.
Guide limitations
- These commands do not establish that a developer's new hook behaves as intended; custom logic still requires suitable tests.
- This workflow does not cover deployment.
Sources & review
Source record details
- Source availability
- Active
- Sources checked
- 12 October 2026
- Original website title
- slice-so/hooks · Official homepage title · retained in its source language

