Skip to content

Commit

Permalink
fix(#patch); lido; Fix protocol side revenue (#2538)
Browse files Browse the repository at this point in the history
  • Loading branch information
dhruv-chauhan authored May 24, 2024
1 parent 02cca85 commit bf003ac
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 22 deletions.
2 changes: 1 addition & 1 deletion deployment/deployment.json
Original file line number Diff line number Diff line change
Expand Up @@ -2908,7 +2908,7 @@
"status": "prod",
"versions": {
"schema": "1.4.0",
"subgraph": "1.0.7",
"subgraph": "1.0.8",
"methodology": "1.0.0"
},
"files": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"graftEnabled": false,
"subgraphId": "",
"graftStartBlock": 0
"subgraphId": "QmYh4s6bVHBrZftuqNsMrMyVqHUUUQiZhuaGhXgnx8ydZJ",
"graftStartBlock": 17266004
}
34 changes: 15 additions & 19 deletions subgraphs/lido/src/mappings/Lido.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit bf003ac

Please sign in to comment.