Liquidation mechanism

If the value of the collateral associated with a user's Loan Module experiences a significant decline and the user fails to timely settle interest payments or bolster collateral funds, triggering a drop below the stipulated minimum pledge rate, Keepers have the authority to submit a liquidation request to the Loan Module []. Keepers simply need to adhere to the liquidation amount broadcasted by the Insurance Module, along with the corresponding Module's address. They can then execute a direct transfer to this address. Upon consensus agreement from the Indexer, the Module undergoes unlocking, transforming into a White Module. Subsequently, the Keeper initiates a withdrawal request, securing the escalated collateral. The clearing fee, configured within the Insurance contract script by the Yala Foundation, presents an opportunity for Keepers to acquire collateral at a discounted rate, capitalizing on arbitrage gains.

AMM for liquidation

Facing the high volatility of the BTC market, we explored ways to mitigate borrowers' losses when asset depreciation triggers liquidation.

The Auto Market Maker[@], widely adopted in decentralized exchanges (DEX), offers a solution by automatically setting buy and sell prices through basic algorithms, functioning like an automated trader. This innovation addresses the cost and efficiency challenges of transitioning from traditional exchanges to DEXs, facilitating seamless, unauthorized, and decentralized trading of digital assets.

Curve's novel approach employs a reverse AMM within their latest protocol, Curve Stablecoin[] , to tackle liquidation more effectively than traditional stablecoin or lending protocols like MakerDAO, Liquity, and Compound. By leveraging its AMM, Curve stablecoin enhances liquidation efficiency, significantly lowering the risk of accruing bad debts. Furthermore, the AMM aids in absorbing liquidated assets, thereby dampening market volatility induced by mass asset sales. This represents a key advancement over older stablecoin and lending models, offering a more resilient solution to liquidation challenges.

Under the BRC-20 modular protocol, there are several issues to consider when using AMM for clearing, including the black module cannot withdraw when the conditions are not met, and the flexibility of Defi under ERC cannot be realized within the module. So we design the progressive AMM clearing process applicable to Yala Finance.

At this point there is the function:

substituting into Eq. (1) and Eq. (2), we get

solves to:


The complete AMM constant product formula is then obtained:

The external price changes at an extremely slow rate, which means that the spread between the external price and the internal price of the Module at a given time is negligibly small.

The internal price of the Module follows the external price, and since the spread between the internal and external prices of the AMM is negligible, the keepers do not incur losses due to the spread during the trading process.

According to Uniswap V3 (6.13), we can get the liquidation completion point estimation function:

Last updated