Skip to content

david87131/Astera

 
 

Repository files navigation

Astera

Soroban Contracts CI

Real World Assets on Stellar. Invoice financing for emerging markets.

Astera lets SMEs tokenize unpaid invoices as Soroban-based RWA tokens. Community investors fund a USDC liquidity pool. Smart contracts handle escrow, repayment, and yield distribution. Every paid invoice builds an on-chain credit history.


Architecture

contracts/
  invoice/   — RWA invoice token contract (Soroban/Rust)
  pool/      — Liquidity pool + yield distribution (Soroban/Rust)
frontend/    — Next.js 14 app (Freighter wallet, Stellar SDK)

Contracts

Invoice Contract

  • create_invoice — SME mints an invoice token with amount, debtor, due date
  • mark_funded — Called by pool when invoice is funded
  • mark_paid — SME or pool marks invoice as repaid
  • mark_defaulted — Pool flags missed repayment

Pool Contract

  • initialize — Sets admin, first accepted stablecoin (initial_token), and invoice contract
  • add_token / remove_token — Admin maintains a whitelist of accepted stablecoin SAC addresses
  • deposit — Investor deposits a whitelisted stablecoin into the pool (positions are per token)
  • init_co_funding — Admin opens an invoice for co-funding in a specific stablecoin
  • commit_to_invoice — Investors commit available balance in that invoice’s token until the principal target is met
  • repay_invoice — SME repays principal + simple interest (8% APY default) in the same token the invoice was funded with
  • withdraw — Investor withdraws available (undeployed) balance in the chosen token

Setup

Rapid Local Development (Docker Compose)

We provide a one-command setup using Docker Compose that spins up the Stellar local network, the Next.js frontend, a contracts development environment, and mock services.

docker-compose up -d

After running this command:


Manual Setup

Prerequisites

If you are on Windows, we strongly recommend using WSL2. See our Windows/WSL2 Setup Guide for details.

1. Build contracts

cd astera
cargo build --target wasm32-unknown-unknown --release

2. Deploy to Testnet

# Fund a testnet account
stellar keys generate --global deployer --network testnet
stellar keys fund deployer --network testnet

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

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

3. Initialize contracts

# Initialize invoice contract
stellar contract invoke \
  --id <INVOICE_CONTRACT_ID> \
  --source deployer \
  --network testnet \
  -- initialize \
  --admin <YOUR_ADDRESS> \
  --pool <POOL_CONTRACT_ID>

# Initialize pool contract
stellar contract invoke \
  --id <POOL_CONTRACT_ID> \
  --source deployer \
  --network testnet \
  -- initialize \
  --admin <YOUR_ADDRESS> \
  --usdc_token <USDC_TOKEN_ID> \
  --invoice_contract <INVOICE_CONTRACT_ID>

4. Run frontend

cd frontend
cp .env.example .env.local
# Fill in contract IDs in .env.local

npm install
npm run dev

Open http://localhost:3000.


User Flows

SME Flow

  1. Connect Freighter wallet
  2. Go to New Invoice — fill debtor, amount, due date
  3. Sign transaction — invoice minted on Stellar
  4. Monitor status on Dashboard — see funding, credit score
  5. When customer pays, call repay_invoice to settle

Investor Flow

  1. Connect Freighter wallet
  2. Go to Invest — choose a whitelisted stablecoin and deposit into the pool
  3. Pool admin deploys liquidity to approved invoices
  4. When invoices are repaid, yield accumulates in the pool
  5. Withdraw available balance anytime

Testnet USDC

Use the Stellar testnet USDC asset or deploy a mock token:

stellar contract invoke \
  --id <TOKEN_ID> \
  --source deployer \
  --network testnet \
  -- mint \
  --to <YOUR_ADDRESS> \
  --amount 1000000000000

Deployment

Frontend Deployment

Deploy your own instance of the Astera frontend with one click:

Deploy with Vercel

For detailed instructions on various hosting options, see the Frontend Deployment Guide.

Testnet Deployment

For development and testing, see the Testnet Deployment Guide for step-by-step instructions.

Mainnet Deployment

For production deployment, see the comprehensive Mainnet Deployment Guide which includes:

  • Pre-deployment security checklist
  • Contract verification procedures
  • Monitoring and alerting setup
  • Rollback and emergency procedures
  • Post-deployment verification steps

For upgrade runbooks and migration safety checks, see the Contract Upgrade Guide.

⚠️ Important: Mainnet deployment involves real assets. Complete all security audits and testing before deploying to production.


Network Information

Testnet

Mainnet


Continuous Integration

The contracts.yml workflow runs on every push to main and on every pull request targeting main. It:

  • Installs Rust stable with the wasm32-unknown-unknown target
  • Caches ~/.cargo/registry and target/ via Swatinem/rust-cache
  • Builds the workspace with cargo build --target wasm32-unknown-unknown --release
  • Runs cargo test for each contract (invoice, pool, credit_score)

Branch protection

Branch protection for main should be configured so that:

  • Pull requests cannot be merged unless the Build & test Soroban contracts check passes.
  • Direct pushes to main are disabled (PRs only).

To apply, in GitHub: Settings → Branches → Branch protection rules → Add rule for main, enable Require status checks to pass before merging, and select Build & test Soroban contracts from the list of checks.

💰 Bounty Contribution

  • Task: Add SME onboarding verification — prevent duplicate SME accounts
  • Reward: $10
  • Source: GitHub-Paid
  • Date: 2026-04-27

About

No description, website, or topics provided.

Resources

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • TypeScript 62.4%
  • Rust 37.1%
  • Other 0.5%