-
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
floor decimals on check expected balances #396
Conversation
WalkthroughThe changes introduced in this pull request primarily focus on enhancing the calculation and logging of expected token balances in 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: 0
Configuration used: CodeRabbit UI
Files selected for processing (1)
- packages/kamino-sdk/src/Kamino.ts (2} hunks)
Files skipped from review due to trivial changes (1)
- packages/kamino-sdk/src/Kamino.ts
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: 0
Configuration used: CodeRabbit UI
Files selected for processing (1)
- packages/kamino-sdk/src/Kamino.ts (1} hunks)
Additional comments: 1
packages/kamino-sdk/src/Kamino.ts (1)
- 2890-2895: The new approach to calculate
expectedALamports
andexpectedBLamports
by flooring the decimal values is a significant change. Ensure that this change doesn't introduce any rounding errors or inaccuracies in theCheckExpectedVaultsBalancesArgs
object. Also, consider removing the console log statements after you finish debugging to maintain code cleanliness.- console.log('expectedALamportsDecimal ', expectedALamportsDecimal.toString()); - console.log('expectedBLamportsDecimal ', expectedBLamportsDecimal.toString());Committable suggestion (Beta)
let expectedALamportsDecimal = collToLamportsDecimal(expectedABalance, strategyState.tokenAMintDecimals.toNumber()); let expectedBLamportsDecimal = collToLamportsDecimal(expectedBBalance, strategyState.tokenBMintDecimals.toNumber()); let expectedALamports = expectedALamportsDecimal.floor(); let expectedBLamports = expectedBLamportsDecimal.floor(); const args: CheckExpectedVaultsBalancesArgs = { tokenAAtaBalance: new BN(expectedALamports.toString()),
let expectedBLamports = collToLamportsDecimal(expectedBBalance, strategyState.tokenBMintDecimals.toNumber()); | ||
let expectedALamportsDecimal = collToLamportsDecimal(expectedABalance, strategyState.tokenAMintDecimals.toNumber()); | ||
let expectedBLamportsDecimal = collToLamportsDecimal(expectedBBalance, strategyState.tokenBMintDecimals.toNumber()); | ||
console.log('expectedALamportsDecimal ', expectedALamportsDecimal.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 would remove the logs from the SDK
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 to keep it for a few days just in case this keeps happening and then remove
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.
Fair enough
Summary by CodeRabbit
Please note, these changes are under-the-hood improvements and won't affect the user interface or user experience directly. However, they contribute to the overall performance and reliability of the system.