Skip to content

Comments

Add support for Pump Fun creator fee upgrade#98

Merged
smypmsa merged 1 commit intomainfrom
feat/pump-fun-update-creator-fee
May 13, 2025
Merged

Add support for Pump Fun creator fee upgrade#98
smypmsa merged 1 commit intomainfrom
feat/pump-fun-update-creator-fee

Conversation

@smypmsa
Copy link
Member

@smypmsa smypmsa commented May 12, 2025

Recently, the Pump Fun program has been upgraded. The upgrade introduced creator fee. More on that here:
https://github.com/pump-fun/pump-public-docs/blob/main/docs/PUMP_CREATOR_FEE_README.md

The bot has been update to support updated structure of bonding curve and buy/sell transactions on bonding curve. The same changes have been made to the listener in the learning examples (updates for other scripts will come soon).

IDLs in the project have been updated too.

Summary by CodeRabbit

  • New Features

    • Added support for tracking and displaying both "creator" and "creator vault" information for tokens across monitoring, trading, and event processing components.
    • Enhanced token info outputs to clearly distinguish between "user" and "creator" fields.
  • Bug Fixes

    • Corrected encoding and parsing of public key data to use base58 encoding for improved compatibility.
  • Chores

    • Disabled one bot configuration and introduced a new, detailed configuration file for Solana trading bots.
  • Tests

    • Updated test outputs to separately display "user" and "creator" fields for better clarity.

@smypmsa smypmsa requested a review from akegaviar May 12, 2025 20:12
@smypmsa smypmsa self-assigned this May 12, 2025
@smypmsa smypmsa added the enhancement New feature or request label May 12, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented May 12, 2025

Walkthrough

The changes introduce a new "creator" public key field throughout the token creation, monitoring, and trading pipeline. This includes updating data structures, parsing, event processors, and transaction builders to handle the new creator and its associated "creator vault" address. Configuration files and test outputs are also updated for clarity and consistency.

Changes

File(s) Change Summary
bots/bot-sniper-2-logs.yaml Disabled the bot by setting enabled to false.
bots/bot-sniper-3-blocks.yaml Added a new comprehensive configuration file for a Solana trading bot, specifying connection, trading, fee, filtering, retry, cleanup, and node settings.
learning-examples/listen-new-tokens/listen_blocksubscribe.py Changed public key decoding from base64 to base58 and updated type from "publicKey" to "pubkey" in the instruction parser.
learning-examples/listen-new-tokens/listen_geyser.py Added parsing and printing of a new creator public key field using a helper function.
learning-examples/listen-new-tokens/listen_logsubscribe.py
learning-examples/listen-new-tokens/listen_logsubscribe+abc.py
Updated instruction parsing to extract an additional "creator" public key field.
src/core/curve.py Added a creator field to BondingCurveState, updated constructor to parse it, and changed error formatting in get_curve_state.
src/monitoring/block_event_processor.py Added extraction and derivation of creator and creator_vault fields, switched pubkey encoding to base58, and updated error formatting.
src/monitoring/geyser_event_processor.py Added parsing of creator public key, derivation of creator_vault address, and included both in token info.
src/monitoring/logs_event_processor.py Added parsing of creator public key, derivation of creator_vault address, and included both in token info.
src/trading/base.py Extended TokenInfo dataclass to include creator and creator_vault fields; updated serialization/deserialization methods.
src/trading/buyer.py Replaced use of SystemAddresses.RENT with token_info.creator_vault as a writable account in buy transactions.
src/trading/seller.py Replaced use of SystemAddresses.ASSOCIATED_TOKEN_PROGRAM with token_info.creator_vault as a writable account in sell transactions; updated error formatting.
tests/test_block_listener.py
tests/test_geyser_listener.py
tests/test_logs_listener.py
Updated test output to separately print both user and creator fields for clarity.

Sequence Diagram(s)

sequenceDiagram
    participant Creator
    participant EventProcessor
    participant TokenInfo
    participant Buyer/Seller

    Creator->>EventProcessor: Create Token (includes creator pubkey)
    EventProcessor->>TokenInfo: Parse and store creator & creator_vault
    Buyer/Seller->>TokenInfo: Access creator_vault for transactions
    Buyer/Seller->>EventProcessor: Use creator_vault in buy/sell instructions
Loading

Poem

In the warren of code, a new field appears,
"Creator" now hops through our structs and our peers.
With vaults for each bunny, and base58 cheer,
Our tokens are clearer, intentions sincere.
The tests now distinguish each user and friend—
More fields for the journey, more carrots to spend!
🥕✨

Tip

⚡️ Faster reviews with caching
  • CodeRabbit now supports caching for code and dependencies, helping speed up reviews. This means quicker feedback, reduced wait times, and a smoother review experience overall. Cached data is encrypted and stored securely. This feature will be automatically enabled for all accounts on May 16th. To opt out, configure Review - Disable Cache at either the organization or repository level. If you prefer to disable all data retention across your organization, simply turn off the Data Retention setting under your Organization Settings.

Enjoy the performance boost—your workflow just got faster.

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ 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>, please review it.
    • 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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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)

  • @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 generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this 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.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

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: 3

🔭 Outside diff range comments (1)
src/monitoring/block_event_processor.py (1)

46-58: ⚠️ Potential issue

Fallback IDL is now out of sync – missing creator argument

If the on-disk IDL fails to load, the hard-coded fallback only defines three args.
_decode_create_instruction() expects a creator arg (parsed as pubkey).
With the current code, offsets will be off by 32 bytes, producing corrupted data or raising an exception.

                         "args": [
                             {"name": "name", "type": "string"},
                             {"name": "symbol", "type": "string"},
                             {"name": "uri", "type": "string"},
+                            {"name": "creator", "type": "pubkey"},
                         ],
🧰 Tools
🪛 Ruff (0.8.2)

46-46: Use logging.exception instead of logging.error

Replace with exception

(TRY400)

🧹 Nitpick comments (16)
src/trading/seller.py (2)

131-131: Consider using logging.exception for better error traceability.

While changing to {e!s} from str(e) is good, using logger.exception would automatically include the full exception traceback, providing more debugging context.

-            logger.error(f"Sell operation failed: {e!s}")
+            logger.exception("Sell operation failed")
🧰 Tools
🪛 Ruff (0.8.2)

131-131: Use logging.exception instead of logging.error

Replace with exception

(TRY400)


210-210: Consider using logging.exception for better error traceability.

Similar to the earlier logging change, using logger.exception would provide more comprehensive error information including the stack trace.

-            logger.error(f"Sell transaction failed: {e!s}")
+            logger.exception("Sell transaction failed")
🧰 Tools
🪛 Ruff (0.8.2)

210-210: Use logging.exception instead of logging.error

Replace with exception

(TRY400)

src/trading/base.py (1)

46-47: Dictionary key naming inconsistency.

The creator_vault field is parsed from a snake_case key "creator_vault", but in the to_dict method (line 65), it's serialized to a camelCase key "creatorVault". Consider using consistent naming.

-            creator_vault=Pubkey.from_string(data["creator_vault"]),
+            creator_vault=Pubkey.from_string(data["creatorVault"]),
learning-examples/listen-new-tokens/listen_geyser.py (1)

80-85: Add return type annotation to the read_pubkey function.

For consistency with coding standards, add a return type annotation to make the function's purpose clearer.

-    def read_pubkey():
+    def read_pubkey() -> str:
🧰 Tools
🪛 Ruff (0.8.2)

80-80: Missing return type annotation for private function read_pubkey

(ANN202)

src/monitoring/logs_event_processor.py (2)

64-66: Duplicate vault-derivation could be consolidated

The same creatorcreator_vault derivation logic now exists in three processors. Re-implementing the PDA calculation in every class introduces repetition and raises the risk of silent divergence if Pump’s seed or program ID ever changes.

Consider extracting _find_creator_vault() into a shared utility (e.g. core/pump_utils.py) or a mix-in so all processors call a single authoritative implementation.


158-175: Utility method can be @staticmethod

_find_creator_vault() does not rely on any instance state; marking it @staticmethod communicates that fact and avoids the accidental use of self in the future.

-    def _find_creator_vault(self, creator: Pubkey) -> Pubkey:
+    @staticmethod
+    def _find_creator_vault(creator: Pubkey) -> Pubkey:
src/monitoring/geyser_event_processor.py (3)

60-65: Add a return-type annotation to satisfy Ruff / readers

The helper already returns a Pubkey; adding the annotation removes the Ruff warning and improves readability.

-            def read_pubkey():
+            def read_pubkey() -> Pubkey:
🧰 Tools
🪛 Ruff (0.8.2)

60-60: Missing return type annotation for private function read_pubkey

(ANN202)


103-105: Broader exception capture & logging style

Catching bare Exception suppresses vital context and hampers troubleshooting.
Additionally, Ruff (TRY400) recommends logger.exception, which automatically includes the traceback.

-        except Exception as e:
-            logger.error(f"Failed to process transaction data: {e}")
+        except Exception:
+            logger.exception("Failed to process transaction data")
🧰 Tools
🪛 Ruff (0.8.2)

103-103: Do not catch blind exception: Exception

(BLE001)


104-104: Use logging.exception instead of logging.error

Replace with exception

(TRY400)


107-124: Consider factoring out duplicate vault logic

Identical _find_creator_vault() implementations are present in three processors. Moving this to a shared helper avoids duplication and guarantees uniform PDA derivation.

src/monitoring/block_event_processor.py (3)

46-46: Prefer logger.exception for tracebacks

-            logger.error(f"Failed to load IDL: {e!s}")
+            logger.exception("Failed to load IDL")
🧰 Tools
🪛 Ruff (0.8.2)

46-46: Use logging.exception instead of logging.error

Replace with exception

(TRY400)


133-135: Same logging issue on transaction parsing

-        except Exception as e:
-            logger.error(f"Error processing transaction: {e!s}")
+        except Exception:
+            logger.exception("Error processing transaction")
🧰 Tools
🪛 Ruff (0.8.2)

133-133: Do not catch blind exception: Exception

(BLE001)


134-134: Use logging.exception instead of logging.error

Replace with exception

(TRY400)


176-193: Repeated vault helper – candidate for shared utility

All three processors include identical logic. A single shared helper (or even a constant CREATOR_VAULT_SEED = b"creator-vault") would reduce duplication.

Also this method can be @staticmethod.

bots/bot-sniper-3-blocks.yaml (4)

5-10: Align name field with configuration filename.
The name is set to "bot-sniper-2" but this file is bot-sniper-3-blocks.yaml. For clarity in logs and monitoring, update the bot name to match.

- name: "bot-sniper-2"
+ name: "bot-sniper-3-blocks"

36-42: Nit: fix typo in priority fee comment.
Correct “riority fee” → “priority fee” for readability.

-  extra_percentage: 0.0 # Percentage increase on riority fee regardless of the calculation method (0.1 = 10%)
+  extra_percentage: 0.0 # Percentage increase on priority fee regardless of the calculation method (0.1 = 10%)

53-57: Consider exponential backoff for retries.
Static wait times may be susceptible to rate limits or transient RPC hiccups. An optional exponential backoff strategy could improve reliability.


71-73: Stubbed node provider limits: implement or remove.
The node.max_rps setting is documented but not yet enforced in code. Either implement rate limiting or mark this section as “TODO” for future work.

Would you like help adding a simple token bucket rate limiter around RPC calls?

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8e2441b and e41a5f4.

📒 Files selected for processing (16)
  • bots/bot-sniper-2-logs.yaml (1 hunks)
  • bots/bot-sniper-3-blocks.yaml (1 hunks)
  • learning-examples/listen-new-tokens/listen_blocksubscribe.py (2 hunks)
  • learning-examples/listen-new-tokens/listen_geyser.py (2 hunks)
  • learning-examples/listen-new-tokens/listen_logsubscribe+abc.py (1 hunks)
  • learning-examples/listen-new-tokens/listen_logsubscribe.py (1 hunks)
  • src/core/curve.py (4 hunks)
  • src/monitoring/block_event_processor.py (6 hunks)
  • src/monitoring/geyser_event_processor.py (4 hunks)
  • src/monitoring/logs_event_processor.py (5 hunks)
  • src/trading/base.py (3 hunks)
  • src/trading/buyer.py (1 hunks)
  • src/trading/seller.py (3 hunks)
  • tests/test_block_listener.py (1 hunks)
  • tests/test_geyser_listener.py (1 hunks)
  • tests/test_logs_listener.py (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (3)
learning-examples/listen-new-tokens/listen_geyser.py (1)
src/monitoring/geyser_event_processor.py (2)
  • read_pubkey (60-64)
  • read_string (50-58)
src/monitoring/logs_event_processor.py (3)
src/core/pubkeys.py (2)
  • PumpAddresses (34-51)
  • SystemAddresses (15-30)
src/monitoring/block_event_processor.py (1)
  • _find_creator_vault (176-193)
src/monitoring/geyser_event_processor.py (1)
  • _find_creator_vault (107-124)
src/monitoring/geyser_event_processor.py (4)
src/core/pubkeys.py (1)
  • PumpAddresses (34-51)
learning-examples/listen-new-tokens/listen_geyser.py (1)
  • read_pubkey (80-84)
src/monitoring/block_event_processor.py (1)
  • _find_creator_vault (176-193)
src/monitoring/logs_event_processor.py (1)
  • _find_creator_vault (158-175)
🪛 Ruff (0.8.2)
learning-examples/listen-new-tokens/listen_geyser.py

80-80: Missing return type annotation for private function read_pubkey

(ANN202)

src/trading/seller.py

131-131: Use logging.exception instead of logging.error

Replace with exception

(TRY400)


210-210: Use logging.exception instead of logging.error

Replace with exception

(TRY400)

src/monitoring/geyser_event_processor.py

60-60: Missing return type annotation for private function read_pubkey

(ANN202)


103-103: Do not catch blind exception: Exception

(BLE001)


104-104: Use logging.exception instead of logging.error

Replace with exception

(TRY400)

src/monitoring/block_event_processor.py

46-46: Use logging.exception instead of logging.error

Replace with exception

(TRY400)


133-133: Do not catch blind exception: Exception

(BLE001)


134-134: Use logging.exception instead of logging.error

Replace with exception

(TRY400)

src/core/curve.py

111-111: Use logging.exception instead of logging.error

Replace with exception

(TRY400)


112-112: Within an except clause, raise exceptions with raise ... from err or raise ... from None to distinguish them from errors in exception handling

(B904)


112-112: Avoid specifying long messages outside the exception class

(TRY003)

🔇 Additional comments (24)
bots/bot-sniper-2-logs.yaml (1)

11-11: Configuration change verified

The bot is now disabled by setting enabled: false. This seems intentional as part of the changes supporting the creator fee upgrade, where you might be shifting to a different configuration approach.

tests/test_block_listener.py (1)

42-43: Better separation of User and Creator fields

The output has been updated to clearly distinguish between the user and creator, which aligns well with the Pump Fun creator fee upgrade. This improves clarity in test outputs and ensures both fields are properly displayed.

learning-examples/listen-new-tokens/listen_blocksubscribe.py (2)

14-14: Added missing dependency

Adding the base58 import to support the new encoding format for public keys.


41-43: Update to standardized public key handling

Changed the type check from "publicKey" to "pubkey" and switched from base64 to base58 encoding, which standardizes public key handling across the codebase to support the creator field.

learning-examples/listen-new-tokens/listen_logsubscribe+abc.py (2)

57-57: Added Creator field to parsing

Added the "creator" field to the list of parsed fields, which is essential for supporting the Pump Fun creator fee upgrade. This change allows the system to extract the creator's public key from token creation instructions.


50-58:

Details

✅ Verification successful

Verify Creator field is used in JSON output

The creator field is now parsed correctly, but I notice the code that prints the parsed data (around line 130-132) just iterates through the parsed fields without explicitly mentioning the creator field. This will work as-is since it's included in parsed_data, but consider adding specific handling if needed.


🏁 Script executed:

#!/bin/bash
# Check if there's any specific handling for the creator field elsewhere in the codebase
rg -A 5 "creator.*publicKey" --type py learning-examples/

Length of output: 1632


🏁 Script executed:

#!/bin/bash
# Locate and display how parsed_data is printed to verify handling of the creator field
rg -n "parsed_data" -A5 learning-examples/listen-new-tokens/listen_logsubscribe+abc.py

Length of output: 1978


Creator field is correctly included via dynamic iteration

The for key, value in parsed_data.items(): loop at lines 130–132 will print every entry in parsed_data, including "creator", so no additional code is required to surface that field.

tests/test_geyser_listener.py (1)

42-43: Improved clarity of token creator information display

The update correctly distinguishes between the token's user and creator in the output, which aligns with the wider changes for supporting the Pump Fun creator fee upgrade. This change enhances clarity by separately displaying these two distinct roles.

tests/test_logs_listener.py (1)

42-43: Improved clarity of token creator information display

The update correctly distinguishes between the token's user and creator in the output, which aligns with the broader changes for supporting the Pump Fun creator fee upgrade. This change ensures consistent representation of these distinct roles across the codebase.

src/trading/buyer.py (1)

179-180:

Details

✅ Verification successful

Updated transaction account structure to support creator fees

The transaction now properly includes the creator's vault account as writable, which is essential for supporting the new creator fee structure. This change aligns with the Pump Fun upgrade requirements and ensures fees can be directed to the token creator.


🏁 Script executed:

#!/bin/bash
# Check if the seller.py file has a similar update for consistency
rg -A 3 -B 3 "creator_vault" src/trading/seller.py

Length of output: 386


Consistent creator_vault writable flag
Both src/trading/buyer.py (lines 179–180) and src/trading/seller.py now mark the creator’s vault (token_info.creator_vault) as is_writable=True. This update fully supports the new creator fee structure, aligns with the Pump Fun upgrade requirements, and ensures fees are correctly directed to the token creator.

src/trading/seller.py (1)

178-179: Important account change for creator fee support.

The transaction now includes the creator's vault account as a writable account, replacing the previous reference to the associated token program. This is a critical change to support the new creator fee structure in the Pump Fun bonding curve.

src/trading/base.py (2)

25-26: Added essential creator fields to support creator fee upgrade.

The TokenInfo dataclass now includes two new fields to track the creator's public key and their vault address, which are core components for implementing the creator fee upgrade.


64-65: Serialization of new creator fields.

The implementation correctly converts the new Pubkey objects to strings for serialization. The camelCase style for JSON is consistent with other fields like "bondingCurve".

learning-examples/listen-new-tokens/listen_geyser.py (3)

89-89: Added creator public key extraction.

The code now extracts the creator public key from the instruction data, which is essential for the creator fee upgrade support.


95-95: Include creator in token info dictionary.

This change ensures the creator public key is stored in the token information dictionary, making it available for display and further processing.


116-116: Display creator information in output.

This enhances the output to show the creator's public key, which is valuable for debugging and monitoring the creator fee functionality.

src/core/curve.py (3)

8-8: Added Bytes import for creator field.

The import now includes the Bytes type from construct, which is necessary to define the new creator field in the struct.


31-31: Added creator field to bonding curve structure.

The bonding curve state now includes a 32-byte field for the creator's public key, which is essential for implementing the creator fee functionality.


48-51: Convert raw creator bytes to Pubkey object.

Added code to convert the raw creator bytes to a proper Pubkey object, with appropriate type checking for data safety.

src/monitoring/block_event_processor.py (1)

113-118: Unchecked key access may raise KeyError

decoded_args["creator"] presumes the key exists. After fixing the fallback IDL this is fine, but you might still defensive-code:

creator_str = decoded_args.get("creator")
if not creator_str:
    logger.warning("Creator field missing in decoded args")
    return None
creator = Pubkey.from_string(creator_str)
bots/bot-sniper-3-blocks.yaml (5)

1-4: Looks good: header documentation is clear.
The top comments provide useful guidance on customizing the bot parameters.


15-18: Verify supported Geyser auth_type values.
You’ve documented auth_type can be "basic" or "x-token". Ensure the code parsing this config indeed accepts both values and fails fast on invalid options.


22-26: Clarify sell parameters or document default behavior.
You configure buy_amount and sell_slippage but no explicit sell_amount. If the bot sells a fixed or full position, document that in comments; otherwise, consider adding a sell_amount field for symmetry.


27-31: EXTREME FAST mode settings look solid.
The flags and token‐amount overrides are well documented and correctly scoped.


60-68: Cleanup configuration is comprehensive.
The modes and flags cover the main use cases. No immediate changes needed here.

Comment on lines +39 to 40
("creator", "publicKey"),
]
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Added support for parsing the creator public key

The parser now correctly extracts the creator's public key from token creation instructions, which is an essential part of supporting the Pump Fun creator fee upgrade. This change ensures that creator information is properly captured during token monitoring.


🏁 Script executed:

#!/bin/bash
# Check if other listening examples have been similarly updated
fd -e py listen_ learning-examples/listen-new-tokens/ | xargs rg -l "creator.*publicKey"

Length of output: 212


🏁 Script executed:

#!/bin/bash
# Find all Python listening example scripts across the repository
fd -e py listen_

Length of output: 506


🏁 Script executed:

#!/bin/bash
# Verify if any listening example scripts outside the new-tokens directory reference creator publicKey
fd -e py listen_ | xargs rg -l "creator.*publicKey"

Length of output: 234


Ensure Migration Example Parses Creator Public Key

The migration script learning-examples/listen-migrations/listen_logsubscribe.py still references the creator’s public key but doesn’t extract it. To keep all examples in sync and fully support the Pump Fun creator fee upgrade, please add the same parsing logic you introduced in the new-tokens listener.

• learning-examples/listen-migrations/listen_logsubscribe.py: implement extraction of creator.publicKey from token creation instructions, matching the approach in listen-new-tokens/listen_logsubscribe.py.

Comment on lines +111 to +112
logger.error(f"Failed to get curve state: {e!s}")
raise ValueError(f"Invalid curve state: {e!s}")
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Improve exception handling.

Consider the following improvements to exception handling:

  1. Use logger.exception to automatically include traceback
  2. Use raise ... from e to properly chain exceptions
  3. Keep error messages concise in the exception constructor
-            logger.error(f"Failed to get curve state: {e!s}")
-            raise ValueError(f"Invalid curve state: {e!s}")
+            logger.exception("Failed to get curve state")
+            raise ValueError("Invalid curve state") from e
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
logger.error(f"Failed to get curve state: {e!s}")
raise ValueError(f"Invalid curve state: {e!s}")
logger.exception("Failed to get curve state")
raise ValueError("Invalid curve state") from e
🧰 Tools
🪛 Ruff (0.8.2)

111-111: Use logging.exception instead of logging.error

Replace with exception

(TRY400)


112-112: Within an except clause, raise exceptions with raise ... from err or raise ... from None to distinguish them from errors in exception handling

(B904)


112-112: Avoid specifying long messages outside the exception class

(TRY003)

Comment on lines +43 to +51
# Filters for token selection
filters:
match_string: null # Only process tokens with this string in name/symbol
bro_address: null # Only trade tokens created by this user address
listener_type: "blocks" # Method for detecting new tokens: "logs", "blocks", or "geyser"
max_token_age: 0.001 # Maximum token age in seconds for processing
marry_mode: false # Only buy tokens, skip selling
yolo_mode: false # Continuously trade tokens

Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Rename bro_address filter to creator_address.
The new schema introduces a “creator” field; using bro_address here is inconsistent and may confuse users.

-filters:
-  match_string: null # Only process tokens with this string in name/symbol
-  bro_address: null # Only trade tokens created by this user address
+filters:
+  match_string: null         # Only process tokens whose name/symbol contains this string
+  creator_address: null      # Only trade tokens created by this public key

Also update any downstream code or docs that reference bro_address.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
# Filters for token selection
filters:
match_string: null # Only process tokens with this string in name/symbol
bro_address: null # Only trade tokens created by this user address
listener_type: "blocks" # Method for detecting new tokens: "logs", "blocks", or "geyser"
max_token_age: 0.001 # Maximum token age in seconds for processing
marry_mode: false # Only buy tokens, skip selling
yolo_mode: false # Continuously trade tokens
# Filters for token selection
filters:
match_string: null # Only process tokens whose name/symbol contains this string
creator_address: null # Only trade tokens created by this public key
listener_type: "blocks" # Method for detecting new tokens: "logs", "blocks", or "geyser"
max_token_age: 0.001 # Maximum token age in seconds for processing
marry_mode: false # Only buy tokens, skip selling
yolo_mode: false # Continuously trade tokens

@smypmsa smypmsa merged commit 1e34b5b into main May 13, 2025
4 checks passed
@smypmsa smypmsa deleted the feat/pump-fun-update-creator-fee branch May 13, 2025 06:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants