Skip to content

Conversation

@khadni
Copy link
Collaborator

@khadni khadni commented Dec 5, 2025

This pull request refactors the consumer contract example and guide to use ReceiverTemplate instead of IReceiverTemplate, and introduces several improvements to code clarity, security, and maintainability. The changes include renaming the abstract contract, updating all references, switching permission fields to private, adding getter functions and events, and enhancing documentation for metadata encoding. These updates make the contract interface more robust and easier to use for developers.

Contract and API Refactoring

  • Renamed the abstract contract from IReceiverTemplate to ReceiverTemplate, updated all inheritance and import statements, and replaced all references in documentation and code examples. [1] [2] [3] [4] [5] [6]
  • Changed permission fields (forwarderAddress, expectedAuthor, expectedWorkflowName, expectedWorkflowId) from public to private, and provided public getter functions for each.
  • Added events for permission updates, such as ForwarderAddressUpdated, ExpectedAuthorUpdated, ExpectedWorkflowNameUpdated, and ExpectedWorkflowIdUpdated, and emitted these events in the corresponding setter functions. [1] [2] [3]

Security and Maintainability Improvements

  • Updated setter functions for permission fields to emit events and use previous values for better auditability. [1] [2] [3]
  • Improved the metadata decoding documentation and implementation to clarify the encoding structure and match the CRE engine's encoding algorithm. [1] [2] [3]

Example and Guide Updates

  • Refactored example contracts (CalculatorConsumer, MyConsumer, AdvancedConsumer) to inherit from ReceiverTemplate, use new field names, and update logic to match new API. [1] [2] [3] [4] [5]
  • Updated guide sections and navigation to reflect the new contract name and improved documentation for workflow name encoding and metadata structure. [1] [2] [3]

@khadni khadni added the CRE label Dec 5, 2025
@vercel
Copy link

vercel bot commented Dec 5, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Updated (UTC)
documentation Ready Ready Preview Dec 9, 2025 6:08pm

@khadni khadni marked this pull request as ready for review December 9, 2025 18:02
@khadni khadni requested a review from a team as a code owner December 9, 2025 18:02
@khadni khadni merged commit 87c9d14 into main Dec 9, 2025
22 checks passed
@khadni khadni deleted the receivertemplate-update branch December 9, 2025 18:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants