eTokens
[Draft version]
Introduction
Each asset supported by the Lendland Protocol is integrated through a eToken contract, which is an EIP-20 compliant representation of balances supplied to the protocol. By minting eTokens, users (1) earn interest through the eToken's exchange rate, which increases in value relative to the underlying asset, and (2) gain the ability to use eTokens as collateral.
eTokens are the primary means of interacting with the Lendland Protocol; when a user mints, redeems, borrows, repays a borrow, liquidates a borrow, or transfers eTokens, she will do so using the eToken contract.
FAQ
How to earn interest?
Each market has its own Supply interest rate (APR). Interest isn't distributed; instead, simply by holding eTokens, you'll earn interest.
eTokens accumulates interest through their exchange rate — over time, each eToken becomes convertible into an increasing amount of its underlying asset, even while the number of eTokens in your wallet stays the same.
Need I calculate the exchange rate?
When a market is launched, the eToken exchange rate (how much RNA one eRNA is worth) begins at 0.020000 — and increases at a rate equal to the Lendland market interest rate. For example, after one year, the exchange rate might equal 0.03.
Each user has the same eToken exchange rate; there’s nothing unique to your wallet that you have to worry about.
How can I view my eToken?
Each eToken is visible on GeneChain Scan, and you should be able to view them in the list of tokens associated with your address.
eToken balances have been integrated into MetaMask Wallet; other wallets may add eToken support.
Can eToken be transferred?
Yes, but exercise caution! By transferring eTokens, you’re transferring your balance of the underlying asset inside the Lendland protocol. If you send a eToken to your friend, your balance (viewable in the Lendland Interface) will decline, and your friend will see their balance increase.
A eToken transfer will fail if the account has entered that eToken market and the transfer would have put the account into a state of negative liquidity.
Functionality
Mint
The mint function transfers an asset into the protocol, which begins accumulating interest based on the current Supply Rate for the asset. The user receives a quantity of eTokens equal to the underlying tokens supplied, divided by the current Exchange Rate.
function mint(uint mintAmount) returns (uint)
Redeem
The redeem function converts a specified quantity of eTokens into the underlying asset, and returns them to the user. The amount of underlying tokens received is equal to the quantity of eTokens redeemed, multiplied by the current Exchange Rate. The amount redeemed must be less than the user's Account Liquidity and the market's available liquidity.
function redeem(uint redeemTokens) returns (uint)
Redeem Underlying
The redeem underlying function converts eTokens into a specified quantity of the underlying asset, and returns them to the user. The amount of eTokens redeemed is equal to the quantity of underlying tokens received, divided by the current Exchange Rate. The amount redeemed must be less than the user's Account Liquidity and the market's available liquidity.
function redeemUnderlying(uint redeemAmount) returns (uint)
Borrow
The borrow function transfers an asset from the protocol to the user, and creates a borrow balance which begins accumulating interest based on the Borrow Rate for the asset. The amount borrowed must be less than the user's Account Liquidity and the market's available liquidity.
function borrow(uint borrowAmount) returns (uint)
Repay Borrow
The repay function transfers an asset into the protocol, reducing the user's borrow balance.
function repayBorrow(uint repayAmount) returns (uint)
Repay Borrow Behalf
The repay function transfers an asset into the protocol, reducing the target user's borrow balance.
function repayBorrowBehalf(address borrower, uint repayAmount) returns (uint)
Transfer
Transfer is an ERC-20 method that allows accounts to send tokens to other GeneChain addresses. A eToken transfer will fail if the account has entered that eToken market and the transfer would have put the account into a state of negative liquidity.
function transfer(address recipient, uint256 amount) returns (bool)
Liquidate Borrow
A user who has negative account liquidity is subject to liquidation by other users of the protocol to return his/her account liquidity back to positive (i.e. above the collateral requirement). 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.
A liquidator may close up to a certain fixed percentage (i.e. close factor) of any individual outstanding borrow of the underwater account. Liquidators must interact with each eToken contract in which they wish to repay a borrow and seize another asset as collateral. When collateral is seized, the liquidator is transferred eTokens, which they may redeem the same as if they had supplied the asset themselves. Users must approve each eToken contract before calling liquidate (i.e. on the borrowed asset which they are repaying), as they are transferring funds into the contract.
function liquidateBorrow(address borrower, uint amount, address collateral) returns (uint)
Last updated
Was this helpful?