|
| 1 | +Action: `stream` (Superfluid Constant Flow Agreement v1) |
| 2 | + |
| 3 | +When to use: |
| 4 | +- The user wants to create, update, or delete a Superfluid "constant flow" (stream) for GoodDollar's SuperToken (SuperGoodDollar). |
| 5 | + |
| 6 | +Important note about addresses: |
| 7 | +- This repo's `NameService` keys are not defined for Superfluid Host / CFA by default. |
| 8 | +- To avoid hardcoding, ask the user for `superfluidHost` and `constantFlowAgreementV1` addresses (or provide the corresponding `NameService` keys if you have them). |
| 9 | + |
| 10 | +Inputs to request (if missing): |
| 11 | +- `superfluidHost` (address): the Superfluid Host contract (`ISuperfluid`) |
| 12 | +- `constantFlowAgreementV1` (address): CFA v1 agreement class (`IConstantFlowAgreementV1`) |
| 13 | +- `superToken` (address): the SuperToken to stream (likely `SuperGoodDollar`) |
| 14 | +- `action`: `create` | `update` | `delete` |
| 15 | +- `receiver` (address): flow receiver |
| 16 | +- `flowRate` (int96 as bigint/decimal): required for `create` and `update` |
| 17 | +- `sender` (address, optional): required for `delete` (defaults to signer address) |
| 18 | +- `userData` (bytes, optional): forwarded to callbacks; default `0x` |
| 19 | + |
| 20 | +Execution: |
| 21 | +1) Build the CFA callData with placeholder ctx: |
| 22 | + - Use `ctx = 0x` (empty bytes) for all actions. |
| 23 | + - For `create`: |
| 24 | + - callData = `abi.encodeWithSelector(CFA.createFlow.selector, superToken, receiver, flowRate, ctx)` |
| 25 | + - For `update`: |
| 26 | + - callData = `abi.encodeWithSelector(CFA.updateFlow.selector, superToken, receiver, flowRate, ctx)` |
| 27 | + - For `delete`: |
| 28 | + - callData = `abi.encodeWithSelector(CFA.deleteFlow.selector, superToken, sender, receiver, ctx)` |
| 29 | + |
| 30 | +2) Send the transaction via the host: |
| 31 | + - call `superfluidHost.callAgreement(constantFlowAgreementV1, callData, userData)` |
| 32 | + |
| 33 | +3) (Optional) Post-check: |
| 34 | + - Call `constantFlowAgreementV1.getFlow(superToken, sender, receiver)` and report `flowRate`. |
| 35 | + |
| 36 | +Output to the user: |
| 37 | +- tx hash |
| 38 | +- action (`create`/`update`/`delete`) |
| 39 | +- receiver + (best-effort) resulting flowRate if post-check is performed |
| 40 | + |
0 commit comments