Skip to content

Commit

Permalink
min repay decimal handle
Browse files Browse the repository at this point in the history
  • Loading branch information
xieqiancaosissi committed Jan 14, 2024
1 parent 67c1c35 commit c12d123
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions components/Modal/Action.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@ export default function Action({ maxBorrowAmount, healthFactor, poolAsset }) {
decimals,
0,
);
if (+interestChargedIn1min === 0) {
interestChargedIn1min = "1";
}
}
if (poolAsset?.supplied?.shares) {
minRepay = new Decimal(poolAsset?.supplied?.balance)
Expand Down
4 changes: 2 additions & 2 deletions components/Modal/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ export const getModalData = (asset): UIAsset & Props & { disabled: boolean } =>
.div(poolAsset?.supplied?.shares)
.mul(2)
.toFixed(0, 2),
extraDecimals + decimals,
decimals,
);
}
let interestChargedIn1min = "0";
Expand All @@ -139,7 +139,7 @@ export const getModalData = (asset): UIAsset & Props & { disabled: boolean } =>
.div(365 * 24 * 60)
.div(100)
.mul(borrowed)
.toFixed();
.toFixed(decimals, 2);
}
const repayAmount = Decimal.max(
new Decimal(borrowed).plus(interestChargedIn1min),
Expand Down

0 comments on commit c12d123

Please sign in to comment.