-
Notifications
You must be signed in to change notification settings - Fork 346
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
feature: migration v2-v3 avalanche and Polygon [skip cypress] #1442
feature: migration v2-v3 avalanche and Polygon [skip cypress] #1442
Conversation
(cherry picked from commit 21362ac)
fix: small fixes
|
❌ CI run has failed! |
📦 Next.js Bundle AnalysisThis analysis was generated by the next.js bundle analysis action 🤖
|
Page | Size (compressed) |
---|---|
global |
489.86 KB (🟡 +7.66 KB) |
Details
The global bundle is the javascript bundle that loads alongside every page. It is in its own category because its impact is much higher - an increase to its size means that every page on your website loads slower, and a decrease means every page loads faster.
Any third party scripts you have added directly to your app using the <script>
tag are not accounted for in this analysis
If you want further insight into what is behind the changes, give @next/bundle-analyzer a try!
New Page Added
The following page was added to the bundle from the code in this PR:
Page | Size (compressed) | First Load |
---|---|---|
/v3-migration |
28.14 KB |
518 KB |
Eleven Pages Changed Size
The following pages changed size from the code in this PR compared to its base branch:
Page | Size (compressed) | First Load |
---|---|---|
/ |
41.49 KB (🟡 +554 B) |
531.36 KB |
/404 |
6.35 KB (🟡 +112 B) |
496.21 KB |
/500 |
6.79 KB (🟡 +139 B) |
496.65 KB |
/faucet |
22.3 KB (🟡 +154 B) |
512.16 KB |
/governance |
62.53 KB (🟡 +123 B) |
552.39 KB |
/governance/ipfs-preview |
107.74 KB (🟡 +125 B) |
597.61 KB |
/governance/proposal |
107.9 KB (🟡 +125 B) |
597.76 KB |
/governance/proposal/[proposalId] |
62.6 KB (🟡 +125 B) |
552.46 KB |
/markets |
16.07 KB (🟡 +174 B) |
505.93 KB |
/reserve-overview |
64.76 KB (🟡 +157 B) |
554.62 KB |
/staking |
20.55 KB (🟡 +135 B) |
510.41 KB |
Details
Only the gzipped size is provided here based on an expert tip.
First Load is the size of the global bundle plus the bundle for the individual page. If a user were to show up to your website and land on a given page, the first load size represents the amount of javascript that user would need to download. If next/link
is used, subsequent page loads would only need to download that page's bundle (the number in the "Size" column), since the global bundle has already been downloaded.
Any third party scripts you have added directly to your app using the <script>
tag are not accounted for in this analysis
Next to the size is how much the size has increased or decreased compared with the base branch of this PR. If this percentage has increased by 20% or more, there will be a red status indicator applied, indicating that special attention should be given to this.
|
…tion-additional-disable-
❌ CI run has failed! |
) * cleanup: remove apollo caching fallback * feat: implement demo zustand * feat: add store for protocol data * feat: migrate general stake data to zustand * fix: some patches on store * feat: replace protocolDataProvider * feat: remove walletmodalcontext * fix: fix rename miss * feat: finish stake migration * feat: replace walletDataProvider with zustand * feat: migrate pool and incentive data * feat: start with governance store * feat: finish governance migration * fix: remove all graphql * fix: remove persist * fix: flatten store * fix: merge getters * fix: restore url parameter behavior * fix: patch stake provider * feat: move staking to zustand * fix: add persist * cleanup: remove rpc only flag * fix: remove unncessary flag * fix: a batch of fixes * feat: migrate faucet * fix: fix type * fix: refactor withdraw * Feature immer minimal example with zustand (cherry picked from commit 21362ac) * fix: fix immer usage * Feature remove computed() from poolSlice and walletSlice and introduce selectors * Fix eslint errors and contract-herlpers version bump * fix: fix pacakge.json & lockfile * fix: remove explicit deepmerge * feat: lending pool methods migration to zustand pool slice (aave#7) * feat: lending pool methods migration to zustand pool slice * fix: remove lending provider from context * fix: remove lending pool type from tx builder * fix: update utilities to version with shaking * fix: simplify deprecated governanceDataProvider * fix: some docs * fix: update zustand * fix: move claim rewards to zustand (aave#8) Co-authored-by: Lukas <lukasstrassel@googlemail.com> * fix: resolve merge issues * fix: only set valid market * fix: don't break localstorage * fix: commit the actual fix * fix: remove current account from pool actions * fix: close wallet modal after wallet connect * fix: paraswap repay with collateral and swap collateral to use underlying chain id * fix: build error and omit current user from governance methods * fix: move current account selection to stake slice * fix: build error * fix: add delay after wallet click in cypress test * fix: yarn lock update * fix: eslint import errors * feat: allow multi signature transactions * fix: revert change * feat: v3 migration started * feat: migrator approval permit added * feat: migration service added * feat: testing migration on a fork * feat: v3 migration prototype continue * feat: supply and borrow position splitted approve flow working * feat: migrate no borrow with permits continue * feat: loading for migratin actions added * feat: migration components structure * feat: finished main migration screen * feat: migration modal styles * feat: migration with borrow * feat: migrate with borrow and permits continue * feature: select current market v2 and v3 dynamic selectors added * feat: health factor calculations added before and after migration * feat: migration continue wrong network hook added * fix: migrate screen top panel * fix: migrate navigation * fix: health factor calculation based on increased amount * fix: calculate health factor based on scaled balance * fix: clear selected positions on v3 migration page * chore: check null conditions in poolSelectors * feat: enable permit in MigrateV3Actions * fix: permit amount convert to wei * fix: usage as collateral improvements for migration * fix: pass user emode category id for migration formatting summary * feat: migratio with isolation mode started * fix: change selected assets to arary instead of map * feat: select definitive supply asset for migration based on v3 balance * feat: isolated dynamic mode active * fix: permit order and health factor calculation for isolation mode * fix: usage as collateral enabled by user respect v3 positions * fix: migration screen styles * fix: dynamic isolation mode * feat: emode integration for migration page * fix: new mobile styles merged * fix: rename pool data selectors and make v2 and v3 market data selection dynamic * fix: eMode fixes and disabling assets for migration with different underlying assets * fix: disabled for migration updates for emode and isolation mode * feat: scaffold new column layout * feat: update migration page header * feat: update migration panel headers * chore: remove emode info box from migration page header * feat: stable and variable debt migration added * chore: check styling * chore: reduce select column width * chore: draft APY type change in borrow table * chore: placeholder apy change * chore: add migration disabled enum * fix: list row layout * feat: update base item row styling * feat: update borrow item styling * feat: add MigrationUserReserve type and pass to MigrationListItem * feat: pass V2 and V3 rates to MigrationListItem rows * feat: v2 -> v3 collateral change styling * fix: center market icon * feat: show number selected and style mobile layout * feat: mobile row styling * feat: entering isolation mode warning * fix: row alignment * chore: cleanup * chore: change select all behaviour with partially selected list * chore: update selection box styling * fix: desktop raw spacing * fix: mobile row alignment * feat: warning component for all migration states * chore: separate warnings for entering isolation and staying in isolation * feat: disabled states + apply warnings component * chore: separate entering isolation mode * feat: disabled properties and styling * feat: computing selected and available reserves * chore: i18n * feat: migration v2 v3 with credit delegation * fix: add promise all to unsigned payloads * fix: numAvailable * chore: disabled risk checkbox if there is blocking error * chore: adjust desktop sizing for migration layout * feat: add reserve incentives to pool slice and use for v3 migration * fix: disabled supply asset styling * fix: checkbox disabled states * fix: display migration button check * feat: differentiate entering isolation mode * feat: define IsolatedReserve type * feat: add warning for existing isolation mode and clean up * fix: exclude disabled assets for migration * fix: HF calculation involving disabled V2 or V3 assets * feat: include disabled assets in mobile counter * chore: update mobile breakpoints * chore: fix issue with selector breaking when migrating asset which doesn't exist in V3 * fix: restore bad merge file content * fix: eslint and type errors * fix: handle case for migrationDisabled being 0 element in enum * fix: avalanche v3 migrator address updated * fix: exclude assets disabled for migration for v3 health factor calculations * fix: add migration helper exceptions * fix: use disabled button state for non-clickable button * fix: display collateral usage for disabled assets * feat: updated migrator addresses and contract helpers * fix: add migration exceptions loading added * fix: add enable as collateral dynamic logic * fix: select all only enabled assets for migration * fix: styles for migration item switcher * fix: remove migrator addresses from v3 * chore: disabled styling for apy type buttons on mobile * fix: icon symbols in migration modal * fix: condition for isolation mode collateral toggle * fix: display logic for isolation mode colalteral toggle * fix: hanging migration page for networks without balance exceptions * fix: usage as collateral after migration wrong flag * fix: insuficient liquidity for borrow disable migration * feat: additonal disable migration states added * fix: market switcher in migration modal * fix: use correct iconm in add token modal * feat: update contract helpers and migrator addresses for mainnet * fix: missing asset Co-authored-by: Lukas <lukasstrassel@googlemail.com> Co-authored-by: Alex <argeares97@gmail.com> Co-authored-by: Andrew Schmidt <andrew@aave.com>
General changes
Dedicated page with logic to handle migration from AAVE v2 to v3.
In nutshell, migrating from v2 to v3 positions requires, to set current market to v2, while simultaneously fetching data for v3.
Selecting positions from v2 should dynamically change health factor and display both before and after migration HF for both v2 and v3.
When user selects multiple assets to migrate, supply asset amount should be slightly increased to allow migrating the whole position, or the balance would grow during approving and transaction execution and method would fail as HF will fell below 1, with no supply and a little bit of debt.
In order to properly do that, changes in the whole transaction flow on the aave interface required. More specifically, changes to how
useTransactionHandler
is working.On any modal opens in the app after small delay, transactions are filtered into approval and actions by transaction type.
If approval state is not empty, that means we need to approve action first with permit if available after with on chain approval.
Currently, AAVE interface assumes that each
Action
in the app will have single approve or single permit and single following transaction. Although it worked great for most parts, specifically for migration it didn't work, since migrating multiple positions would require approving/signing permit for each supply asset.Also, it's the first pr with new changes done in zustand completely, which also changed a bit the flow working with Actions component, as mentioned in this discussion, we want to migrate from idea of dedicated actions component anyway. It also showcases how easy it is to nest multiple non-destructive data manipulation in selectors. i.e. increasing amount, filtering for non-empty states, etc. Which is the bulk of the logic in the app.
Isolation mode
When user has 0 collateral on v3, the order of supply assets will define the isolation mode, if isolated supply is supplied on v2.
Supply USDT as collateral to empty balance on v3, will automatically enable it as collateral and activate isolation mode, therefore supplying any other collateral will be ignored.
To make it easier for user to understand enabled as collateral toggles are presented.
The logic is following, if only isolated supplies are selected, the last one will be selected as collateral and therefore migrated first.
if any non-isolated supply is available, non-isolated supplies will be selected as collateral. Non-isolated supplies will be migrated first. Since it’s way harder to migrate from isolated supply to non-isolated one.
It’s still possible though to enable isolated supply manually and user choice will be respected.
The situation gets more complicated with non-empty balance on v3, which is not enabled as collateral.
In that case supplied assets on v3 can not be toggled as collateral, but the rest of the assets will still follow the same rules of the first migrated supply will trigger isolation mode. For example
In this example, user has DAI disabled as collateral on v3 and that’s why it’s disabled for usage as collateral on migration page.
But MATIC or USDT can be triggered as collateral and therefore define the isolation mode
Balancer will be enabled/disabled for migration based on isolation mode dynamically
Developer notes
Since v2-v3 migrator is not deployed, use this RPC for testing
Be careful fork chain is equal to real chain ID on purpose, in order to test permits, both fork and base chain id required to be the same
contract helpers version is set to deployed of this PR
aave/aave-utilities#459 once we merge it to main will change to bumped version
Demo
(top UI was changed a bit)
CleanShot.2022-12-06.at.18.54.07.1.mp4
To discuss
[ ] Discuss how to dynamically change market names based on chain ID after migration deployment