Skip to content

Commit 2981672

Browse files
committed
fix repay max
1 parent bee5e1b commit 2981672

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/components/transactions/Repay/RepayActions.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ export interface RepayActionProps extends BoxProps {
3030
repayWithATokens: boolean;
3131
blocked?: boolean;
3232
maxApproveNeeded: string;
33+
maxAmountToRepay: string;
3334
}
3435

3536
export const RepayActions = ({
@@ -42,6 +43,7 @@ export const RepayActions = ({
4243
repayWithATokens,
4344
blocked,
4445
maxApproveNeeded,
46+
maxAmountToRepay,
4547
...props
4648
}: RepayActionProps) => {
4749
const [
@@ -198,9 +200,11 @@ export const RepayActions = ({
198200
action,
199201
txState: 'success',
200202
asset: poolAddress,
201-
amount: amountToRepay,
203+
amount: amountToRepay === '-1' ? maxAmountToRepay : amountToRepay,
202204
assetName: symbol,
203-
amountUsd: valueToBigNumber(amountToRepay).multipliedBy(poolReserve.priceInUSD).toString(),
205+
amountUsd: valueToBigNumber(amountToRepay === '-1' ? maxAmountToRepay : amountToRepay)
206+
.multipliedBy(poolReserve.priceInUSD)
207+
.toString(),
204208
});
205209

206210
queryClient.invalidateQueries({ queryKey: queryKeysFactory.pool });

src/components/transactions/Repay/RepayModalContent.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,7 @@ export const RepayModalContent = ({
289289
isWrongNetwork={isWrongNetwork}
290290
symbol={modalSymbol}
291291
repayWithATokens={repayWithATokens}
292+
maxAmountToRepay={maxAmountToRepay.toString(10)}
292293
/>
293294
</>
294295
);

0 commit comments

Comments
 (0)