-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: useMaxRedeem for some situations #549
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
function AmountWithOptionalTooltip(props: { | ||
canOnlyWithdrawSome: boolean; | ||
maxPossibleToWithdraw: TNormalizedBN; | ||
tokenSymbol: string; | ||
}): ReactElement { | ||
if (props.canOnlyWithdrawSome) { | ||
return ( | ||
<div className={'flex flex-row items-center justify-between space-x-2'}> | ||
<label | ||
htmlFor={'fromAmount'} | ||
className={'hidden text-base text-neutral-600 md:inline'}> | ||
{'Amount'} | ||
</label> | ||
<span className={'tooltip'}> | ||
<IconQuestion className={'hidden opacity-40 md:block'} /> | ||
<span className={'tooltipLight top-full w-full pt-1'}> | ||
<div | ||
className={ | ||
'font-number mr-[-360px] max-w-sm border border-neutral-300 bg-neutral-100 p-1 px-2 text-center text-xxs text-neutral-900' | ||
}> | ||
<p className={'font-number whitespace-pre text-wrap text-left text-neutral-400 md:text-xs'}> | ||
{`This Vault is not always totally liquid (don’t worry anon, funds are Safu).\n\nYou can currently withdraw up to ${formatAmount(props.maxPossibleToWithdraw.normalized, 6)} ${props.tokenSymbol}.\n\nLike the best things in life, liquidity comes and goes so feel free to check back later.`} | ||
</p> | ||
</div> | ||
</span> | ||
</span> | ||
</div> | ||
); | ||
} | ||
return ( | ||
<div> | ||
<label | ||
htmlFor={'fromAmount'} | ||
className={'hidden text-base text-neutral-600 md:inline'}> | ||
{'Amount'} | ||
</label> | ||
</div> | ||
); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Display a little (?) with a message if the user can only withdraw part of it's vault deposit
@@ -213,7 +255,7 @@ export function VaultDetailsQuickActionsFrom(): ReactElement { | |||
onChangeAmount( | |||
isDepositing | |||
? maxDepositPossible(toAddress(actionParams?.selectedOptionFrom?.value)) | |||
: userBalance | |||
: maxWithdrawPossible().safeLimit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of just the user's balance, we use the safeLimit (either user balance of maxRedeem with some security)
Use max redeem to determine the max amount a user can withdraw