MCPcopy Index your code
hub / github.com/cutupdev/Solana-Token-Presale-Smart-Contract

github.com/cutupdev/Solana-Token-Presale-Smart-Contract @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
63 symbols 124 edges 30 files 15 documented · 24%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Spl token presale smart contract

This is token presale smart contract. This is full-working project. As a novice of solana smart contract, it might be one of good source code for you. Feel free to reach out of me if you have any question or custom requirements[telegram: https://t.me/DevCutup or whatsapp: https://wa.me/13137423660].

How to use it

Install Dependencies

  • Install node and yarn

  • Install rust, solana and anchor

    https://www.anchor-lang.com/docs/installation

How to deploy this program?

First of all, you have to clone this repo to your PC. In the folder token-presale

  1. Install node modules using yarn

  2. Build program using anchor cli anchor build

  3. Get program address using solana cli.

    solana-keygen pubkey ./target/deploy/presale-keypair.json

You can get the pubkey of the program. e.g. BE4G...5qhv

  1. Change program address in the code to BE4G...5qhv

in lib.rs declare_id!("BE4G...5qhv"); in Anchor.toml presale = "BE4G...5qhv"

  1. Change provider settings in Anchor.toml cluster = "localnet" wallet = "./admin.json"

  2. run anchor build again

  3. deploy program using anchor cli anchor deploy

Test case

./tests/presal.ts is test script for each instruction

run anchor test to check test the smart contract

Test on devnet

You should build and deploy on devnet first.

Check the program address and USDC, USDT address.

- Initialize project

yarn script init -t <TOKEN_ADDRESS>

e.g. yarn script init -t 5U6PVxcjCWo361vFwS6cfB65Br4T5jECA6vsVAtm5urt

- Set DAO wallet address

yarn script set-vault -v <DAO_WALLET_ADDRESS>

e.g. yarn script set-vault -v DJDcV3UxP55KqHUKsTSBve7xssRYtbQ5eSG8uWND2HQ7

- Deposit token to the program

yarn script deposit-token -t <TOKEN_ADDRESS> -a <DEPOSIT_ADMOUNT>

e.g. yarn script deposit-token -t 5U6PVxcjCWo361vFwS6cfB65Br4T5jECA6vsVAtm5urt -a 200000000000000

- Start presale

yarn script start-presale -t <TOKEN_ADDRESS>

e.g. yarn script start-presale -t 5U6PVxcjCWo361vFwS6cfB65Br4T5jECA6vsVAtm5urt

- Set stage

yarn script set-stage -s <STAGE_NUMBER>

e.g. yarn script set-stage -s 1

Contact Information

  • Telegram: https://t.me/DevCutup
  • Whatsapp: https://wa.me/13137423660
  • Twitter: https://x.com/devcutup

Extension points exported contracts — how you extend this code

GlobalState (Interface)
(no doc)
lib/types.ts

Core symbols most depended-on inside this repo

getAssociatedTokenAccount
called by 8
lib/util.ts
execTx
called by 5
lib/util.ts
setClusterConfig
called by 5
cli/scripts.ts
programCommand
called by 5
cli/command.ts
getAssociatedTokenAccount
called by 4
tests/utils.ts
createAssociatedTokenAccountInstruction
called by 2
lib/util.ts
createMintAcct
called by 2
tests/create-mints.ts
airdropToken
called by 2
tests/airdrop-tokens.ts

Shape

Function 40
Class 12
Method 9
Enum 1
Interface 1

Languages

Rust57%
TypeScript43%

Modules by API surface

programs/presale/src/lib.rs9 symbols
lib/util.ts6 symbols
cli/scripts.ts6 symbols
lib/scripts.ts5 symbols
programs/presale/src/util.rs4 symbols
lib/executor.ts4 symbols
programs/presale/src/state.rs3 symbols
tests/create-mints.ts2 symbols
programs/presale/src/instructions/start_presale.rs2 symbols
programs/presale/src/instructions/set_vault_address.rs2 symbols
programs/presale/src/instructions/set_stage.rs2 symbols
programs/presale/src/instructions/set_live.rs2 symbols

For agents

$ claude mcp add Solana-Token-Presale-Smart-Contract \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page