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

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

Aave

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.

DyDx

dYdX is a decentralized trading platform that currently supports margin trading, spot trading, lending, and borrowing. dYdX runs on smart contracts on the Ethereum blockchain, and allows users to trade with no intermediaries.

Interface

The IProvider.sol defines the provider interface that the vault contracts use to make external calls to the lending-borrowing protocols.
1
interface IProvider {
2
//Basic Core Functions
3
4
function deposit(address _collateralAsset, uint256 _collateralAmount) external payable;
5
6
function borrow(address _borrowAsset, uint256 _borrowAmount) external payable;
7
8
function withdraw(address _collateralAsset, uint256 _collateralAmount) external payable;
9
10
function payback(address _borrowAsset, uint256 _borrowAmount) external payable;
11
12
// returns the borrow annualized rate for an asset in ray (1e27)
13
//Example 8.5% annual interest = 0.085 x 10^27 = 85000000000000000000000000 or 85*(10**24)
14
function getBorrowRateFor(address _asset) external view returns (uint256);
15
16
function getBorrowBalance(address _asset) external view returns (uint256);
17
18
function getDepositBalance(address _asset) external view returns (uint256);
19
20
function getBorrowBalanceOf(address _asset, address _who) external returns (uint256);
Copied!
Last modified 1mo ago
Copy link
Contents
Interface