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

Transaction Confirmed but failing with overflow #6

Open
pascaloberle opened this issue Oct 30, 2024 · 1 comment
Open

Transaction Confirmed but failing with overflow #6

pascaloberle opened this issue Oct 30, 2024 · 1 comment

Comments

@pascaloberle
Copy link

pascaloberle commented Oct 30, 2024

Hi all and thanks for the great code and support!
I just see my transactions are confirmed
.... Bonding curve address: 6DLfCj6LjwLG3sCrHV3BYtNtrvGRMrLGoM5ny6arsaFB Token price: 0.0003334000 SOL Buying 0.010000 SOL worth of the new token with 35.0% slippage tolerance... Amount to buy: 29.994001199760046 Associated token account already exists. Associated token account address: H1DX3hJuDrTdmmhgtN8jvmwsqaQG8cNm7EEBRRJH2N7G Transaction sent: https://explorer.solana.com/tx/gw3ps14YMtufNnCi56mYoyrbvLdXaFLBLpYJSwhs7QTXtpKajZWcFRBMfBEtPd3niSP5jH4aasfbrv7GbThjhzn Attempt 1 failed: Unable to confirm transaction gw3ps14YMtufNnCi56mYoyrbvLdXaFLBLpYJSwhs7QTXtpKajZWcFRBMfBEtPd3niSP5jH4aasfbrv7GbThjhzn Retrying in 1 seconds... Transaction sent: https://explorer.solana.com/tx/2KX3LVdW24CLMU7jaHvpifwRRLcjNPsahaW6ar1KK2yq724RKoLd6vfZpvcHsk6Wd2c7ybsfd2qMoJKNxwYF2cau Transaction confirmed ...

But if you inspect all my attempts (with and without set compute unit price it keeps failing)

https://solscan.io/account/H1DX3hJuDrTdmmhgtN8jvmwsqaQG8cNm7EEBRRJH2N7G#transactions

#1 Pump.fun instruction

Program log: Instruction: Buy
Program log: panicked at programs/pump/src/lib.rs:615:48: attempt to subtract with overflow
Program Pump.fun consumed 18864 of 200000 compute units
Program returned error: SBF program panicked

I am not sure if I can be missing anything from the instructions
{
amount:{
type: "u64"
data:"29994001"
}
maxSolCost:{
type:"u64"
data:"13500000"
}
}

From the code below in the transaction
data = discriminator + struct.pack("<Q", int(token_amount * 10**6)) + struct.pack("<Q", max_amount_lamports) ?

are you able to derive a bit more what the token_amount * 10**6 is supposed to represent? is it just the amount of token to buy offset to million for some reasons? I just suspect (just a guess at this stage) that there could be some problem with the amount but not too sure

@chainstacklabs chainstacklabs deleted a comment from SmithDEVV Oct 31, 2024
@pascaloberle pascaloberle changed the title Transaction Keeps Failing Transaction Confirmed but failing with overflow Oct 31, 2024
@smypmsa
Copy link
Contributor

smypmsa commented Nov 8, 2024

Hi @pascaloberle! The data variable contains a payload, input data for the instruction. In this case, we specify the amount of tokens we're willing to buy and the max amount of SOL we're happy to spend (including slippage).

10**6 means converting the amount into microunits. SLP tokens usually have 6 decimal places.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants