-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: time handling for interest #17
Conversation
Teolhyn
commented
Aug 21, 2024
- Time (in ledger sequences) is now stored in loan manager storage
- add_interest calculates time between the present and last update to get correct amount of interest
- Added some unit tests to loan_pool
.storage() | ||
.persistent() | ||
.get(&key) | ||
.unwrap_or(current_ledger.into_val(&e)); // If there is no previous ledger, use current. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Googlasin mitä eroa on unwrap_or
ja unwrap_or_else
välillä koska en tiennyt. Ei tässä kohtaa väliä kumpaa käyttää, mutta jos toi else-haara olisi kallista laskea, niin unwrap_or_else
olisi helppo tapa optimoida.
@@ -109,7 +112,7 @@ impl LoanPoolTrait for LoanPoolContract { | |||
*/ | |||
let address = String::from_str( | |||
&e, | |||
"CCR7ARWZN4WODMEWVTRCMPPJJQKE2MBKUPJBSYWCDEOT3OLBPAPEGLPH", | |||
"CB6MHNR6FJMQHJZDWOKAU4KESR4OARLPZ4RMN57R55P2QUBH4QJENHLY", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tää oli kaiketi väliaikanen ratkasu?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Joo tämä juuri pitäisi korjata 'Store loan manager’s ID for liquidity pool' tiketissä.
let withdraw_args = vec![&e, user.to_val(), amount_2]; | ||
let _withdraw_result: (i128, i128) = | ||
e.invoke_contract(&contract_id, &Symbol::new(&e, "withdraw"), withdraw_args); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Solidit testit 👏