Pool Interaction

The Bonding Curve Pool is a dynamic pricing mechanism used in the GoFundMeme Protocol to enable seamless token swaps. Instead of relying on traditional order books, bonding curves establish an automated market maker (AMM)-style system where price adjusts based on supply and demand.

With the GoFundMeme SDK, you can: ✅ Fetch Bonding Curve pool details ✅ Buy tokens from the bonding curve ✅ Sell tokens back for SOL ✅ Harvest LP fees and staking rewards ✅ Stake, unstake, and claim rewards


🛠️ Fetching a Bonding Curve Pool

To interact with a Bonding Curve Pool, fetch its data using the mint address of the token launched in a Fair Launch.

import { Connection, PublicKey } from "@solana/web3.js";
import { initGoFundMemeSDK } from "@gofundmeme/sdk";

const connection = new Connection("https://api.mainnet-beta.solana.com");

(async () => {
  const gfmSDK = await initGoFundMemeSDK({ connection });

  // Replace with the token mint address
  const mintAddress = new PublicKey("THE TOKEN MINT ADDRESS");

  // Fetch the Bonding Curve Pool
  const bondingCurvePool = await gfmSDK.pools.bondingCurve.fetchBondingCurvePool(
    { mintB: mintAddress }
  );

  console.log("Bonding Curve Pool Data:", bondingCurvePool);
})();

📊 Checking Pool Status

Once you've fetched the Bonding Curve Pool, you can check its status, target raise, and funding progress.


🛒 Buying Tokens on the Bonding Curve

Purchasing tokens from the Bonding Curve Pool is simple. Specify the amount of SOL you wish to spend and set a slippage tolerance.


💰 Selling Tokens Back for SOL

If you want to sell tokens back to the Bonding Curve Pool, specify the amount of tokens to sell and set your slippage tolerance.


🏦 Fetching LP Fees & Harvester Rewards

Once the Bonding Curve Pool has completed its lifecycle, LP fees and harvester rewards can be retrieved.

📌 Example Response:


🌾 Harvesting LP Fees

LP fees generated from trades can be harvested by crankers.

Last updated