-
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: direct grants lite strategy #34
Conversation
StrategyTimings, | ||
UnsupportedEventException, | ||
} from "../../../internal.js"; | ||
import { BaseStrategyHandler } from "../common/base.strategy.js"; |
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.
import from index?
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.
const { srcAddress } = this.event; | ||
const { recipientId: _recipientId, amount: strAmount, token: _token } = this.event.params; | ||
|
||
const amount = BigInt(strAmount); |
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.
if amount is zero maybe we should return early to avoid unnecessary calls that'll just return 0
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 wouldn't return early but very nice catch, i will improve code to avoid querying prices wen amount is 0 🤝
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.
* @returns The changeset with an UpdateRound operation. | ||
* @throws RoundNotFound if the round is not found. | ||
*/ | ||
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.
I noticed in some of the handlers you do inherit docs for handle() and in others you write it out--not sure if it's intentional or you want to pick one
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.
|
||
if (!isValidApplicationStatus(status)) { | ||
logger.warn( | ||
`[DGLiteUpdatedRegistrationHandler] Invalid status: ${this.event.params.status}`, |
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'm surprised there isn't an actual exception thrown for this but if that's intentional then it's ok
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.
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 something to tackle once we are focusing on error handling, for now it is okay, as nigiri said, there are some un-implemented flows, and for simplicity i think skipping is a good choice for now.
@@ -50,3 +74,19 @@ export const decodeDVMDExtendedApplicationData = ( | |||
recipientsCounter: values[1].toString(), |
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 know this isn't part of this PR but I noticed the "encodededDVMD" typo lol
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.
const result = await handler.handle(); | ||
|
||
// parsed data: | ||
// { |
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.
commented out code
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.
|
||
import { DGLiteTimestampsUpdatedHandler } from "../../../../src/processors/strategy/directGrantsLite/handlers/timestampsUpdated.handler.js"; | ||
|
||
function createMockEvent( |
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.
consider moving the createXEvent functions for the handlers into one file because it will be easier to find if you make changes to multiple 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.
ah you're 100% right, didn't realize that. will do 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.
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.
LGTM after addressing beebs comments :)
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.
👌
🤖 Linear
Closes GIT-162 GIT-164 GIT-165 GIT-158 GIT-168 GIT-143 GIT-141
Description
ApplicationPayout
model, repository and ChangesetsDirectGrantsLiteStrategy
handler and events handlers:Registered
UpdatedRegistration
TimestampsUpdated
Allocated
RecipientStatusUpdated
Checklist before requesting a review