Strategy Contracts
A Strategy contract can easily be created by composing extensions and gates. They are inspired by OpenZeppelin’s ERC20, ERC721, and the AccessControl contracts.
- Strategy - base strategy contract
- Registry - handles registration and approvals of projects and applications
- Allocator - handles token transfers to and from strategy contract
- Gates - modifiers to restrict function calls (eg. via checking token balance, or attestations)
There are some benefits in using the same functions and events for our strategies:
- Hooks are generated by Wagmi CLI for
register
,approve
,allocate
, anddistribute
. - Indexer will automatically index all
Initialize
,Register
,Approve
,Allocate
events without us needing to make any changes to it.
This means when we’re building apps we can simply re-use a handful of hooks and the indexer will index these events:
useStrategies()
- created strategiesuseRegister(strategyAddress)
- register projects and applicationsuseApprove(strategyAddress)
- review and approve projects and applicationsuseAllocate(strategyAddress)
- transfer tokens to an address (donations, funding, voting)useDistribute(strategyAddress)
- transfer tokens from the strategy (matching funds, etc)useRegistrations(query)
- query projects, applications, reviewsuseAllocations(query)
- query any token transfers in relation to the strategy
Last updated on