Skip to content

Borrow against collateral outside the LiquidityHub #537

@miguelmtzinf

Description

@miguelmtzinf

We want to allow borrowing against assets that are outside the liquidity hub (sitting on collateral vaults): Gnosis Safe wallets, Fireblocks vaults, Coinbase smart wallet, etc. Our intention is to build a custom spoke for this, but I think it could be possible to add it to the regular Spoke.

The spoke calls the Hub to fetch collateral info, but we could make this call more general so it calls whatever is needed instead of calling the Hub. The following function is the one responsible to fetch collateral info while calculating user account data.

function _getUserBalanceInBaseCurrency(
DataTypes.UserPosition storage userPosition,
ILiquidityHub hub,
uint256 assetId,
uint256 assetPrice,
uint256 assetUnit
) internal view returns (uint256) {
return
(hub.convertToSuppliedAssets(assetId, userPosition.suppliedShares) * assetPrice).wadify() /
assetUnit;
}

At first glance, this is the only place where we fetch collateral info, meaning that if we make this part more flexible, we could fetch collateral from any other place and support this new feature. I recommend to do a bit of research:

  • To evaluate feasibility, let's create couple of tests where we directly borrow (with no supply beforehand) and we mock that call inside _getUserBalanceInBaseCurrency. This will help us to identify if this would work with that simple change.
  • Think about liquidation process, how these assets are remove, and what we would need.
  • What kind of config would we need? DAO would need to whitelist which collateral vaults are allowed?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions