Project Broke is built on top of Superfluid to allow people to buy stuff, for example NFTs, using streams. Effectively allowing the user to pay off the token over a set amount of time instead of paying everything upfront
Project Broke is a pretty basic smart contract that simply builds a mechanism to allow people to pay for stuff using Superfluid streams. The contract does it by first letting the seller create an agreement. They specify the total price of the NFT, the length of the agreement in seconds, as well as the deposit they expect the buyer to provide. The buyer then starts a Superfluid stream to the seller's address using the flow rate specified in the agreement (price divided by the length). After that, they can call the Broke contract to accept the agreement. Now the buyer waits for the agreement to finish and then they are able to withdraw their deposit and the NFT from the Broke contract. The deposit is used as a safety mechanism to incentivize the buyer to go through with the agreement instead of stopping the Superfluid stream in the middle of the agreement. If something like that happens the seller is rewarded the buyer's deposit. Effectively, the contract makes sure both parties uphold the agreement. Currently, the contract is not production-ready. There are still some edge cases that are not covered. So, I do have to rework it in the future. But, it's fine as a proof-of-concept showing how Superfluid streams might be used for payments over a specific amount of time.
How it's made
The Broke contract is pretty simple. It simply allows users to create and accept agreements as well as keeps track of all the active ones. The main component is Superfluid which is used to create and manage the streams. The Broke contract itself doesn't create any streams itself but calls the Superfluid contract to make sure the buyer has started the correct stream. It also uses it to verify that the stream was not tampered with by the buyer. As a development tool, I used DappTools which is the best thing out there IMO, and made my life really easy.