Skip to content

BCPathway/bc-forge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

63 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

bc-forge πŸ”¨

A modular Soroban smart contract platform for token minting on the Stellar blockchain, with a TypeScript SDK for seamless integration.

Built for open-source collaboration via drips.network.


✨ Features

  • SEP-41 Compliant Token β€” Full TokenInterface implementation (balance, transfer, approve, burn)
  • Admin-Controlled Minting β€” Only the contract admin can mint new tokens
  • Pausable Lifecycle β€” Emergency pause/unpause to halt all operations
  • Ownership Transfer β€” Securely hand over admin rights
  • Total Supply Tracking β€” Accurate supply updated on every mint/burn
  • TypeScript SDK β€” High-level client for all contract interactions
  • Modular Architecture β€” Separate crates for admin, lifecycle, and token logic

πŸ“ Project Structure

bc-forge/
β”œβ”€β”€ contracts/                    # Soroban smart contracts (Rust)
β”‚   β”œβ”€β”€ admin/                    # Admin access control module
β”‚   β”‚   β”œβ”€β”€ Cargo.toml
β”‚   β”‚   └── src/lib.rs
β”‚   β”œβ”€β”€ lifecycle/                # Pause/unpause lifecycle module
β”‚   β”‚   β”œβ”€β”€ Cargo.toml
β”‚   β”‚   └── src/lib.rs
β”‚   └── token/                    # Core SEP-41 token contract
β”‚       β”œβ”€β”€ Cargo.toml
β”‚       └── src/
β”‚           β”œβ”€β”€ lib.rs            # Token contract implementation
β”‚           β”œβ”€β”€ events.rs         # Structured event emissions
β”‚           └── test.rs           # Unit tests
β”œβ”€β”€ sdk/                          # TypeScript SDK
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ index.ts              # Entry point
β”‚   β”‚   β”œβ”€β”€ client.ts             # bcForgeClient class
β”‚   β”‚   └── utils.ts              # Transaction helpers
β”‚   β”œβ”€β”€ package.json
β”‚   └── tsconfig.json
β”œβ”€β”€ .github/
β”‚   β”œβ”€β”€ ISSUE_TEMPLATE/           # Bug, Feature, Contract Improvement
β”‚   β”œβ”€β”€ PULL_REQUEST_TEMPLATE.md
β”‚   └── workflows/ci.yml         # CI pipeline
β”œβ”€β”€ Cargo.toml                    # Workspace manifest
β”œβ”€β”€ CONTRIBUTING.md               # Contributor guide (drips.network)
β”œβ”€β”€ LICENSE                       # MIT
└── README.md                     # This file

πŸ› οΈ Prerequisites

Tool Version Install
Rust 1.74+ rustup.rs
Wasm target β€” rustup target add wasm32-unknown-unknown
Stellar CLI 22.0+ cargo install stellar-cli --locked
Node.js 18+ nodejs.org

πŸš€ Local Setup

1. Clone the Repository

git clone https://github.com/p3ris0n/bc-forge.git
cd bc-forge

2. Install Rust & Soroban Tooling

# Install Rust (if not already installed)
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

# Add the WebAssembly target
rustup target add wasm32-unknown-unknown

# Install Stellar CLI (includes Soroban)
cargo install stellar-cli --locked

3. Build the Smart Contracts

# Build all contracts (debug)
cargo build

# Build optimized WASM for deployment
cargo build --target wasm32-unknown-unknown --release

# Or use Stellar CLI
stellar contract build

4. Run Contract Tests

cargo test --tests

Expected output:

running 5 tests (admin)     ... ok
running 5 tests (lifecycle) ... ok
running 16 tests (token)    ... ok

5. Setup the TypeScript SDK

cd sdk
npm install
npm run build

🌐 Deploy to Testnet

Generate a Keypair

stellar keys generate --global deployer --network testnet

Fund the Account

stellar keys fund deployer --network testnet

Deploy the Token Contract

stellar contract deploy \
  --wasm target/wasm32-unknown-unknown/release/bc_forge_token.wasm \
  --source deployer \
  --network testnet

Save the returned Contract ID (e.g., CABC...XYZ).

Initialize the Token

stellar contract invoke \
  --id <CONTRACT_ID> \
  --source deployer \
  --network testnet \
  -- \
  initialize \
  --admin <YOUR_PUBLIC_KEY> \
  --decimal 7 \
  --name "bc-forge Token" \
  --symbol "SFG"

Mint Tokens

stellar contract invoke \
  --id <CONTRACT_ID> \
  --source deployer \
  --network testnet \
  -- \
  mint \
  --to <RECIPIENT_ADDRESS> \
  --amount 10000000000

Check Balance

stellar contract invoke \
  --id <CONTRACT_ID> \
  --network testnet \
  -- \
  balance \
  --id <ADDRESS>

πŸ§ͺ Local Development with Quickstart

If you want to build and test against a local Soroban network, run the Stellar Quickstart container instead of using public testnet services.

Start Quickstart

docker run -d \
  -p "8000:8000" \
  --name stellar \
  stellar/quickstart \
  --local

This starts a local Stellar network with RPC, Horizon, and Friendbot on your machine.

Configure the CLI for the Local Network

Register the local network once, then switch the CLI to it:

stellar network add local \
  --rpc-url http://localhost:8000/rpc \
  --network-passphrase "Test SDF Network ; September 2015"

stellar network use local

Generate and Fund Accounts

Create a local identity and fund it from the local Friendbot instance:

stellar keys generate deployer
stellar keys fund deployer

You can use stellar keys public-key deployer to print the address, then use that keypair as the source account for contract deploy and invoke commands on the local network.

Point the TypeScript SDK at Quickstart

When using bcForgeClient, point rpcUrl at the local Quickstart instance:

import { bcForgeClient } from '@bc-forge/sdk';

const client = new bcForgeClient({
  rpcUrl: 'http://localhost:8000',
  networkPassphrase: 'Test SDF Network ; September 2015',
  contractId: 'CABC...XYZ',
});

If your local Quickstart setup exposes RPC on a different path, keep the same host and update the URL to match your container configuration.

πŸ“¦ SDK Usage

import { bcForgeClient } from '@bc-forge/sdk';
import { Keypair } from '@stellar/stellar-sdk';

const client = new bcForgeClient({
  rpcUrl: 'https://soroban-testnet.stellar.org',
  networkPassphrase: 'Test SDF Network ; September 2015',
  contractId: 'CABC...XYZ',
});

// Query balance
const balance = await client.getBalance('GABC...DEF');
console.log('Balance:', balance.toString());

// Mint tokens (admin only)
const admin = Keypair.fromSecret('SXXX...');
await client.mint('GABC...DEF', BigInt(1000_0000000), admin);

// Transfer tokens
const sender = Keypair.fromSecret('SYYY...');
await client.transfer(
  sender.publicKey(),
  'GXYZ...ABC',
  BigInt(100_0000000),
  sender
);

See sdk/README.md for the full API reference.

πŸ—οΈ Smart Contract Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                  BcForgeToken                   β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”β”‚
β”‚  β”‚   Admin    β”‚  β”‚  Lifecycle   β”‚  β”‚  SEP-41   β”‚β”‚
β”‚  β”‚  Module    β”‚  β”‚   Module     β”‚  β”‚ Interface β”‚β”‚
β”‚  β”‚           β”‚  β”‚              β”‚  β”‚           β”‚β”‚
β”‚  β”‚ set_admin β”‚  β”‚ pause()      β”‚  β”‚ balance() β”‚β”‚
β”‚  β”‚ get_admin β”‚  β”‚ unpause()    β”‚  β”‚ transfer()β”‚β”‚
β”‚  β”‚ require_  β”‚  β”‚ is_paused()  β”‚  β”‚ approve() β”‚β”‚
β”‚  β”‚   admin() β”‚  β”‚ require_not_ β”‚  β”‚ burn()    β”‚β”‚
β”‚  β”‚           β”‚  β”‚   paused()   β”‚  β”‚ mint()    β”‚β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

🀝 Contributing

We welcome contributions! bc-forge is maintained on drips.network β€” contributors can earn rewards by resolving posted issues.

Quick Start for Contributors

  1. Browse open issues β€” Look for issues labeled good-first-issue, smart-contract, or sdk
  2. Fork & branch β€” Create a branch: feature/<issue-number>-<short-description>
  3. Implement & test β€” Write code, add/update tests, ensure cargo test and npm run build pass
  4. Submit a PR β€” Use the PR template; reference the issue number

See CONTRIBUTING.md for the full guide.

Branch Naming Convention

feature/<issue-number>-<description>     # New features
fix/<issue-number>-<description>         # Bug fixes
docs/<issue-number>-<description>        # Documentation
test/<issue-number>-<description>        # Test improvements

πŸ“„ License

MIT β€” Free for personal and commercial use.

πŸ”— Links

About

Modular Soroban smart contracts and TypeScript SDK for token minting on the Stellar blockchain.

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors