From 38162d6d12072a43d97a5d9cbe0551f932da3095 Mon Sep 17 00:00:00 2001 From: waynebruce0x Date: Fri, 19 Jul 2024 14:07:59 +0100 Subject: [PATCH] pendle v4 factory --- projects/pendle/v2.js | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/projects/pendle/v2.js b/projects/pendle/v2.js index c14c8069ae8d..beb4e471bb99 100644 --- a/projects/pendle/v2.js +++ b/projects/pendle/v2.js @@ -9,20 +9,26 @@ const config = { ethereum: { factory: "0x27b1dacd74688af24a64bd3c9c1b143118740784", factoryV3: "0x1A6fCc85557BC4fB7B534ed835a03EF056552D52", + factoryV4: '0x3d75Bd20C983edb5fD218A1b7e0024F1056c7A2F', fromBlock: 16032059, fromBlockV3: 18669498, + fromBlockV4: 20323253 }, arbitrum: { factory: "0xf5a7de2d276dbda3eef1b62a9e718eff4d29ddc8", factoryV3: "0x2FCb47B58350cD377f94d3821e7373Df60bD9Ced", + factoryV4: '0xd9f5e9589016da862D2aBcE980A5A5B99A94f3E8', fromBlock: 62979673, - fromBlockV3: 154873897 + fromBlockV3: 154873897, + fromBlockV4: 233004891 }, bsc: { factory: "0x2bEa6BfD8fbFF45aA2a893EB3B6d85D10EFcC70E", factoryV3: "0xC40fEbF5A33b8C92B187d9be0fD3fe0ac2E4B07c", + factoryV4: '0x7D20e644D2A9e149e5be9bE9aD2aB243a7835d37', fromBlock: 34060741, fromBlockV3: 33884419, + fromBlockV4: 40539593, pts: [ "0x5eC2ae0AFDEc891E7702344dc2A31C636B3627Eb", "0x70c1138B54ba212776d3A9d29b6160C54C31cd5d", @@ -32,19 +38,23 @@ const config = { optimism: { factory: "0x17F100fB4bE2707675c6439468d38249DD993d58", factoryV3: "0x4A2B38b9cBd83c86F261a4d64c243795D4d44aBC", + factoryV4: '0x73Be47237F12F36203823BAc9A4d80dC798B7015', fromBlock: 108061448, fromBlockV3: 112783590, + fromBlockV4: 122792017 }, mantle: { factoryV3: "0xD228EC1f7D4313fe321fab511A872475D07F5bA6", + factoryV4: '0xCa274A44a52241c1a8EFb9f84Bf492D8363929FC', fromBlockV3: 61484384, + fromBlockV4: 66526601 }, }; module.exports = {}; Object.keys(config).forEach((chain) => { - const { factory, factoryV3, fromBlock, pts, fromBlockV3 } = config[chain]; + const { factory, factoryV3, factoryV4, fromBlock, pts, fromBlockV3, fromBlockV4 } = config[chain]; module.exports[chain] = { tvl: async (api) => { const logs = factory @@ -75,7 +85,21 @@ Object.keys(config).forEach((chain) => { }) : []; - const pt = logs.map((i) => i.PT).concat(logsV3.map((i) => i.PT)); + const logsV4 = factoryV4 + ? await getLogs({ + api, + target: factoryV4, + topic: [ + "0xae811fae25e2770b6bd1dcb1475657e8c3a976f91d1ebf081271db08eef920af", + ], + eventAbi: + "event CreateNewMarket (address indexed market, address indexed PT, int256 scalarRoot, int256 initialAnchor, uint256 lnFeeRateRoot)", + onlyArgs: true, + fromBlock: fromBlockV4, + }) + : []; + + const pt = logs.map((i) => i.PT).concat(logsV3.map((i) => i.PT)).concat(logsV4.map((i) => i.PT)); if (pts) pt.push(...pts); let sy = [ ...new Set(