Skip to content

Commit

Permalink
Merge pull request #25 from comit-network/dynamic-liquidation
Browse files Browse the repository at this point in the history
Add dynamic price-based liquidation to loan protocol
  • Loading branch information
luckysori authored Jul 29, 2021
2 parents d8b46ce + ed0c504 commit db553d0
Show file tree
Hide file tree
Showing 4 changed files with 1,056 additions and 205 deletions.
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,27 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Added

- Dynamic liquidation branch to the loan protocol:
- New `async fn dynamic_liquidation_transaction()` API on `Lender1`.
It takes a message of the form `price:timestamp` and an oracle's signature on the hash of the message, so that a _lender_ can unilaterally liquidate the loan if the `price` falls below a threshold and the `timestamp` is past a certain time.
- `Lender0` constructor now requires blinding key of lender address and an oracle public key.

### Changed

- `loan::LoanResponse` fields:
- Made `timelock` private, but accessible via `LoanResponse::collateral_contract(&self).timelock()`.
- Made `transaction` private, accessible via getter.
- Made `collateral_amount` private, but accessible via getter.
- `loan::Borrower1` fields:
- Made `loan_transaction` private, but accessible via getter.
- Made `collateral_amount` private, but accessible via getter.
- `loan::Lender1` fields:
- Made `timelock` private, but accessible via getter.
- `fn liquidation_transaction()` API on `Lender1` is now `async`.
- Model the collateral contract's timelock as a `u32`.

## [0.1.1] - 2021-07-23

## [0.1.0] - 2021-07-16
Expand Down
2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ env_logger = "0.8.3"
hex = "0.4"
hmac = "0.10"
log = "0.4"
rand = "0.6"
rust_decimal = "1"
secp256k1 = { version = "0.20", features = [ "bitcoin_hashes", "rand" ] }
# TODO: See if we can remove this direct dependency
Expand All @@ -30,5 +31,6 @@ thiserror = "1"
[dev-dependencies]
elements-harness = { git = "https://github.com/comit-network/elements-harness" }
elements-rpc = { path = "./elements-rpc" }
rand_chacha = "0.1"
testcontainers = "0.12"
tokio = { version = "1", default-features = false, features = [ "macros" ] }
Loading

0 comments on commit db553d0

Please sign in to comment.