Skip to content

Commit

Permalink
Fxi zero period staking rewards snapshot (#43)
Browse files Browse the repository at this point in the history
  • Loading branch information
tsudmi authored Jan 18, 2022
1 parent 1d7b11f commit f427500
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"parser": "@typescript-eslint/parser",
"plugins": ["@typescript-eslint"],
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended", "prettier", "prettier/@typescript-eslint"]
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended", "prettier"]
}
8 changes: 6 additions & 2 deletions subgraphs/stakewise/src/entities/rewardEthToken.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,12 @@ export function createStakingRewardsSnapshot(

let periodDuration = BIG_INT_ZERO;
let submitDuration = block.timestamp.minus(lastUpdateTimestamp);
while (periodDuration.plus(ORACLES_UPDATE_PERIOD).lt(submitDuration)) {
periodDuration = periodDuration.plus(ORACLES_UPDATE_PERIOD);
if (submitDuration.le(ORACLES_UPDATE_PERIOD)) {
periodDuration = submitDuration
} else {
while (periodDuration.plus(ORACLES_UPDATE_PERIOD).lt(submitDuration)) {
periodDuration = periodDuration.plus(ORACLES_UPDATE_PERIOD);
}
}

snapshot.periodTotalRewards = periodTotalRewards;
Expand Down
5 changes: 2 additions & 3 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"extends": "@graphprotocol/graph-ts/tsconfig",
"compilerOptions": {
"strict": true,
"target": "es5",
"moduleResolution": "node"
"types": ["@graphprotocol/graph-ts"]
}
}

0 comments on commit f427500

Please sign in to comment.