4 releases (breaking)
0.4.0 | Aug 13, 2021 |
---|---|
0.3.0 | Aug 6, 2021 |
0.2.0 | Aug 2, 2021 |
0.1.0 | Jul 16, 2021 |
#12 in #defi
21 downloads per month
115KB
3K
SLoC
Project Baru
Library to facilitate DeFi on liquid.
Loan Protocol
- The lender and borrower need to agree on the principal, loan_term, collateral of the loan contract.
- The borrower sends the lender the LoanRequest with the UTXO's to fund the collateral, collateral amount, borrower_address, borrower_public_key(not associated witht he borrower address).
- The lender receives the message and creates the loan transaction: inputs: principal_inputs: coming from the the lender collateral_inputs: coming from the borrower outputs: collateral_output: locked by the collateral output locking script (defined below) principal_output: locked to borrower address borrower_change_output lender_change_output fees.
- The loan transaction is unsigned, the lender sends it to the borrower to sign along with some secret values to enable repayment later on (blinding factors)
- The borrower verifies (fancy because of confidential transaction) the transaction and signs the collateral inputs.
- The borrower send the signed transaction to the lender.
- The lender signs the principal inputs.
- The lender broadcasts the loan transaction
Collateral Output Locking Script
if is_repayment {
if the tx that is using the collateral output as an input:
1. includes and output that pays the principal + interest to the lender
2. the sender is the borrower
return 1
else
return 0
} else {
//liquidation at expiration
if the current block number is < loan_term
return 0
if the sender is not the lender
return 0
return 1
}
Releases
We will release every Friday with the intention of frequently pushing out features and enhancements for Project Baru's stream-aligned team to use.
Steps
- Update the version number in Cargo.toml according to SemVer.
- Update the changelog and make sure that all breaking changes and new additions have been mentioned.
- Generate a GitHub release of the library's master branch.
- Publish on crates.io using the
cargo publish
subcommand.
Dependencies
~28–46MB
~588K SLoC