Skip to content

Repository files navigation

Sluice Protocol

Per-second money streaming on Robinhood Chain. Deposit once, open a stream to any wallet, and the recipient's balance climbs every second — withdrawable any moment, self-custodial, no gas per tick.

This repo holds the on-chain primitive, its interface, a test suite, and the client SDK. The web app is built against exactly this surface, so wiring the deployed contract in is a one-line swap.


How streaming works

Every account carries three numbers on-chain:

field meaning
settled balance realized as of the last touch
netFlowRate wei per second, inbound streams minus outbound
lastSettled timestamp settled was last brought current

The realtime balance is linear accrual the chain computes on read — no loop, no per-second transaction:

realtimeBalanceOf(a) = settled(a) + netFlowRate(a) * (now - lastSettled(a))

This is Superfluid's Constant Flow Agreement, condensed into one self-contained contract over the native token. Full walkthrough: docs/streaming.md.

Lifecycle

  1. deposit() — fund your account (payable).
  2. createFlow(recipient, ratePerSecond) — open a stream; requires a rate * 4h solvency buffer up-front so it can never overdraw.
  3. balance accrues every second, on both sides, with no further gas.
  4. withdraw(amount) — pull your realtime balance to your wallet, anytime.
  5. deleteFlow(recipient) — stop the stream on the same block.

Layout

contracts/
  SluiceStream.sol            reference streaming contract
  interfaces/ISluiceStream.sol the surface the SDK + app bind to
test/
  SluiceStream.t.sol          Foundry tests (accrual, withdraw, buffer, cancel)
sdk/
  src/index.ts                @sluice/sdk — typed ethers wrapper
deployments/
  robinhood.json              addresses (filled in at mainnet deploy)
docs/
  streaming.md                the mechanics, in full

Build & test

forge install foundry-rs/forge-std
forge build
forge test -vvv

SDK

import { Sluice, ratePerSecondFromMonthly } from "@sluice/sdk";

const sluice = new Sluice(CONTRACT_ADDRESS, signer);
await sluice.deposit("1.5");                                   // 1.5 ETH
await sluice.openStream(recipient, ratePerSecondFromMonthly(parseEther("5000")));
const bal = await sluice.realtimeBalanceOf(recipient);        // climbs every second
await sluice.withdraw(bal);

Status

Unaudited reference. SluiceStream is the shape the app and SDK are built against so integration can proceed before audit. It is not deployed to mainnet and must not be until an independent audit is complete. Insolvent-sender liquidation and ERC-20 (USDC) streams are intentionally out of scope for the reference — see the contract NatSpec and docs/streaming.md.

Until the contract is live, the app moves funds with ordinary self-custodial wallet transfers on Robinhood Chain; the same interface routes through this contract the moment an address lands in deployments/robinhood.json.

About

Per-second money streaming on Robinhood Chain — the SluiceStream contract, @sluice/sdk and docs for Sluice ($SLU).

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages