Welcome to the project! This guide will help you quickly get started by installing the required tools and configuring your local environment.
Ensure the following tools are installed on your system:
ℹ️ Recommended Anchor version:
0.30.1ℹ️ Recommended solana versioni1.18.18
Verify that everything is properly installed and configured:
rustc --version # Check Rust version
solana --version # Check Solana CLI version
anchor --version # Check Anchor version
solana config get # View current Solana config
solana config set --url devnet # Set network to devnet
solana config set --url mainnet-rpc # Set network to mainnetGenerate and manage your wallet keys:
solana-keygen new -o ./keys/admin.json # Generate a new keypair
solana-keygen pubkey ./keys/admin.json # Get public key
solana balance ./keys/admin.json # Check wallet balance
#devnet
solana airdrop 5 YOUR_WALLET_ADDRESS -u devnet # Airdrop 5 SOL to your wallet
#mainnet
#send sol to ./keys/admin.json # Deposit sol to admin wallet with your wallet like phantomClone the project and install dependencies:
git clone https://github.com/project-repo.git
cd project-folder
yarnCompile the Anchor smart contract:
# Build the Anchor program using nightly toolchain
RUSTUP_TOOLCHAIN="nightly-2024-11-19" anchor build
# Sync all program public keys
anchor keys sync
# Rebuild if the program address in lib.rs has changed
RUSTUP_TOOLCHAIN="nightly-2024-11-19" anchor buildEnsure your Anchor.toml uses Devnet:
[provider]
cluster = "https://api.devnet.solana.com"Ensure your Anchor.toml uses Devnet:
[provider]
cluster = "mainnet-rpc"anchor deployUse these CLI scripts to interact with your smart contract and perform DeFi operations.
yarn script fund -t <TARGET_WALLET_ADDRESS> -a <FUND_AMOUNT>
# Example:
yarn script fund -t H4YTJNFJdp1ZVvAQ2NAsE59nY9MFscfjYZPfVU837mHU -a 100000000Parameters:
<TARGET_WALLET_ADDRESS>: The token mint address to fund<FUND_AMOUNT>: Amount to fund in sol units (e.g., lamports for SOL)
Options:
-e, --env <string>: Solana cluster environment (default: mainnet-beta)-r, --rpc <string>: RPC endpoint URL (default: Helius mainnet-rpc)-k, --keypair <string>: Path to keypair file (default: ./keys/admin.json)
yarn script buy -t <TOKEN_ADDRESS> -a <BUY_AMOUNT>
# Example:
yarn script buy -t 7cWi5gXHNzPWRZd6cCTedR1vtvbYnBmZwirsLK8gSFYc -a 100000Parameters:
<TOKEN_ADDRESS>: The token mint address to buy<BUY_AMOUNT>: Amount of SOL to spend on the purchase
Options:
-e, --env <string>: Solana cluster environment (default: mainnet-beta)-r, --rpc <string>: RPC endpoint URL (default: Helius mainnet-rpc)-k, --keypair <string>: Path to keypair file (default: ./keys/admin.json)
yarn script sell -t <TOKEN_ADDRESS> -a <SELL_AMOUNT>
# Example:
yarn script sell -t 7cWi5gXHNzPWRZd6cCTedR1vtvbYnBmZwirsLK8gSFYc -a 2871320744Parameters:
<TOKEN_ADDRESS>: The token mint address to sell<SELL_AMOUNT>: Amount of tokens to sell
Options:
-e, --env <string>: Solana cluster environment (default: mainnet-beta)-r, --rpc <string>: RPC endpoint URL (default: Helius mainnet-rpc)-k, --keypair <string>: Path to keypair file (default: ./keys/admin.json)
All commands support the following global options:
-e, --env <string>: Solana cluster environment- Options:
mainnet-beta,testnet,devnet(default: mainnet-rpc)
- Options:
-r, --rpc <string>: Custom RPC endpoint URL-k, --keypair <string>: Path to your wallet keypair file
Example with custom configuration:
yarn script buy -t TOKEN_ADDRESS -a 100000 -e mainnet-beta -r "https://your-rpc-url.com" -k "./keys/mainnet.json"For questions or inquiries about Solana smart contract development, DeFi implementation, or DEX integration, please reach out to the project maintainers.