Skip to content

This project implements a custom SPL token on the Solana blockchain using the Anchor framework. It includes a smart contract (program) for token creation and management, a Rust client for interaction, and comprehensive integration tests.

Notifications You must be signed in to change notification settings

guicybercode/rust-solana

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Token Creator - Custom Solana SPL Token

This project implements a custom SPL token on the Solana blockchain using the Anchor framework. It includes a smart contract (program) for token creation and management, a Rust client for interaction, and comprehensive integration tests.

🚀 Features

  • Smart Contract Completo:
  • Metadados Integrados:
  • Cliente Rust:
  • Testes Abrangentes:
  • Segurança:
  • Documentação:

📁 Project Structure

solanarust/
├── Anchor.toml              # Configuração do Anchor
├── Cargo.toml               # Workspace Cargo
├── README.md                # Este arquivo
├── programs/
│   └── token_creator/       # Smart contract
│       ├── Cargo.toml
│       ├── Xargo.toml
│       └── src/
│           └── lib.rs       # Código principal do programa
├── client/                  # Cliente Rust
│   ├── Cargo.toml
│   └── src/
│       └── main.rs          # Aplicação cliente
└── tests/                   # Testes de integração
    └── integration_test.rs

🛠️ Prerequisites

Before running the project, make sure you have the following installed:

  1. Rust (ver 1.70+)

    curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
    source ~/.cargo/env
  2. Solana CLI (ver 1.17+)

    sh -c "$(curl -sSfL https://release.solana.com/v1.17.0/install)"
    export PATH="~/.local/share/solana/install/active_release/bin:$PATH"
  3. Anchor CLI (ver 0.29+)

    cargo install --git https://github.com/coral-xyz/anchor avm --locked --force
    avm install latest
    avm use latest

⚙️ Configuration

1. Start local validator

Separate Terminal:

solana-test-validator

Dont close him!

2. Compilation

anchor build

3. Deploy

anchor deploy

4. Execute Cliente

cd client
cargo run

5. Execute Test

cargo test --manifest-path tests/Cargo.toml

🔧 Data Structure:

InitTokenParams

pub struct InitTokenParams {
    pub name: String,        // Nome do token
    pub symbol: String,      // Símbolo do token
    pub uri: String,         // URI dos metadados
    pub decimals: u8,        // Número de casas decimais
}

🧪 Include Test:

Try with:

cargo test

🔒 Security:

The project implements several security measures:

  • PDAs (Program Derived Addresses)
  • Verificação de Autoridade
  • Validação de Contas
  • Constraints do Anchor

📄 License:

This project is licensed under the MIT License. See the LICENSE file for details.

🔗 Links:


About

This project implements a custom SPL token on the Solana blockchain using the Anchor framework. It includes a smart contract (program) for token creation and management, a Rust client for interaction, and comprehensive integration tests.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published