Provider

Provider smart contracts wrap the unique logic and arguments to interact with each lending-borrowing protocol in a common interface. Provider smart contracts are stateless contracts.

Fuji defines a provider as any protocol with a lending-borrowing market that allows users to interact with the following main 4 functions: deposit, withdraw, borrow and payback.

Fuji core integrates the following providers:

Compound V2 and V3

Compound is an algorithmic, autonomous interest rate protocol built for developers, to unlock a universe of open financial applications.

Aave V2 and V3

Aave is a decentralized non-custodial liquidity protocol where users can participate as depositors or borrowers. Depositors provide liquidity to the market to earn a passive income, while borrowers are able to borrow in an overcollateralized (perpetually) or undercollateralized (one-block liquidity) fashion.

Forks and other lending markets including: Geist, Hundred, DForce, WePiggy

Interface

The IProvider.sol defines the provider interface that the vault contracts use to make external calls to the lending-borrowing protocols.

interface IProvider {
  //Basic Core Functions

  function deposit(address _collateralAsset, uint256 _collateralAmount) external payable;

  function borrow(address _borrowAsset, uint256 _borrowAmount) external payable;

  function withdraw(address _collateralAsset, uint256 _collateralAmount) external payable;

  function payback(address _borrowAsset, uint256 _borrowAmount) external payable;

  // returns the borrow annualized rate for an asset in ray (1e27)
  //Example 8.5% annual interest = 0.085 x 10^27 = 85000000000000000000000000 or 85*(10**24)
  function getBorrowRateFor(address _asset) external view returns (uint256);

  function getBorrowBalance(address _asset) external view returns (uint256);

  function getDepositBalance(address _asset) external view returns (uint256);

  function getBorrowBalanceOf(address _asset, address _who) external returns (uint256);

Last updated