Author: nook Source code: TODO Intended audience: Beginners Topics: Token streaming, Superfluid
A component that uses @superfluid-finance/js-sdk to upgrade/downgrade super tokens, create new flows, and start streaming money in real time 🏄.
Make sure you have some kovan ETH.
Clone the repo
git clone https://github.com/0xnook/scaffold-eth.git
Get dependencies
yarn install
Edit 'packages/react-app/src/App.jsx' with one of the available networks (Kovan by default)
...
const targetnetwork = networks.kovan; // <------- select your target frontend network (localhost, rinkeby, xdai, mainnet)
...
Start the frontend, and open http://localhost:3000
yarn start
<Superfluid />
: A dashboard to create and view Superfluid money streams.
The superfluid component is already initialized for you in 'packages/react-app/src/App.jsx'
- address: the current user address or ENS
- provider: web3 provider
- tokens: the list desired tokens
<Superfluid
address={address}
provider={injectedProvider}
tokens={["fDAI", "fUSDC"]}
/>
The superfluid/js-sdk will take care of calling the resolver contract and retrieve the corresponding token contracts for the selected network, so no need to manually provide the contract addresses.
TODO
After adquiring fake tokens, they can be upgraded to super tokens, to do this
first make a token approval transaction by clicking the Approve unlimited spending
button.
After approving, enter the desired amount to upgrade and click the Upgrade to super token
button.
The superfluid/js-sdk will take care of calling the resolver contract and retrieve the corresponding token contracts for the selected network, so no need to manually provide the contract addresses.
TODO
After adquiring fake tokens, they can be upgraded to super tokens, to do this
first make a token approval transaction by clicking the Approve unlimited spending
button.
After approving, enter the desired amount to upgrade and click the Upgrade to super token
button.
Lets create Bob as our first recipient. To do this enter Bob's name and a valid ethereum address in the form shown below.
After adding Bob as a recipient, a new panel with his flows will appear.
Lets stream $1000 fDAI to Bob for a month.
To start the new flow, select fDAI from the dropdown shown below, and set the flow rate to 385802469135802, this corresponds to $1000 fDAI per month. Finally, click the Create new flow
button and sign the transaction to start the stream.
After doing this, you can see the new flow in the fDAI outflows section of your flow panel, and as an fDAI inflow on Bob's pannel.