This directory contains various examples of Settlement Hooks organized by business scenarios. Each scenario includes all necessary contracts for a complete implementation.
Scenario: NFT Sales & Minting
Complete NFT minting solutions for digital asset sales:
NFTMintHook.sol- Automatically mint NFT after paymentRandomNFT.sol- Example NFT contract with sequential token ID generation
Use cases: NFT marketplaces, digital collectibles, event tickets
Scenario: Loyalty & Rewards
Customer loyalty and reward point systems:
RewardHook.sol- Transfer payment to merchant and distribute reward tokensRewardToken.sol- ERC20 reward points token with controlled distribution
Use cases: Customer loyalty programs, cashback systems, gamification
Each Hook is designed for a specific business scenario and is deployed per application:
- Application-Specific: Each app deploys its own Hook instance with specific parameters
- Scenario-Focused: Hooks are optimized for particular use cases rather than generic flexibility
- Trust Model: Resource Server controls Hook configuration; Facilitator only handles gas costs
-
hookData is not cryptographically protected
- Facilitator could theoretically modify hookData
- Mitigation: Resource Server can run its own Facilitator or use trusted Facilitators
-
Hook instances are application-specific
- Each application needs to deploy its own Hook
- Mitigation: Use standard Hook implementations from examples
This design is appropriate when:
- Resource Server can run or trust the Facilitator
- Application-specific Hook logic is acceptable
- Focus is on core functionality rather than maximum decentralization
All Hook examples implement the ISettlementHook interface and can be used with the SettlementRouter contract. Each scenario includes:
- Hook Contract - Business logic implementation
- Supporting Contracts - Tokens, NFTs, or other required contracts
- Deployment Examples - How to deploy and configure the scenario
- Test Cases - Comprehensive testing examples
- Choose the scenario that matches your use case
- Deploy the required contracts from that scenario
- Configure the Hook with your specific parameters
- Integrate with your Resource Server
Run forge test from the contracts root to execute all tests.