September 7, 2021
Instadapp recently released a frontend for Liquity protocol which made it easier for borrowers to leverage their ETH multiple times with a single click. Protecting loans from liquidation is also now a lot simpler, and cheaper, as borrowers can swap some of their ETH collateral to LUSD to increase their collateral ratio, also in a single click.
While this is great for borrowers, in this article we’re going to explore how Frontend Operators can also benefit from Instadapp.
An example of combining smart contract calls across different DeFi protocols could be:
This would allow users to earn passive income on their LUSD, in one-click, as a single transaction.
Instadapp have a getting started guide which explains how to integrate the SDK into your frontend.
The stock UI we built for Liquity serves as a building block for Frontend Operators to innovate on top of. We’ve already seen some great products emerge such as B.Protocol’s auto-compounding Stability Pool derivative, and DeFi Saver’s automated leverage.
We wanted to make it easy for Frontend operators to receive ideas and feedback from Liquity users, so we created a #frontend-suggestions channel in our Discord which enables users and operators to communicate directly. However, there’s one type of request from users which has been difficult to implement:
Currently Frontend operators could implement this functionality on the frontend by “stacking” a queue of transactions, but this would be slow, laborious, and expensive (gas intensive). With a DSA managed Trove, you can instead combine these calls into a one-click “recipe” which gets executed as a single transaction, without needing to write a line of Solidity code.
Let’s take a look at what such a frontend recipe would look like.
When users accumulate LUSD gains from their staked LQTY, they can move it to the Stability Pool to earn yield, rather than having it sit idle. This would normally require two manual transactions from the user. Frontend operators could use a recipe such as this to achieve it as one transaction:
Breaking down the spells 🧙
Here you can see we’ve composed two transactions (“spells”) together into a recipe which can be executed as a single transaction. This function could, for example, be called in response to a button click.
Instadapp users with a Maker vault might be interested in taking up Liquity’s 0% interest loan as an alternative to the recurring interest fees required in Maker. This operation would normally require a lot of manual transactions across Maker, Liquity, and Curve, as well as requiring the the user to have the upfront DAI to repay their vault debt. With this recipe, we can use flash loans to repay the Maker vault without requiring any upfront funds.
Breaking down the spells 🧙
These recipes only skim the surface of what you can build on top of Instadapp’s DSAs. There are many powerful and useful features to be built, such as refinancing your Trove from another DeFi protocol 👀
We look forward to seeing what you’ll build!
To call a DeFi protocol in a recipe, there must be a “connector” contract which integrates with the desired protocol — these connectors can be contributed by anyone via pull request.
To support DSA owned Troves in your frontend you need to integrate Instadapp’s frontend SDK and check if the the user has a DSA account or not. If they do have a DSA owned Trove you’ll need your frontend smart contract calls to go through Instadapp’s Liquity connector instead of directly to Liquity’s own smart contracts.
To enable your existing users to move their Trove to a DSA you’ll need to guide them through closing their Trove, creating a DSA, and reopening the Trove with the DSA account. This would be three transactions:
To learn more about Instadapp, here are some resources to get you started:
If you want to discuss anything in this article we’d be happy to talk — join our Discord #frontend-operators channel.
Website | Twitter | Discord | Telegram | Github | Reddit | LiquityCN