Skip to content

solv-finance/SolvBTC-Stellar-Contract

Repository files navigation

SolvBTC Stellar Contracts

This project contains the implementation of SolvBTC smart contracts on the Stellar Soroban platform.

Project Structure

  • fungible-token/: Fungible token contract
  • oracle/: Price oracle contract
  • vault/: Vault contract
  • tests/: Integration tests

Development Environment Setup

Prerequisites

  • Rust 1.74.0 or higher
  • Soroban CLI
  • wasm32-unknown-unknown target

Installing Dependencies

# Install Rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
rustup default stable
rustup target add wasm32-unknown-unknown

# Install Soroban CLI
cargo install --locked soroban-cli

Building and Testing

Build All Contracts

make build

Run All Tests

make test

Run Integration Tests Only

make integration-test

Code Quality Check

make check

Automatically Fix Code Issues

make fix

Deployment

Generate TypeScript Bindings

make generate-js

Project Structure

The project is organized as a Cargo workspace with the following components:

  • fungible-token: Implementation of a fungible token contract compatible with Stellar standards
  • vault: Main vault contract for managing deposits and withdrawals
  • oracle: NAV (Net Asset Value) oracle contract for price feeds
  • integration-tests: End-to-end integration tests for the contracts
  • key-test: Testing utilities for cryptographic operations

Prerequisites

  • Rust and Cargo (latest stable version)
  • Soroban CLI with opt feature
  • Wasm target: rustup target add wasm32-unknown-unknown

Building the Project

To build all contracts:

make build

This will:

  1. Compile all contracts
  2. Generate WASM files for each contract
  3. Optimize the WASM files using Soroban's optimizer
  4. Output the optimized WASM files to target/wasm32-unknown-unknown/optimized/

Running Tests

To run all tests:

make test

This will run both unit tests and integration tests for all contracts.

Development Commands

  • make fmt: Format the code using rustfmt
  • make clean: Clean build artifacts
  • make generate-js: Generate TypeScript bindings for the contracts

Contract Details

Fungible Token

A standard-compliant fungible token with additional features:

  • Minting and burning capabilities
  • Blacklist functionality
  • Pausable transfers
  • Admin controls

Vault

The main vault contract that:

  • Manages deposits of assets
  • Processes withdrawals with cryptographic verification
  • Interacts with the oracle for NAV updates

Oracle

Provides NAV (Net Asset Value) data:

  • Managed by authorized administrators
  • Enforces limits on NAV changes
  • Supports configurable precision

About

SolvBTC-Stellar-Contract

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors