From 4c85ca9137c520e59f6b21841c959bd16f1b151b Mon Sep 17 00:00:00 2001 From: Corey Rice Date: Tue, 21 Nov 2023 15:30:58 -0300 Subject: [PATCH] fix: listen to indexed MarketListed --- .../@venusprotocol+venus-protocol+3.1.0.patch | 227 ------------------ subgraphs/venus/package.json | 2 +- subgraphs/venus/template.yaml | 33 ++- yarn.lock | 31 +-- 4 files changed, 47 insertions(+), 246 deletions(-) delete mode 100644 patches/@venusprotocol+venus-protocol+3.1.0.patch diff --git a/patches/@venusprotocol+venus-protocol+3.1.0.patch b/patches/@venusprotocol+venus-protocol+3.1.0.patch deleted file mode 100644 index d82b2954..00000000 --- a/patches/@venusprotocol+venus-protocol+3.1.0.patch +++ /dev/null @@ -1,227 +0,0 @@ -diff --git a/node_modules/@venusprotocol/venus-protocol/contracts/Comptroller/Comptroller.sol b/node_modules/@venusprotocol/venus-protocol/contracts/Comptroller/Comptroller.sol -index a07ff43..b7db1fa 100644 ---- a/node_modules/@venusprotocol/venus-protocol/contracts/Comptroller/Comptroller.sol -+++ b/node_modules/@venusprotocol/venus-protocol/contracts/Comptroller/Comptroller.sol -@@ -15,7 +15,7 @@ import "./Unitroller.sol"; - * @title Venus's Comptroller Contract - * @author Venus - */ --contract Comptroller is ComptrollerV12Storage, ComptrollerInterfaceG2, ComptrollerErrorReporter, ExponentialNoError { -+contract CorePoolComptroller is ComptrollerV12Storage, ComptrollerInterfaceG2, ComptrollerErrorReporter, ExponentialNoError { - /// @notice Emitted when an admin supports a market - event MarketListed(VToken vToken); - -diff --git a/node_modules/@venusprotocol/venus-protocol/contracts/Comptroller/ComptrollerG3.sol b/node_modules/@venusprotocol/venus-protocol/contracts/Comptroller/ComptrollerG3.sol -index bb00a9d..8e7e7f6 100644 ---- a/node_modules/@venusprotocol/venus-protocol/contracts/Comptroller/ComptrollerG3.sol -+++ b/node_modules/@venusprotocol/venus-protocol/contracts/Comptroller/ComptrollerG3.sol -@@ -1,7 +1,7 @@ - pragma solidity ^0.5.16; - - import "../Oracle/PriceOracle.sol"; --import "../Tokens/VTokens/VToken.sol"; -+import { CorePoolVToken as VToken } from "../Tokens/VTokens/VToken.sol"; - import "../Utils/ErrorReporter.sol"; - import "../Utils/Exponential.sol"; - import "../Tokens/XVS/XVS.sol"; -diff --git a/node_modules/@venusprotocol/venus-protocol/contracts/Comptroller/ComptrollerG4.sol b/node_modules/@venusprotocol/venus-protocol/contracts/Comptroller/ComptrollerG4.sol -index aa478da..f6e7393 100644 ---- a/node_modules/@venusprotocol/venus-protocol/contracts/Comptroller/ComptrollerG4.sol -+++ b/node_modules/@venusprotocol/venus-protocol/contracts/Comptroller/ComptrollerG4.sol -@@ -1,7 +1,7 @@ - pragma solidity ^0.5.16; - - import "../Oracle/PriceOracle.sol"; --import "../Tokens/VTokens/VToken.sol"; -+import { CorePoolVToken as VToken } from "../Tokens/VTokens/VToken.sol"; - import "../Utils/ErrorReporter.sol"; - import "../Tokens/XVS/XVS.sol"; - import "../Tokens/VAI/VAI.sol"; -diff --git a/node_modules/@venusprotocol/venus-protocol/contracts/Comptroller/ComptrollerG5.sol b/node_modules/@venusprotocol/venus-protocol/contracts/Comptroller/ComptrollerG5.sol -index e1c447f..942b96c 100644 ---- a/node_modules/@venusprotocol/venus-protocol/contracts/Comptroller/ComptrollerG5.sol -+++ b/node_modules/@venusprotocol/venus-protocol/contracts/Comptroller/ComptrollerG5.sol -@@ -1,7 +1,7 @@ - pragma solidity ^0.5.16; - - import "../Oracle/PriceOracle.sol"; --import "../Tokens/VTokens/VToken.sol"; -+import { CorePoolVToken as VToken } from "../Tokens/VTokens/VToken.sol"; - import "../Utils/ErrorReporter.sol"; - import "../Tokens/XVS/XVS.sol"; - import "../Tokens/VAI/VAI.sol"; -diff --git a/node_modules/@venusprotocol/venus-protocol/contracts/Comptroller/ComptrollerInterface.sol b/node_modules/@venusprotocol/venus-protocol/contracts/Comptroller/ComptrollerInterface.sol -index c8695bc..83177b7 100644 ---- a/node_modules/@venusprotocol/venus-protocol/contracts/Comptroller/ComptrollerInterface.sol -+++ b/node_modules/@venusprotocol/venus-protocol/contracts/Comptroller/ComptrollerInterface.sol -@@ -1,6 +1,6 @@ - pragma solidity ^0.5.16; - --import "../Tokens/VTokens/VToken.sol"; -+import { CorePoolVToken as VToken } from "../Tokens/VTokens/VToken.sol"; - import "../Oracle/PriceOracle.sol"; - - contract ComptrollerInterfaceG1 { -diff --git a/node_modules/@venusprotocol/venus-protocol/contracts/Comptroller/ComptrollerLensInterface.sol b/node_modules/@venusprotocol/venus-protocol/contracts/Comptroller/ComptrollerLensInterface.sol -index 2f56b52..fcd8940 100644 ---- a/node_modules/@venusprotocol/venus-protocol/contracts/Comptroller/ComptrollerLensInterface.sol -+++ b/node_modules/@venusprotocol/venus-protocol/contracts/Comptroller/ComptrollerLensInterface.sol -@@ -1,7 +1,7 @@ - pragma solidity ^0.5.16; - pragma experimental ABIEncoderV2; - --import "../Tokens/VTokens/VToken.sol"; -+import { CorePoolVToken as VToken } from "../Tokens/VTokens/VToken.sol"; - - interface ComptrollerLensInterface { - function liquidateCalculateSeizeTokens( -diff --git a/node_modules/@venusprotocol/venus-protocol/contracts/Comptroller/ComptrollerStorage.sol b/node_modules/@venusprotocol/venus-protocol/contracts/Comptroller/ComptrollerStorage.sol -index d651f66..80c99db 100644 ---- a/node_modules/@venusprotocol/venus-protocol/contracts/Comptroller/ComptrollerStorage.sol -+++ b/node_modules/@venusprotocol/venus-protocol/contracts/Comptroller/ComptrollerStorage.sol -@@ -1,6 +1,6 @@ - pragma solidity ^0.5.16; - --import "../Tokens/VTokens/VToken.sol"; -+import { CorePoolVToken as VToken } from "../Tokens/VTokens/VToken.sol"; - import "../Oracle/PriceOracle.sol"; - import "../Tokens/VAI/VAIControllerInterface.sol"; - import "./ComptrollerLensInterface.sol"; -diff --git a/node_modules/@venusprotocol/venus-protocol/contracts/Comptroller/UpdatedComptroller.sol b/node_modules/@venusprotocol/venus-protocol/contracts/Comptroller/UpdatedComptroller.sol -index 68c1ff9..28cf9af 100644 ---- a/node_modules/@venusprotocol/venus-protocol/contracts/Comptroller/UpdatedComptroller.sol -+++ b/node_modules/@venusprotocol/venus-protocol/contracts/Comptroller/UpdatedComptroller.sol -@@ -1,7 +1,7 @@ - pragma solidity ^0.5.16; - - import "../Oracle/PriceOracle.sol"; --import "../Tokens/VTokens/VToken.sol"; -+import { CorePoolVToken as VToken } from "../Tokens/VTokens/VToken.sol"; - import "../Utils/ErrorReporter.sol"; - import "../Tokens/XVS/XVS.sol"; - import "../Tokens/VAI/VAI.sol"; -diff --git a/node_modules/@venusprotocol/venus-protocol/contracts/Comptroller/UpdatedComptrollerInterface.sol b/node_modules/@venusprotocol/venus-protocol/contracts/Comptroller/UpdatedComptrollerInterface.sol -index 3e476c3..565ebda 100644 ---- a/node_modules/@venusprotocol/venus-protocol/contracts/Comptroller/UpdatedComptrollerInterface.sol -+++ b/node_modules/@venusprotocol/venus-protocol/contracts/Comptroller/UpdatedComptrollerInterface.sol -@@ -1,6 +1,6 @@ - pragma solidity ^0.5.16; - --import "../Tokens/VTokens/VToken.sol"; -+import { CorePoolVToken as VToken } from "../Tokens/VTokens/VToken.sol"; - import "../Oracle/PriceOracle.sol"; - - contract UpdatedComptrollerInterfaceG1 { -diff --git a/node_modules/@venusprotocol/venus-protocol/contracts/Lens/ComptrollerLens.sol b/node_modules/@venusprotocol/venus-protocol/contracts/Lens/ComptrollerLens.sol -index 5e08227..6de41a6 100644 ---- a/node_modules/@venusprotocol/venus-protocol/contracts/Lens/ComptrollerLens.sol -+++ b/node_modules/@venusprotocol/venus-protocol/contracts/Lens/ComptrollerLens.sol -@@ -6,7 +6,7 @@ import "../Tokens/VTokens/VToken.sol"; - import "../Tokens/EIP20Interface.sol"; - import "../Oracle/PriceOracle.sol"; - import "../Utils/ErrorReporter.sol"; --import "../Comptroller/Comptroller.sol"; -+import { CorePoolComptroller as Comptroller, ComptrollerLensInterface, ComptrollerErrorReporter } from "../Comptroller/Comptroller.sol"; - import "../Tokens/VAI/VAIControllerInterface.sol"; - - /** -diff --git a/node_modules/@venusprotocol/venus-protocol/contracts/Lens/SnapshotLens.sol b/node_modules/@venusprotocol/venus-protocol/contracts/Lens/SnapshotLens.sol -index d44d94a..8750d4d 100644 ---- a/node_modules/@venusprotocol/venus-protocol/contracts/Lens/SnapshotLens.sol -+++ b/node_modules/@venusprotocol/venus-protocol/contracts/Lens/SnapshotLens.sol -@@ -3,7 +3,7 @@ pragma experimental ABIEncoderV2; - - import "../Tokens/VTokens/VToken.sol"; - import "../Utils/SafeMath.sol"; --import "../Comptroller/Comptroller.sol"; -+import { CorePoolComptroller as Comptroller } from "../Comptroller/Comptroller.sol"; - import "../Tokens/EIP20Interface.sol"; - import "../Tokens/VTokens/VBep20.sol"; - -diff --git a/node_modules/@venusprotocol/venus-protocol/contracts/Lens/VenusLens.sol b/node_modules/@venusprotocol/venus-protocol/contracts/Lens/VenusLens.sol -index 234ca82..8906ec0 100644 ---- a/node_modules/@venusprotocol/venus-protocol/contracts/Lens/VenusLens.sol -+++ b/node_modules/@venusprotocol/venus-protocol/contracts/Lens/VenusLens.sol -@@ -2,7 +2,7 @@ pragma solidity ^0.5.16; - pragma experimental ABIEncoderV2; - - import "../Tokens/VTokens/VBep20.sol"; --import "../Tokens/VTokens/VToken.sol"; -+import { CorePoolVToken as VToken } from "../Tokens/VTokens/VToken.sol"; - import "../Oracle/PriceOracle.sol"; - import "../Tokens/EIP20Interface.sol"; - import "../Governance/GovernorAlpha.sol"; -diff --git a/node_modules/@venusprotocol/venus-protocol/contracts/Oracle/PriceOracle.sol b/node_modules/@venusprotocol/venus-protocol/contracts/Oracle/PriceOracle.sol -index 15f44c1..f8f5685 100644 ---- a/node_modules/@venusprotocol/venus-protocol/contracts/Oracle/PriceOracle.sol -+++ b/node_modules/@venusprotocol/venus-protocol/contracts/Oracle/PriceOracle.sol -@@ -1,6 +1,6 @@ - pragma solidity ^0.5.16; - --import "../Tokens/VTokens/VToken.sol"; -+import { CorePoolVToken as VToken } from "../Tokens/VTokens/VToken.sol"; - - contract PriceOracle { - /// @notice Indicator that this is a PriceOracle contract (for inspection) -diff --git a/node_modules/@venusprotocol/venus-protocol/contracts/Tokens/VAI/VAIController.sol b/node_modules/@venusprotocol/venus-protocol/contracts/Tokens/VAI/VAIController.sol -index 5998a64..b03f187 100644 ---- a/node_modules/@venusprotocol/venus-protocol/contracts/Tokens/VAI/VAIController.sol -+++ b/node_modules/@venusprotocol/venus-protocol/contracts/Tokens/VAI/VAIController.sol -@@ -4,7 +4,7 @@ import "../../Oracle/PriceOracle.sol"; - import "../../Utils/ErrorReporter.sol"; - import "../../Utils/Exponential.sol"; - import "../../Comptroller/ComptrollerStorage.sol"; --import { Comptroller } from "../../Comptroller/Comptroller.sol"; -+import { CorePoolComptroller } from "../../Comptroller/Comptroller.sol"; - import "../../Governance/IAccessControlManager.sol"; - import "../VTokens/VToken.sol"; - import "./VAIControllerStorage.sol"; -diff --git a/node_modules/@venusprotocol/venus-protocol/contracts/Tokens/VAI/VAIControllerStorage.sol b/node_modules/@venusprotocol/venus-protocol/contracts/Tokens/VAI/VAIControllerStorage.sol -index 2dbd38a..548c27e 100644 ---- a/node_modules/@venusprotocol/venus-protocol/contracts/Tokens/VAI/VAIControllerStorage.sol -+++ b/node_modules/@venusprotocol/venus-protocol/contracts/Tokens/VAI/VAIControllerStorage.sol -@@ -1,6 +1,6 @@ - pragma solidity ^0.5.16; - --import { Comptroller } from "../../Comptroller/Comptroller.sol"; -+import { CorePoolComptroller as Comptroller } from "../../Comptroller/Comptroller.sol"; - - contract VAIUnitrollerAdminStorage { - /** -diff --git a/node_modules/@venusprotocol/venus-protocol/contracts/Tokens/VTokens/VToken.sol b/node_modules/@venusprotocol/venus-protocol/contracts/Tokens/VTokens/VToken.sol -index fdbc8b8..4c27206 100644 ---- a/node_modules/@venusprotocol/venus-protocol/contracts/Tokens/VTokens/VToken.sol -+++ b/node_modules/@venusprotocol/venus-protocol/contracts/Tokens/VTokens/VToken.sol -@@ -13,7 +13,7 @@ import "./VTokenInterfaces.sol"; - * @notice Abstract base for vTokens - * @author Venus - */ --contract VToken is VTokenInterface, Exponential, TokenErrorReporter { -+contract CorePoolVToken is VTokenInterface, Exponential, TokenErrorReporter { - struct MintLocalVars { - MathError mathErr; - uint exchangeRateMantissa; -diff --git a/node_modules/@venusprotocol/venus-protocol/contracts/test/MockVBNB.sol b/node_modules/@venusprotocol/venus-protocol/contracts/test/MockVBNB.sol -index a8a4cab..59d4173 100644 ---- a/node_modules/@venusprotocol/venus-protocol/contracts/test/MockVBNB.sol -+++ b/node_modules/@venusprotocol/venus-protocol/contracts/test/MockVBNB.sol -@@ -1,6 +1,6 @@ - pragma solidity ^0.5.16; - --import "../Tokens/VTokens/VToken.sol"; -+import { CorePoolVToken as VToken } from "../Tokens/VTokens/VToken.sol"; - - /** - * @title Venus's vBNB Contract -diff --git a/node_modules/@venusprotocol/venus-protocol/contracts/test/VBep20MockDelegate.sol b/node_modules/@venusprotocol/venus-protocol/contracts/test/VBep20MockDelegate.sol -index fe9520f..f7eceb0 100644 ---- a/node_modules/@venusprotocol/venus-protocol/contracts/test/VBep20MockDelegate.sol -+++ b/node_modules/@venusprotocol/venus-protocol/contracts/test/VBep20MockDelegate.sol -@@ -1,6 +1,6 @@ - pragma solidity ^0.5.16; - --import "../Tokens/VTokens/VToken.sol"; -+import { CorePoolVToken as VToken } from "../Tokens/VTokens/VToken.sol"; - - /** - * @title Venus's VBep20 Contract diff --git a/subgraphs/venus/package.json b/subgraphs/venus/package.json index d393c9dc..b13c548a 100644 --- a/subgraphs/venus/package.json +++ b/subgraphs/venus/package.json @@ -25,7 +25,7 @@ "test:integration": "true" }, "dependencies": { - "@venusprotocol/venus-protocol": "3.1.0", + "@venusprotocol/venus-protocol": "5.2.0", "@venusprotocol/venus-protocol-orig-events": "npm:@venusprotocol/venus-protocol@2.2.1" } } diff --git a/subgraphs/venus/template.yaml b/subgraphs/venus/template.yaml index 58c94338..9b57bdf9 100644 --- a/subgraphs/venus/template.yaml +++ b/subgraphs/venus/template.yaml @@ -21,7 +21,7 @@ dataSources: - Market abis: - name: Comptroller - file: ../../node_modules/@venusprotocol/venus-protocol/artifacts/contracts/Comptroller/Comptroller.sol/Comptroller.json + file: ../../node_modules/@venusprotocol/venus-protocol/artifacts/contracts/Comptroller/Diamond/DiamondConsolidated.sol/DiamondConsolidated.json - name: VToken file: ../../node_modules/@venusprotocol/venus-protocol/artifacts/contracts/Tokens/VTokens/VBep20.sol/VBep20.json - name: PriceOracle @@ -29,7 +29,7 @@ dataSources: - name: BEP20 file: ../../node_modules/@venusprotocol/venus-protocol/artifacts/contracts/Tokens/BEP20Interface.sol/BEP20Interface.json eventHandlers: - - event: MarketListed(address) + - event: MarketListed(indexed address) handler: handleMarketListed - event: MarketEntered(address,address) handler: handleMarketEntered @@ -47,6 +47,33 @@ dataSources: handler: handleXvsDistributed - event: DistributedSupplierVenus(indexed address,indexed address,uint256,uint256) handler: handleXvsDistributed + - kind: ethereum/contract + name: Comptroller + network: {{ network }} + source: + address: "{{ address }}" + abi: Comptroller + startBlock: {{ startBlock }} + mapping: + kind: ethereum/events + apiVersion: 0.0.5 + language: wasm/assemblyscript + file: ./src/mappings/comptroller.ts + entities: + - Comptroller + - Market + abis: + - name: Comptroller + file: ../../node_modules/@venusprotocol/venus-protocol-orig-events/artifacts/contracts/Comptroller/Comptroller.sol/Comptroller.json + - name: VToken + file: ../../node_modules/@venusprotocol/venus-protocol/artifacts/contracts/Tokens/VTokens/VBep20.sol/VBep20.json + - name: PriceOracle + file: ../../node_modules/@venusprotocol/oracle/artifacts/contracts/ResilientOracle.sol/ResilientOracle.json + - name: BEP20 + file: ../../node_modules/@venusprotocol/venus-protocol/artifacts/contracts/Tokens/BEP20Interface.sol/BEP20Interface.json + eventHandlers: + - event: MarketListed(address) + handler: handleMarketListed templates: - name: VToken kind: ethereum/contract @@ -65,8 +92,6 @@ templates: abis: - name: VToken file: ../../node_modules/@venusprotocol/venus-protocol-orig-events/artifacts/contracts/Tokens/VTokens/VBep20.sol/VBep20.json - - name: VBep20Storage - file: ../../node_modules/@venusprotocol/venus-protocol-orig-events/artifacts/contracts/Tokens/VTokens/VTokenInterfaces.sol/VBep20Storage.json - name: PriceOracle file: ../../node_modules/@venusprotocol/oracle/artifacts/contracts/ResilientOracle.sol/ResilientOracle.json - name: BEP20 diff --git a/yarn.lock b/yarn.lock index 9baeb27e..dc8a5a79 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3316,7 +3316,7 @@ __metadata: languageName: node linkType: hard -"@openzeppelin/contracts@npm:^4.3.3": +"@openzeppelin/contracts@npm:4.9.3, @openzeppelin/contracts@npm:^4.3.3": version: 4.9.3 resolution: "@openzeppelin/contracts@npm:4.9.3" checksum: 4932063e733b35fa7669b9fe2053f69b062366c5c208b0c6cfa1ac451712100c78acff98120c3a4b88d94154c802be05d160d71f37e7d74cadbe150964458838 @@ -4267,6 +4267,13 @@ __metadata: languageName: node linkType: hard +"@venusprotocol/governance-contracts@npm:^0.0.2": + version: 0.0.2 + resolution: "@venusprotocol/governance-contracts@npm:0.0.2" + checksum: 101ade6013fe3963968d37ff839a4c62aeaedd9f26d8c5ae47bdc413e6c61732b4048a1b026e4281ade5676fb1545a49ecac299f6b669a9f0c7e73723666d7e1 + languageName: node + linkType: hard + "@venusprotocol/governance-contracts@npm:^1.3.0": version: 1.3.0 resolution: "@venusprotocol/governance-contracts@npm:1.3.0" @@ -4335,17 +4342,19 @@ __metadata: languageName: node linkType: hard -"@venusprotocol/venus-protocol@npm:3.1.0": - version: 3.1.0 - resolution: "@venusprotocol/venus-protocol@npm:3.1.0" +"@venusprotocol/venus-protocol@npm:5.2.0": + version: 5.2.0 + resolution: "@venusprotocol/venus-protocol@npm:5.2.0" dependencies: - "@openzeppelin/contracts": ^4.8.3 + "@openzeppelin/contracts": 4.9.3 "@openzeppelin/contracts-upgradeable": ^4.8.0 + "@venusprotocol/governance-contracts": ^0.0.2 + bignumber.js: ^9.1.2 dotenv: ^16.0.1 module-alias: ^2.2.2 peerDependencies: hardhat: ^2.10.1 - checksum: 0c44a6566ed623161f49036961d2118958485a59bdba71733e86c77731cde2adcfcb535b69c275381888bc1fc6d807ab9ec271e8796aa961897dac2850081e1c + checksum: 39c709ead10c1cea667cb61ba5dae0945640cd68778719581452dbc465b19e8eb73b572a78fe8fcfd42e4fe3a6820efe7b60bc38fbf290d6fb8dbe228b68703c languageName: node linkType: hard @@ -5318,7 +5327,7 @@ __metadata: languageName: node linkType: hard -"bignumber.js@npm:^9.0.0": +"bignumber.js@npm:^9.0.0, bignumber.js@npm:^9.1.2": version: 9.1.2 resolution: "bignumber.js@npm:9.1.2" checksum: 582c03af77ec9cb0ebd682a373ee6c66475db94a4325f92299621d544aa4bd45cb45fd60001610e94aef8ae98a0905fa538241d9638d4422d57abbeeac6fadaf @@ -6548,12 +6557,6 @@ __metadata: languageName: node linkType: hard -"core-pool-abis@workspace:packages/core-pool-abis": - version: 0.0.0-use.local - resolution: "core-pool-abis@workspace:packages/core-pool-abis" - languageName: unknown - linkType: soft - "core-util-is@npm:1.0.2": version: 1.0.2 resolution: "core-util-is@npm:1.0.2" @@ -15989,7 +15992,7 @@ __metadata: version: 0.0.0-use.local resolution: "venus-subgraph@workspace:subgraphs/venus" dependencies: - "@venusprotocol/venus-protocol": 3.1.0 + "@venusprotocol/venus-protocol": 5.2.0 "@venusprotocol/venus-protocol-orig-events": "npm:@venusprotocol/venus-protocol@2.2.1" languageName: unknown linkType: soft