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.
All standard EIP20 methods are implemented, such as
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.
Describes basic interfaces to integrate with the protocol, such as deposit as collaterals and take a loan, etc.
Caller deposits underlying asset and gets iToken in exchange according to the exchange rate.
function mint(address recipient, uint256 mintAmount);
Caller deposits underlying asset, gets iToken in exchange according to the exchange rate and make the asset as collateral.
function mintForSelfAndEnterMarket(uint256 mintAmount);
Caller redeems specified iToken and gets underlying asset.
function redeem(address from, uint256 redeemTokens);
Redeem by the amount of underlying asset as input.
function redeemUnderlying(address _from, uint256 _redeemUnderlying);
Take a loan if the caller has enough deposits as collateral.
function borrow(uint256 _borrowAmount);
Repay a loan.
function repayBorrow(uint256 _repayAmount);
Repay a loan on behalf of the borrower.
function repayBorrowBehalf(address _borrower, uint256 _repayAmount);
Repay a loan on behalf of the borrower and seize the same value of iToken plus incentive as a reward.
Update asset's borrow and supply interests, push total borrows and reserves up-to-date.
function updateInterest() external override returns (bool)；
Gets the newest exchange rate by accruing interest.
function exchangeRateCurrent() external returns (uint256);
Gets the stored exchange rate without accruing interest.
function exchangeRateStored() external view override returns (uint256);
Gets the up-to-date underlying balance of a depositor.
function balanceOfUnderlying(address _account) external returns (uint256);
Gets the current total borrows by accruing interest.
function totalBorrowsCurrent() external returns (uint256);
Gets account's up-to-date borrow balance.
function borrowBalanceCurrent(address _user) external returns (uint256);
Gets the stored borrow balance of an account.
function borrowBalanceStored(address _user) external view returns (uint256);
Gets borrow rate per block, annual yield = pow (borrowRatePerBlock, blockPerYear);
function borrowRatePerBlock() external view returns (uint256);
Get supply rate per block, annual yield = pow (supplyRatePerBlock, blockPerYear);
function supplyRatePerBlock() external view returns (uint256);
Get cash of underlying in the protocol.
function getCash() external view returns (uint256);