seesaw

docs

Seesaw is one contract on Robinhood Chain, the book. Each seesaw is a grid on one Stock Token: a price range split into equal steps that buy low and sell high inside it.

What it is

open(token, lo, hi, steps, usdPerStep) takes steps × usdPerStep USDG. The current Chainlink price must sit inside the range. close(id) sends every token and dollar in the seesaw back to its owner as they are.

Steps

Step i spans from lo + (hi − lo) × i / steps to lo + (hi − lo) × (i + 1) / steps. A step whose floor is at or above the price at opening starts holding the stock, bought in one swap at opening. Every other step starts holding its USDG.

Running a step

run(id, step): a step holding USDG buys when Chainlink is at or under its floor; a step holding the stock sells when Chainlink is at or over its top. The step then holds the other side. Anyone can call it. due(id) lists the steps that can run now.

Fees and fills

Every swap has a minimum out at the Chainlink price less 1.5% (owner cap 5%). If the pool is further away, the run reverts and the step waits. COIN, MSTR and SPY route through WETH. Stock feeds pause between sessions.

The keeper

A Cloudflare worker checks every open seesaw every few minutes and runs each due step. It earns the run fee, which covers its gas.

Owner limits

The book owner can set the price adapter, the router, the routes, the slippage (up to 5%), the treasury, the run fee (up to 0.50 USDG) and the cut (up to 1%). There is no function that sends a seesaw's tokens anywhere except to its owner on close.

Risks

Contracts

BookOpening soon
Chainlink adapter0xe9bBcd46F9B0Df04B418e0207876984F9f8336cb
USDG0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168
Uniswap SwapRouter020xcaf681a66d020601342297493863e78c959e5cb2