Skip to content

Commit

Permalink
Improved num check for minting stablecoins
Browse files Browse the repository at this point in the history
  • Loading branch information
robkorn committed Feb 25, 2021
1 parent ef0b803 commit 77c8039
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion ageusd-headless/src/bank.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,14 @@ impl BankBox {
/// Number of StableCoins possible to be minted based off of current Reserve Ratio
#[wasm_bindgen]
pub fn num_able_to_mint_stablecoin(&self, oracle_box: &ErgUsdOraclePoolBox) -> u64 {
let mut num_to_mint = 0;
// Start at approximately the right amount
let mut num_to_mint = self.equity(oracle_box) / oracle_box.datapoint_in_cents() / 4;

// Add self-adjusting increment to increase efficiency of function
let mut increment_amount = 1;
if self.num_circulating_stablecoins() > 100 {
increment_amount = 10;
}
if self.num_circulating_stablecoins() > 1000000 {
increment_amount = self.num_circulating_reservecoins() / 10000;
}
Expand Down

0 comments on commit 77c8039

Please sign in to comment.