-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: registry handlers #31
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💯 really smol comments but nice ser
) {} | ||
async handle(): Promise<Changeset[]> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
) {} | |
async handle(): Promise<Changeset[]> { | |
) {} | |
/* @inheritdoc */ | |
async handle(): Promise<Changeset[]> { |
or a more specific description
/** | ||
* Handles the ProfileMetadataUpdated event for the Registry contract from Allo protocol. | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i like adding here a general overview of the main actions performed by the handler
for example for PoolCreatedHandler
/**
* Handles the PoolCreated event for the Allo protocol.
*
* This handler performs the following core actions when a new pool is created:
* - Retrieves the metadata associated with the pool
* - Determines the correct token address, handling native tokens appropriately.
* - Extracts the correct strategy information from the provided strategy ID.
* - Calculates the funded amount in USD based on the token's pricing.
* - Creates a new round object
*/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is great, i saw it on your prs 💯
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto for description and inheritdoc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto for description and inheritdoc
if (!project) { | ||
return []; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we throw here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto for description and inheritdoc
if (!parsedMetadata.success) { | ||
// logger.warn({ | ||
// msg: `ProfileMetadataUpdated: Failed to parse metadata`, | ||
// event, | ||
// metadataCid, | ||
// metadata, | ||
// }); | ||
return []; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we throw or return empty?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing test cases for the newly created handlers
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch ser
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great pr ⏭️ , just one comment but maybe i've mixed up things in my head
@@ -1,6 +1,6 @@ | |||
import { Address, ChainId } from "@grants-stack-indexer/shared"; | |||
|
|||
export type ProjectType = "canonical" | "linked"; | |||
export type ProjectType = "canonical" | "linked" | "unknown"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i thought we wouldn't use "unknown" as value
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch
packages/processors/src/processors/registry/handlers/profileNameUpdated.handler.ts
Show resolved
Hide resolved
readonly chainId: ChainId, | ||
private dependencies: Dependencies, | ||
) {} | ||
async handle(): Promise<Changeset[]> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/* @inheritdoc */ ?
@@ -5,3 +5,9 @@ export class ProjectNotFound extends Error { | |||
super(`Project not found for chainId: ${chainId} and anchorAddress: ${anchorAddress}`); | |||
} | |||
} | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess the above exception should be called ProjectByAnchorNotFound since there are multiple of these but just a suggestion
metadata: [0, mockCid], | ||
profileId: "mockProfileId", | ||
}, | ||
// Add other necessary event properties here |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
delete or TODO?
@@ -9,7 +9,7 @@ import { | |||
} from "@grants-stack-indexer/shared"; | |||
|
|||
import { ProcessorDependencies } from "../../../src/internal.js"; | |||
import { RoleGrantedHandler } from "../../../src/registry/handlers/index.js"; // Adjust path if needed | |||
import { RoleGrantedHandler } from "../../../src/processors/registry/handlers/index.js"; // Adjust path if needed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comment intentional?
|
||
const handler = new RoleRevokedHandler(mockEvent, mockChainId, mockDependencies); | ||
|
||
await expect(handler.handle()).rejects.toThrow(error); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we could specifically check that the new custom error is thrown here
🤖 Linear
Closes GIT-138 GIT-145 GIT-146 GIT-147 GIT-148
Description
All Registry contract event handlers.
Checklist before requesting a review