Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(#patch); trader-joe; fix div by zero indexing error #2436

Merged
merged 3 commits into from
Dec 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion deployment/deployment.json
Original file line number Diff line number Diff line change
Expand Up @@ -5330,7 +5330,7 @@
"status": "prod",
"versions": {
"schema": "1.3.2",
"subgraph": "1.2.1",
"subgraph": "1.3.0",
"methodology": "1.0.0"
},
"files": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ description: ...
graft:
base: {{subgraphId}} # Subgraph ID of base subgraph
block: {{graftStartBlock}} # Block number
features:
- grafting
{{/graftEnabled}}
dataSources:
- kind: ethereum
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {
import {
convertTokenToDecimal,
roundToWholeNumber,
safeDiv,
} from "../../../../../src/common/utils/utils";
import { getPoolRewardsWithBonus } from "./handleRewarder";

Expand Down Expand Up @@ -46,11 +47,13 @@ export function updateMasterChef(

// Calculate Reward Emission per second to a specific pool
// Pools are allocated based on their fraction of the total allocation times the rewards emitted per second
const rewardAmountPerInterval = masterChefV2.adjustedRewardTokenRate
.times(masterChefV2Pool.poolAllocPoint)
.div(masterChefV2.totalAllocPoint);
const rewardAmountPerIntervalBigDecimal = BigDecimal.fromString(
rewardAmountPerInterval.toString()
const rewardAmountPerIntervalBigDecimal = safeDiv(
new BigDecimal(
masterChefV2.adjustedRewardTokenRate.times(
masterChefV2Pool.poolAllocPoint
)
),
new BigDecimal(masterChefV2.totalAllocPoint)
dhruv-chauhan marked this conversation as resolved.
Show resolved Hide resolved
);

// Based on the emissions rate for the pool, calculate the rewards per day for the pool.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import {
import {
convertTokenToDecimal,
roundToWholeNumber,
safeDiv,
} from "../../../../../src/common/utils/utils";
import { getPoolRewardsWithBonus } from "./handleRewarder";

Expand Down Expand Up @@ -57,11 +58,13 @@ export function updateMasterChef(

// Calculate Reward Emission per second to a specific pool
// Pools are allocated based on their fraction of the total allocation times the rewards emitted per second
const rewardAmountPerInterval = masterChefV3.adjustedRewardTokenRate
.times(masterChefV3Pool.poolAllocPoint)
.div(masterChefV3.totalAllocPoint);
const rewardAmountPerIntervalBigDecimal = BigDecimal.fromString(
rewardAmountPerInterval.toString()
const rewardAmountPerIntervalBigDecimal = safeDiv(
new BigDecimal(
masterChefV3.adjustedRewardTokenRate.times(
masterChefV3Pool.poolAllocPoint
)
),
new BigDecimal(masterChefV3.totalAllocPoint)
);

// Based on the emissions rate for the pool, calculate the rewards per day for the pool.
Expand Down
Loading