Skip to content

Commit 19fea19

Browse files
authored
Ocean: fix get apr default if any zero (#3075)
* ignore if any zero * fmt
1 parent 3648669 commit 19fea19

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

lib/ain-ocean/src/api/pool_pair/service.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -461,6 +461,14 @@ pub async fn get_apr(
461461
let loan_usd = get_yearly_reward_loan_usd(ctx, id).await?;
462462
let total_liquidity_usd = get_total_liquidity_usd(ctx, p).await?;
463463

464+
if custom_usd.is_zero()
465+
|| pct_usd.is_zero()
466+
|| loan_usd.is_zero()
467+
|| total_liquidity_usd.is_zero()
468+
{
469+
return Ok(PoolPairAprResponse::default());
470+
}
471+
464472
let yearly_usd = custom_usd
465473
.checked_add(pct_usd)
466474
.context(ArithmeticOverflowSnafu)?

0 commit comments

Comments
 (0)