Skip to content

Commit

Permalink
Update apy.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
rouzwelt committed Oct 20, 2024
1 parent 8fe210d commit e5cae7d
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions crates/subgraph/src/apy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -474,10 +474,11 @@ fn year() -> I256 {

/// Returns annual rate as 18 point decimals as I256
fn annual_rate(start: u64, end: u64) -> I256 {
let timeframe = parse_units(&(end - start).to_string(), 18)
parse_units(&(end - start).to_string(), 18)
.unwrap()
.get_signed();
timeframe.saturating_mul(one()).saturating_div(year())
.get_signed()
.saturating_mul(one())
.saturating_div(year())
}

#[cfg(test)]
Expand Down

0 comments on commit e5cae7d

Please sign in to comment.