Borrowing
Borrowing transaction
Let
be the decrease in the
pool. This decrease is due to the borrower withdrawing
assets from the pool.
be the increase in the
pool.
be the increase in the
pool.
The value of
,
, and
is calculated from maintaining constant

So as
increases,
has to decrease ; when
increases,
has to decrease.
The maximum of
is when
:
The maximum of
is when
Let d be time duration from the time of user transaction to maturity time of pool in seconds
The borrower receives
assets from the pool.
The Debt that a borrower will have to repay before maturity is
with a constraint that there is a minimum interest debt to be paid by borrowers such that
The Collateral (w) that a borrower will have to lock is z_{max}+zd/2^25
For the borrowers, the more collateral they lock, the lower interest they have to pay. This reflects the fact that the higher the collateral locked, the less is the probability for the borrower to default at the maturity date. Thus, borrowers have the flexibility to decide their opportunity cost vs cost of loan profile at the time of borrowing assets from the pool.
The amount of collateral the borrower has to stake has a minimum value ofwhenis chosen so that enough collateral will always cover the amount borrowed. Similarly the debt has a minimum value whensuch that there is always a minimum interest payable by a borrower
Bob wants to borrow DAI using his collateral ETH. Suppose a LP initiates the DAI-ETH pool with similar parameters as mentioned in the previous lending transaction such that:
Now Bob wants to borrow 1000 DAI by depositing collateral in the form of ETH. So as per the AMM equation for a borrowing transaction:
Solving for
,
Solving for
,
Let
2592000 (duration of 30 days from the time of tx in seconds)
The annual interest rate that can be selected by Alice will have a range of
to
(where
is no. of sec in a year = 31556926).
In this case, Bob can select APR from 1% to 16%
Assuming Bob chose to pay annual interest of 10%
Interest value per second
Debt to be repaid by Bob=
Solving for
,
Collateral to be locked z_{max}+zd/2^25 = 0.469+0.18*2592000/33554432 = 0.4829 ETH
Bob now has the optionality to pay back his debt of 1008.2 DAI before maturity in order to unlock his locked collateral of 0.4829 ETH. In case Bob decides to default, his collateral will be automatically forfeited at maturity

Summarising:
Bob borrowed 1000 DAI from the pool before 1 month of pool expiry by depositing 0.4829 ETH as collateral. When Bob repays 1008.2 DAI before maturity of the pool, he will receive his collateral back. If Bob defaults on the borrowing, his locked collateral of 0.4829 ETH will be proportionately distributed to the lenders based on the Insurance tokens lenders hold.
Last modified 1yr ago