Skip to content

Conversation

@Divyansh-Gupta-Antier
Copy link

No description provided.


@BigNumberArrayProperty()
amounts: BigNumber[];
amounts: string[];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This property appears to be missing class-validator decorators that reflect the updated type change

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added validations to this property in the latest commit.

Comment on lines 708 to 709
@IsNotEmpty()
@ValidateNested()
@Type(() => PositionsObject)
positions: PositionsObject;
positions: IPosition[];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently this IPosition[] property is only decorated with @IsNotEmpty(). Suggest adding at least one more decorator that is more specific.

I understand if IPosition references an interface, not a Type, it might not work as easily with some of class-validator's options.

But at a minimum I think we could use something like @ArrayNotEmpty() or @ArrayMinSize(0) here in addition to @IsNotEmpty().

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added validations to this property in the latest commit.

Comment on lines 46 to 52
@ChainKey({ position: 2 })
@IsInt()
@Min(TickData.MIN_TICK)
@IsLessThan("tickUpper")
tickLower: number;

@ChainKey({ position: 4 })
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
@ChainKey({ position: 2 })
@IsInt()
@Min(TickData.MIN_TICK)
@IsLessThan("tickUpper")
tickLower: number;
@ChainKey({ position: 4 })
@ChainKey({ position: 2 })
@IsInt()
@Min(TickData.MIN_TICK)
@IsLessThan("tickUpper")
tickLower: number;
@ChainKey({ position: 3 })

Keep the @ChainKey positions sequential

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed the skipped chainkey position index.

Comment on lines 43 to 46
@JSONSchema({
description: `A tick range mapping that maps a tick range (eg. 10-20) to a unique position ID for this pool`
})
tickRangeMap: Record<string, string[]>;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll want at least some minimum use of validation decorators on tickRangeMap beyond a JSONSchema declaration

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Due to the lack of native support in class-validator for validating Record data structures, we’ve implemented a custom validator named IsStringArrayRecord. This custom validation has been applied to the corresponding property to ensure its structure adheres to expected constraints.

Copy link
Contributor

@sentientforest sentientforest left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good work. The new data structures and reduction in complexity of the Pool class defined in DexV3Pool are steps in the right direction.

@Jehosephat Jehosephat merged commit 761de8e into GalaChain:main-v1 May 13, 2025
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants