cotyledon
The framework for writing sprouts — sandboxed, event-driven trading automations for Solana protocols.
A sprout is ordinary Rust that compiles to WebAssembly. It declares its triggers
and wallet in a sprout.toml, and implements one handler per trigger inside a
#[sprout::program] module. Every privileged operation — prices, balances,
signing, submitting, persistent state — goes through the [Ctx] handle, which
the Sprouts engine executes on the sprout's behalf. The sprout itself has no
keys, no network, and no ambient access; the sandbox is the security boundary.
Install
[]
= "0.1"
Or scaffold a new project with the CLI:
Example
use *;
Each pub async fn(ctx: Ctx) -> Result<()> in the module is a handler that a
trigger in sprout.toml can target (a schedule, a webhook, or a manual run).
What Ctx gives you
- Market data —
ctx.price(...). - Wallet — address and balances via
ctx.wallet(). - Signing & submission — sign and send transactions; the engine holds the keys and enforces the sprout's guardrails.
- State — durable key/value storage scoped to the sprout.
- Observability —
ctx.log(...),ctx.metric(...), and trade events.
Building
Sprouts target wasm32-wasip1:
sprouts deploy does this for you and uploads the artifact.
A sprout may only
.awaitonCtxcalls — it must not start its own async runtime. The sandbox enforces this.
Feature flags
Optional, opt-in protocol plugins:
jupitermeteora
License
MIT OR Apache-2.0