Workflow Overview
Last updated
Last updated
Side Finance defines a liquidity pool-based lending protocol that provides loans to BTC holders and generates returns for loan providers. The loan assets are pooled in smart contracts on the Side Chain and offered to borrowers without involving any third party holding the collateral during the loan period. At a high level, the protocol proceeds as follows:
Loan Assignment
The borrower sends a loan request to the Lending Contract, including a hash of loan_secret
and the Maturity Time to initiate the loan. The Lending Contract then assigns a Collateral Vault that is specifically created for the Borrower to lock their collateral.
The Lending Contract computes the interest rate and liquidation price based on the current market price, and pre-allocates the loan amount from available liquidity for the Borrower.
To claim the loan, the borrower deposits the BTC collateral into the assigned Collateral Vault and submits the loan_secret
along with pre-signed Contract Execution Transactions (CETs) and an adaptor signature to the Lending Contract. One of the CETs will be executed in the event of liquidation triggered by the depreciation of the BTC collateral value.
The Lending Contract verifies the validity of the adaptor signature and checks whether the hash of loan_secret
in the Bitcoin lock script from the previous step matches the one in the loan request to the Lending Contract. If the adaptor signature is valid and the hashes match, the borrower is able to claim the pre-allocated loan amount. The BTC collateral remains securely locked in the Collateral Vault until the loan reaches the Maturity Time.
Repayment
At some point before the Maturity Time, the borrower initiates repayment. At that time, the Borrower generates a repayment_secret
and sends the loan amount with interest to the Repayment Escrow, using the hash of repayment_secret
and a Partially Signed Bitcoin Transaction (PSBT).
The Lending Contract verifies the repayment and produces a SignRequest for the DCA. The DCA then retrieves the required details and partially signs the adaptor signature of the Bitcoin transaction, submitting it back to the Lending Contract. The contract aggregates these partial signatures from both the Borrower and the DCA into a complete signature.
With the aggregated signature and the repayment_secret
, the borrower can now claim the collateral locked in the Collateral Vault. When the borrower claims the collateral, the repayment_secret
is revealed.
Once the repayment_secret
is revealed, the DCA (or in fact, any user) can withdraw the repaid loan funds from the Repayment Escrow into the Lending Contract, finalizing the process.
Liquidation
see Section 3.5
Final Timeout
A final_timeout
protects the Borrower in the event that the Lending Contract or Side Chain becomes unresponsive.
In the following sections, we will provide more details of each step involved in the lending process as outlined above.