Skip to content

Stablecoin liquidity pool #31

Open
@lastperson

Description

@lastperson

The idea is to extend LiquidityPool with support of multiple assets for borrowing. Technically any other asset can be borrowed as long as it is available in the pool, as long as we allow to withdraw profit only when deposited funds are fully covered.

Simple use case: user wants to get USDT so solver does borrowAndSwap, exchanges 100 USDC to USDT, then later 102 USDT is returned to the pool. At this time we are 100 USDC short. Now we need a way to convert those 102 USDT to USDC to break even and calculate profit. So we convert 102 USDT to USDC, and have 2 USDC as profit. Same could be applied to any other asset (it is just easier with stablecoins, but it is up to the MPC to decide which assets to let borrow/repay).

Implementation details

If we only allow profits withdrawal (in any tokens), from stable pool, when USDC.balanceOf(this) >= Deposited, then all will be good. So just need to add the swapping function. OR borrowAndSwap could be used to swap other stables to USDC, we can even ask solvers to do this.

so minimally we can convert USDC pool to a universal pool by 2 changes:

  1. Allow borrowing any token that sits in the pool.
  2. Deny withdraw profits if USDC.balanceOf(this) < Deposited.
    Adding the swap (or modifying repay for that) is just a potential UX improvement.

Testing details

Acceptance Criteria

QA Details

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions