We love NFTs. We love DeFi. We love Composability.
Behold the birth of LoanShark...
We are heavily involved in the NFT space and believe there exists the need for NFT collectors to be able to trustlessly lease their hard-earned NFTs to those willing to leverage the utility and prowess which they hold within.
Imagine getting to the final level of a game and needing a badass weapon. Not being able to afford it, you should be able to rent the item for a set period of time e.g. 1 hour to play and complete the game!
Imagine an avid CryptoArt collector who has amassed a collection from the dopest crypto artists in the space. Then take a CryptoVoxels / Decentraland / MetaVerse landlord looking for some killer artworks to use in the opening of a new plot. Well, now the collector can safely lend their NFT for, say, 7 days at a set price knowing that at the end, the artwork is safe and sound back in their wallet.
What it does
LoanShark blends NFTs with DeFi in the form of streamed payments powered by the Sablier protocol. https://www.sablier.finance
LoanShark is a lease marketplace that can wrap any standard ERC721 NFT, proxying through all methods of the original NFT as well as enabling a payment stream between the lender and the borrower.
The NFT looks, tastes and smells like the original. However, it is encased within the LoanShark contract which has the power to always “return” the NFT back to the owner and which will facilitate the payment between the two parties involved.
How we built it
We have built on the shoulders of giants, leveraging OpenZeppelin’s solid foundation for token standards such as ERC-20 and ERC-721, building on top Sablier’s payment stream EIP-1620 and harnessing DAI as the payment token of choice.
We have created a proxy contract capable of consuming and holding other NFTs which is itself an NFT. We then allow a user to deposit the NFT and define the conditions of the leasing contract.
Anyone willing to take the lease can then pay the fee (by locking up a deposit amount upfront) which is then streamed back to the lender on a per second basis.
Once finished with the NFT, even if this is early, the borrower can return the NFT, closing the payment stream and handing back control of the NFT to the original lender. As we use a stream, the magic is that if the asset is returned early, any remaining locked-up deposit amount can be returned to the borrower.
If the borrower does not return the NFT, once the payment stream is used up, the lender can enforce the “return” of their asset. Also, once the stream is used up, the shark contract reverts all proxied methods, so the NFT returns to it original owner safe and sound.
Challenges we ran into
We underestimated the complexity of UI: portraying the concept is tricky and we didn't get all sections working fully during the hackathon timeframe.
Sablier is a killer platform but not really setup for local development, luckily Paul helped us out and created us some nice streamlined contracts to get us going and running locally which saved the day. (Thanks, Paul!)
There were also some challenges in some of the methods we wanted to proxy and in the end we skipped a few due to time constraints.
Accomplishments that we're proud of
It works! At least at a basic level which proves the concept. We were pleased to find we had a balanced team set up, with diverse and complementary skills.
We also have a few (passing) unit tests, shock horror!
The team managed to mix business with pleasure by fuelling development with beer, gin & tonics, and nuts!
What we learned
UI/UX is hard (no shit!) - we spoke lots conceptually about the hack beforehand but didn’t spend enough time thinking in advance about the user journey. Also DeFi is powerful but burdensome to hack locally in many scenarios.
Composability of NFTs is really only just being explored, plenty more these babies can do. Learning new EIPs such as payment streams was very interesting.
What's next for LoanShark
We have grand ideas. Some of the things we want to get to are:
- Using charged particle NFTs to allow interest to be earned whilst you lease your token
- zkDAI to allow private leasing contracts
- A larger marketplace to facilitate various use-cases, such as leasing for gaming and art galleries
- Monetization / brokerage concepts
- Multi-token support such as social tokens