Skip to content

Commit

Permalink
Lend-market v2: execute ratios
Browse files Browse the repository at this point in the history
  • Loading branch information
ueco-jb committed Nov 21, 2023
1 parent c09fd1d commit 2001ae6
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions contracts/lending/market_v2/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,28 @@ mod execute {

use super::*;

/// Helper struct for return of [`charge_interest`] function
#[derive(Debug, Clone)]
pub struct Ratios<T> {
pub messages: Vec<SubMsg<T>>,
pub ctoken_ratio: Decimal,
pub debt_ratio: Decimal,
}

impl<T> Ratios<T> {
pub fn unchanged() -> Self {
Self {
messages: vec![],
ctoken_ratio: Decimal::one(),
debt_ratio: Decimal::one(),
}
}

pub fn is_unchanged(&self) -> bool {
self.messages.is_empty()
}
}

/// Handler for `ExecuteMsg::Withdraw`
pub fn withdraw(
mut deps: DepsMut,
Expand Down

0 comments on commit 2001ae6

Please sign in to comment.