-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added inital logic for interest calculation and updating of interest …
…and health-factor
- Loading branch information
Showing
5 changed files
with
121 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
use soroban_sdk::{Address, Env}; | ||
|
||
mod loan_pool { | ||
soroban_sdk::contractimport!( | ||
file = "../../target/wasm32-unknown-unknown/release/loan_pool.wasm" | ||
); | ||
} | ||
#[allow(dead_code)] | ||
pub const BASE_INTEREST_RATE: i128 = 200_000; // TODO: This should be based on what pool it is. Current 2 %. | ||
|
||
#[allow(dead_code, unused_variables)] | ||
pub fn get_interest(e: Env, pool: Address) -> i128 { | ||
let pool_client = loan_pool::Client::new(&e, &pool); | ||
//let available = pool_client.get_available_balance | ||
//let total = pool_client.get_total_balance | ||
//let borrowed_rate = (available - total) * decimal / total | ||
BASE_INTEREST_RATE | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
#![no_std] | ||
|
||
mod contract; | ||
mod interest; | ||
mod oracle; | ||
mod positions; | ||
mod storage_types; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters