mirror of
https://github.com/chainstacklabs/pumpfun-bonkfun-bot.git
synced 2026-08-15 16:28:04 +00:00
feat(core): update buy instruction, add volume_accumulator accounts
This commit is contained in:
+1
-1
@@ -86,7 +86,7 @@ async def start_bot(config_path: str):
|
|||||||
"wait_before_new_token", 15
|
"wait_before_new_token", 15
|
||||||
),
|
),
|
||||||
max_token_age=cfg.get("timing", {}).get("max_token_age", 0.001),
|
max_token_age=cfg.get("timing", {}).get("max_token_age", 0.001),
|
||||||
token_wait_timeout=cfg.get("timing", {}).get("token_wait_timeout", 30),
|
token_wait_timeout=cfg.get("timing", {}).get("token_wait_timeout", 120),
|
||||||
# Cleanup settings
|
# Cleanup settings
|
||||||
cleanup_mode=cfg.get("cleanup", {}).get("mode", "disabled"),
|
cleanup_mode=cfg.get("cleanup", {}).get("mode", "disabled"),
|
||||||
cleanup_force_close_with_burn=cfg.get("cleanup", {}).get(
|
cleanup_force_close_with_burn=cfg.get("cleanup", {}).get(
|
||||||
|
|||||||
@@ -49,3 +49,34 @@ class PumpAddresses:
|
|||||||
LIQUIDITY_MIGRATOR: Final[Pubkey] = Pubkey.from_string(
|
LIQUIDITY_MIGRATOR: Final[Pubkey] = Pubkey.from_string(
|
||||||
"39azUYFWPz3VHgKCf3VChUwbpURdCHRxjWVowf5jUJjg"
|
"39azUYFWPz3VHgKCf3VChUwbpURdCHRxjWVowf5jUJjg"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def find_global_volume_accumulator() -> Pubkey:
|
||||||
|
"""
|
||||||
|
Derive the Program Derived Address (PDA) for the global volume accumulator.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Pubkey of the derived global volume accumulator account
|
||||||
|
"""
|
||||||
|
derived_address, _ = Pubkey.find_program_address(
|
||||||
|
[b"global_volume_accumulator"],
|
||||||
|
PumpAddresses.PROGRAM,
|
||||||
|
)
|
||||||
|
return derived_address
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def find_user_volume_accumulator(user: Pubkey) -> Pubkey:
|
||||||
|
"""
|
||||||
|
Derive the Program Derived Address (PDA) for a user's volume accumulator.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
user: Pubkey of the user account
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Pubkey of the derived user volume accumulator account
|
||||||
|
"""
|
||||||
|
derived_address, _ = Pubkey.find_program_address(
|
||||||
|
[b"user_volume_accumulator", bytes(user)],
|
||||||
|
PumpAddresses.PROGRAM,
|
||||||
|
)
|
||||||
|
return derived_address
|
||||||
|
|||||||
@@ -195,6 +195,12 @@ class TokenBuyer(Trader):
|
|||||||
AccountMeta(
|
AccountMeta(
|
||||||
pubkey=PumpAddresses.PROGRAM, is_signer=False, is_writable=False
|
pubkey=PumpAddresses.PROGRAM, is_signer=False, is_writable=False
|
||||||
),
|
),
|
||||||
|
AccountMeta(
|
||||||
|
pubkey=PumpAddresses.find_global_volume_accumulator(), is_signer=False, is_writable=True
|
||||||
|
),
|
||||||
|
AccountMeta(
|
||||||
|
pubkey=PumpAddresses.find_user_volume_accumulator(self.wallet.pubkey), is_signer=False, is_writable=True
|
||||||
|
),
|
||||||
]
|
]
|
||||||
|
|
||||||
# Prepare idempotent create ATA instruction: it will not fail if ATA already exists
|
# Prepare idempotent create ATA instruction: it will not fail if ATA already exists
|
||||||
|
|||||||
Reference in New Issue
Block a user