Skip to content

Commit

Permalink
Create collateralization.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
KOSASIH authored Dec 7, 2024
1 parent 9d15324 commit fd18d56
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/stablecoin/src/collateralization.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// src/collateralization.rs
pub struct Collateralization {
collateral: f64,
stablecoin_value: f64,
}

impl Collateralization {
pub fn new() -> Self {
Collateralization {
collateral: 0.0,
stablecoin_value: 314.159,
}
}

pub fn add_collateral(&mut self, amount: f64) {
self.collateral += amount;
}

pub fn check_collateralization(&self) -> bool {
self.collateral >= self.stablecoin_value
}
}

0 comments on commit fd18d56

Please sign in to comment.