Skip to content

Commit

Permalink
remove max label on form
Browse files Browse the repository at this point in the history
  • Loading branch information
fishonamos committed Sep 10, 2024
1 parent 776d2d6 commit bd16ce9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
8 changes: 5 additions & 3 deletions src/components/Deposit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export default function Deposit(props: DepositProps) {
// const { balance, isLoading, isError } = useERC20Balance(selectedMarket);
const maxAmount: MyNumber = useMemo(() => {
if (props.buttonText === 'Redeem') {
return balance; // Use the actual balance for Redeem
return balance;
}

const currentTVl = tvlInfo.data?.amount || MyNumber.fromZero();
Expand Down Expand Up @@ -167,7 +167,8 @@ export default function Deposit(props: DepositProps) {
color: 'color_50p',
}}
onClick={() => {
const maxAmountToSet = props.buttonText === 'Redeem' ? balance : maxAmount;
const maxAmountToSet =
props.buttonText === 'Redeem' ? balance : maxAmount;
setAmount(maxAmountToSet);
setRawAmount(maxAmountToSet.toEtherStr());
mixpanel.track('Chose max amount', {
Expand Down Expand Up @@ -298,7 +299,8 @@ export default function Deposit(props: DepositProps) {
)}
{amount.compare(maxAmount.toEtherStr(), 'gt') && (
<Text marginTop="2px" marginLeft={'7px'} color="red" fontSize={'13px'}>
Amount to be less than or equal to {maxAmount.toEtherToFixedDecimals(2)}
Amount to be less than or equal to{' '}
{maxAmount.toEtherToFixedDecimals(2)}
</Text>
)}

Expand Down
6 changes: 4 additions & 2 deletions src/utils/MyNumber.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,10 @@ export default class MyNumber {
);
}

// Use a hardcoded value for MAX_UINT256
static MAX_UINT256 = new MyNumber('115792089237316195423570985008687907853269984665640564039457584007913129639935', 0);
static MAX_UINT256 = new MyNumber(
'115792089237316195423570985008687907853269984665640564039457584007913129639935',
0,
);

isMaxUint256() {
return this.eq(MyNumber.MAX_UINT256);
Expand Down

0 comments on commit bd16ce9

Please sign in to comment.