Loan Liquidation at the Limit: a Worked out Example
In this post, we build on a previous more abstract writeup and work out a numerical example that illustrates how Hoyu protocol operates at the boundary of its possibilities without creating bad loans.
Let us consider a pool (a trading market) for two generic tokens: ALT, which stands for altcoin, and CUR for currency. The reserves of the pool are 1 million ALT and 1 million CUR. This means that the price is 1 CUR/ALT. The Hoyu protocol supports a minimum collateral ratio (CR) of 110%. The loan-to-value (LTV) ratio is the inverse of the CR, which is 90% in this case if rounded down pessimistically. In other words, 90% is the highest LTV that the Hoyu protocol supports. Note that CR and LTV here are computed in terms of the reserve price (ie, the spot price), which is different from the liquidation price.
As we have seen in a previous blopost, this restriction limits the total sum of outstanding loans. For now, let's take the 7.8% total loan restriction as given. This means that all users combined may have at most 78,000 CUR loans outstanding, inclusive of all fees and interest, since
It is a pessimistic restriction, meaning that it guarantees that collateral liquidation covers the whole loan with a slight excess to account for rounding errors etc in the actual implementation of the protocol.
For simplicity, let's say that a single user owes 78,000 CUR to the protocol. Their collateral must at this point be at least
It turns out that to cover the outstanding 78,000 CUR, selling at least 84,854 ALT is needed which results in roughly 78,000.6 CUR according to the constant-product market maker formula
where are the reserves in the pool, is the amount of ALT that the user send to the pool, is the amount of CUR that the pool sends to the user, and represents the 0.3% fee for swaps.
Note that the reserve price (spot price) before the swap was 1 CUR/ALT, whereas the actual swap (liquidation) price is
As we saw in a previous blopost as well, the reserve (spot) price moves due to this swap, and after the swap (liquidation) it stands at
To sum up, we have seen that even when a maximum allowed sum is lent out by the protocol at a marginal collateral ratio or loan-to-value of 90%, there is enough collateral to cover the debt.