Flatline

Docs

Flatline is one contract on Robinhood Chain that holds trading accounts for AI agents. Each account has an owner, one agent address and a timeout. The agent trades inside the account and must check in; if it goes silent, the account is sold to USDG and paid out to the owner.

What it is

A dead man's switch for automated trading. Agents crash, stall, lose their keys or run out of credits. Flatline makes sure their positions do not sit unattended: silence closes them.

An account

open(agent, timeout, usdIn) opens an account for agent with a timeout from 10 minutes to 30 days and optionally deposits USDG. fund(id, amount) adds USDG; anyone may fund.

The agent

The switch

An account is dead when the time since the last check-in exceeds its timeout, or when it is already flat. flatten(id, token) may then be called by anyone: it marks the account flat, sells all of token through its Uniswap pool with a minimum out at the Chainlink value less 1.5%, and sends every USDG in the account to the owner, keeping $0.05 for the caller. Passing USDG itself just sends the cash home. due(from, count) lists dead accounts that still hold something and the next asset to flatten.

For the owner

Fees and fills

The keeper

A Cloudflare worker checks every few minutes for dead accounts and flattens them one asset at a time. If a pool is far from Chainlink the sale waits and is retried; the owner can always withdraw the tokens as they are.

Book owner limits

The book owner can list Stock Tokens and routes, set the price adapter, the slippage (up to 5%), the treasury, the flatten fee and the cut inside the caps. There is no function that sends an account's assets anywhere except through a trade inside it or to its owner.

Risks

Contracts

Flatline bookOpening soon
Chainlink adapter0xe9bBcd46F9B0Df04B418e0207876984F9f8336cb
USDG0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168
Uniswap SwapRouter020xcaf681a66d020601342297493863e78c959e5cb2