-
Notifications
You must be signed in to change notification settings - Fork 11
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
Kamino sdk small fixes #388
Conversation
WalkthroughThe changes primarily focus on updating the method used to read unsigned 64-bit integers from the buffer across various files. The Changes
TipsChat with CodeRabbit Bot (
|
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.
Review Status
Actionable comments generated: 1
Files selected for processing (5)
- packages/kamino-sdk/src/rebalance_methods/driftRebalance.ts (2 hunks)
- packages/kamino-sdk/src/rebalance_methods/periodicRebalance.ts (2 hunks)
- packages/kamino-sdk/src/rebalance_methods/pricePercentageRebalance.ts (1 hunks)
- packages/kamino-sdk/src/rebalance_methods/pricePercentageWithResetRebalance.ts (1 hunks)
- packages/kamino-sdk/src/utils/utils.ts (1 hunks)
Files skipped from review due to trivial changes (2)
- packages/kamino-sdk/src/rebalance_methods/periodicRebalance.ts
- packages/kamino-sdk/src/utils/utils.ts
Additional comments (Suppressed): 4
packages/kamino-sdk/src/rebalance_methods/pricePercentageRebalance.ts (1)
- 132-133: The variables
lowerSqrtPriceX64
andupperSqrtPriceX64
are no longer being converted toDecimal
objects but are directly assigned as strings. This change could potentially affect the subsequent calculations where these variables are used. Ensure that the change in data type does not introduce bugs or inaccuracies in the calculations.packages/kamino-sdk/src/rebalance_methods/driftRebalance.ts (2)
161-165: The change from
readBigUint64LE
toreadBigUInt64LE
is correct as it ensures the correct reading of thesecondsPerTick
anddirection
parameters. This change should not introduce any breaking changes as the method signatures remain the same and the returned values are still converted toDecimal
objects.172-176: The change from
readBigUint64LE
toreadBigUInt64LE
is correct as it ensures the correct reading of thelastDriftTimestamp
parameter. This change should not introduce any breaking changes as the method signature remains the same and the returned value is still converted to aDecimal
object.packages/kamino-sdk/src/rebalance_methods/pricePercentageWithResetRebalance.ts (1)
- 215-216: The
readBigUint128LE
function is now directly converting the buffer to a string, instead of first converting it to aDecimal
object. Ensure that this change does not affect any calculations or operations that rely onlowerResetSqrtPriceX64
andupperResetSqrtPriceX64
beingDecimal
objects.
let resetLowerRangeBps = new Decimal(params.find((param) => param.label == 'resetLowerRangeBps')?.value.toString()!); | ||
let resetUpperRangeBps = new Decimal(params.find((param) => param.label == 'resetUpperRangeBps')?.value!.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.
The use of the non-null assertion operator (!
) after value
assumes that the value
property will always exist in the found parameter object. If a parameter with the specified label is not found, or if the found parameter object does not have a value
property, this will result in a runtime error. Consider adding error handling or a default value to prevent potential issues.
Summary by CodeRabbit
driftRebalance
,periodicRebalance
, andutils
functions.pricePercentageRebalance
andpricePercentageWithResetRebalance
functions to assign certain variables as strings directly, removing the usage of theDecimal
class. The impact on user experience is currently unclear, but this change simplifies the codebase.