Skip to content

Conversation

@AGMASO
Copy link
Collaborator

@AGMASO AGMASO commented Dec 4, 2025

General Changes

• Refactored the Supply and Borrow actions on the reserve-overview page to fully use the SDK for calculating health factor previews and for building the transaction to be sent.
• Special cases for wrapped tokens (DAI/sDAI) and USDT resets are all covered and tested.

• This PR also includes the refactor of Withdraw and Repay (added here for future use in the dashboard page).

Developer Notes

• For testing purposes, you can access the Supply SDK and Borrow SDK in the reserve-overview page.
• You can access the Withdraw SDK and Repay SDK in the supplied position view and borrowed position view respectively.

NOTE: Major issue blocking the release of the Repay SDK flow: I have tested that the SDK’s Repay action does not support aToken repayments. This means we cannot repay debt using collateral; only ERC-20 tokens from the wallet are supported.


Reviewer Checklist

Please ensure you, as the reviewer(s), have gone through this checklist to ensure that the code changes are ready to ship safely and to help mitigate any downstream issues that may occur.

  • End-to-end tests are passing without any errors
  • Code changes do not significantly increase the application bundle size
  • If there are new 3rd-party packages, they do not introduce potential security threats
  • If there are new environment variables being added, they have been added to the .env.example file as well as the pertinant .github/actions/* files
  • There are no CI changes, or they have been approved by the DevOps and Engineering team(s)

@github-actions
Copy link

github-actions bot commented Dec 8, 2025

@github-actions
Copy link

github-actions bot commented Dec 8, 2025

📦 Next.js Bundle Analysis for aave-ui

This analysis was generated by the Next.js Bundle Analysis action. 🤖

This PR introduced no changes to the JavaScript bundle! 🙌

@github-actions
Copy link

github-actions bot commented Dec 9, 2025

@github-actions
Copy link

github-actions bot commented Dec 9, 2025

📦 Next.js Bundle Analysis for aave-ui

This analysis was generated by the Next.js Bundle Analysis action. 🤖

This PR introduced no changes to the JavaScript bundle! 🙌

Copy link
Contributor

@mgrabina mgrabina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HUGE work! Adding some comments.

Idea for relase: prepare a dashboard on amplitude to track all actions and quickly monitor in case we have any issues.

).toString();
if (reserve.userState) {
maxAmountToBorrow = reserve.userState.borrowable.amount.value || '0';
maxAmountToSupply = getMaxAmountAvailableToSupplySDK(walletBalance, reserve, underlyingAsset);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aren't we losing minRemainingBaseTokenBalance condition?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

During debugging, I noticed an inconsistency between the Legacy flow and the SDK. The difference in the amounts was exactly the value I was using for minRemainingBaseTokenBalance. For that reason, I simplified it. I have the feeling that the SDK already includes minRemainingBaseTokenBalance in its backend calculations. not 100% sure, but is working identical like that

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

makes sense

balance = walletBalances[API_ETH_MOCK_ADDRESS.toLowerCase()];
}

const isNativeSelected = reserve.acceptsNative && selectedAsset === baseAssetSymbol;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we use isWrappedBaseAsset condition instead of acceptsNative? not sure

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same question everywhere in this file

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isWrappedBaseAsset is a flag from API legacy, not present in SDK. The equivalent would be that the object reserve.acceptsNative is not null.

visibleDecimals={2}
/>
<Typography variant="subheader2" color="text.secondary">
sDAI
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this hardcoded symbol intended?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah. same as the Legacy Flow

tokenWrapperAddress={wrappedTokenConfig.tokenWrapperAddress}
tokenIn={wrappedTokenConfig.tokenIn.underlyingAsset}
amountToSupply={amount}
decimals={18}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

18 decimals hardcoded intended?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, required for the case sDai (i just followed the legacy flow)

<TxActionsWrapper
blocked={blocked}
mainTxState={mainTxState}
approvalTxState={{}}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we are probably losing the approval state in the button here

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We’re using the useApprovalTx hook, which handles all approval state and execution internally, so we no longer need to pass approvalTxState to the wrapper. Tested and it works fine.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah but that wrapper isn't chaing the text based on the approvalTxState?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, make sense. updated

reserve={poolReserve}
/>
) : (
<SupplyActions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or SDK? let's add some comments explaining why we need different Actions for Wrapped or when we use each one for future reference

Same for other actions

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry! you are right, for the fallback should be SupplyActionsSDK as well

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comments added

@github-actions
Copy link

@github-actions
Copy link

📦 Next.js Bundle Analysis for aave-ui

This analysis was generated by the Next.js Bundle Analysis action. 🤖

This PR introduced no changes to the JavaScript bundle! 🙌

@github-actions
Copy link

@github-actions
Copy link

📦 Next.js Bundle Analysis for aave-ui

This analysis was generated by the Next.js Bundle Analysis action. 🤖

This PR introduced no changes to the JavaScript bundle! 🙌

@vercel
Copy link

vercel bot commented Dec 11, 2025

You must have Developer access to commit code to Aave on Vercel. If you contact an administrator and receive Developer access, commit again to see your changes.

Learn more: https://vercel.com/docs/accounts/team-members-and-roles/access-roles#team-level-roles

@github-actions
Copy link

@github-actions
Copy link

📦 Next.js Bundle Analysis for aave-ui

This analysis was generated by the Next.js Bundle Analysis action. 🤖

This PR introduced no changes to the JavaScript bundle! 🙌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants