explaingit

lily-protocol/lily-contracts

13RustAudience · developerComplexity · 4/5ActiveLicenseSetup · hard

TLDR

Smart contracts for Lily Protocol, an autonomous agent finance stack on Stellar blockchain, written in Rust for the Soroban runtime.

Mindmap

mindmap
  root((repo))
    What it does
      Protocol config
      Agent registry
      Wallet mapping
      Payment tracking
    Tech stack
      Rust
      Soroban SDK
      WebAssembly
    Use cases
      Deploy agent wallets
      Register agents
      Track payments
      Manage settlements
    Key features
      Typed storage keys
      Auth-gated actions
      Event emission
    Future work
      Reputation system
      Multi-role governance
      Cross-contract calls

Things people build with this

USE CASE 1

Deploy autonomous agent wallets on Stellar with spend limits and settlement tracking.

USE CASE 2

Register and manage agent identities with controller rotation and metadata updates.

USE CASE 3

Track payment intents and finalize settlements between agents and treasury.

USE CASE 4

Build multi-agent finance applications on top of Lily Protocol's contract foundation.

Tech stack

RustSoroban SDKWebAssemblyStellarCargo

Getting it running

Difficulty · hard Time to first run · 1h+

Requires Rust toolchain, stellar-cli, wasm32v1-none target, and Soroban SDK 22. Building and testing WebAssembly contracts takes time and setup.

Use freely for any purpose, including commercial use, as long as you include the original copyright notice and license text.

In plain English

This repository holds the on-chain smart contracts for Lily Protocol, which the README describes as an autonomous agent finance stack built on the Stellar blockchain. The contracts are written for Soroban, the smart contract runtime used by Stellar, and the project is laid out as a Rust workspace. The README presents this codebase as the foundation that other parts of Lily Protocol will sit on top of, not a finished product. Four contract crates sit under the contracts folder. The protocol contract handles global configuration: one-time initialization, transferring the admin role, a fee value in basis points, and a treasury address. The identity contract is an agent registry that supports bootstrapping, registering agents, rotating their controllers, updating metadata, and admin-driven deactivation. The wallet contract maps agents to wallets and records settlement asset symbols, spend limits, and an enabled flag. The payments contract tracks payment intents, lets the payer cancel, and lets an admin finalize settlement. Two shared crates support the contracts: lily-common with typed errors, a payment status enum, basis point checks, and storage time-to-live helpers, and lily-test-support with reusable test utilities for Soroban environments. For local work, the README requires a Rust toolchain with cargo, rustfmt, and clippy, the stellar-cli tool for contract artifacts and deployment, and the wasm32v1-none target for building WebAssembly outputs. It points to soroban-sdk version 22 as the current SDK and shows three ways to install stellar-cli: through Homebrew, through cargo install, or with the official Stellar installer. After cloning the repo, the suggested first steps are make fmt and make test. A script called check-tooling.sh reports on the local toolchain state. A list of Makefile commands covers formatting, format checking, linting, type checking, tests, regular builds, Wasm builds, packaging artifacts, and a combined ci target. The README states that the codebase deliberately ships a small but reviewable foundation rather than implementing every feature up front, with typed storage keys, initialization guards, auth-gated admin actions, event emission on state transitions, and conservative settlement transitions. A future work section names items intentionally left out for now: on-chain agent reputation, multi-role governance with timelocks, escrowed settlement and token transfers, cross-contract composition, upgrade and migration plans, fuzzing and invariant testing, and mainnet deployment manifests. Security notes warn against implicit auth paths, unbounded storage growth, silent state overwrites, incomplete initialization, and panic-driven logic. The license is Apache 2.0.

Copy-paste prompts

Prompt 1
Show me how to initialize the Lily Protocol contracts on Stellar testnet and register a new agent.
Prompt 2
How do I set up a local Soroban development environment and run the test suite for lily-contracts?
Prompt 3
Walk me through the wallet contract to understand how spend limits and settlement assets are managed.
Prompt 4
What are the security considerations I should know before deploying these contracts to mainnet?
Prompt 5
How do I extend the identity contract to add custom metadata fields for agents?
Open on GitHub → Explain another repo

Generated 2026-05-22 · Model: sonnet-4-6 · Verify against the repo before relying on details.