feat(core): update buy instruction, add volume_accumulator accounts

This commit is contained in:
smypmsa
2025-08-01 05:25:54 +00:00
parent d2f157e7f0
commit 3faeb1338e
3 changed files with 38 additions and 1 deletions
+31
View File
@@ -49,3 +49,34 @@ class PumpAddresses:
LIQUIDITY_MIGRATOR: Final[Pubkey] = Pubkey.from_string(
"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