From f39e79780dcbf45b81bdf245006d2f07569ede82 Mon Sep 17 00:00:00 2001 From: Mark Grothe Date: Sat, 27 Jul 2024 11:51:59 -0500 Subject: [PATCH] fix: pool version check and liquidity calcs [skip cypress] (#2121) --- package.json | 4 ++-- src/services/UIPoolService.ts | 22 +--------------------- yarn.lock | 16 ++++++++-------- 3 files changed, 11 insertions(+), 31 deletions(-) diff --git a/package.json b/package.json index 9d09ce331a..735e63a5fa 100644 --- a/package.json +++ b/package.json @@ -31,8 +31,8 @@ "test:coverage": "jest --coverage" }, "dependencies": { - "@aave/contract-helpers": "1.29.0", - "@aave/math-utils": "1.29.0", + "@aave/contract-helpers": "1.29.1", + "@aave/math-utils": "1.29.1", "@bgd-labs/aave-address-book": "^2.26.1", "@emotion/cache": "11.10.3", "@emotion/react": "11.10.4", diff --git a/src/services/UIPoolService.ts b/src/services/UIPoolService.ts index afe18633b7..21c2f06aab 100644 --- a/src/services/UIPoolService.ts +++ b/src/services/UIPoolService.ts @@ -5,7 +5,6 @@ import { UserReserveDataHumanized, } from '@aave/contract-helpers'; import { Provider } from '@ethersproject/providers'; -import { BigNumber, Contract } from 'ethers'; import { MarketDataType } from 'src/ui-config/marketsConfig'; export type UserReservesDataHumanized = { @@ -18,11 +17,7 @@ export class UiPoolService { private async getUiPoolDataService(marketData: MarketDataType) { const provider = this.getProvider(marketData.chainId); - // Temporary check to have the UI detect when the v3.1 upgrade is live so the correct - // data providers can be used on the fly. Once the upgrade is executed on all markets, - // this can be removed. - const poolRevision = await this.getPoolRevision(marketData, provider); - if (poolRevision < 4 || this.useLegacyUiPoolDataProvider(marketData)) { + if (this.useLegacyUiPoolDataProvider(marketData)) { return new LegacyUiPoolDataProvider({ uiPoolDataProviderAddress: marketData.addresses.UI_POOL_DATA_PROVIDER, provider, @@ -37,21 +32,6 @@ export class UiPoolService { } } - private async getPoolRevision(marketData: MarketDataType, provider: Provider) { - if (!marketData.v3) { - return 0; - } - - const poolContract = new Contract( - marketData.addresses.LENDING_POOL, - ['function POOL_REVISION() public view returns (uint256)'], - provider - ); - - const revision: BigNumber = await poolContract.POOL_REVISION(); - return revision.toNumber(); - } - private useLegacyUiPoolDataProvider(marketData: MarketDataType) { if ( !marketData.v3 || diff --git a/yarn.lock b/yarn.lock index 93861693e6..864ad15681 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,17 +2,17 @@ # yarn lockfile v1 -"@aave/contract-helpers@1.29.0": - version "1.29.0" - resolved "https://registry.yarnpkg.com/@aave/contract-helpers/-/contract-helpers-1.29.0.tgz#75e817f44d9d2f0d77eefc8173ce191052f0497d" - integrity sha512-cjkkNNemqhE5uRfMMZuZqreGYbeP2B++VDLnJHOOvLVe9v9rm+RjxlzXJWx/cgVWhfccbqAFtHrP0NTg7HyjQw== +"@aave/contract-helpers@1.29.1": + version "1.29.1" + resolved "https://registry.yarnpkg.com/@aave/contract-helpers/-/contract-helpers-1.29.1.tgz#34beab8afa35bbfc6168c78ced8317d96a493fe0" + integrity sha512-34z5CKpNdEx26G+DSezovdR3PyAf0v0Typbf2udaKG4GrOBgqbKqxr4zqS/dpFO5aAQJJ+nuEM19lKRK4sMcpg== dependencies: isomorphic-unfetch "^3.1.0" -"@aave/math-utils@1.29.0": - version "1.29.0" - resolved "https://registry.yarnpkg.com/@aave/math-utils/-/math-utils-1.29.0.tgz#9c0e2f02f29ac56e335d11707c0f9b1e19b63712" - integrity sha512-pYCFDNJdk9/tAAa5oh1wNdxrmzkQ83mqBVYnIVKmFR69obtwy+QeF5nKe2dUCTW8BfaS+/6fuj5iDK1hyx9/nA== +"@aave/math-utils@1.29.1": + version "1.29.1" + resolved "https://registry.yarnpkg.com/@aave/math-utils/-/math-utils-1.29.1.tgz#fcb9499bd472bde7b80429c7dbe63d4358852697" + integrity sha512-a+L2+vjza/nH4BxUTzwDcoJH/Qr6UP+g+9YSwG7YKUgoVfdy8gJs5VyXjfDDEVe9lMeZuPJq7CqrgV4P2M6Nkg== "@adobe/css-tools@^4.0.1": version "4.0.1"