# Introduction

These docs are a comprehensive guide to all dForce protocols, the codebase is hosted on Github and maintained by the dForce teams.

## Guides

{% content-ref url="/pages/-MNSjryLFG3TgcWyAv8f" %}
[Yield Markets](/lend/dtoken)
{% endcontent-ref %}

{% content-ref url="/pages/-MNSjwmdZeMONBcvVpMx" %}
[Lending & Synthetic Assets](/lend/lend-and-synth)
{% endcontent-ref %}

{% content-ref url="/pages/-MNSkHcFFuc3p\_9JI1fC" %}
[dForce Trade](/liquidity-markets/trade)
{% endcontent-ref %}


# Yield Markets

dToken is an interest-bearing aggregator, representing a pro-rata claim of a specific ERC20 token plus yields earned.

Users mint dToken to earn interest (i.e. deposit USDT and receive dUSDT in return). dToken can be transferred, traded, and redeemed at any time. dToken can attend to a variety of yielding protocols(i.e. Compound, Aave, etc.) and dForce PPP (Public-Private-Pool) (public pool for suppliers and private collateral pool accessible to verified borrowers only) for higher yield and better liquidity.

Users will receive dToken when they deposit a specific ERC20 token into the smart contract, which is redeemable at any time and represents a pro-rata claim of corresponding ERC20 token plus interest earned.

### Open Source Code

<https://github.com/dforce-network/dToken>

### Dapp URL

<https://markets.dforce.network/>


# Architecture

dToken's architectures of smart contracts.

![](/files/-MNb95OYtl21TbSExRCb)


# Modules

dToken's core modules of smart contracts.

### **dToken**

The dToken core contract facilitates Mint/Redeem function, standard ERC20 interface, and governance interface, and adjusts the proportion of tokens allocated to each lending market for optimum yield and liquidity.&#x20;

### **Dispatcher**

Attends to manage the Handler, Mint/Redeem strategy interfaces. In principle, dTokens with the same strategies can use the same Dispatcher. In practice, however, each dToken has an independent Dispatcher.

### **dToken Controller**

Provide mappings of dToken and underlying token, all dTokens and Handlers share the same dToken Controller contract.

### **Handler**

Provide a unified interface to facilitate the wrapping of lending markets, i.e. deposit/withdraw, and query interfaces, etc. Internal Handler is the default Handler of dToken and cannot be removed. The Handler of Lending Market can support multiple dTokens simultaneously.


# Contracts

Deployed contracts in Ethereum Mainnet and Binance Smart Chain.

| Ethereum Mainnet | Contracts                                                                                                             |
| ---------------- | --------------------------------------------------------------------------------------------------------------------- |
| Controller       | [0x9b6bA9e66A2422F1D62f6F83a46A129De907967b](https://etherscan.io/address/0x9b6bA9e66A2422F1D62f6F83a46A129De907967b) |
| Internal Handler | [0x885dD179c76ee5949B9053F1958bA3a91e4CF592](https://etherscan.io/address/0x885dD179c76ee5949B9053F1958bA3a91e4CF592) |
| Compound Handler | [0xBcDD2a069a46E9b5D032D2F99725418508CE6Aee](https://etherscan.io/address/0xBcDD2a069a46E9b5D032D2F99725418508CE6Aee) |
| Aave Handler     | [0xbb7D75BE4dc8Eb15FF90422137C0a5BcBd316953](https://etherscan.io/address/0xbb7D75BE4dc8Eb15FF90422137C0a5BcBd316953) |
| USR Handler      | [0x8916A9B0064Feab04b3BF3729ADBB0bE119eD12D](https://etherscan.io/address/0x8916A9B0064Feab04b3BF3729ADBB0bE119eD12D) |
| dDAI             | [0x02285AcaafEB533e03A7306C55EC031297df9224](https://etherscan.io/address/0x02285AcaafEB533e03A7306C55EC031297df9224) |
| dPAX             | [0xF4dFc3Df8C83Be5a2ec2025491fd157c474f438a](https://etherscan.io/address/0xF4dFc3Df8C83Be5a2ec2025491fd157c474f438a) |
| dTUSD            | [0x55BCf7173C8840d5517424eD19b7bbF11CFb9F2B](https://etherscan.io/address/0x55BCf7173C8840d5517424eD19b7bbF11CFb9F2B) |
| dUSDC            | [0x16c9cF62d8daC4a38FB50Ae5fa5d51E9170F3179](https://etherscan.io/address/0x16c9cF62d8daC4a38FB50Ae5fa5d51E9170F3179) |
| dUSDT            | [0x868277d475E0e475E38EC5CdA2d9C83B5E1D9fc8](https://etherscan.io/address/0x868277d475E0e475E38EC5CdA2d9C83B5E1D9fc8) |
| dUSDx            | [0x109917F7C3b6174096f9E1744e41ac073b3E1F72](https://etherscan.io/address/0x109917F7C3b6174096f9E1744e41ac073b3E1F72) |

| Binance Smart Chain | Contracts                                                                                                            |
| ------------------- | -------------------------------------------------------------------------------------------------------------------- |
| Controller          | [0x7F15bf6D40bfEE79099bCcA893a30B72Aee6C9Eb](https://bscscan.com/address/0x7f15bf6d40bfee79099bcca893a30b72aee6c9eb) |
| Internal Handler    | [0xC46751E2494897eB34E2297bEB649672dBabF975](https://bscscan.com/address/0xC46751E2494897eB34E2297bEB649672dBabF975) |
| Cream Handler       | [0xdE399d88eA8331fE2F18306793893a46D142cc5f](https://bscscan.com/address/0xdE399d88eA8331fE2F18306793893a46D142cc5f) |
| dBUSD               | [0xce14792a280b20c4f8E1ae76805a6dfBe95729f5](https://bscscan.com/address/0xce14792a280b20c4f8E1ae76805a6dfBe95729f5) |
| dDAI                | [0x4E0B5BaFC52D09A8F18eA0b7a6A7dc23A1096f99](https://bscscan.com/address/0x4E0B5BaFC52D09A8F18eA0b7a6A7dc23A1096f99) |
| dUSDC               | [0x6c0F322442D10269Dd557C6e3A56dCC3a1198524](https://bscscan.com/address/0x6c0F322442D10269Dd557C6e3A56dCC3a1198524) |
| dUSDT               | [0x6199cC917C12E4735B4e9cEfbe29E9F0F75Af9E5](https://bscscan.com/address/0x6199cC917C12E4735B4e9cEfbe29E9F0F75Af9E5) |


# Security

Audited by several top security firms

### TrailofBits audit in July 2020

<https://github.com/trailofbits/publications/blob/master/reviews/dtoken.pdf>


# Interface

dToken contract is fully compatible with ERC20 standard, other interfaces are descripted here.

## Send Transactions

* mint(address \_dst, uint \_pie)

  *`mint certain amount of underlying to dst address`*

  * \_dst: account who will get dToken.
  * \_pie: underlying token amount.

* redeem(address \_src, uint \_wad)

  *`redeem certain amount of dToken from dst address`*

  * \_src: account whose dToken will burn from.
  * \_wad: dToken amount to burn.

* redeemUnderlying(address \_src, uint \_pie)

  *`redeem certain amount of underlying from dst address`*

  * \_src: account whose dToken will burn from.
  * \_pie: underlying token amount to withdraw.

## ERC20 Interface

Please refer to <https://eips.ethereum.org/EIPS/eip-20>.

## Call

* currentExchangeRate() returns (uint)

  *`return the most recent exchange rate, scaled by 1e18`*

* totalUnderlying() returns (uint)

  *`return the total underlying token amount`*

* getRealLiquidity() returns (uint)

  *`return current liquidity of the underlying token`*

* balanceOfUnderlying(address \_account) returns (uint)

  * \_account: account address.

  *`return the underlying token balance of the given account`*

* getBaseData() returns (uint, uint, uint, uint, uint)

  *`return (decimals, exchangeRate, mintFeeRate, redeemFeeRate, totalUnderlying)`*

  * decimals: token decimals.
  * exchangeRate: the most recent exchange rate, scaled by 1e18.
  * mintFeeRate: the fee rate of mint(), scaled by 1e18.
  * redeemFeeRate: the fee rate of redeem()/redeemUnderlying(), scaled by 1e18.
  * totalUnderlying: the total underlying token amount.

* originationFee(bytes4 \_sig) returns (uint)

  * \_sig: function signature to query.

  *`return fee, scaled by 1e18`*

* paused() returns (bool)

  *`return true if paused, false if not paused`*

* feeRecipient() returns (address)

  *`return fee receiving address`*


# Lending & Synthetic Assets

Synthetic multi-currency protocol build on top of the General lending protocol

These docs are a comprehensive guide to the dForce Lending & Synthetic Assets Protocol, the codebase is hosted on [Github](https://github.com/dforce-network/LendingContractsV2).

### General Lending Protocol

The general lending protocol is a pool-based lending protocol that supports multi-sided transactions (supply any supported assets to earn supply interests and act as collateral as well, then borrow any assets if you can satisfy the collateral ratio, otherwise the position could be liquidated), this is the most abstract and generalized form of a lending protocol similar with the popular protocols.

![General Lending Protocol](https://lh6.googleusercontent.com/ZEc8wddU1Etx-ay_fwnat2dgje8yGcOd8EK1vo5JSxJp3GM7qK5bD-bCvf3zxv4m1j5ClAfoCKiPzWNcqjS_XRjrThyz7vGA-ACalWb2XmwqEwGcLMQLSxVtySU7NPGjxPNOqqoB)

### Lending & Synthetic Protocol

Combination of General Lending, native Stablecoin and Synthetic Asset Protocol to capture unlimited input capacity and output synthetic capacity.

![](https://lh6.googleusercontent.com/rkc_dSpu_JMbE1GmW3tDaze-GGKsLz7iyjr-YTyQog2025WzjjTx6aShrB1ABxZnukCOLA76UPJA7ZE_qBl5MYrEBEQcRcRicWgPx1NPdg3mEe3gNIxhWVtkvyUodqXrh9sUCE_R)

###

### How to integrate with dForce Lending & Synthetic Asset Protocol?

Go to the separated content if you want to integrate the protocol. More examples and comprehensive descriptions will come later.

{% content-ref url="/pages/-M\_KVdBVT5nnUaMH9BmI" %}
[Deployed Contracts](/lend/lend-and-synth/deployed-contracts)
{% endcontent-ref %}

{% content-ref url="/pages/-M\_KTyI75lJuPjOpi\_fg" %}
[iTokens](/lend/lend-and-synth/itokens)
{% endcontent-ref %}

{% content-ref url="/pages/-M\_KUJa59I59Hhkf7Hq1" %}
[Controller](/lend/lend-and-synth/controller)
{% endcontent-ref %}


# iTokens

Interest bearing tokens to interact with Lending & Synthetic Protocol.

Each asset supported by the dForce Lending & Synthetic Protocol is integrated with an iToken contract, which is an EIP-20 compliant representation of balances supplied to the protocol. By minting iTokens, users (i) earn supply interest through iToken’s exchange rate, which increases in value relative to the underlying asset, and (ii) gain the ability to use iToken as collateral to borrow assets.

There are currently two types of iTokens: iToken and iETH, both expose the EIP-20 interface, iToken wraps an underlying ERC-20 asset, such as iWBTC wraps WBTC as underlying, while iETH simply wraps native Ether. The major difference involves transferring an asset into the protocol between ERC-20 asset and Ether.

## EIP20 Methods

All standard EIP20 methods are implemented, such as `balanceOf()`, `transfer()`, `transferFrom()`, `approve()`, `totalSupply()`, etc.

## EIP2612 Methods

### permit()

Allows users to permit another account (or contract) to use their funds using a signed message. This enables gas-less transactions and single approval/transfer transactions.&#x20;

```
function permit(
        address _owner,
        address _spender,
        uint256 _value,
        uint256 _deadline,
        uint8 _v,
        bytes32 _r,
        bytes32 _s
    )
```

## Methods

Describes basic interfaces to integrate with the protocol, such as deposit as collaterals and take a loan, etc.

### mint()

Caller deposits underlying asset and gets iToken in exchange according to the exchange rate.

```
function mint(address recipient, uint256 mintAmount);
```

### mint\&enterMarket()

Caller deposits underlying asset, gets iToken in exchange according to the exchange rate and make the asset as collateral.

```
function mintForSelfAndEnterMarket(uint256 mintAmount);
```

###

### redeem()

Caller redeems specified iToken and gets underlying asset.

```
function redeem(address from, uint256 redeemTokens);
```

###

### redeemUnderlying()

Redeem by the amount of underlying asset as input.

```
function redeemUnderlying(address _from, uint256 _redeemUnderlying);
```

### borrow()

Take a loan if the caller has enough deposits as collateral.

```
function borrow(uint256 _borrowAmount);
```

### repayBorrow()

Repay a loan.

```
function repayBorrow(uint256 _repayAmount);
```

### repayBorrowBehalf()

Repay a loan on behalf of the borrower.

```
function repayBorrowBehalf(address _borrower, uint256 _repayAmount);
```

### liquidateBorrow()

Repay a loan on behalf of the borrower and seize the same value of iToken plus incentive as a reward.

```
function liquidateBorrow(
        address _borrower,
        uint256 _repayAmount,
        address _assetCollateral
    );
```

### updateInterest()

Update asset's borrow and supply interests, push total borrows and reserves up-to-date.

```
function updateInterest() external override returns (bool)；
```

### exchangeRateCurrent()

Gets the newest exchange rate by accruing interest.

```
function exchangeRateCurrent() external returns (uint256);
```

### exchangeRateStored()

Gets the stored exchange rate without accruing interest.

```
function exchangeRateStored() external view override returns (uint256);
```

### balanceOfUnderlying()

Gets the up-to-date underlying balance of a depositor.

```
function balanceOfUnderlying(address _account) external returns (uint256);
```

### totalBorrowsCurrent()

Gets the current total borrows by accruing interest.

```
function totalBorrowsCurrent() external returns (uint256);
```

### borrowBalanceCurrent()

Gets account's up-to-date borrow balance.

```
function borrowBalanceCurrent(address _user) external returns (uint256);
```

### borrowBalanceStored()

Gets the stored borrow balance of an account.

```
function borrowBalanceStored(address _user) external view returns (uint256);
```

### borrowRatePerBlock()

Gets borrow rate per block, annual yield = pow (borrowRatePerBlock, blockPerYear);

```
function borrowRatePerBlock() external view returns (uint256);
```

### supplyRatePerBlock()

Get supply rate per block, annual yield = pow (supplyRatePerBlock, blockPerYear);

```
function supplyRatePerBlock() external view returns (uint256);
```

### getCash()

Get cash of underlying in the protocol.

```
function getCash() external view returns (uint256);
```

### Key Events

| Event                                                                                                                                                                                             | Description                               |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------- |
| <p>event Mint ( </p><p>address spender,</p><p>address recipient,</p><p>uint256 mintAmount,</p><p>uint256 mintTokens )</p>                                                                         | Emitted upon a successful Mint.           |
| <p>event Redeem ( </p><p>address from,</p><p>address recipient,</p><p>uint256 redeemiTokenAmount,</p><p>uint256 redeemUnderlyingAmount )</p>                                                      | Emitted upon a successful Redeem.         |
| <p>event Borrow (</p><p>address borrower,</p><p>uint256 borrowAmount,</p><p>uint256 accountBorrows,</p><p>uint256 accountInterestIndex,</p><p>uint256 totalBorrows )</p>                          | Emitted upon a successful Borrow.         |
| <p>event RepayBorrow (</p><p>address payer,</p><p>address borrower,</p><p>uint256 repayAmount,</p><p>uint256 accountBorrows,</p><p>uint256 accountInterestIndex,</p><p>uint256 totalBorrows )</p> | Emitted upon a successful RepayBorrow.    |
| <p>event LiquidateBorrow (</p><p>address liquidator,</p><p>address borrower,</p><p>uint256 repayAmount,</p><p>address iTokenCollateral,</p><p>uint256 seizeTokens )</p>                           | Emitted upon a successful LiquidateBorrow |


# Controller

The Controller is the risk management portal of the dForce Lending & Synthetic Protocol, it determines how much collateral a user is required to maintain, whether (and how much) a user can be liquidated, and control the protocol risk by adjusting supply/borrow capacity and risk parameters.

## Methods

### enterMarkets()

Enter into a list of markets. In order to supply collateral or borrow in a market, it must be entered first.

```
function enterMarkets(address[] calldata iTokens)
        external
        returns (bool[] memory);
```

###

### exitMarkets()

Exit a market, exited markets will not count towards account liquidity calculations.

```
function exitMarkets(address[] calldata iTokens)
        external
        returns (bool[] memory);
```

###

### getAlliTokens()

Get all markets already added into the protocol.

```
function getAlliTokens() external view returns (address[] memory);
```

###

### hasiToken()

Return the status whether an iToken is listed in the controller.

```
function hasiToken(address _iToken) external view returns (bool);
```

###

### getEnteredMarkets()

Get all markets already entered from one account.

```
function getEnteredMarkets(address account)
        external
        view
        returns (address[] memory);
```

###

### getBorrowedAssets()

Get all assets already borrowed from one account.

```
function getBorrowedAssets(address account)
        external
        view
        returns (address[] memory);
```

### calcAccountEquity()

Account liquidity represents the USD value with the specific asset/amount-continue-redeeming or amount-continue-borrowing before it reaches liquidation. Returns Tuple of values (equity, shortfall, collaterals, borrows). A non-zero equity value indicates the account has available borrowable value, a non-zero shortfall value indicates the account is currently below the collateral requirement and is subject to liquidation. At most one of equity or shortfall shall be non-zero. Collaterals and borrows represent the current collateral and borrow value is USD with 36 integer precision which for example, 360000000000000000000000000000000000000000 indicates 360000 in USD.

```
function calcAccountEquity(address _account)
        public
        view
        override
        returns (
            uint256 equity,
            uint256 shortfall,
            uint256 collaterals,
            uint256 borrows
        )
```

### liquidateCalculateSeizeTokens()

Compute the amount of collateral iToken available to seize after repaying a specific amount of borrow asset.

```
function liquidateCalculateSeizeTokens(
        address _iTokenBorrowed,
        address _iTokenCollateral,
        uint256 _actualRepayAmount
    )
    external
    view
    override
    returns (uint256 _seizedTokenCollateral)
```

###

### Key Events

| Event                                                                | Description                                                           |
| -------------------------------------------------------------------- | --------------------------------------------------------------------- |
| <p>event MarketEntered</p><p>(address iToken, address account)</p>   | Emitted upon a successful Enter Market.                               |
| <p>event MarketExited</p><p>(address iToken, address account)</p>    | Emitted upon a successful Exit Market.                                |
| <p>event BorrowedAdded</p><p>(address iToken, address account)</p>   | Emitted upon a successful borrowing new asset(never borrowed before). |
| <p>event BorrowedRemoved</p><p>(address iToken, address account)</p> | Emitted upon a successful payoff an outstanding loan.                 |


# iMSDTokens

## MSD Token

MSD Token is the synthetic asset in the dForce Lending & Synthetic system. It conforms to the ERC-20 standard and has a Mint interface with permissions. Only MsdController has permission to call mint function. Users can mint MSD Token when the certain collateral ratio is satisfied.&#x20;

Minting MSD Token from the system has similar behavior to borrowing, and repay borrow means burn the MSD Token. When the collateral rate is lower than the requirement, the MSD loan can be liquidated. The liquidation of MSD is consistent with the liquidation of the loan.

### EIP20 Methods

All standard EIP20 methods are implemented, such as `balanceOf()`, `transfer()`, `transferFrom()`, `approve()`, `totalSupply()`, etc.

###

### EIP2612 Methods

#### permit()

Allows a user to permit another account (or contract) to use their funds using a signed message. This enables gas-less transactions and single approval/transfer transactions.&#x20;

```
function permit(
        address _owner,
        address _spender,
        uint256 _value,
        uint256 _deadline,
        uint8 _v,
        bytes32 _r,
        bytes32 _s
    )
```

### Methods

#### Mint()

```
function mint(address to, uint256 amount) external onlyMinter
```

Mint MSD token with limited authority, only MSD Controller has authority to mint, account who has enough collateral can call borrow from iMsdToken to mint MSD.

#### Burn()

```
function burn(address from, uint256 amount) external;
```

## iMsdTokens

iMSDToken inherits most functions of iToken, explores interfaces to interact with protocol to mint or burn MsdTokens. Borrowing from iMsdToken results in minting MsdToken under collaterals, and repaying from iMsdToken results in burning MsdToken, no Mint & Redeem function needed.

### Methods

#### Borrow()

Users call Borrow function to mint MSD token if the certain collateral ratio is satisfied.

```
function borrow(uint256 _borrowAmount) external;
```

#### RepayBorrow()

Users call RepayBorrow function to burn MSD token, this will repay the outstanding loan of user.

```
function repayBorrow(uint256 _repayAmount) external;
```

#### RepayBorrowBehalf()

Repay a loan on behalf of borrower.

```
function repayBorrowBehalf(address _borrower, uint256 _repayAmount) external;
```

#### LiquidateBorrow()

Repay a loan on behalf of the borrower and seize the same value of iToken plus incentive as a reward.

```
function liquidateBorrow(
        address _borrower,
        uint256 _repayAmount,
        address _assetCollateral
    ) external;
```


# MSDController

MsdController manages the minting authority of MsdToken.

## Methods

### getAllMSDs()

List all MSD tokens added into the controller.

```
function getAllMSDs() public view return (address[])
```

###

### hasMSD()

Return status whether an MSD token has been added to the controller.

```
function hasMSD(address) public view return (bool)
```

###

### getMSDMinters()

List all MSD token's minter.

```
function getMSDMinters(address MSD)
        public
        view
        return (address[])
```

### mintCaps()

Return minting capacity of one of the MSD minters.

```
function mintCaps(address MSD, address minter) public view return (uint256 cap)
```


# Price Oracle

We use ChainLink's decentralized oracles for the primary price feed, and use dForce oracle as a backup in case of price from ChainLink has significant deviation from markets.

{% tabs %}
{% tab title="Asset Prices" %}

1. Check the price from a Chainlink aggregator.
2. If the price is below or equal to zero, call dForce backup price oracle, which is currently maintained by the dForce team.
3. For prices Chainlink not provided, price is posted by service maintained by dForce team, currently, only DF.
4. In the future, dForce governance will manage the selection of price sources.
   {% endtab %}
   {% endtabs %}

{% tabs %}
{% tab title="Ethereum Mainnet" %}

| Asset                                                                | Address                                      |
| -------------------------------------------------------------------- | -------------------------------------------- |
| DF                                                                   | 0x1B7c5DA3D2DBc05B089053FA3318f26bdD8aB10A   |
| USDT                                                                 | 0x3E7d1eAB13ad0104d2750B8863b489D65364e32D   |
| USDC                                                                 | always equal to 1 dollar.                    |
| ETH                                                                  | 0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419   |
| WBTC                                                                 | 0xF4030086522a5bEEa4988F8cA5B36dbC97BeE88c   |
| DAI                                                                  | 0xAed0c38402a5d19df6E4c03F4E2DceD6e29c1ee9   |
| GOLDx                                                                | 0x8C5022C57dE46252CE1a49644c5ADf5C866e3E8D\* |
| UNI                                                                  | 0x553303d460EE0afB37EdFf9bE42922D8FF63220e   |
| EUX                                                                  | 0xb49f677943BC038e9857d61E7d053CaA2C1734C1   |
| <img src="/files/-Ma8GRlKaS18jpHACvy3" alt="" data-size="line"> TSLA | 0x1ceDaaB50936881B3e449e47e40A2cDAF5576A4a   |
| <img src="/files/-Ma8GRlKaS18jpHACvy3" alt="" data-size="line"> AAPL | 0x139C8512Cde1778e9b9a8e721ce1aEbd4dD43587   |
| <img src="/files/-Ma8GRlKaS18jpHACvy3" alt="" data-size="line"> AMZN | 0x8994115d287207144236c13Be5E2bDbf6357D9Fd   |
| <img src="/files/-Ma8GRlKaS18jpHACvy3" alt="" data-size="line"> COIN | 0xb10a047f8db80d781D006F1401BEB7d70Eb4da1a   |
| {% endtab %}                                                         |                                              |

{% tab title="Binance Smart Chain Mainnet" %}

| Asset                                                                | Address                                      |
| -------------------------------------------------------------------- | -------------------------------------------- |
| DF                                                                   | 0x8fC12c875BE2f443F23fF8F0262E06F4696Aa5d1   |
| USDT                                                                 | 0xB97Ad0E74fa7d920791E90258A6E2085088b4320   |
| USDC                                                                 | always equal to 1 dollar.                    |
| BNB                                                                  | 0x0567F2323251f0Aab15c8dFb1967E4e8A7D42aeE   |
| BUSD                                                                 | 0xcBb98864Ef56E9042e7d2efef76141f15731B82f   |
| BTCB                                                                 | 0x264990fbd0A4796A3E3d8E37C4d5F87a3aCa5Ebf   |
| DAI                                                                  | 0x132d3C0B1D2cEa0BC552588063bdBb210FDeecfA   |
| ADA                                                                  | 0xa767f745331D267c7751297D982b050c93985627   |
| ATOM                                                                 | 0xb056B7C804297279A9a673289264c17E6Dc6055d   |
| FIL                                                                  | 0xE5dbFD9003bFf9dF5feB2f4F445Ca00fb121fb83   |
| ETH                                                                  | 0x9ef1B8c0E4F7dc8bF5719Ea496883DC6401d5b2e   |
| GOLDx                                                                | 0x7F8caD4690A38aC28BDA3D132eF83DB1C17557Df\* |
| UNI                                                                  | 0xb57f259E7C24e56a1dA00F66b55A5640d9f9E7e4   |
| EUX                                                                  | 0x0bf79F617988C472DcA68ff41eFe1338955b9A80   |
| <img src="/files/-Ma8GRlKaS18jpHACvy3" alt="" data-size="line"> TSLA | 0xEEA2ae9c074E87596A85ABE698B2Afebc9B57893   |
| <img src="/files/-Ma8GRlKaS18jpHACvy3" alt="" data-size="line"> AAPL | 0xb7Ed5bE7977d61E83534230f3256C021e0fae0B6   |
| <img src="/files/-Ma8GRlKaS18jpHACvy3" alt="" data-size="line"> AMZN | 0x51d08ca89d3e8c12535BA8AEd33cDf2557ab5b2a   |
| <img src="/files/-Ma8GRlKaS18jpHACvy3" alt="" data-size="line"> COIN | 0x2d1AB79D059e21aE519d88F978cAF39d74E31AEB   |
| {% endtab %}                                                         |                                              |
| {% endtabs %}                                                        |                                              |

`*GOLDx's price is calculated as the price of PAXG/30.1034768.`

{% hint style="info" %}
Prices for stocks <img src="/files/-Ma8GRlKaS18jpHACvy3" alt="" data-size="line"> are only considered valid during [market trading hours](https://www.nasdaq.com/stock-market-trading-hours-for-nasdaq) in Nasdaq. When asset price considered invalid during market close period, the protocol will disable operations (such as redeem collaterals, continue borrowing/minting, liquidateborrow, etc) until market opens again. For more comprehansive explanations, please refer to the [action rules in Stock Pool.](https://docs.dforce.network)
{% endhint %}

## Method

### getUnderlyingPrice()

Get the price of underlying token by iToken.

```
/**
     * @notice Get the underlying price of a iToken asset
     * @param _iToken The iToken to get the underlying price of
     * @return The underlying asset price mantissa (scaled by 1e18).
     *  Zero means the price is unavailable.
     */
    function getUnderlyingPrice(address _iToken)
        external
        view
        returns (uint256);
```

### getUnderlyingPriceAndStatus()

Get underlying price and status if the price is available (for example, stock's price is unavailable when market close, here is "[Nasdaq trading hours](https://www.nasdaq.com/stock-market-trading-hours-for-nasdaq)" for your reference).

```
/**
     * @notice Get the price and status of an underlying asset
     * @param _iToken The iToken to get the underlying price of
     * @return The underlying asset price mantissa (scaled by 1e18).
     * @return If the price is available, true is available, vice versa.
     */
    function getUnderlyingPriceAndStatus(address _iToken)
        external
        view
        returns (uint256, bool);
```


# Reward Distribution

Every dForce Lending user accrues DF for each block they are supplying to or borrowing (including minting Synths) from the protocol. *`globalDistributionSpeed`* and *`globalDistributionSupplySpeed`* represent the total amount of token distributed per block on the borrow and supply sides respectively. Each asset that participated in the reward schedule will be allocated with a distribution speed, *`distributionSpeed`* and *`distributionSupplySpeed`* represent reward amount distribute on supply and borrow sides respectively.

#### Variables to address distribution speed of each asset.

```
/// @notice the global Reward distribution speed for borrow
    uint256 public globalDistributionSpeed;
    
/// @notice the global Reward distribution speed for supply
    uint256 public globalDistributionSupplySpeed;

/// @notice the Reward distribution speed of each iToken
    mapping(address => uint256) public distributionSpeed;
    
/// @notice the Reward distribution speed supply side of each iToken
    mapping(address => uint256) public distributionSupplySpeed;
```

### Deployed Contracts

{% tabs %}
{% tab title="Mainnet" %}

* General Pool

| Name               | Address                                                                                                               | Descriptions               |
| ------------------ | --------------------------------------------------------------------------------------------------------------------- | -------------------------- |
| Reward Distributor | [0x8fAeF85e436a8dd85D8E636Ea22E3b90f1819564](https://etherscan.io/address/0x8fAeF85e436a8dd85D8E636Ea22E3b90f1819564) | Interface for distribution |
| LendingData        | [0x37600A5a555F61ec2012D94b32f9B8c8eb2EfC5e](https://etherscan.io/address/0x37600A5a555F61ec2012D94b32f9B8c8eb2EfC5e) | Interface for data         |

* Stock Pool (not distributed yet)

| Name               | Address                                                                                                               | Descriptions               |
| ------------------ | --------------------------------------------------------------------------------------------------------------------- | -------------------------- |
| Reward Distributor | [0xcf4ad4da361671dc84be51a6c1131eaf84926e00](https://etherscan.io/address/0xcf4ad4da361671dc84be51a6c1131eaf84926e00) | Interface for distribution |
| LendingData        | [0x52ed0A880EdA217052E1fae4333Ba1F4abfe2ac3](https://etherscan.io/address/0x52ed0A880EdA217052E1fae4333Ba1F4abfe2ac3) | Interface for data         |
| {% endtab %}       |                                                                                                                       |                            |

{% tab title="BSC" %}

* General Pool

| Name               | Address                                                                                                              | Descriptions               |
| ------------------ | -------------------------------------------------------------------------------------------------------------------- | -------------------------- |
| Reward Distributor | [0x6fC21a5a767212E8d366B3325bAc2511bDeF0Ef4](https://bscscan.com/address/0x6fC21a5a767212E8d366B3325bAc2511bDeF0Ef4) | Interface for distribution |
| LendingData        | [0x2B9B3F4D83eAD0EA412D354E3CCd8C9eA558ACD7](https://bscscan.com/address/0x2B9B3F4D83eAD0EA412D354E3CCd8C9eA558ACD7) | Interface for data         |

* Stock Pool (not distributed yet)

| Name               | Address                                                                                                              | Descriptions               |
| ------------------ | -------------------------------------------------------------------------------------------------------------------- | -------------------------- |
| Reward Distributor | [0xa28F287630184d3b5EeE31a5FE8dB0A63c4A6e2f](https://bscscan.com/address/0xa28F287630184d3b5EeE31a5FE8dB0A63c4A6e2f) | Interface for distribution |
| LendingData        | [0xfABc3D9dAFb8a51b9C70db4ed530E4f17014dcA5](https://bscscan.com/address/0xfABc3D9dAFb8a51b9C70db4ed530E4f17014dcA5) | Interface for data         |
| {% endtab %}       |                                                                                                                      |                            |

{% tab title="Arbitrum" %}

| Name               | Address                                                                                                              | Descriptions               |
| ------------------ | -------------------------------------------------------------------------------------------------------------------- | -------------------------- |
| Reward Distributor | [0xF45e2ae152384D50d4e9b08b8A1f65F0d96786C3](https://arbiscan.io/address/0xF45e2ae152384D50d4e9b08b8A1f65F0d96786C3) | Interface for distribution |
| LendingData        | [0x9dDBB20521cCEE5715aF0a8ac5046Fa6B4A39941](https://arbiscan.io/address/0x9dDBB20521cCEE5715aF0a8ac5046Fa6B4A39941) | Interface for data         |
| {% endtab %}       |                                                                                                                      |                            |

{% tab title="Optimism" %}

| Name               | Address                                                                                                                          | Descriptions               |
| ------------------ | -------------------------------------------------------------------------------------------------------------------------------- | -------------------------- |
| Reward Distributor | [0x870ac6a76A30742800609F205c741E86Db9b71a2](https://optimistic.etherscan.io/address/0x870ac6a76A30742800609F205c741E86Db9b71a2) | Interface for distribution |
| LendingData        | [0x0C0AdB03423c8232a0b7785433919EaF62A59173](https://optimistic.etherscan.io/address/0x0C0AdB03423c8232a0b7785433919EaF62A59173) | Interface for data         |
|                    |                                                                                                                                  |                            |
| {% endtab %}       |                                                                                                                                  |                            |

{% tab title="Polygon" %}

| Name               | Address                                                                                                                  | Descriptions               |
| ------------------ | ------------------------------------------------------------------------------------------------------------------------ | -------------------------- |
| Reward Distributor | [0x47C19A2ab52DA26551A22e2b2aEED5d19eF4022F](https://polygonscan.com/address/0x47C19A2ab52DA26551A22e2b2aEED5d19eF4022F) | Interface for distribution |
| LendingData        | [0xEb339b4EA1051C8064A124C959b531C89b834182](https://polygonscan.com/address/0xEb339b4EA1051C8064A124C959b531C89b834182) | Interface for data         |
| {% endtab %}       |                                                                                                                          |                            |

{% tab title="Conflux eSpace" %}

| Name               | Address                                                                                                                      | Descriptions               |
| ------------------ | ---------------------------------------------------------------------------------------------------------------------------- | -------------------------- |
| Reward Distributor | [0x3482f35B866E24D85AC29FfdbcD4A89EC65288c0](https://evm.confluxscan.net/address/0x3482f35B866E24D85AC29FfdbcD4A89EC65288c0) | Interface for distribution |
| LendingData        | [0x121F88625831702d02dcF93092E5247eca7b94f4](https://evm.confluxscan.net/address/0x121f88625831702d02dcf93092e5247eca7b94f4) | Interface for data         |

{% endtab %}
{% endtabs %}

#### How to calculate the claimable amount of reward in LendingDataV2.sol?

Returns the amount of reward one account has earned in participating in all the assets of supplying or borrowing(mint MSD token considers as borrow).

```
function getAccountRewardAmount(address _account) external returns (uint256)
```

#### Claim reward for any account and any asset in RewardDistributorV3.sol.

```
/**
* @notice Claim reward accrued in iTokens by the holders
* @param _holders The account to claim for
* @param _iTokens The _iTokens to claim from
 */
    function claimReward(address[] memory _holders, address[] memory _iTokens)
        public;
```

#### Claim reward for any account of all participated assets supplied to or borrowed (including mint Synths) from the protocol RewardDistributorV3.sol.

```
/**
* @notice Claim reward accrued in iTokens by the holders
* @param _holders The account to claim for
* @param _suppliediTokens The _suppliediTokens to claim from
* @param _borrowediTokens The _borrowediTokens to claim from
 */
    function claimRewards(address[] memory _holders, address[] memory _suppliediTokens, address[] memory _borrowediTokens)
        external 
```

#### Claim reward for any account of all participated assets RewardDistributorV3.sol.

```
**
* @notice Claim reward accrued in all iTokens by the holders
* @param _holders The account to claim for
*/
    function claimAllReward(address[] memory _holders) external
```


# Security

The security of the protocol is our highest priority, dForce development team works closely with third-party auditors and formal verification teams to ensure that the protocols match the highest security standards.

### Audits

{% hint style="success" %}
[**ConsenSys Deligence&#x20;*****Audit*****&#x20;- April 2021**](https://consensys.net/diligence/audits/2021/03/dforce-lending-protocol-review/)
{% endhint %}

{% hint style="success" %}
[**Trail of Bits&#x20;*****Audit*****&#x20;- March 2021**](https://github.com/dforce-network/documents/blob/master/audit_report/Lending/dForceLending-Audit-Report-TrailofBits-Mar-2021.pdf)
{% endhint %}

{% hint style="success" %}
[**Certora&#x20;*****Formal Verification*****&#x20;- March 2021**](https://www.certora.com/pubs/dForceFeb2021.pdf)
{% endhint %}

{% hint style="success" %}
[**Certik&#x20;*****Audit*****&#x20;- February 2021**](https://www.certik.org/projects/dforce)
{% endhint %}

### Bug Bounty

We encourage the hunting of bugs and potential exploits in our protocols, Refer to our [bug bounty program](https://docs.dforce.network/devs/bug-bounty) for details.


# Deployed Contracts

The dForce Lending & Synthetic Assets Protocol is currently deployed on the following networks:

{% tabs %}
{% tab title="Ethereum Mainnet" %}

* [**General Pool**](https://app.dforce.network/#/lending)

| Name                       | Address                                    |
| -------------------------- | ------------------------------------------ |
| iWBTC                      | 0x5812fCF91adc502a765E5707eBB3F36a07f63c02 |
| iETH                       | 0x5ACD75f21659a59fFaB9AEBAf350351a8bfaAbc0 |
| iUSDT                      | 0x1180c114f7fAdCB6957670432a3Cf8Ef08Ab5354 |
| iUSDC                      | 0x2f956b2f801c6dad74E87E7f45c94f6283BF0f45 |
| iDAI                       | 0x298f243aD592b6027d4717fBe9DeCda668E3c3A8 |
| iBUSD                      | 0x24677e213DeC0Ea53a430404cF4A11a6dc889FCe |
| iHBTC                      | 0x47566acD7af49D2a192132314826ed3c3c5f3698 |
| DF                         | 0x431ad2ff6a9C365805eBaD47Ee021148d6f7DBe0 |
| iDF                        | 0xb3dc7425e63E1855Eb41107134D471DD34d7b239 |
| iGOLDx                     | 0x164315EA59169D46359baa4BcC6479bB421764b6 |
| iUNI                       | 0xbeC9A824D6dA8d0F923FD9fbec4FAA949d396320 |
| iLINK                      | 0xA3068AA78611eD29d381E640bb2c02abcf3ca7DE |
| iwstETH                    | 0xbfd291da8a403daaf7e5e9dc1ec0aceacd4848b9 |
| iMKR                       | 0x039E7Ef6a674f3EC1D88829B8215ED45385c24bc |
| iTUSD                      | 0x6E6a689a5964083dFf9FD7A0f788BAF620ea2DBe |
| iFrax                      | 0x71173e3c6999c2C72ccf363f4Ae7b67BCc7E8F63 |
| iFei                       | 0x47C19A2ab52DA26551A22e2b2aEED5d19eF4022F |
| iAAVE                      | 0x3e5CB932D7A1c0ca096b71Cc486b2aD7e0DC3D0e |
| iCRV                       | 0xe39672DFa87C824BcB3b38aA480ef684687CBC09 |
| irenFIL                    | 0x59055220e00da46C891283EA1d79363c769158b9 |
| Controller                 | 0x8B53Ab2c0Df3230EA327017C91Eb909f815Ad113 |
| MSDController              | 0x45677a101D70E9910C418D9426bC6c5874CE2Fd7 |
| nonStableInterestModel     | 0x0C3b23092E63709cBEE6dF82D9891AB7331284Cd |
| stableInterestModel        | 0x630a71ee05881A880DeF3B51e917169288d05f84 |
| StablePrimaryInterestModel | 0x8DfBF566566A8F29e86F490594Bd170162EE99fC |
| MainPrimaryInterestModel   | 0x48B5Ae58b7A03009235EbEB8Ecba061Bc9AD6d8C |
| MainSecondaryInterestModel | 0x330FD6d0B2bdC06eEB583D73Dba0F1D3C2fE508D |
| fixedInterestModel         | 0x786846d89736a5729e6a223f124bbb2377a8d337 |
| PriceOracle                | 0x34BAf46eA5081e3E49c29fccd8671ccc51e61E79 |
| Proxy\_Admin               | 0x4FF0455bcfBB5886607c078E0F43Efb5DE34DeF4 |
| RewardDistributor          | 0x8fAeF85e436a8dd85D8E636Ea22E3b90f1819564 |
| LendingData                | 0x6b5c49e9B452037489d0067D333e7FFEda4D9493 |
| USX                        | 0x0a5E677a6A24b2F1A2Bf4F3bFfC443231d2fDEc8 |
| EUX                        | 0xb986F3a2d91d3704Dc974A24FB735dCc5E3C1E70 |
| xBTC                       | 0x527Ec46Ac094B399265d1D71Eff7b31700aA655D |
| xETH                       | 0x8d2Cb35893C01fa8B564c84Bd540c5109d9D278e |
| iUSX                       | 0x1AdC34Af68e970a93062b67344269fD341979eb0 |
| iEUX                       | 0x44c324970e5CbC5D4C3F3B7604CbC6640C2dcFbF |
| ixBTC                      | 0x4013e6754634ca99aF31b5717Fa803714fA07B35 |
| ixETH                      | 0x237C69E082A94d37EBdc92a84b58455872e425d6 |
| iMUSX                      | 0xd1254d280e7504836e1B0E36535eBFf248483cEE |
| iMEUX                      | 0x591595Bfae3f5d51A820ECd20A1e3FBb6638f34B |
| iMxBTC                     | 0xfa2e831c674B61475C175B2206e81A5938B298Dd |
| iMxETH                     | 0x028DB7A9d133301bD49f27b5E41F83F56aB0FaA6 |

* [**Synthetic Pool**](https://app.dforce.network/#/lending) **(Caution! Deprecated)**

| Name               | Address                                    |
| ------------------ | ------------------------------------------ |
| Controller         | 0x3bA6e5e5dF88b9A88B2c19449778A4754170EA17 |
| Reward distributor | 0xcf4ad4da361671dc84be51a6c1131eaf84926e00 |
| iUSX               | 0xF54954BA7e3cdFDA23941753b48039aB5192AEa0 |
| iEUX               | 0xab9C8C81228aBd4687078EBDA5AE236789b08673 |
| xTSLA              | 0x8dc6987F7D8E5aE9c39F767A324C5e46C1f731eB |
| iMxTSLA            | 0xa4C13398DAdB3a0A7305647b406ACdCD0689FCC5 |
| xAAPL              | 0xc4Ba45BeE9004408403b558a26099134282F2185 |
| iMxAAPL            | 0x3481E1a5A8014F9C7E03322e4d4532D8ec723409 |
| xAMZN              | 0x966E726853Ca97449F458A3B012318a08B508202 |
| iMxAMZN            | 0xaab2BAb88ceeDCF6788F45885155B278faD09110 |
| xCOIN              | 0x32F9063bC2A2A57bCBe26ef662Dc867d5e6446d1 |
| iMxCOIN            | 0xb0ffBD1E81B60C4e8a8E19cEF3A6A92fe18Be86D |
| LendingData        | 0x52ed0A880EdA217052E1fae4333Ba1F4abfe2ac3 |
| {% endtab %}       |                                            |

{% tab title="Binance Smart Chain" %}

* [**General Pool**](https://app.dforce.network/#/lending)

<table><thead><tr><th width="201.06914095623245">Name</th><th>Address</th></tr></thead><tbody><tr><td>iBTCB</td><td>0x0b66A250Dadf3237DdB38d485082a7BfE400356e</td></tr><tr><td>iBNB</td><td>0xd57E1425837567F74A35d07669B23Bfb67aA4A93</td></tr><tr><td>iETH</td><td>0x390bf37355e9dF6Ea2e16eEd5686886Da6F47669</td></tr><tr><td>iUSDT</td><td>0x0BF8C72d618B5d46b055165e21d661400008fa0F</td></tr><tr><td>iUSDC</td><td>0xAF9c10b341f55465E8785F0F81DBB52a9Bfe005d</td></tr><tr><td>iDAI</td><td>0xAD5Ec11426970c32dA48f58c92b1039bC50e5492</td></tr><tr><td>iBUSD</td><td>0x5511b64Ae77452C7130670C79298DEC978204a47</td></tr><tr><td>iATOM</td><td>0x55012aD2f0A50195aEF44f403536DF2465009Ef7</td></tr><tr><td>DF</td><td>0x4A9A2b2b04549C3927dd2c9668A5eF3fCA473623</td></tr><tr><td>iDF</td><td>0xeC3FD540A2dEE6F479bE539D64da593a59e12D08</td></tr><tr><td>iGOLDx</td><td>0xc35ACAeEdB814F42B2214378d8950F8555B2D670</td></tr><tr><td>iUNI</td><td>0xee9099C1318cf960651b3196747640EB84B8806b</td></tr><tr><td>iADA</td><td>0xFc5Bb1E8C29B100Ef8F12773f972477BCab68862</td></tr><tr><td>iDOT</td><td>0x9ab060ba568B86848bF19577226184db6192725b</td></tr><tr><td>iFIL</td><td>0xD739A569Ec254d6a20eCF029F024816bE58Fb810</td></tr><tr><td>iXRP</td><td>0x6D64eFfe3af8697336Fc57efD5A7517Ad526Dd6d</td></tr><tr><td>iLTC</td><td>0xd957BEa67aaDb8a72061ce94D033C631D1C1E6aC</td></tr><tr><td>iLINK</td><td>0x50E894894809F642de1E11B4076451734c963087</td></tr><tr><td>iCAKE</td><td>0xeFae8F7AF4BaDa590d4E707D900258fc72194d73</td></tr><tr><td>iBCH</td><td>0x9747e26c5Ad01D3594eA49ccF00790F564193c15</td></tr><tr><td>iXTZ</td><td>0x8be8cd81737b282C909F1911f3f0AdE630c335AA</td></tr><tr><td>Controller</td><td>0x0b53E608bD058Bb54748C35148484fD627E6dc0A</td></tr><tr><td>nonStableInterestModel</td><td>0x68d3ba6201a6BA098bfF4570ee501e27777518e7</td></tr><tr><td>stableInterestModel</td><td>0xfA7d42a1aCB2d8AbA554077db7B7dC1772058723</td></tr><tr><td>StablePrimaryInterestModel</td><td>0x53a03328F24a979999d8eD62dCD438ec6d28AF25</td></tr><tr><td>MainPrimaryInterestModel</td><td>0xB181F1f928a105CFc6ba487096D6B11142558300</td></tr><tr><td>MainSecondaryInterestModel</td><td>0x7F3A079b5aE25111ee778a42c00fF1F14CC36FC8</td></tr><tr><td>BNBLikeInterestModel</td><td>0x9b0FD221C2682A8990b41140a88fDAC2f17C7E27</td></tr><tr><td>CakeLikeInterestModel</td><td>0x0068afa287993C5498D041E25532476665c7BD25</td></tr><tr><td>PriceOracle</td><td>0x7dc17576200590c4d0d8d46843c41f324da2046c</td></tr><tr><td>Proxy_Admin</td><td>0x0800604DA276c1D5e9c2C7FEC0e3b43FAb1Ca61a</td></tr><tr><td>RewardDistributor</td><td>0x6fC21a5a767212E8d366B3325bAc2511bDeF0Ef4</td></tr><tr><td>MSD Controller</td><td>0x4601d9c8def18c101496dec0a4864e8751295bee</td></tr><tr><td>Fixed Interest model</td><td>0x0BCb6Be12022c1881031F86C502daA49909b74a1</td></tr><tr><td>LendingData</td><td>0x2B9B3F4D83eAD0EA412D354E3CCd8C9eA558ACD7</td></tr><tr><td>USX</td><td>0xB5102CeE1528Ce2C760893034A4603663495fD72</td></tr><tr><td>iUSX</td><td>0x7B933e1c1F44bE9Fb111d87501bAADA7C8518aBe</td></tr><tr><td>iMUSX</td><td>0x36f4C36D1F6e8418Ecb2402F896B2A8fEDdE0991</td></tr><tr><td>EUX</td><td>0x367c17D19fCd0f7746764455497D63c8e8b2BbA3</td></tr><tr><td>iEUX</td><td>0x983A727Aa3491AB251780A13acb5e876D3f2B1d8</td></tr><tr><td>iMEUX</td><td>0xb22eF996C0A2D262a19db2a66A256067f51511Eb</td></tr><tr><td>xBTC</td><td>0x20Ecc92F0a33e16e8cf0417DFc3F586cf597F3a9</td></tr><tr><td>ixBTC</td><td>0x219B850993Ade4F44E24E6cac403a9a40F1d3d2E</td></tr><tr><td>iMxBTC</td><td>0x6E42423e1bcB6A093A58E203b5eB6E8A8023b4e5</td></tr><tr><td>xETH</td><td>0x463E3D1e01D048FDf872710F7f3745B5CDF50D0E</td></tr><tr><td>ixETH</td><td>0xF649E651afE5F05ae5bA493fa34f44dFeadFE05d</td></tr><tr><td>iMxETH</td><td>0x6AC0a0B3959C1e5fcBd09b59b09AbF7C53C72346</td></tr></tbody></table>

* [**Synthetic Pool**](https://app.dforce.network/#/lending)

<table data-header-hidden><thead><tr><th width="206.6106806724087">Name</th><th>Address</th></tr></thead><tbody><tr><td>Name</td><td>Address</td></tr><tr><td>Controller</td><td>0xb6f29c4507A53A7Ab78d99C1698999dbCf33c800</td></tr><tr><td>Reward distributor</td><td>0xa28F287630184d3b5EeE31a5FE8dB0A63c4A6e2f</td></tr><tr><td>iUSX</td><td>0x911F90e98D5c5C3a3B0c6c37Bf6ea46D15eA6466</td></tr><tr><td>iEUX</td><td>0x8Af4f25019E00c64B5c9d4A49D71464d411c2199</td></tr><tr><td>xTSLA</td><td>0xf21259B517D307F0dF8Ff3D3F53cF1674EBeAFe8</td></tr><tr><td>iMxTSLA</td><td>0x45055315dfCCBC91aC7107300FAAd7Abb234E7b7</td></tr><tr><td>xAAPL</td><td>0x70D1d7cDeC24b16942669A5fFEaDA8527B744502</td></tr><tr><td>iMxAAPL</td><td>0x8633cEb128F46a6a8d5b9EceA5161e84127D3c0a</td></tr><tr><td>xAMZN</td><td>0x0326dA9E3fA36F946CFDC87e59D24B45cbe4aaD0</td></tr><tr><td>iMxAMZN</td><td>0x500F397FcEe86eBEE89592b38005ab331De94AfF</td></tr><tr><td>xCOIN</td><td>0x3D9a9ED8A28A64827A684cEE3aa499da1824BF6c</td></tr><tr><td>iMxCOIN</td><td>0x82279995B210d63fba31790c5C64E3FF5e37d1E0</td></tr><tr><td>LendingData</td><td>0xfABc3D9dAFb8a51b9C70db4ed530E4f17014dcA5</td></tr></tbody></table>
{% endtab %}

{% tab title="Arbitrum" %}

| Name                                 | Address                                    |
| ------------------------------------ | ------------------------------------------ |
| Controller                           | 0x8E7e9eA9023B81457Ae7E6D2a51b003D421E5408 |
| StablePrimaryInterestModel           | 0xAF72329e42d0be8bee137Bc3420f20Fc04a49eFb |
| MainPrimaryInterestModel             | 0xbFFA37B585B7AcF7Ed8A93D03506e794A8Ee6d50 |
| MainSecondaryInterestModel           | 0x8E59F17b90D9422CdAACE49A8912386CF1F0Bb9C |
| MSD Controller                       | 0x38a5585d347E8DFc3965C1914498EAfbDeD7c5Ff |
| <p></p><p>Fixed Interested Model</p> | 0x96429fD3a3b29C918c3734b86871142aAA6ce2fd |
| Reward Distributor                   | 0xF45e2ae152384D50d4e9b08b8A1f65F0d96786C3 |
| iWBTC                                | 0xD3204E4189BEcD9cD957046A8e4A643437eE0aCC |
| DF                                   | 0xaE6aab43C4f3E0cea4Ab83752C278f8dEbabA689 |
| iDF                                  | 0xaEa8e2e7C97C5B7Cd545d3b152F669bAE29C4a63 |
| iETH                                 | 0xEe338313f022caee84034253174FA562495dcC15 |
| iUSDC                                | 0x8dc3312c68125a94916d62B97bb5D925f84d4aE0 |
| iUSDT                                | 0xf52f079Af080C9FB5AFCA57DDE0f8B83d49692a9 |
| iDAI                                 | 0xf6995955e4B0E5b287693c221f456951D612b628 |
| iUNI                                 | 0x46Eca1482fffb61934C4abCA62AbEB0b12FEb17A |
| iLINK                                | 0x013ee4934ecbFA5723933c4B08EA5E47449802C8 |
| iFRAX                                | 0xb3ab7148cCCAf66686AD6C1bE24D83e58E6a504e |
| iAAVE                                | 0x7702dC73e8f8D9aE95CF50933aDbEE68e9F1D725 |
| iCRV                                 | 0x662da37F0B992F58eF0d9b482dA313a3AB639C0D |
| iwstETH                              | 0xa8bAd6CE1937F8e047bcA239Cff1f2224B899b23 |
| USX                                  | 0x641441c631e2F909700d2f41FD87F0aA6A6b4EDb |
| EUX                                  | 0xC2125882318d04D266720B598d620f28222F3ABd |
| iUSX                                 | 0x0385F851060c09A552F1A28Ea3f612660256cBAA |
| iEUX                                 | 0x5675546Eb94c2c256e6d7c3F7DcAB59bEa3B0B8B |
| iMUSX                                | 0xe8c85B60Cb3bA32369c699015621813fb2fEA56c |
| iMEUX                                | 0x5BE49B2e04aC55A17c72aC37E3a85D9602322021 |
|                                      |                                            |
| {% endtab %}                         |                                            |

{% tab title="Optimism" %}

| Name                         | Address                                    |
| ---------------------------- | ------------------------------------------ |
| Controller                   | 0xA300A84D8970718Dac32f54F61Bd568142d8BCF4 |
| StablePrimaryInterestModel   | 0x40BE37096ce3b8A2E9eC002468Ab91071501C499 |
| StableSecondaryInterestModel | 0x5f7CA155cd53f552e60f8D1B088D6e4CA5885c35 |
| MainPrimaryInterestModel     | 0xec85F77104Ffa35a5411750d70eDFf8f1496d95b |
| MainSecondaryInterestModel   | 0x1EE116B869eCc7cd13C629a8a2Ae39Fa361265CF |
| MSD controller               | 0x9E8B68E17441413b26C2f18e741EAba69894767c |
| Fixed Interested Model       | 0xC5b1EC605738eF73a4EFc562274c1c0b6609cF59 |
| Reward Distributor           | 0x870ac6a76A30742800609F205c741E86Db9b71a2 |
| iWBTC                        | 0x24d30216c07Df791750081c8D77C83cc8b06eB27 |
| iETH                         | 0xA7A084538DE04d808f20C785762934Dd5dA7b3B4 |
| iUSDC                        | 0xB344795f0e7cf65a55cB0DDe1E866D46041A2cc2 |
| iUSDT                        | 0x5d05c14D71909F4Fe03E13d486CCA2011148FC44 |
| iDAI                         | 0x5bedE655e2386AbC49E2Cc8303Da6036bF78564c |
| iLINK                        | 0xDd40BBa0faD6810A7A09e8Ccca9bCe1E48B28Ece |
| iAAVE                        | 0xD65a18dAE68C846297F3038C93deea0B181288d5 |
| iCRV                         | 0xED3c20d047D2c57C3C6DD862C9FDd1b353Aff36f |
| iDF                          | 0x6832364e9538Db15655FA84A497f2927F74A6cE6 |
| iOP                          | 0x7702dC73e8f8D9aE95CF50933aDbEE68e9F1D725 |
| isUSD                        | 0x1f144cD63d7007945292EBCDE14a6Df8628e2Ed7 |
| iwstETH                      | 0x4B3488123649E8A671097071A02DA8537fE09A16 |
| DF                           | 0x9e5AAC1Ba1a2e6aEd6b32689DFcF62A509Ca96f3 |
| USX                          | 0xbfD291DA8A403DAAF7e5E9DC1ec0aCEaCd4848B9 |
| iUSX                         | 0x7e7e1d8757b241Aa6791c089314604027544Ce43 |
| iMUSX                        | 0x94a14Ba6E59f4BE36a77041Ef5590Fe24445876A |
|                              |                                            |
| {% endtab %}                 |                                            |

{% tab title="Polygon" %}

| Name                         | Address                                    |
| ---------------------------- | ------------------------------------------ |
| Controller                   | 0x52eaCd19E38D501D006D2023C813d7E37F025f37 |
| StablePrimaryInterestModel   | 0x6Bf21BF8cB213997ac0F3A3b1feD431E2BD0C45a |
| StableSecondaryInterestModel | 0xA300A84D8970718Dac32f54F61Bd568142d8BCF4 |
| MainPrimaryInterestModel     | 0x428e1914404dbFf52bD8C7Baed9719cc5eD181be |
| MainSecondaryInterestModel   | 0xA2c3996a9DbAFD5B23f5f8f5aa6CAC1B9c346059 |
| MSD controller               | 0x40BE37096ce3b8A2E9eC002468Ab91071501C499 |
| Fixed Interested Model       | 0x369Da886fC07B6d5ee5F1bb471d4f8E7833526F9 |
| Reward Distributor           | 0x47C19A2ab52DA26551A22e2b2aEED5d19eF4022F |
| iWBTC                        | 0x94a14Ba6E59f4BE36a77041Ef5590Fe24445876A |
| iWETH                        | 0x0c92617dF0753Af1CaB2d9Cc6A56173970d81740 |
| iUSDC                        | 0x5268b3c4afb0860D365a093C184985FCFcb65234 |
| iUSDT                        | 0xb3ab7148cCCAf66686AD6C1bE24D83e58E6a504e |
| iDAI                         | 0xec85F77104Ffa35a5411750d70eDFf8f1496d95b |
| iAAVE                        | 0x38D0c498698A35fc52a6EB943E47e4A5471Cd6f9 |
| iCRV                         | 0x7D86eE431fbAf60E86b5D3133233E478aF691B68 |
| iDF                          | 0xcB5D9b6A9BA8eA6FA82660fAA9cC130586F939B2 |
| iMATIC                       | 0x6A3fE5342a4Bd09efcd44AC5B9387475A0678c74 |
| DF                           | 0x08C15FA26E519A78a666D19CE5C646D55047e0a3 |
| USX                          | 0xbfD291DA8A403DAAF7e5E9DC1ec0aCEaCd4848B9 |
| EUX                          | 0x448BBbDB706cD0a6AB74fA3d1157e7A33Dd3A4a8 |
| iUSX                         | 0xc171EBE1A2873F042F1dDdd9327D00527CA29882 |
| iEUX                         | 0x15962427A9795005c640A6BF7f99c2BA1531aD6d |
|                              |                                            |
| {% endtab %}                 |                                            |

{% tab title="Conflux eSapce" %}

| Name                         | Address                                    |
| ---------------------------- | ------------------------------------------ |
| controller                   | 0xA377eCF53253275125D0a150aF195186271f6a56 |
| msdController                | 0x13c0361698A38Ec1200C8BEC722F4D9aD0A2f558 |
| stablePrimaryInterestModel   | 0x3BbB16351059D7405b2C41D9Fb9B89d71A8A1A4f |
| stableSecondaryInterestModel | 0xa4e5ebEdcD1129Ed30C77644a70F4dd3c2d482cc |
| mainPrimaryInterestModel     | 0x9d18008Da36A66c7535d8fdbEF36465e535ed148 |
| mainSecondaryInterestModel   | 0xEF7b35Aab3C0Dd3103c707656bFCA9E5eA48D83b |
| fixedInterestRateModel       | 0xBba57759378967398Bb6268A57676958Ae7Bd826 |
| USX                          | 0x422a86f57b6b6F1e557d406331c25EEeD075E7aA |
| rewardDistributor            | 0x3482f35B866E24D85AC29FfdbcD4A89EC65288c0 |
| iWBTC                        | 0xE08020a6517c1AD321D47c45Efbe1d76F5035d75 |
| iETH                         | 0x620e8Ed48945d97CBea0B794F50E5e51950EbA24 |
| iCFX                         | 0x25CCd7E60550EF32266fA90441BcE2BA742d88bc |
| iUSDT                        | 0xC80aD49191113d31fe52427c01A197106ef5EB5b |
| iUSDC                        | 0xb88DC5AaE0C26903230ebc9a6fBAb8D511AF9897 |
| iUSX                         | 0x6f87b39a2e36F205706921d81a6861B655db6358 |

{% endtab %}
{% endtabs %}


# Glossary

Terms used throughout the documentation may be unfamiliar to developers. Below we list some common terms that will help with your understanding.

| Term                  | Description                                                                                                                                                                                                                                         |
| --------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Adequacy Ratio        | Represents the ratio between total collateral multiplied by the LTV, and the borrowed principal multiplied 1/Borrow\_Factor\*\*. When the Adequacy Ratio goes below 1, the loan is undercollateralized and can be liquidated.                       |
| Exchange Rate         | Each iToken is convertible into an ever increasing quantity of the underlying asset, as interest accrues in the market. The exchange rate represents the real-time exchanging ratio between iToken and the underlying asset.                        |
| Loan To Value         | The maximum borrowing power of a specific collateral specified per collateral and expressed in percentage points.                                                                                                                                   |
| Borrow Factor         | The discount on LTV when borrowing asset, specified per borrowing asset and expressed in percentage points.                                                                                                                                         |
| Close Factor          | The maximum percentage of outstanding borrow of the underwater borrows when a liquidation occurs.                                                                                                                                                   |
| Liquidation Incentive | When a liquidation occurs, a liquidator may repay some or all of an outstanding borrow on behalf of a borrower and in return receive a discounted amount of collateral held by the borrower; this discount is defined as the liquidation incentive. |
| Supply Capacity       | The maximum supplying amount of collateral. If the capacity meets, no more supply is permitted.                                                                                                                                                     |
| Borrow Capacity       | The maximum borrowing amount of borrow asset. If the capacity meets, no more borrows are permitted.                                                                                                                                                 |
| Distribution Speed    | The total amount of reward token distributes in one block.                                                                                                                                                                                          |
| Distribution Factor   | The distribution factor defines the weighted factor of reward speed for each asset.                                                                                                                                                                 |
| Reserve Factor        | The reserve factor defines the portion of borrower interest that is converted into protocol profits.                                                                                                                                                |

\*\*Adequacy Ratio is calculated as followed,

<div align="left"><img src="/files/-M_KuyAQriHtlamx2coZ" alt=""></div>


# Vaults

Vaults can be tailor-made to support different collaterals and use cases with different risk profiles.

#### Contracts

{% tabs %}
{% tab title="Mainnet" %}

| Name                   | Address                                    |
| ---------------------- | ------------------------------------------ |
| Controller             | 0x1E96e916A64199069CcEA2E6Cf4D63d30a61b93d |
| rewardDistributor      | 0x5ebc758AC96316Fb3c80AbFF549962f305A54a30 |
| PriceOracleV2          | 0x486BeBDE6ae82a58631AaAeD044DCF8c2fB3565a |
| AggregatorProxy        | 0x5a8B3B8b381e735042cc6E7cD925268f9a593B01 |
| LPCurveAggregatorModel | 0x0288eF3966f02d516c482b09b4f890c31E935b2a |
| Treasury               | 0x56570496C5fD443e49eb5635A6C3E30C9A54c3CA |
| VaultData              | 0x4779f4b09C74b9Ed31aBe60E1cfC3B1b4832F128 |
| vCRV USX/3CRV          | 0xd8d07A8ab4F6a1cC4cF86b3cB11b78A7C1e701ad |
| vMUSX                  | 0x53BF3c82f62B152800E0152DB743451849F1aFF9 |
| {% endtab %}           |                                            |

{% tab title="Arbitrum" %}

| Name                   | Address                                    |
| ---------------------- | ------------------------------------------ |
| Controller             | 0x50210A88217d1dD9e7FBc3E4a927Cc55829a38eB |
| rewardDistributor      | 0x00b006A1Db650f41aaA367F353572c869b373592 |
| PriceOracleV2          | 0x15962427A9795005c640A6BF7f99c2BA1531aD6d |
| AggregatorProxy        | 0x0D535ca4C27f0C25a20e2D474Ee3E99c1316BAfe |
| LPCurveAggregatorModel | 0xB047039B2922B5DAFd527860235DBA6C3bDa7F9A |
| Treasury               | 0x5ebc758AC96316Fb3c80AbFF549962f305A54a30 |
| VaultData              | 0x3Fc9F017fbF4251f006163B7CAd6601fC1A8Aa71 |
| vCRV USX/2CRV          | 0x3EA2c9daa2aB26dbc0852ea653f99110c335f10a |
| vMUSX                  | 0x8A49dbE58CE2D047D3453a3ee4f0F245b7195f67 |
| {% endtab %}           |                                            |

{% tab title="BSC" %}
Coming soon!
{% endtab %}
{% endtabs %}


# dForce Trade

[dForce Trade](https://trade.dforce.network/) is a DEX aggregator to search for the best trading price and aggregate proper liquidity across multiple platforms to deliver an optimized trade.&#x20;

Currently, dForce Trade has been integrated with 8 DEXes including Uniswap, Curve, Sushiswap, Balancer, Kyber, Oasis, S.Finance, Unisave, with almost 100% coverage of ERC20 token trades.&#x20;

Link: <https://app.dforce.network/#/trade>

Github: <https://github.com/dforce-network>

{% tabs %}
{% tab title="Ethereum Mainnet" %}

| Name         | Contract                                   |
| ------------ | ------------------------------------------ |
| DForceSplit  | 0xC9Ef75CB4C0e3402529d12eD5FFC5206d253Ad60 |
| {% endtab %} |                                            |

{% tab title="Binance Smart Chain" %}

| Name          | Contract                                   |
| ------------- | ------------------------------------------ |
| DForceSplit   | 0x5CD4B2F0891bf450d42aBae62315027a50e0afa3 |
| {% endtab %}  |                                            |
| {% endtabs %} |                                            |

### How to interact with dForce trade by contract

**function getExpectedReturn()**

get expected target returns by target token.

```
function getExpectedReturn(
        IERC20 fromToken,
        IERC20 toToken,
        uint256 amount,
        uint256 parts,
        uint256 flags
    )
        public
        view
        returns(
            uint256 returnAmount,
            uint256[] memory distribution
        );
```

**function swap()**

swap tokens by expected returns.

```
function swap(
        IERC20 fromToken,
        IERC20 toToken,
        uint256 amount,
        uint256 minReturn,
        uint256[] memory distribution,
        uint256 flags
    ) public payable;
```


# Liquidity Mining

Active liquidity mining contracts are all here

### How to calculate staking annual yield?

For example, in USX/DF staking pool,

1. Get the price in USD of all assets, in this case, that would be USX and DF, assumption that the price is `pUSX` and `pDF`;
2. Get total balance of USX and DF deposited in the LP contract, say `tbUSX` and `tbDF`;
3. Calculate 1 LP token value should be:

   `vLP = (pUSX * tbUSX + pDF * tbDF) / LP.totalSupply;`
4. Get total balance deposited in staking contract, say `tbLP`, then the total value of deposited LP tokens should be:

   `tvLP = vLP * tbLP;`
5. Get reward rate from staking contract, this variable represents the distributed amount of reward token per block, in Ethereum Mainnet, the block period is \~13 seconds (for BSC, it's about 3 seconds per block), so distribution value per year is:

   `tvR = pDF * RR(RewardRate) * blockPerYear;`

   `blockPerYear = 3600 * 24 * 365 / block_peroid;`
6. The annual yield should be:

   `annual_yield = tvR / tvLP * 100%;`

### Deployed Contracts

{% tabs %}
{% tab title="Mainnet" %}

| Name                 | Address                                                                                                               |
| -------------------- | --------------------------------------------------------------------------------------------------------------------- |
| **Reward Treasury**  | [0x1D22AFC7dc4Bf336532dd6248d453C647CecA1B3](https://etherscan.io/address/0x1D22AFC7dc4Bf336532dd6248d453C647CecA1B3) |
| **UNISWAP** - ETH/DF | [0xFe599129B3018eE3231334d02E0b869a19dB3F8b](https://etherscan.io/address/0xFe599129B3018eE3231334d02E0b869a19dB3F8b) |
| {% endtab %}         |                                                                                                                       |

{% tab title="BSC" %}

| Name                  | Address                                                                                                              |
| --------------------- | -------------------------------------------------------------------------------------------------------------------- |
| **Reward Treasury**   | [0x959715da68DC2D1329F4bb34e13Da03FE10c374b](https://bscscan.com/address/0x959715da68DC2D1329F4bb34e13Da03FE10c374b) |
| **DODOEX** - USX/BUSD | [0x8d61b71958dD9Df6eAA670c0476CcE7e25e98707](https://bscscan.com/address/0x8d61b71958dD9Df6eAA670c0476CcE7e25e98707) |
| {% endtab %}          |                                                                                                                      |

{% tab title="Arbitrum" %}

| Name                  | Address                                                                                                              |
| --------------------- | -------------------------------------------------------------------------------------------------------------------- |
| **Reward Treasury**   | [0xc0Dc7C5057141C9065bd9bedf79fd4E9EA69a739](https://arbiscan.io/address/0xc0Dc7C5057141C9065bd9bedf79fd4E9EA69a739) |
| **DODOEX** - USX/USDC | [0xAa6E14e99E3b7B71ca163AA82384Ed68F9067Dd7](https://arbiscan.io/address/0xAa6E14e99E3b7B71ca163AA82384Ed68F9067Dd7) |
| **DODOEX** - USX/EUX  | [0xd0BaA984Cd2D25A555710B4f199e873Af668866a](https://arbiscan.io/address/0xd0BaA984Cd2D25A555710B4f199e873Af668866a) |
| Curve - USX/2CRV      | [0xcdc46a2393706b33ee22a1b8316b8348312212b2](https://arbiscan.io/address/0xcdc46a2393706b33ee22a1b8316b8348312212b2) |

{% endtab %}

{% tab title="Optimism" %}

<table><thead><tr><th>Name</th><th>Address</th><th data-hidden></th></tr></thead><tbody><tr><td><strong>Reward Treasury</strong></td><td><a href="https://optimistic.etherscan.io/address/0x7B598182875Df02236eEa8a3e264f9376511D5ad">0x7B598182875Df02236eEa8a3e264f9376511D5ad</a></td><td></td></tr><tr><td></td><td></td><td></td></tr></tbody></table>
{% endtab %}

{% tab title="Polygon" %}

<table><thead><tr><th>Name</th><th>Address</th><th data-hidden></th></tr></thead><tbody><tr><td><strong>Reward Treasury</strong></td><td><a href="https://polygonscan.com/address/0x958b0166B9De547a1998cc06A55c4fa5B4304d0d">0x958b0166B9De547a1998cc06A55c4fa5B4304d0d</a></td><td></td></tr><tr><td></td><td></td><td></td></tr></tbody></table>
{% endtab %}
{% endtabs %}

### Reward Distributor

#### Function getAllRecipients()

Returns all activated staking contracts.

```
  function getAllRecipients()
    public
    view
    returns (address[] memory _allRecipients)
```

### Staking Pool

Every staking pool shares the same interface for users depositing/withdraw LP tokens and claim their rewards.

#### Variables

| Name                | Descriptions                                                                                                     |
| ------------------- | ---------------------------------------------------------------------------------------------------------------- |
| address rewardToken | reward token address.                                                                                            |
| uint256 rewardRate  | amount of reward token will be distributed per block.                                                            |
| uint256 startTime   | <p>timestamp for starting to distribute reward,</p><p>who deposits before this time will not get any reward.</p> |

#### function rewardDistributed()

Returns the total distributed amount since start time.

```
function rewardDistributed() public view returns (uint256);
```

#### function earned()

Returns the up-to-date amount of reward to be claimed.

```
function earned(address _account) public view returns (uint256);
```

#### function stake()

Deposit LP token into staking pool.

```
function stake(uint256 _amount) public;
```

#### function withdraw()

Withdraw LP token from staking pool.

```
function withdraw(uint256 _amount) public;
```

#### function getReward()

Claim rewards.

```
function getReward() public;
```

#### function exit()

Withdraw all LP tokens and claim rewards.

```
function exit() external;
```


# Free Staking

Free Staking: [0x41602ccf9b1F63ea1d0Ab0F0A1D2F4fd0da53f60](https://etherscan.io/address/0x41602ccf9b1F63ea1d0Ab0F0A1D2F4fd0da53f60)


# Lock-up Staking

veDF: [0x6050B7040cF4Ae3e60c3c1A5d0367B565a1460C1](https://etherscan.io/address/0x6050B7040cF4Ae3e60c3c1A5d0367B565a1460C1)

veDFManager: [0xc0d7f11455aacD225c6fd1Be7dDF0bCf93b31cb3](https://etherscan.io/address/0xc0d7f11455aacD225c6fd1Be7dDF0bCf93b31cb3)


