Skip to content

Commit

Permalink
Clean up rounding on markets page
Browse files Browse the repository at this point in the history
The hacks are no longer necessary as the fix has been merged
upstream: ethers-io/ethers.js#1629
  • Loading branch information
onbjerg committed Jul 10, 2021
1 parent 97bbe95 commit e4ef823
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions src/views/Markets/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -146,14 +146,9 @@ const VariableAPRView: React.FC<{ tokenAddress: string }> = ({
return <>-</>;
}

// HACK: Awaiting rounding bug fix for https://github.com/ethers-io/ethers.js/issues/1629
return (
<PercentageView
value={query.data
.mulUnsafe(FixedNumber.from(1000, query.data.format))
.floor()
.divUnsafe(FixedNumber.from(1000, query.data.format))
.toUnsafeFloat()}
value={query.data.round(4).toUnsafeFloat()}
/>
);
}, [query.data]);
Expand All @@ -168,14 +163,9 @@ const StableAPRView: React.FC<{ tokenAddress: string }> = ({
return <>-</>;
}

// HACK: Awaiting rounding bug fix for https://github.com/ethers-io/ethers.js/issues/1629
return (
<PercentageView
value={query.data
.mulUnsafe(FixedNumber.from(1000, query.data.format))
.floor()
.divUnsafe(FixedNumber.from(1000, query.data.format))
.toUnsafeFloat()}
value={query.data.round(4).toUnsafeFloat()}
/>
);
}, [query.data]);
Expand Down

0 comments on commit e4ef823

Please sign in to comment.