From bf003acfe471501e60941ba070f7e0929a3db698 Mon Sep 17 00:00:00 2001 From: Dhruv Chauhan Date: Fri, 24 May 2024 19:12:03 +0530 Subject: [PATCH] fix(#patch); lido; Fix protocol side revenue (#2538) --- deployment/deployment.json | 2 +- .../lido-ethereum/configurations.json | 4 +-- subgraphs/lido/src/mappings/Lido.ts | 34 ++++++++----------- 3 files changed, 18 insertions(+), 22 deletions(-) diff --git a/deployment/deployment.json b/deployment/deployment.json index 825388c502..87b1c87159 100644 --- a/deployment/deployment.json +++ b/deployment/deployment.json @@ -2908,7 +2908,7 @@ "status": "prod", "versions": { "schema": "1.4.0", - "subgraph": "1.0.7", + "subgraph": "1.0.8", "methodology": "1.0.0" }, "files": { diff --git a/subgraphs/lido/protocols/lido/config/deployments/lido-ethereum/configurations.json b/subgraphs/lido/protocols/lido/config/deployments/lido-ethereum/configurations.json index 9638969573..73157b4f7b 100644 --- a/subgraphs/lido/protocols/lido/config/deployments/lido-ethereum/configurations.json +++ b/subgraphs/lido/protocols/lido/config/deployments/lido-ethereum/configurations.json @@ -1,5 +1,5 @@ { "graftEnabled": false, - "subgraphId": "", - "graftStartBlock": 0 + "subgraphId": "QmYh4s6bVHBrZftuqNsMrMyVqHUUUQiZhuaGhXgnx8ydZJ", + "graftStartBlock": 17266004 } diff --git a/subgraphs/lido/src/mappings/Lido.ts b/subgraphs/lido/src/mappings/Lido.ts index 271d7aed91..6e38c2119f 100644 --- a/subgraphs/lido/src/mappings/Lido.ts +++ b/subgraphs/lido/src/mappings/Lido.ts @@ -95,28 +95,24 @@ export function handleTransfer(event: Transfer): void { fromZeros && recipient == Address.fromString(PROTOCOL_TREASURY_ID); let isMintToNodeOperators = false; - if (event.block.number < LIDO_V2_UPGRADE_BLOCK) { - // get node operators - let nodeOperators: Address[] = []; - const nodeOperatorsRegistry = NodeOperatorsRegistry.bind( - Address.fromString(PROTOCOL_NODE_OPERATORS_REGISTRY_ID) - ); - const getRewardsDistributionCallResult = - nodeOperatorsRegistry.try_getRewardsDistribution(BIGINT_ZERO); - if (getRewardsDistributionCallResult.reverted) { - log.info("NodeOperatorsRegistry call reverted", []); - } else { - nodeOperators = getRewardsDistributionCallResult.value.getRecipients(); - } - - isMintToNodeOperators = - fromZeros && (nodeOperators.includes(recipient) as boolean); + // get node operators + let nodeOperators: Address[] = []; + const nodeOperatorsRegistry = NodeOperatorsRegistry.bind( + Address.fromString(PROTOCOL_NODE_OPERATORS_REGISTRY_ID) + ); + const getRewardsDistributionCallResult = + nodeOperatorsRegistry.try_getRewardsDistribution(BIGINT_ZERO); + if (getRewardsDistributionCallResult.reverted) { + log.info("NodeOperatorsRegistry call reverted", []); } else { - isMintToNodeOperators = - fromZeros && - recipient == Address.fromString(PROTOCOL_NODE_OPERATORS_REGISTRY_ID); + nodeOperators = getRewardsDistributionCallResult.value.getRecipients(); } + isMintToNodeOperators = + fromZeros && + ((nodeOperators.includes(recipient) as boolean) || + recipient == Address.fromString(PROTOCOL_NODE_OPERATORS_REGISTRY_ID)); + // update metrics if (isMintToTreasury || isMintToNodeOperators) { updateProtocolSideRevenueMetrics(event.block, value);