Skip to content

Repository files navigation

astroid-contract

CI License: MIT Stellar Drips Wave

Soroban smart contracts — the on-chain backbone of Astroid, the Financial Operating System for autonomous AI agents on Stellar. Built for the Drips Stellar Wave Program.

Eight production-grade Soroban contracts that form the protocol layer of Astroid: a system that lets AI agents spend real funds on-chain only within cryptographically-enforced governance rules set by human organizations.

Architecture

Registry ──► Wallet ──► Treasury
    │             └──► Budget
    │             └──► Policy
    │             └──► Escrow
    └──► Multisig ──► Proposal

Deployment order: registry → wallet → treasury → multisig → proposal → budget → policy → escrow

Contracts

Contract WASM Responsibility
Registry astroid_registry.wasm Single source of truth. Stores org owners, module addresses, and the version upgrade map.
Wallet astroid_wallet.wasm Per-org Stellar wallet. Holds funds, enforces policy before any transfer.
Treasury astroid_treasury.wasm Organization treasury. Manages asset pools and allocation to wallets.
Multisig astroid_multisig.wasm k-of-n threshold signing. Guards high-value transactions requiring multiple approvals.
Proposal astroid_proposal.wasm Approval proposal lifecycle (create → approve/reject → execute/cancel/expire).
Budget astroid_budget.wasm Spending limits per time period. Tracks consumption and blocks over-limit transfers.
Policy astroid_policy.wasm Pluggable transfer rule engine. Checks every transfer against registered policy modules.
Escrow astroid_escrow.wasm Time-locked or condition-based fund escrow with release/refund/expire paths.

Registry Contract — Public API

Function Auth Description
initialize(admin) One-time initialization. Sets the protocol admin.
register_org(caller, org, owner) Admin Register an organization and its owner.
set_org_owner(caller, org, new_owner) Org owner or admin Transfer org ownership.
register_module(caller, org, kind, address) Org owner or admin Record a module address for an org.
remove_module(caller, org, kind) Org owner or admin Remove a module registration.
register_version(caller, kind, version, address) Admin Record a contract version in the global upgrade map.
get_version(kind, version) Look up an implementation address by version.
get_latest(kind) Look up the latest implementation address for a module kind.
get_org_owner(org) Read the owner of an organization.
get_admin() Read the current protocol admin.
set_admin(caller, new_admin) Admin Rotate the admin address.
lookup(org, kind) Interface method: resolve a module address for an org.
verify_owner(org, owner) Interface method: check if an address is the org owner.

Tech Stack

Layer Technology
Language Rust (edition 2021)
SDK soroban-sdk 21.7.7
Build target wasm32v1-none
Build tool Stellar CLI
Test runner cargo test (Soroban test environment)

Quick Start

# Prerequisites: Rust stable + Stellar CLI
cargo install --locked stellar-cli

# Build all contracts
stellar contract build

# Run all tests
cargo test --workspace

# Format check
cargo fmt --check

# Lint
cargo clippy --workspace -- -D warnings

Deployment (Testnet)

# 1. Generate and fund a deployer identity
stellar keys generate alice --network testnet
stellar keys fund alice --network testnet

# 2. Deploy the registry (deploy other contracts in dependency order)
stellar contract deploy \
  --wasm target/wasm32v1-none/release/astroid_registry.wasm \
  --source alice \
  --network testnet
# → Save the output Contract ID (C...)

Deployed Registry (Testnet): CCUYI4DSYDNOQC377NFIU6K3GVRQ5VQ3MLTG2CUK5N2E7DUPCIJJC4H7

Workspace Structure

astroid-contract/
├── contracts/
│   ├── registry/     # Protocol source of truth
│   ├── wallet/       # Per-org Stellar wallet
│   ├── treasury/     # Asset pool management
│   ├── multisig/     # k-of-n threshold signing
│   ├── proposal/     # Approval lifecycle
│   ├── budget/       # Spending limits
│   ├── policy/       # Transfer rule engine
│   └── escrow/       # Time-locked escrow
├── interfaces/       # Shared contract interface traits
└── shared/           # Shared types, errors, constants, validation

Related Repositories

Repo Description
astroid-api NestJS backend that calls these contracts
astroid-web Next.js dashboard
astroid-sdk TypeScript SDK and React hooks

Maintainers

Name GitHub Contact
Astroid Team @ASTROIDX556 Open an issue or discussion

Contributing

See CONTRIBUTING.md. PRs require passing cargo test, cargo fmt --check, and cargo clippy.

Security

These contracts are unaudited. Use on testnet only until a professional audit is completed. See SECURITY.md for the disclosure policy.

License

MIT — see LICENSE.

About

Soroban smart contracts - the on-chain backbone of Astroid on Stellar

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages