-
Notifications
You must be signed in to change notification settings - Fork 13
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
BE-636-get-incentive | Pool Incentive helper method #576
Conversation
Adds Incentive helper method for Pool computing and returning its incentive type.
Quality Gate failedFailed conditions |
WalkthroughThe pull request introduces changes to enhance the Changes
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
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.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (4)
sqsdomain/pools.go (3)
51-52
: Enhance method documentationThe documentation comment could be more descriptive by including details about possible return values and their significance.
- // Incentive returns the incentive type for the pool + // Incentive returns the incentive type for the pool based on APR data. + // Returns one of: + // - IncentiveType_SUPERFLUID: If pool has non-zero SuperfluidAPR + // - IncentiveType_OSMOSIS: If pool has non-zero OsmosisAPR + // - IncentiveType_BOOST: If pool has non-zero BoostAPR + // - IncentiveType_NONE: If no APR values are set
230-250
: Add nil check and document priority orderThe implementation is clean but could benefit from two improvements:
- Add a nil check for APR data
- Document the priority order of incentive types
// Incentive implements PoolI. func (p *PoolWrapper) Incentive() api.IncentiveType { apr := p.GetAPRData() + // If APR data is not available, return NONE + if apr.Status.Error != nil { + return api.IncentiveType_NONE + } + // Check APR ranges in priority order: + // 1. Superfluid + // 2. Osmosis + // 3. Boost checks := []struct { apr sqspassthroughdomain.PoolDataRange incentive api.IncentiveType
12-17
: Format imports using goimportsThe import statements need to be formatted according to the standard Go import grouping.
Run
goimports
on the file to automatically organize imports into groups:
- Standard library
- External packages
- Internal packages
domain/mocks/pool_mock.go (1)
Line range hint
256-270
: Add IncentiveType to deepCopyPoolThe deepCopyPool function should include the new IncentiveType field to ensure complete pool copies.
return &MockRoutablePool{ ID: mp.ID, Denoms: newDenoms, PoolLiquidityCap: newPoolLiquidityCap, PoolType: mp.PoolType, + IncentiveType: mp.IncentiveType, // Note these are not deep copied. ChainPoolModel: mp.ChainPoolModel,
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
⛔ Files ignored due to path filters (1)
sqsdomain/pools_test.go
is excluded by!**/*_test.go
📒 Files selected for processing (2)
domain/mocks/pool_mock.go
(3 hunks)sqsdomain/pools.go
(3 hunks)
🧰 Additional context used
🪛 golangci-lint (1.62.2)
sqsdomain/pools.go
229-229: File is not goimports
-ed
(goimports)
🔇 Additional comments (2)
domain/mocks/pool_mock.go (2)
36-36
: LGTM!
The IncentiveType field is correctly added to support the new interface method.
182-184
: LGTM!
The implementation correctly returns the mock value, suitable for testing purposes.
This PR represents a smaller, more focused part of bigger PR #553 implementing sorting, filtering, pagination and search functionality for /pools endpoint. For bigger implementation picture refer to mentioned PR and for more context please refer to BE-636.
This PR adds Incentive helper method for Pool computing and returning its incentive type used for WithMarketIncentives filter.
Summary by CodeRabbit
New Features
IncentiveType
field to enhance theMockRoutablePool
functionality.Incentive()
method to retrieve incentive types based on APR data in thePoolI
interface and its implementation.Bug Fixes