Skip to content

Commit

Permalink
Merge branch 'withdraw-dust' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
naturexie committed Feb 10, 2025
2 parents ffeac47 + 68fa41f commit e5e206b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions components/Modal/style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export const Wrapper = styled(Box)(({ theme }) => ({
border: "1px solid #4F5178",
boxShadow: "0px 0px 10px 4px #00000026",
flexDirection: "column",
overflow: "auto",
[theme.breakpoints.down("sm")]: {
position: "absolute",
width: "100%",
Expand Down
8 changes: 5 additions & 3 deletions store/actions/withdraw.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@ export async function withdraw({
// console.log('0000000000000-accountId', accountId)
// console.log('0000000000000-account', account)
if (!accountId) return;

const asset = assets[tokenId];
const { decimals } = asset.metadata;
const { logicContract, oracleContract } = await getBurrow();
const isNEAR = tokenId === nearTokenId;
const { isLpToken } = asset;
const suppliedBalance = new Decimal(accountPortfolio?.supplied[tokenId]?.balance || 0);
const hasBorrow = accountPortfolio?.borrows?.length > 0;
const maxAmount = computeWithdrawMaxAmount(tokenId, assets, accountPortfolio!);

const expandedAmount = isMax
Expand Down Expand Up @@ -137,7 +137,8 @@ export async function withdraw({
{
DecreaseCollateral: {
token_id: tokenId,
amount: decreaseCollateralAmount.toFixed(0),
amount:
!hasBorrow && isMax ? undefined : decreaseCollateralAmount.toFixed(0),
},
},
withdrawAction,
Expand All @@ -151,7 +152,8 @@ export async function withdraw({
{
DecreaseCollateral: {
token_id: tokenId,
amount: decreaseCollateralAmount.toFixed(0),
amount:
!hasBorrow && isMax ? undefined : decreaseCollateralAmount.toFixed(0),
},
},
withdrawAction,
Expand Down

0 comments on commit e5e206b

Please sign in to comment.