Repay loan with any token or multiple tokens

Title: [RFC] [Repay loan with any token or multiple tokens]
Author(s): [Wido (https://www.joinwido.com/)]
Submission Date: 2023-03-01T00:00:00Z

Simple Summary
This proposal outlines a solution to improve the user experience of Euler Finance’s loan repayment process. The proposal suggests building smart contracts and updating the frontend app to enable loan repayment with any token or multiple tokens from the user’s wallet. The proposal includes three milestones: creating a detailed UI mock, launching a testnet version, and launching the final product.

Motivation / Problem
Euler is already ahead of most DeFi protocols in terms of transaction experience. It provides transaction bundling that greatly improves the user experience. However, we believe that it can be even better.

Specifically, users cannot repay their loans with any token or multiple tokens in their wallet. As shown in the screenshot below, the user has 0.003888559288980439 wstETH tokens as debt but only 0.003885292756693672 wstETH tokens in their wallet. The user is missing 0.000003266532287 wstETH to repay their debt, and the debt amount grows with every new block.

  • To repay this debt, the user must swap another token in their wallet for wstETH and then repay. This requires the user to leave Euler’s app and use 3rd party swap provider like Uniswap or 1inch.
  • Given the amount of debt balance grows with new blocks, it’s challenging for the user to calculate how much wstETH they need to buy to ensure they get enough to repay their loan and are not left with some extra dust.

Proposed Solution
The Wido team proposes to build smart contracts and update Euler’s web app frontend code to enable loan repayment with any token in the user’s wallet or multiple tokens in the user’s wallet. We also propose to let the user deposit any token from their wallet while selecting the “target” collateral inside Euler. The app would take care of swapping the token from the user for the desired collateral.

A detailed explanation of those features follows:

  1. Repay the loan with any token — users can select any token from their wallet after clicking repay inside the Quick Actions modal.

    • There is a new “Repay with” input form, which lists all tokens the user currently has in their “Wallet Balance”
    • The user can select any token they have in their wallet
    • The user can define how much of the token to use to repay their loan
    • The UI would tell the user how much of the loan is left after the repayment transaction
    • We are attaching a simple UX mock to visualise how it would look. We would follow the existing UI style of Euler.Finance web app, to ensure it feels natural to Euler users

  1. Repay loan with multiple tokens — users can select multiple tokens from their wallet after clicking repay inside the Quick Actions modal. This is an extension of the previous feature

    • The user can set multiple tokens to repay their debt
    • The UI keeps informing the user how much debt they are repaying and how much will be left after the repayment transaction succeeds

We believe those features will improve the UX of using the Euler app increase the conversion of Loan Repayments, contributing to the overall improvement of the Euler platform.

Proposed Milestones

We propose splitting the work into three Milestones, each with a budget and clearly defined deliverables. We will complete them serially, beginning with Milestone 1, then Milestone 2, and finally Milestone 3.

We propose upfront funding for each milestone, based on the budgets assigned.

Milestone 1: Actionable plan, product architecture and UI mock

  • Document the solution’s architecture and a rough outline of the smart contract and frontend updates.
  • Create a detailed UI mock showing the proposed updates to the Euler’s app
  • Share the above documents with Euler’s core dev team for feedback
  • Budget requested: $1,000

Milestone 2: Testnet launch with a mechanism for soliciting feedback from the Euler community

  • Build the smart contracts and the frontend code that would enable the Proposed Solution explained above
  • Deploy the contracts to Goerli network (Ethereum Testnet)
  • Launch the features inside the Euler’s Web App
  • Write documentation for the smart contracts and the UI
  • Build a feedback collection mechanism to learn about users’ experience within the Euler’s App
  • Announce the new feature to the Euler’s community (help from the Euler’s marketing team will be highly appreciated)
  • Budget requested: $10,000

Milestone 3: Mainnet or production launch incorporating community feedback

  • Collect all feedback submitted from the Euler’s community
  • Prioritise feedback from the community and decide what gets incorporated as part of this work and what doesn’t (help with prioritisation from the Euler team would be highly appreciated)
  • Announce the product is Live (help from Euler’s marketing team will be highly appreciated)
  • Budget requested: $5,000

About Wido
Wido is building tools to improve the user experience (UX) of DeFi protocols and wallets. We focus on bundling multiple transactions into one, to provide a one-click experience. Our Router smart contract enables deposits with any token into any smart contract across EVM chains. It has been audited by CertiK and PeckShield, and is used by Pickle.Finance. Yearn.Finance (PR), Harvest.Finance and other DeFi protocols are currently integrating it into their dApps. We’re also building single-transaction collateral swaps for Compound.

Wido is founded and led by Roman (formerly Argent) and Kunal (formerly Google/Facebook).

Summary

The Wido team’s proposed solution will significantly improve the user experience for Euler users by enabling them to repay loans with any token or multiple tokens. This solution will keep users on Euler’s website, reducing the need to leave the platform to swap tokens. The three milestones outlined above will ensure steady progress and successful solution implementation.

This is interesting, although Euler already allows repaying with any token. It’s supported in UI in the repay form by selecting ‘Euler Deposits’ in the ‘From’ dropdown. Users can select any token deposited in their account which will be swapped on 1inch or uniswap and used to repay. If the token is in their wallet, they can add a deposit operation first in the tx builder. The repay form also allows selecting to swap exactly the amount that’s needed to repay full debt.

Would this proposal add extra benefits on top of what’s already available in Euler?

Hey, @iamzim thank you for your reply and the context.

It is great that it’s already possible to swap exactly what’s needed to repay full debt using tokens inside the “Euler Deposits”. Similarly for repaying with any token from “Euler Deposits”.

The extra benefits, summarised, would be:

  • Enable users to repay their loans with any token directly from their wallet, in one click. No need to have the token inside Euler Deposits, or bundle extra transaction using tx builder
  • Ability to repay a loan with multiple tokens
    • Note: we could allow this feature to work with tokens in users’ wallets as well as tokens in users’ “Euler Deposits” if there is interest.

Generally, the proposal is about letting users do actions directly from their own wallets, in a single click, instead of using “Euler Deposits”. It would be great to hear your thoughts and interest in this approach.

On a separate note, I have noticed that it is currently impossible to deposit any tokens directly into the “Euler Deposits.” For example, I cannot deposit my ETH directly into “Euler Deposits” without first wrapping it. Similarly, for other tokens, I need to swap them for supported tokens before being able to deposit them. We are keen to expand this proposal to allow users to deposit any token into “Euler Deposits” with just one click, without requiring any additional steps.

Hi @romanm, thanks for expanding.

Let me play a devil’s advocate for a sec. On your first point, one click repay from wallet can also be very easily implemented in FE as a single step proces. Tx builder already supports operations which are not atomic. Short for example is a mint and swap internally, but it’s a single form and a single item in the builder. I imagine however that having a dedicated contract could reduce gas costs slightly. On the other hand, as I understand the architecture, users would still need to approve the swapping contract for every token in their wallet, is this correct? Of course approval is also needed for depositing into Euler, but its a one time operation to interact with the platform.

On your second point, repaying with multiple tokens is also possible to implement as a single form in the UI, without any contract changes. In any case it would be a UX challange.

But I see your point about using ETH directly or tokens that don’t have activated markets in Euler, this is definitelly not possible currently.