Release v1.1.0: Event Log System, Multicall Utility & Metrics Aggregation#95
Release v1.1.0: Event Log System, Multicall Utility & Metrics Aggregation#95tahseen-ccprotocol merged 30 commits intomainfrom
Conversation
- Introduced new types for event filtering and decoded logs in events.ts, including EventFilterOptions, DecodedEventLog, and RawLog. - Added decodeEventLog function to viem/index.ts for processing event logs. - Updated index.ts to export new event-related types for broader accessibility.
- Added functions to fetch and decode event logs for various events in the AllOrNothing contract, including Receipt, RefundClaimed, and WithdrawalSuccessful. - Introduced a watcher mechanism for real-time event monitoring. - Updated AllOrNothingEvents interface to include new methods for retrieving and watching event logs. - Enhanced the decode functionality for raw logs to improve event handling capabilities.
… in AllOrNothing - Introduced methods to fetch and decode Approval and ApprovalForAll event logs in the AllOrNothing contract. - Added watcher functions for Approval, ApprovalForAll, and several other events to enable real-time monitoring. - Updated the AllOrNothingEvents interface to include new methods for improved event handling.
- Added functions to fetch and decode event logs for various CampaignInfo events, including DeadlineUpdated, GoalAmountUpdated, LaunchTimeUpdated, PlatformInfoUpdated, SelectedPlatformUpdated, OwnershipTransferred, Paused, and Unpaused. - Introduced watcher functions for real-time monitoring of these events. - Updated CampaignInfoEvents interface to include new methods for improved event handling and log decoding capabilities.
- Implemented functions to fetch and decode event logs for CampaignInfoFactory events, including CampaignCreated, CampaignInitialized, and OwnershipTransferred. - Introduced watcher functions for real-time monitoring of these events. - Updated CampaignInfoFactoryEvents interface to include new methods for improved event handling and log decoding capabilities.
- Implemented functions to fetch and decode event logs for various GlobalParams events, including PlatformEnlisted, PlatformDelisted, and others. - Introduced watcher functions for real-time monitoring of these events. - Updated GlobalParamsEvents interface to include new methods for improved event handling and log decoding capabilities.
- Implemented functions to fetch and decode ItemAdded event logs, including a watcher for real-time monitoring. - Updated ItemRegistryEvents interface to include new methods for improved event handling and log decoding capabilities. - Enhanced the decode functionality for raw logs to support the new event structure.
- Implemented functions to fetch and decode event logs for various KeepWhatsRaised events, including Receipt, RefundClaimed, WithdrawalWithFeeSuccessful, and others. - Introduced watcher functions for real-time monitoring of these events. - Updated KeepWhatsRaisedEvents interface to include new methods for improved event handling and log decoding capabilities.
- Implemented functions to fetch and decode event logs for various PaymentTreasury events, including PaymentCreated, PaymentCancelled, PaymentConfirmed, and others. - Introduced watcher functions for real-time monitoring of these events. - Updated PaymentTreasuryEvents interface to include new methods for improved event handling and log decoding capabilities.
- Implemented functions to fetch and decode event logs for TreasuryFactory events, including TreasuryFactoryTreasuryDeployed, TreasuryImplementationRegistered, TreasuryImplementationRemoved, and TreasuryImplementationApproval. - Introduced watcher functions for real-time monitoring of these events. - Updated TreasuryFactoryEvents interface to include new methods for improved event handling and log decoding capabilities.
- Added a testTimeout property to the Jest configuration to allow for longer-running tests, improving test reliability in scenarios that require more time to complete.
- Updated event tests for AllOrNothing, CampaignInfo, CampaignInfoFactory, GlobalParams, KeepWhatsRaised, PaymentTreasury, and TreasuryFactory contracts to verify the presence of event helper methods.
- Expanded the README.md to include detailed sections on event handling capabilities for various contracts, including methods for fetching historical logs, decoding raw logs, and watching live events. - Documented available events for GlobalParams, CampaignInfoFactory, TreasuryFactory, CampaignInfo, PaymentTreasury, AllOrNothing Treasury, and KeepWhatsRaised Treasury contracts, enhancing developer understanding of event interactions.
- Introduced a new `multicall` function to enable batching of multiple entity read calls into a single RPC request, improving efficiency. - Updated `provider.ts` to enable `batch.multicall` in the JSON RPC provider configuration. - Exported the new `multicall` function from the utils index for easy access.
- Implemented a new `multicall` method in the `OakContractsClient` interface to facilitate batching of multiple entity read calls into a single RPC request. - Updated the `create.ts` file to include the `multicall` function, enhancing the client’s functionality and efficiency in handling multiple asynchronous calls.
- Added `getCampaignSummary` function to aggregate financial data from the CampaignInfo contract, including total raised, refunded, and goal status. - Introduced `getTreasuryReport` function for per-treasury reporting, supporting AllOrNothing, KeepWhatsRaised, and PaymentTreasury contracts. - Updated types to reflect new options and return structures for campaign and treasury reports. - Enhanced documentation with examples for both functions to improve usability.
- Introduced tests for the `multicall` utility, verifying concurrent execution of closures and error propagation. - Expanded the `getPlatformStats`, `getCampaignSummary`, and `getTreasuryReport` functions with comprehensive tests to ensure accurate financial data aggregation and reporting. - Implemented mock client for testing contract interactions, improving test coverage and reliability.
- Introduced a new section on Multicall, detailing its usage for batching multiple entity read calls into a single RPC request, with examples for standalone utility and client convenience methods. - Added a Metrics section, outlining pre-built aggregation functions for platform statistics, campaign summaries, and treasury reports, complete with usage examples. - Updated the exported entry points to include the new multicall and metrics functionalities for improved accessibility.
- Introduced a constant for the canonical Multicall3 address, ensuring consistency across supported chains. - Updated Celo Mainnet and Celo Sepolia chain definitions to include the Multicall3 contract address and block creation details, enhancing interoperability for multicall functionalities.
Add comprehensive event log handling across all contract entities
Add multicall utility and metrics aggregation module
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: aaf37dcb0e
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Fix readme and changeset
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 41b18acefc
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Fix links in README
Summary
Introduced shared event types (
EventFilterOptions,DecodedEventLog,RawLog,EventWatchHandler) anddecodeEventLogre-export from viem to support event handling across the SDK.Implemented full event log fetching, decoding, and real-time watching for all 8 contract entities: GlobalParams, CampaignInfoFactory, TreasuryFactory, CampaignInfo, PaymentTreasury, AllOrNothing, KeepWhatsRaised, and ItemRegistry.
Every ABI event in every contract now has a
get*Logs()method for historical log queries (defaults to searching from genesis), adecodeLog()method for raw receipt log parsing, and awatch*()method for real-time subscriptions.Updated all
*Eventstype interfaces with full JSDoc coverage for the new methods.Added unit tests for all new event methods, maintaining 100% code coverage across statements, branches, functions, and lines.
Multicall utility: Added an ergonomic
multicallfunction that batches multiple entity read calls into a single RPC round-trip via Multicall3. Accepts lazy closures (() => gp.getProtocolFeePercent()) instead of raw ABI descriptors, aligning with the existing entity read pattern. Enabled viem'sbatch.multicalltransport on the provider so all concurrentreadContractcalls are automatically aggregated. Exposed as both a standalone utility (multicall(...)) and a client convenience method (oak.multicall(...)).Metrics module: Implemented three aggregation functions —
getPlatformStats,getCampaignSummary, andgetTreasuryReport— that combine multiple on-chain reads into structured reports. Supports all three treasury types (all-or-nothing,keep-whats-raised,payment-treasury) with correct ABI resolution for each.Tests & docs: Added comprehensive unit tests for the multicall utility and all three metrics functions with 100% coverage. Updated
README.mdwith dedicated Multicall and Metrics sections, usage examples, doc links, and the exported entry points table.