fix(core): minor fixes in hardcoded values

This commit is contained in:
smypmsa
2025-08-05 20:19:00 +00:00
parent 874d148777
commit 329266611c
4 changed files with 17 additions and 10 deletions
+4
View File
@@ -12,6 +12,10 @@ from solders.pubkey import Pubkey
LAMPORTS_PER_SOL: Final[int] = 1_000_000_000
TOKEN_DECIMALS: Final[int] = 6
# Token account constants
TOKEN_ACCOUNT_SIZE: Final[int] = 165 # Size of a token account in bytes
TOKEN_ACCOUNT_RENT_EXEMPT_RESERVE: Final[int] = 2_039_280 # Rent-exempt minimum for token accounts
# Core system programs
SYSTEM_PROGRAM: Final[Pubkey] = Pubkey.from_string("11111111111111111111111111111111")
TOKEN_PROGRAM: Final[Pubkey] = Pubkey.from_string(
+1 -3
View File
@@ -10,6 +10,7 @@ import grpc
from geyser.generated import geyser_pb2, geyser_pb2_grpc
from interfaces.core import Platform, TokenInfo
from monitoring.base_listener import BaseTokenListener
from platforms import platform_factory
from utils.logger import get_logger
logger = get_logger(__name__)
@@ -38,9 +39,6 @@ class UniversalGeyserListener(BaseTokenListener):
f"Expected one of {valid_auth_types}"
)
# Import platform factory and get supported platforms
from platforms import platform_factory
if platforms is None:
self.platforms = platform_factory.get_supported_platforms()
else:
+2 -2
View File
@@ -209,7 +209,7 @@ class LetsBonkCurveManager(CurveManager):
return pool_data
def validate_pool_state_structure(self, pool_address: Pubkey) -> bool:
async def validate_pool_state_structure(self, pool_address: Pubkey) -> bool:
"""Validate that the pool state structure matches IDL expectations.
Args:
@@ -221,7 +221,7 @@ class LetsBonkCurveManager(CurveManager):
try:
# This would be used during development/testing to ensure
# the IDL parsing is working correctly
pool_state = self.get_pool_state(pool_address)
pool_state = await self.get_pool_state(pool_address)
required_fields = [
"virtual_base", "virtual_quote",
+10 -5
View File
@@ -14,7 +14,12 @@ from solders.pubkey import Pubkey
from solders.system_program import CreateAccountWithSeedParams, create_account_with_seed
from spl.token.instructions import create_idempotent_associated_token_account
from core.pubkeys import TOKEN_DECIMALS, SystemAddresses
from core.pubkeys import (
TOKEN_ACCOUNT_RENT_EXEMPT_RESERVE,
TOKEN_ACCOUNT_SIZE,
TOKEN_DECIMALS,
SystemAddresses,
)
from interfaces.core import AddressProvider, InstructionBuilder, Platform, TokenInfo
from utils.idl_parser import IDLParser
from utils.logger import get_logger
@@ -84,7 +89,7 @@ class LetsBonkInstructionBuilder(InstructionBuilder):
wsol_account = address_provider.create_wsol_account_with_seed(user, wsol_seed)
# Account creation cost + amount to spend
account_creation_lamports = 2_039_280 # Standard account creation cost
account_creation_lamports = TOKEN_ACCOUNT_RENT_EXEMPT_RESERVE
total_lamports = amount_in + account_creation_lamports
create_wsol_ix = create_account_with_seed(
@@ -94,7 +99,7 @@ class LetsBonkInstructionBuilder(InstructionBuilder):
base=user,
seed=wsol_seed,
lamports=total_lamports,
space=165, # Size of a token account
space=TOKEN_ACCOUNT_SIZE,
owner=SystemAddresses.TOKEN_PROGRAM
)
)
@@ -184,7 +189,7 @@ class LetsBonkInstructionBuilder(InstructionBuilder):
wsol_account = address_provider.create_wsol_account_with_seed(user, wsol_seed)
# Minimal account creation cost
account_creation_lamports = 2_039_280
account_creation_lamports = TOKEN_ACCOUNT_RENT_EXEMPT_RESERVE
create_wsol_ix = create_account_with_seed(
CreateAccountWithSeedParams(
@@ -193,7 +198,7 @@ class LetsBonkInstructionBuilder(InstructionBuilder):
base=user,
seed=wsol_seed,
lamports=account_creation_lamports,
space=165, # Size of a token account
space=TOKEN_ACCOUNT_SIZE,
owner=SystemAddresses.TOKEN_PROGRAM
)
)