Tracking Initiative Support
The Signals protocol provides comprehensive view functions to query initiative support data, including current weight, historical weight, supporters, and individual lock positions.
Overview
You can track initiative support through several types of queries:
- Initiative data - Get basic information about the initiative
- Weight tracking - Query current and historical weight
- Lock positions - View individual lock details
- Supporter activity - Derive supporters from lock data or events
- Position enumeration - List NFT positions by owner
Key Concepts
Weight vs. Token Amount
- Token Amount: The raw number of tokens locked in an initiative
- Weight: The voting power those tokens contribute, which decays over time based on lock duration and elapsed time
Weight determines when an initiative reaches the acceptance threshold.
Current vs. Historical Queries
Many query functions accept a timestamp parameter:
- Current: Use
getWeight(initiativeId)for weight at the current block - Historical: Use
getWeightAt(initiativeId, timestamp)for weight at a specific time
Historical queries are useful for creating charts and verifying past data.
Common Query Patterns
Check Initiative Progress
To see how close an initiative is to acceptance:
- Get the current weight using
getWeight() - Get the acceptance threshold
- Calculate progress percentage
View Your Positions
To see all your lock positions:
- Use ERC721Enumerable (
balanceOf,tokenOfOwnerByIndex) to enumerate NFT token IDs you own - For each token ID, use
getTokenLock(tokenId)to get lock details - Check which initiatives you're supporting
Monitor Supporter Activity
To track an initiative's support:
- Use
locksForInitiative(initiativeId)to get all lock positions - For each lock, call
getTokenLock(tokenId)and read thesupporteraddress - Aggregate stats (total locked, average duration, unique supporters) or use the indexer
Weight Decay
Weight decays over time based on the board's configuration:
- Linear Decay: Weight decreases steadily
- Exponential Decay: Weight decreases at an accelerating rate
Query functions automatically account for decay when calculating weight. The weight you see reflects the current voting power, not the original locked amount.
Events for Real-Time Tracking
For real-time updates, monitor these events:
InitiativeProposed- New initiative createdInitiativeSupported- Someone locked tokensInitiativeAccepted- Owner accepted the initiativeInitiativeExpired- Initiative expired due to inactivityRedeemed- Someone redeemed their lock positionTransfer- NFT position was transferred
Using the Indexer
For efficient querying and historical data, consider using the indexer API (if available). The indexer provides:
- Aggregated initiative data with weight/supporters
- Historical weight snapshots
- Lock position details
- Event history
Querying the indexer is faster and more cost-effective than making multiple contract calls.
Best Practices
- Use historical queries for charts - Call
getWeightAt()with past timestamps - Cache static data - Board configuration doesn't change frequently
- Index events off-chain - Don't query events directly from the contract
- Batch read calls - Use multicall for multiple queries
- Use indexer when available - Faster than direct contract queries
For technical details including all function signatures, data structures, query examples, and integration code, see the Initiative Interactions Reference.
