Skip to content

Commit

Permalink
Peter/fix interlay issues (#1300)
Browse files Browse the repository at this point in the history
* chore: update monetary to latest 0.7.3

* fix: add missing translation and fix lend APY display

* refactor: bring back formatting with 0 amount case covered

* refactor: code review

* refactor: code review
  • Loading branch information
peterslany authored Jun 19, 2023
1 parent 7669181 commit 4a19226
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/components/LoanPositionsTable/ApyCell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const ApyCell = ({
}: ApyCellProps): JSX.Element => {
const rewardsApy = getSubsidyRewardApy(currency, rewardsPerYear, prices);

const totalApy = isBorrow ? apy.sub(rewardsApy || 0) : apy.add(rewardsApy || 0);
const totalApy = isBorrow ? (rewardsApy || Big(0)).sub(apy) : apy.add(rewardsApy || 0);

const totalApyLabel = getApyLabel(totalApy);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const DepositOutputAssets = ({ pool, values, prices }: DepositOutputAssetsProps)
return (
<Flex direction='column' gap='spacing4'>
<P align='center' size='xs'>
{t('amm.pools.receivable_assets')}
{t('receivable_assets')}
</P>
<Dl direction='column' gap='spacing2'>
<StyledDlGroup justifyContent='space-between'>
Expand Down
3 changes: 3 additions & 0 deletions src/utils/helpers/loans.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ const MIN_DECIMAL_NUMBER = 0.01;

// MEMO: returns formatted apy or better representation of a very small apy
const getApyLabel = (apy: Big): string => {
if (apy.eq(0)) {
return formatPercentage(0);
}
const isPositive = apy.gt(0);
const isTinyApy = isPositive ? apy.lt(MIN_DECIMAL_NUMBER) : apy.gt(-MIN_DECIMAL_NUMBER);

Expand Down

2 comments on commit 4a19226

@vercel
Copy link

@vercel vercel bot commented on 4a19226 Jun 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on 4a19226 Jun 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.