Production-oriented Soroban smart contracts for Lily Protocol on Stellar.
lily-contracts is the on-chain smart contract repository for Lily Protocol, an autonomous agent finance stack on Stellar. This workspace provides the protocol foundation for agent identity, wallet policy, payment settlement primitives, and global protocol configuration, with contributor-friendly structure for future protocol expansion.
Lily Protocol needs contract infrastructure that is secure, modular, and understandable by external contributors. This repository is designed to support:
- Agent registration and identity records
- Wallet and policy binding for AgentLily-controlled accounts
- Payment intent creation and asynchronous settlement flows
- Protocol-wide configuration and admin controls
- Shared storage, event, and error conventions across contracts
.
├── contracts
│ ├── identity
│ ├── payments
│ ├── protocol
│ └── wallet
├── crates
│ ├── lily-common
│ └── lily-test-support
├── .github
│ ├── ISSUE_TEMPLATE
│ └── workflows
├── scripts
├── Cargo.toml
└── Makefile
Global protocol configuration contract. Handles one-time initialization, admin transfer, fee basis points, and treasury configuration.
Agent identity registry. Supports protocol bootstrapping, agent registration, controller rotation, metadata updates, and admin deactivation.
Wallet policy registry. Maintains agent-to-wallet bindings, settlement asset symbols, spend limits, and enabled state toggles.
Payment intent and settlement primitive. Tracks payment intents, allows payer-side cancellation, and supports admin-driven settlement finalization.
Shared contract utilities, typed protocol errors, payment status enum, basis point guards, and storage TTL helpers.
Reusable Soroban test helpers for local environments, synthetic addresses, and string conversion.
- Rust toolchain with
cargoandrustfmt clippycomponent available for lintingstellar-clifor contract artifact workflows and deploymentwasm32v1-nonetarget installed for Wasm builds
Official Stellar docs currently recommend:
- A Rust workspace with contracts under
contracts/* soroban-sdk = "22"for current Soroban contractsstellar-cliinstallation viabrew install stellar-cli,cargo install --locked stellar-cli, or the Stellar installer
git clone https://github.com/lily-protocol/lily-contracts.git
cd lily-contracts
make fmt
make testIf you need the CLI locally:
brew install stellar-cliIf you need the Wasm target:
rustup target add wasm32v1-noneYou can inspect the local toolchain status with:
./scripts/check-tooling.shmake fmt
make fmt-check
make lint
make check
make test
make build
make build-wasm
make artifacts
make ciThis repository intentionally ships a real, reviewable foundation without prematurely implementing every protocol feature. The current contracts establish:
- Typed storage keys and typed return structs
- Explicit initialization guards
- Auth-gated admin and actor actions
- Event emission on state transitions
- Conservative state transitions for settlement lifecycle
- Clear separation between protocol domains
- On-chain agent reputation and credential attestations
- Multi-role governance and timelocked admin changes
- Escrowed settlement and token transfer integration
- Cross-contract composition between identity, wallet, and payments
- Upgrade and migration playbooks
- Fuzzing, invariants, and deeper adversarial testing
- Mainnet deployment manifests and release signing
Read CONTRIBUTING.md before opening a pull request. Contributors should keep changes scoped to a clear protocol concern and include tests for any state transition, auth path, or storage behavior they modify.
This is smart contract infrastructure. Avoid introducing:
- Implicit authorization paths
- Unbounded storage growth without design review
- Silent state overwrites
- Incomplete initialization or upgrade assumptions
- Panic-driven business logic where typed errors are more appropriate
If you believe you’ve found a vulnerability, please follow the security guidance in CONTRIBUTING.md.