diff --git a/package.json b/package.json index 70a9db1a..d0d0d4cf 100644 --- a/package.json +++ b/package.json @@ -48,7 +48,7 @@ "@types/mustache": "^4.2.1", "@typescript-eslint/eslint-plugin": "^5.40.1", "@typescript-eslint/parser": "^5.40.1", - "@venusprotocol/isolated-pools": "0.1.0-develop.3", + "@venusprotocol/isolated-pools": "1.0.0", "@venusprotocol/oracle": "^1.4.1", "@venusprotocol/venus-protocol": "^0.6.0", "assemblyscript": "0.19.23", diff --git a/subgraphs/isolated-pools/config/mainnet.json b/subgraphs/isolated-pools/config/mainnet.json index 16f3ae6c..561522c3 100644 --- a/subgraphs/isolated-pools/config/mainnet.json +++ b/subgraphs/isolated-pools/config/mainnet.json @@ -1,6 +1,6 @@ { "network": "bsc", - "poolRegistryAddress": "0x6e8813dD1a5714182C700A6ba3A05a482b36dEdf", - "poolLensAddress": "0x525FAEcE436cF0702b399A9Ef48EAb358E43A671", - "startBlock": "24711657" + "poolRegistryAddress": "0x9F7b01A536aFA00EF10310A162877fd792cD0666", + "poolLensAddress": "0xe12da02820fAD83e0369C6De7Ae30721eaB60E32", + "startBlock": "29300000" } diff --git a/subgraphs/isolated-pools/config/testnet.json b/subgraphs/isolated-pools/config/testnet.json index 8cf0fd71..4137fb4b 100644 --- a/subgraphs/isolated-pools/config/testnet.json +++ b/subgraphs/isolated-pools/config/testnet.json @@ -1,6 +1,6 @@ { "network": "chapel", - "poolRegistryAddress": "0x1aF50D1Ee859Bb972384F1f96F3cFCccfC5Ac210", - "poolLensAddress": "0x7d6A1a595dCa742B4FF4Fb8684e3F018C3c0bEC0", - "startBlock": "28205600" + "poolRegistryAddress": "0xC85491616Fa949E048F3aAc39fbf5b0703800667", + "poolLensAddress": "0x559936086C5f65b92240012ae0D2F70C082Ac0b0", + "startBlock": "30870000" } diff --git a/subgraphs/isolated-pools/schema.graphql b/subgraphs/isolated-pools/schema.graphql index 77d26af8..c7760cb9 100644 --- a/subgraphs/isolated-pools/schema.graphql +++ b/subgraphs/isolated-pools/schema.graphql @@ -6,16 +6,6 @@ type PoolRegistry @entity { id: ID! } - -enum RiskRating { - VERY_HIGH_RISK - HIGH_RISK - MEDIUM_RISK - LOW_RISK - MINIMAL_RISK -} - - enum PoolActionType { Transfer Seize @@ -42,8 +32,6 @@ type Pool @entity { blockPosted: BigInt! "Timestamp of market creation" timestampPosted: BigInt! - "Rating of the pools risk level" - riskRating: RiskRating! "Category that the pool belongs too" category: String! "Url for pool logo" diff --git a/subgraphs/isolated-pools/src/constants/index.ts b/subgraphs/isolated-pools/src/constants/index.ts index 2fc688c7..1795b7dc 100644 --- a/subgraphs/isolated-pools/src/constants/index.ts +++ b/subgraphs/isolated-pools/src/constants/index.ts @@ -32,8 +32,6 @@ export const MEDIUM_RISK = 'MEDIUM_RISK'; export const LOW_RISK = 'LOW_RISK'; export const MINIMAL_RISK = 'MINIMAL_RISK'; -export const RiskRatings = [VERY_HIGH_RISK, HIGH_RISK, MEDIUM_RISK, LOW_RISK, MINIMAL_RISK]; - export const Actions = [ MINT, REDEEM, diff --git a/subgraphs/isolated-pools/src/operations/create.ts b/subgraphs/isolated-pools/src/operations/create.ts index 307fe1e4..9ff4c708 100644 --- a/subgraphs/isolated-pools/src/operations/create.ts +++ b/subgraphs/isolated-pools/src/operations/create.ts @@ -30,7 +30,6 @@ import { MINT, REDEEM, REPAY, - RiskRatings, TRANSFER, UNDERLYING_AMOUNT, UNDERLYING_REPAY_AMOUNT, @@ -69,7 +68,6 @@ export function createPool(comptroller: Address): Pool { pool.creator = poolDataFromLens.creator; pool.blockPosted = poolDataFromLens.blockPosted; pool.timestampPosted = poolDataFromLens.timestampPosted; - pool.riskRating = RiskRatings[poolDataFromLens.riskRating]; pool.category = poolDataFromLens.category; pool.logoUrl = poolDataFromLens.logoURL; pool.description = poolDataFromLens.description; diff --git a/subgraphs/isolated-pools/src/operations/update.ts b/subgraphs/isolated-pools/src/operations/update.ts index 2d74a78f..7c08d5c5 100644 --- a/subgraphs/isolated-pools/src/operations/update.ts +++ b/subgraphs/isolated-pools/src/operations/update.ts @@ -3,7 +3,6 @@ import { Address, BigInt, Bytes } from '@graphprotocol/graph-ts'; import { PoolMetadataUpdatedNewMetadataStruct } from '../../generated/PoolRegistry/PoolRegistry'; import { AccountVToken, Market } from '../../generated/schema'; import { VToken } from '../../generated/templates/VToken/VToken'; -import { RiskRatings } from '../constants'; import { exponentToBigDecimal, getExchangeRateBigDecimal } from '../utilities'; import { getTokenPriceInUsd } from '../utilities'; import { getOrCreateMarket } from './getOrCreate'; @@ -209,7 +208,6 @@ export function updatePoolMetadata( ): void { const pool = getOrCreatePool(comptroller); if (pool) { - pool.riskRating = RiskRatings[newMetadata.riskRating]; pool.category = newMetadata.category; pool.logoUrl = newMetadata.logoURL; pool.description = newMetadata.description; diff --git a/subgraphs/isolated-pools/template.yaml b/subgraphs/isolated-pools/template.yaml index d7189df3..f07c555f 100644 --- a/subgraphs/isolated-pools/template.yaml +++ b/subgraphs/isolated-pools/template.yaml @@ -39,9 +39,9 @@ dataSources: handler: handlePoolRegistered - event: PoolNameSet(indexed address,string,string) handler: handlePoolNameSet - - event: MarketAdded(indexed address,address) + - event: MarketAdded(indexed address,indexed address) handler: handleMarketAdded - - event: PoolMetadataUpdated(indexed address,(uint8,string,string,string),(uint8,string,string,string)) + - event: PoolMetadataUpdated(indexed address,(string,string,string),(string,string,string)) handler: handlePoolMetadataUpdated templates: @@ -76,9 +76,9 @@ templates: - name: RewardsDistributor file: ../../node_modules/@venusprotocol/isolated-pools/artifacts/contracts/Rewards/RewardsDistributor.sol/RewardsDistributor.json eventHandlers: - - event: MarketEntered(address,address) + - event: MarketEntered(indexed address,indexed address) handler: handleMarketEntered - - event: MarketExited(address,address) + - event: MarketExited(indexed address,indexed address) handler: handleMarketExited - event: NewCloseFactor(uint256,uint256) handler: handleNewCloseFactor diff --git a/subgraphs/isolated-pools/tests/PoolRegistry/index.test.ts b/subgraphs/isolated-pools/tests/PoolRegistry/index.test.ts index f986571f..da2351cd 100644 --- a/subgraphs/isolated-pools/tests/PoolRegistry/index.test.ts +++ b/subgraphs/isolated-pools/tests/PoolRegistry/index.test.ts @@ -60,7 +60,6 @@ describe('Pool Registry', () => { assertPoolDocument('creator', '0x0000000000000000000000000000000000000072'); assertPoolDocument('blockPosted', '100'); assertPoolDocument('timestampPosted', '1662990421'); - assertPoolDocument('riskRating', 'HIGH_RISK'); assertPoolDocument('category', 'Games'); assertPoolDocument('logoUrl', '/logo.png'); assertPoolDocument('description', 'Game related tokens'); diff --git a/subgraphs/isolated-pools/tests/VToken/mocks.ts b/subgraphs/isolated-pools/tests/VToken/mocks.ts index 14b1ef12..a5330b61 100644 --- a/subgraphs/isolated-pools/tests/VToken/mocks.ts +++ b/subgraphs/isolated-pools/tests/VToken/mocks.ts @@ -37,7 +37,6 @@ export const createPoolRegistryMock = (pools: Array>): voi pool[2], // comptroller ethereum.Value.fromUnsignedBigInt(BigInt.fromI32(100)), // blockPosted ethereum.Value.fromUnsignedBigInt(BigInt.fromString('1662990421')), // timestampPosted - ethereum.Value.fromI32(1), // riskRating ethereum.Value.fromString('Games'), // category ethereum.Value.fromString('/logo.png'), // logoURL ethereum.Value.fromString('Game related tokens'), // description @@ -53,7 +52,7 @@ export const createPoolRegistryMock = (pools: Array>): voi createMockedFunction( poolLensAddress, 'getPoolByComptroller', - 'getPoolByComptroller(address,address):((string,address,address,uint256,uint256,uint8,string,string,string,address,uint256,uint256,uint256,(address,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,bool,uint256,address,uint256,uint256)[]))', + 'getPoolByComptroller(address,address):((string,address,address,uint256,uint256,string,string,string,address,uint256,uint256,uint256,(address,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,bool,uint256,address,uint256,uint256)[]))', ) .withArgs([ethereum.Value.fromAddress(poolRegistryAddress), pool[2]]) .returns([lensTupleValue]); diff --git a/subgraphs/isolated-pools/tests/integration/poolRegistry.ts b/subgraphs/isolated-pools/tests/integration/poolRegistry.ts index 14a31f43..b66076ac 100644 --- a/subgraphs/isolated-pools/tests/integration/poolRegistry.ts +++ b/subgraphs/isolated-pools/tests/integration/poolRegistry.ts @@ -8,7 +8,6 @@ import deploy from './utils/deploy'; const DEFAULT_POOL = { name: 'Pool 1', creator: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', - riskRating: 'VERY_HIGH_RISK', category: '', logoUrl: '', description: '', @@ -56,7 +55,6 @@ describe('Pool Registry', function () { expect(pool.name).to.be.equal(DEFAULT_POOL.name); expect(pool.creator).to.be.equal('0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266'); expect(pool.blockPosted).to.be.string; - expect(pool.riskRating).to.be.equal('VERY_HIGH_RISK'); expect(pool.category).to.be.equal(''); expect(pool.logoUrl).to.be.equal(''); expect(pool.description).to.be.equal(''); @@ -70,7 +68,6 @@ describe('Pool Registry', function () { expect(dataBeforeUpdate).to.not.be.equal(undefined); const { pools: poolsBeforeUpdate } = dataBeforeUpdate!; const poolBeforeUpdate = poolsBeforeUpdate[0]; - expect(poolBeforeUpdate.riskRating).to.equal(DEFAULT_POOL.riskRating); expect(poolBeforeUpdate.category).to.equal(DEFAULT_POOL.category); expect(poolBeforeUpdate.logoUrl).to.equal(DEFAULT_POOL.logoUrl); expect(poolBeforeUpdate.description).to.equal(DEFAULT_POOL.description); @@ -88,7 +85,6 @@ describe('Pool Registry', function () { expect(data).to.not.be.equal(undefined); const { pools } = data!; const pool = pools[0]; - expect(pool.riskRating).to.equal('MEDIUM_RISK'); expect(pool.category).to.equal(category); expect(pool.logoUrl).to.equal(logoUrl); expect(pool.description).to.equal(description); diff --git a/subgraphs/isolated-pools/tests/integration/queries/poolsQuery.graphql b/subgraphs/isolated-pools/tests/integration/queries/poolsQuery.graphql index 132dbde4..7bdd29d5 100644 --- a/subgraphs/isolated-pools/tests/integration/queries/poolsQuery.graphql +++ b/subgraphs/isolated-pools/tests/integration/queries/poolsQuery.graphql @@ -5,7 +5,6 @@ query Pools { creator blockPosted timestampPosted - riskRating category logoUrl description diff --git a/subgraphs/venus-governance/template.yaml b/subgraphs/venus-governance/template.yaml index 5b08b5e4..99166e86 100644 --- a/subgraphs/venus-governance/template.yaml +++ b/subgraphs/venus-governance/template.yaml @@ -228,7 +228,7 @@ dataSources: - Permission abis: - name: AccessControlManger - file: ../../node_modules/@venusprotocol/isolated-pools/artifacts/contracts/Governance/AccessControlManager.sol/AccessControlManager.json + file: ../../node_modules/@venusprotocol/isolated-pools/artifacts/@venusprotocol/governance-contracts/contracts/Governance/AccessControlManager.sol/AccessControlManager.json eventHandlers: - event: PermissionGranted(address,address,string) handler: handlePermissionGranted diff --git a/yarn.lock b/yarn.lock index 7a73f4d1..bd966f15 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3502,6 +3502,13 @@ __metadata: languageName: node linkType: hard +"@openzeppelin/contracts-upgradeable@npm:^4.8.3": + version: 4.9.0 + resolution: "@openzeppelin/contracts-upgradeable@npm:4.9.0" + checksum: c94eb8fc6761e17a245cee586eeaa74a098200f8508c56eda5ccbe1612fbe754f42f91ef1fea768f49295e1507dcb9cb72d33682949d84659ef63846cf83e26b + languageName: node + linkType: hard + "@openzeppelin/contracts@npm:^4.6.0, @openzeppelin/contracts@npm:^4.7.3": version: 4.8.0 resolution: "@openzeppelin/contracts@npm:4.8.0" @@ -3509,10 +3516,10 @@ __metadata: languageName: node linkType: hard -"@openzeppelin/contracts@npm:^4.8.0": - version: 4.8.1 - resolution: "@openzeppelin/contracts@npm:4.8.1" - checksum: 99acefde1ae42c2d935ec9b4ebd327e786c499a4ec76b9582eb9adb0ff94a77c48047332fba44fb97b82b5a46d80e74d3e5d8cf73d5defa7f746f2a67f070281 +"@openzeppelin/contracts@npm:^4.8.3": + version: 4.9.0 + resolution: "@openzeppelin/contracts@npm:4.9.0" + checksum: aa1499897f85821f9184497f5201152a4a272b05749c85c209e9e553d734467a78557bcd2efe35f07994d6e14f30c545b239a4f63622f27f808182efb3103658 languageName: node linkType: hard @@ -4281,17 +4288,18 @@ __metadata: languageName: node linkType: hard -"@venusprotocol/isolated-pools@npm:0.1.0-develop.3": - version: 0.1.0-develop.3 - resolution: "@venusprotocol/isolated-pools@npm:0.1.0-develop.3" +"@venusprotocol/isolated-pools@npm:1.0.0": + version: 1.0.0 + resolution: "@venusprotocol/isolated-pools@npm:1.0.0" dependencies: - "@openzeppelin/contracts": ^4.8.0 - "@openzeppelin/contracts-upgradeable": ^4.8.0 + "@openzeppelin/contracts": ^4.8.3 + "@openzeppelin/contracts-upgradeable": ^4.8.3 "@openzeppelin/hardhat-upgrades": ^1.21.0 "@solidity-parser/parser": ^0.13.2 ethers: ^5.7.0 hardhat-deploy: ^0.11.14 - checksum: a30684e99ae9db993abeb9c673300febdd47cbf55b7568859fe5be5458b6d901aa2be126e862cd01423f00161a5cbe12c4d9dc50c0bdeeb2d3de1cc0e9bcef70 + module-alias: ^2.2.2 + checksum: 113533052d71fd3af7a3b6dac6bbc56c7b979bde9e7811cbe0cc92638ed1e7de5f46ede878b2a345c094a9cfea25ef3e2fd06c572987c67019ba4ce260ac7cd9 languageName: node linkType: hard @@ -14778,7 +14786,7 @@ __metadata: "@types/mustache": ^4.2.1 "@typescript-eslint/eslint-plugin": ^5.40.1 "@typescript-eslint/parser": ^5.40.1 - "@venusprotocol/isolated-pools": 0.1.0-develop.3 + "@venusprotocol/isolated-pools": 1.0.0 "@venusprotocol/oracle": ^1.4.1 "@venusprotocol/venus-protocol": ^0.6.0 assemblyscript: 0.19.23