Skip to content
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: exempt UnrestrictedPoolCreatorWhitelist addresses from pool creation fee #8609

Merged
merged 2 commits into from
Aug 13, 2024

Conversation

czarcas7ic
Copy link
Member

@czarcas7ic czarcas7ic commented Aug 11, 2024

Closes: #7337

What is the purpose of the change

Exempts UnrestrictedPoolCreatorWhitelist addresses from paying the pool creation fee.

Testing and Verifying

gotest added

Documentation and Release Note

  • Does this pull request introduce a new feature or user-facing behavior changes?
  • Changelog entry added to Unreleased section of CHANGELOG.md?

Where is the change documented?

  • Specification (x/{module}/README.md)
  • Osmosis documentation site
  • Code comments?
  • N/A

Copy link
Contributor

coderabbitai bot commented Aug 11, 2024

Walkthrough

The recent changes primarily enhance the functionality and readability of the codebase by introducing new methods for managing whitelisted addresses and refining the pool creation process. Key updates include the addition of methods for checking whitelist status during pool creation and a clearer separation of funding logic. The CHANGELOG.md was also standardized for better readability, documenting these changes comprehensively.

Changes

Files Change Summary
CHANGELOG.md Reformatted entries for consistency; added entry for PR #8609 regarding UnrestrictedPoolCreatorWhitelist.
x/concentrated-liquidity/keeper.go Added GetWhitelistedAddresses method for retrieving whitelisted addresses from parameters.
x/poolmanager/create_pool.go Refactored CreatePool method; introduced fundCommunityPoolIfNotWhitelisted to handle funding logic based on whitelist status.
x/poolmanager/export_test.go Introduced FundCommunityPoolIfNotWhitelisted method to serve as a public interface for funding the community pool.
x/poolmanager/keeper.go Modified type of concentratedKeeper from PoolModuleI to ConcentratedI to reflect more specific interface requirements.
x/poolmanager/keeper_test.go Added TestFundCommunityPoolIfNotWhitelisted to validate the behavior of community pool funding based on whitelist status.
x/poolmanager/types/expected_keepers.go Introduced ConcentratedI interface extending PoolModuleI, adding GetWhitelistedAddresses method for improved address management.

Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between fde1776 and e6a3789.

Files selected for processing (7)
  • CHANGELOG.md (1 hunks)
  • x/concentrated-liquidity/keeper.go (1 hunks)
  • x/poolmanager/create_pool.go (2 hunks)
  • x/poolmanager/export_test.go (1 hunks)
  • x/poolmanager/keeper.go (2 hunks)
  • x/poolmanager/keeper_test.go (2 hunks)
  • x/poolmanager/types/expected_keepers.go (1 hunks)
Files skipped from review due to trivial changes (1)
  • CHANGELOG.md
Additional comments not posted (8)
x/poolmanager/types/expected_keepers.go (1)

100-103: New interface ConcentratedI looks good.

The addition of the GetWhitelistedAddresses method enhances the interface capabilities by allowing retrieval of whitelisted addresses, aligning with the PR objectives.

x/concentrated-liquidity/keeper.go (1)

156-158: New method GetWhitelistedAddresses is well-implemented.

This method efficiently retrieves the list of whitelisted addresses from the module's parameters, supporting the exemption feature.

x/poolmanager/export_test.go (1)

154-156: New method FundCommunityPoolIfNotWhitelisted is appropriate.

The method serves as a public interface to manage community pool funding based on whitelisting, aligning with the PR goals.

x/poolmanager/keeper.go (2)

22-22: Ensure types.ConcentratedI is appropriate.

The change from types.PoolModuleI to types.ConcentratedI suggests a more specific interface is being used. Ensure that all methods required by Keeper are implemented by types.ConcentratedI.


55-55: Review interface change in NewKeeper.

The NewKeeper function now expects types.ConcentratedI instead of types.PoolModuleI for concentratedKeeper. Ensure that all callers of NewKeeper are updated to pass the correct interface type.

x/poolmanager/create_pool.go (1)

49-50: Integration of fundCommunityPoolIfNotWhitelisted.

The integration of fundCommunityPoolIfNotWhitelisted into CreatePool enhances separation of concerns. Ensure that this method is correctly handling all edge cases related to whitelisting.

x/poolmanager/keeper_test.go (2)

11-11: Import distributiontypes for module name.

The import of distributiontypes is necessary for accessing the community pool's address. This addition is appropriate and aligns with the test requirements.


438-493: Comprehensive test coverage for fundCommunityPoolIfNotWhitelisted.

The TestFundCommunityPoolIfNotWhitelisted function effectively covers different scenarios, including whitelisted and non-whitelisted senders. The test ensures the method behaves as expected under various conditions.


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?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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 as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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, codebase verification and nitpick comments (1)
x/poolmanager/export_test.go (1)

154-156: Method fundCommunityPoolIfNotWhitelisted Not Found

The method fundCommunityPoolIfNotWhitelisted does not appear to be implemented in the codebase under the expected name. Please verify if this method is implemented under a different name or if the functionality is covered elsewhere. If it is missing, consider implementing the required logic to check the whitelist status and handle community pool funding.

Analysis chain

Ensure correct implementation of internal logic.

The method FundCommunityPoolIfNotWhitelisted delegates to fundCommunityPoolIfNotWhitelisted. Verify that the internal method correctly checks the whitelist status and handles community pool funding.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the implementation of `fundCommunityPoolIfNotWhitelisted` method.

# Test: Search for the `fundCommunityPoolIfNotWhitelisted` method implementation. Expect: Proper logic for whitelist checking and community pool funding.
rg --type go 'func (k Keeper) fundCommunityPoolIfNotWhitelisted'

Length of output: 66


Script:

#!/bin/bash
# Search for any method in the Keeper struct that might be related to community pool funding or whitelisting.
rg --type go 'func (k Keeper) ' -A 5

# Search for any usage of the term "whitelist" in the codebase to find related logic.
rg --type go 'whitelist'

Length of output: 23216

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

x/poolmanager/create_pool.go Show resolved Hide resolved
@czarcas7ic czarcas7ic changed the title feat: exempt addresses from pool creation fee feat: exempt UnrestrictedPoolCreatorWhitelist addresses from pool creation fee Aug 11, 2024
Copy link
Collaborator

@PaddyMc PaddyMc left a comment

Choose a reason for hiding this comment

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

❤️

@czarcas7ic czarcas7ic merged commit 4385ee0 into main Aug 13, 2024
1 check passed
@czarcas7ic czarcas7ic deleted the adam/override-pool-creation-fee branch August 13, 2024 15:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Exempt addresses on UnrestrictedPoolCreatorWhitelist from pool creation fees
3 participants