Skip to content

Commit

Permalink
Merge pull request #100 from VenusProtocol/feat/isolated-pools-1.0.0
Browse files Browse the repository at this point in the history
Bump @venusprotocol/isolated-pools and add mainnet addresses
  • Loading branch information
gleiser-oliveira authored Jun 27, 2023
2 parents b540f63 + a646dbc commit 0400e50
Show file tree
Hide file tree
Showing 14 changed files with 32 additions and 49 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
6 changes: 3 additions & 3 deletions subgraphs/isolated-pools/config/mainnet.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"network": "bsc",
"poolRegistryAddress": "0x6e8813dD1a5714182C700A6ba3A05a482b36dEdf",
"poolLensAddress": "0x525FAEcE436cF0702b399A9Ef48EAb358E43A671",
"startBlock": "24711657"
"poolRegistryAddress": "0x9F7b01A536aFA00EF10310A162877fd792cD0666",
"poolLensAddress": "0xe12da02820fAD83e0369C6De7Ae30721eaB60E32",
"startBlock": "29300000"
}
6 changes: 3 additions & 3 deletions subgraphs/isolated-pools/config/testnet.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"network": "chapel",
"poolRegistryAddress": "0x1aF50D1Ee859Bb972384F1f96F3cFCccfC5Ac210",
"poolLensAddress": "0x7d6A1a595dCa742B4FF4Fb8684e3F018C3c0bEC0",
"startBlock": "28205600"
"poolRegistryAddress": "0xC85491616Fa949E048F3aAc39fbf5b0703800667",
"poolLensAddress": "0x559936086C5f65b92240012ae0D2F70C082Ac0b0",
"startBlock": "30870000"
}
12 changes: 0 additions & 12 deletions subgraphs/isolated-pools/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
Expand Down
2 changes: 0 additions & 2 deletions subgraphs/isolated-pools/src/constants/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 0 additions & 2 deletions subgraphs/isolated-pools/src/operations/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ import {
MINT,
REDEEM,
REPAY,
RiskRatings,
TRANSFER,
UNDERLYING_AMOUNT,
UNDERLYING_REPAY_AMOUNT,
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 0 additions & 2 deletions subgraphs/isolated-pools/src/operations/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions subgraphs/isolated-pools/template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion subgraphs/isolated-pools/tests/PoolRegistry/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
3 changes: 1 addition & 2 deletions subgraphs/isolated-pools/tests/VToken/mocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ export const createPoolRegistryMock = (pools: Array<Array<ethereum.Value>>): 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
Expand All @@ -53,7 +52,7 @@ export const createPoolRegistryMock = (pools: Array<Array<ethereum.Value>>): 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]);
Expand Down
4 changes: 0 additions & 4 deletions subgraphs/isolated-pools/tests/integration/poolRegistry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import deploy from './utils/deploy';
const DEFAULT_POOL = {
name: 'Pool 1',
creator: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266',
riskRating: 'VERY_HIGH_RISK',
category: '',
logoUrl: '',
description: '',
Expand Down Expand Up @@ -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('');
Expand All @@ -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);
Expand All @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ query Pools {
creator
blockPosted
timestampPosted
riskRating
category
logoUrl
description
Expand Down
2 changes: 1 addition & 1 deletion subgraphs/venus-governance/template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
30 changes: 19 additions & 11 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3502,17 +3502,24 @@ __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"
checksum: dfab51a7f91735cfb1e94dd5074736b0dac0207e4ebf26eb46b32defd3b67adce5a36b248daa7b841c21be74863c1e37cf92ed194a9c36d3f8c5326d1a24242a
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

Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 0400e50

Please sign in to comment.