Skip to content

Commit

Permalink
fix: pool version check and liquidity calcs [skip cypress] (#2121)
Browse files Browse the repository at this point in the history
  • Loading branch information
grothem authored Jul 27, 2024
1 parent 3750ffc commit f39e797
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 31 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
22 changes: 1 addition & 21 deletions src/services/UIPoolService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand All @@ -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,
Expand All @@ -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 ||
Expand Down
16 changes: 8 additions & 8 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@
# yarn lockfile v1


"@aave/[email protected].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/[email protected].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/[email protected].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/[email protected].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"
Expand Down

2 comments on commit f39e797

@github-actions
Copy link

Choose a reason for hiding this comment

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

This commit was deployed on ipfs

@github-actions
Copy link

Choose a reason for hiding this comment

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

This commit was deployed on ipfs

Please sign in to comment.