Skip to main content

Official Zapzy Addresses

Launchlab Platform Config: DDLPBBK1rSRcfzJJtgduV2sx3nDthrFARWUB7nkaza6H Charity Launchlab Platform Config: FPsLPNN6YwuCSQsAKhnMLxMATtmjPRw9C2ndwFBsuCse Charity Vault: HWwAdPnU1UPuHdxDBupVLP8Yfo4wCpNbLqBjgiQPAANv Fee Vault: 3RZHkEdhUYxjw4WFRTNbt8mLqqAeSctqL1zVopL31Zq2

Raydium SDK Configuration

We only support this curve configuration if users want to create a coin via the Raydium SDK.
{
  "migrate_type": 1,
  "migrate_cpmm_fee_on": 255,
  "supply": "1000000000000000",
  "total_base_sell": "793100000000000",
  "total_quote_fund_raising": "85000000000",
  "total_locked_amount": "0",
  "cliff_period": "0",
  "unlock_period": "0"
}

How to Deploy Charity Coins

import {
    getPdaLaunchpadPoolId,
    getPdaLaunchpadVaultId,
    getPdaMetadataKey,
    getPdaLaunchpadAuth,
    METADATA_PROGRAM_ID,
    RENT_PROGRAM_ID,
    struct,
    str,
    ALL_PROGRAM_ID,
    getPdaLaunchpadConfigId,
    getPdaCpiEvent
  } from '@raydium-io/raydium-sdk-v2'
  import { AccountMeta, clusterApiUrl, Connection, Keypair, PublicKey, SystemProgram, TransactionInstruction, TransactionMessage, VersionedTransaction } from '@solana/web3.js'
  import { NATIVE_MINT, TOKEN_PROGRAM_ID } from "@solana/spl-token";


const anchorDataBuf = {
    charityCreateMintV2: Buffer.from([90, 156, 232, 100, 53, 107, 42, 95])
};

async function charityCreateMintInstruction(
    user: PublicKey,
    mintA: Keypair,
    name: string,
    symbol: string,
    uri: string,
    charityAddress: PublicKey
) {

    const { publicKey: poolId } = getPdaLaunchpadPoolId(ALL_PROGRAM_ID.LAUNCHPAD_PROGRAM, mintA.publicKey, NATIVE_MINT);
    const { publicKey: vaultA } = getPdaLaunchpadVaultId(ALL_PROGRAM_ID.LAUNCHPAD_PROGRAM, poolId, mintA.publicKey);
    const { publicKey: vaultB } = getPdaLaunchpadVaultId(ALL_PROGRAM_ID.LAUNCHPAD_PROGRAM, poolId, NATIVE_MINT);
    const { publicKey: metaId } = getPdaMetadataKey(mintA.publicKey);
    const authProgramId = getPdaLaunchpadAuth(ALL_PROGRAM_ID.LAUNCHPAD_PROGRAM).publicKey
    const globalConfig = getPdaLaunchpadConfigId(ALL_PROGRAM_ID.LAUNCHPAD_PROGRAM, NATIVE_MINT, 0, 0).publicKey
    const eventAuthority = getPdaCpiEvent(ALL_PROGRAM_ID.LAUNCHPAD_PROGRAM).publicKey
    const charityPlatformId = new PublicKey("FPsLPNN6YwuCSQsAKhnMLxMATtmjPRw9C2ndwFBsuCse")

    const keys: Array<AccountMeta> = [
    { pubkey: user, isSigner: true, isWritable: true },
    { pubkey: user, isSigner: false, isWritable: false },
    { pubkey: globalConfig, isSigner: false, isWritable: false },
    { pubkey: charityPlatformId, isSigner: false, isWritable: false },
    { pubkey: authProgramId, isSigner: false, isWritable: false },
    { pubkey: poolId, isSigner: false, isWritable: true },
    { pubkey: mintA.publicKey, isSigner: true, isWritable: true },
    { pubkey: NATIVE_MINT, isSigner: false, isWritable: false },
    { pubkey: vaultA, isSigner: false, isWritable: true },
    { pubkey: vaultB, isSigner: false, isWritable: true },
    { pubkey: metaId, isSigner: false, isWritable: true },
    { pubkey: TOKEN_PROGRAM_ID, isSigner: false, isWritable: false },
    { pubkey: TOKEN_PROGRAM_ID, isSigner: false, isWritable: false },
    { pubkey: METADATA_PROGRAM_ID, isSigner: false, isWritable: false },
    { pubkey: SystemProgram.programId, isSigner: false, isWritable: false },
    { pubkey: RENT_PROGRAM_ID, isSigner: false, isWritable: false },
    { pubkey: eventAuthority, isSigner: false, isWritable: false },
    { pubkey: ALL_PROGRAM_ID.LAUNCHPAD_PROGRAM, isSigner: false, isWritable: false },
    { pubkey: charityAddress, isSigner: false, isWritable: false },
    ];

    const data1 = Buffer.alloc(
    Buffer.from(name, "utf-8").length +
        Buffer.from(symbol, "utf-8").length +
        Buffer.from(uri, "utf-8").length +
        4 * 3 +
        1,
    );

    const dataLayout = struct([str("name"), str("symbol"), str("uri")]);
    dataLayout.encode({ name, symbol, uri }, data1);
    
    return new TransactionInstruction({
    keys,
    programId: new PublicKey("ZAPZYdmAFneSZTdPAi9i25yHaTLwUPfeNQRqzwHXjKP"),
    data: Buffer.concat([anchorDataBuf.charityCreateMintV2, data1])
    });
}

// EXAMPLE USAGE:
async function main(){

    const user = Keypair.generate() // Import your wallet.

    const mint = Keypair.generate() // Generate a one time use mint address

    const createInstruction = await charityCreateMintInstruction(
        user.publicKey,
        mint,
        "name",
        "symbol",
        "ipfs.io/ipfs/yourCID",
        new PublicKey("") // Select a charity address from the charity list below.
    )

    const connection = new Connection(clusterApiUrl("mainnet-beta")) // We recommend using a private RPC.
    const blockhash = (await connection.getLatestBlockhash()).blockhash
    
    const messageV0 = new TransactionMessage({
      payerKey: user.publicKey,
      recentBlockhash: blockhash,
      instructions: [createInstruction]
    }).compileToV0Message();
    
    const tx = new VersionedTransaction(messageV0);

    const signature = await connection.sendRawTransaction(tx.serialize(), {
        skipPreflight: false,
        preflightCommitment: 'confirmed'
    });

    console.log("View on solscan: https://solscan.io/tx/" + signature)
}

// charity list
// Hope For Paws: new PublicKey("A1oRuDa23hj8PcxvBXEzYuer386di8Yv9adHYRR8ibyu")
// Best Friends Animal Society: new PublicKey("9xFjyQXMcVm3d7PHia9VcuzdVjj5RbLSMrhxEQvFEdxw")
// SeeTurtles: new PublicKey("984ddkkQscps1LdUE5XfZX2AQ5iHyfbe43eHMaDdSdrv")
// Wildlife SOS: new PublicKey("FCcobictNW3Nw4sogXuymTkzT3QqT1GtMWP9BrWxoc9s")

// Save the Children: new PublicKey("Guo3GSXoJ7Mur3MhjiGk2nswphKNs9YJapmSurW8eSpN")
// American Cancer Society: new PublicKey("CM3oPiRXHDgsEHAkGvyR2BP7dYUYWa5izrbMWYZ6RwXW")
// WaterAid: new PublicKey("7zTryMsCtbNypwM48WLNsDiTxKuHnkqKFpN5XyqzLk4e")
// St. Jude Children’s Research Hospital: new PublicKey("4zaxr46wrN7vbE6V2m4qpe5qK3RUTGyhJGYfJyKBnLWF")
// Pediatric Cancer Research Foundation: new PublicKey("7StvGZdfB6kTGCufSBvdYyiKdZW1N6nHgTc7TfU63Tex")
// No Kid Hungry: new PublicKey("6zMU92MPXoeswGrXheExLanVCbBPqE8xXfkKLaY8ao13")

// One Earth: new PublicKey("CCR15ZWabVTyNNrs8xTs4RK2oHwdbBegA3Ysei4neQge")
// Rainforest Foundation US: new PublicKey("8r2EpKVHLf1ASuDtj2up8TDwjkTbHbDY94UcT7jcEQ1s")
// Oceanic Society: new PublicKey("ANUiK7Cri9rScuR2aDCTMfWEjwfVEuejdbgkGX5GZeyN")
// One Tree Planted: new PublicKey("6gmPAqXWh5HmMeaTx64C9aCpXaxwapaK3MfQ6EhTv7JX")