Skip to content

m8s-lab/pump-fun-smart-contract

Repository files navigation

Solana smart contract for pump.fun

You can check frontend and backend repo as well.

https://github.com/m8s-lab/pump-fun-frontend

https://github.com/m8s-lab/pump-fun-backend

You can contact me if you want a better product.

Available features

  • All handled in smart contracts: Token creation and Raydium deposits are handled in the smart contract.

  • Enable sniping: Add Presale phase before the launch to allow snipers.

  • Raydium/Meteora migration: Token launchers can migrate their tokens to Raydium or Meteora as they wish after the curve is completed.

  • Set curve limit and fee as stable price: Calculate market cap in each swap instruction using oracle.

Telegram: https://t.me/microgift88

Discord: https://discord.com/users/1074514238325927956

Test addresses and transactions

Prerequites

Install Rust, Solana, and Anchor

Here's a useful link. https://anchor-lang.com/docs/installation

# check rust version
rustc --version

# check solana version
solana --version

# check anchor version
# should be 0.30.1
anchor --version

# check solana configuration
solana config get

# set solana rpc as devnet
solana config set --url devnet

# check wallet set in the config
solana balance

# generate new wallet if doesn't exist
solana-keygen new

# airdrop some devnet SOL
solana airdrop 5

Prepare the project

# clone the git repo
git clone https://github.com/...

# install node modules
yarn

Quick Start

Build the program

# build the program
# it will generate new keypair for the program if doesn't exist
# and it will make a build version
anchor build

# sync all keys in program
anchor keys sync

# build again if the program address in lib.rs is changed
anchor build

# you can get keypair and so file here
# ./target/deploy/pumpfun-keypair.json
# ./target/deploy/pumpfun.so

Run tests on localnet

Set the cluster as localnet in Anchor.toml:

[provider]
cluster = "Localnet"

you can run the tests without having to start a local network:

anchor test --provider.cluster Localnet

Test program on devnet

Set the cluster as devnet in Anchor.toml:

[provider]
cluster = "<DEVNET_RPC>"

Deploy program:

anchor deploy

Use CLI to test the program

Initialize program:

yarn script config

Launch a token:

yarn script launch

Swap SOL for token:

yarn script swap -t <TOKEN_MINT> -a <SWAP_AMOUNT> -s <SWAP_DIRECTION>
# <TOKEN_MINT>: You can get token mint when you launch a token
# <SWAP_AMOUNT>: SOL/Token amount to swap
# <SWAP_DIRECTION>: 0 - Buy token, 1 - Sell token

Migrate token to raydium once the curve is completed:

yarn script migrate -t <TOKEN_MINT>
# <TOKEN_MINT>: mint address of the token to be launched on the raydium

About

(pumpfun)pump.fun solana contract (+frontend, backend)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published