This commit is contained in:
William
2025-01-13 18:42:21 +08:00
parent 95889975af
commit d634cb357c
2 changed files with 42 additions and 3 deletions
@@ -196,6 +196,13 @@ impl BondingCurveAccount {
// Return total including fee, converting back to u64
(total_sell_value + fee) as u64
}
pub fn get_token_price(&self) -> f64 {
let v_sol = self.virtual_sol_reserves as f64 / 100_000_000.0;
let v_tokens = self.virtual_token_reserves as f64 / 100_000.0;
let token_price = v_sol / v_tokens;
token_price
}
}
#[cfg(test)]