# 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;
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://developers.dforce.network/lend/lend-and-synth/msdtokens.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
