diff --git a/src/sdk/utils/math.test.ts b/src/sdk/utils/math.test.ts index d153eaa5..66f77c00 100644 --- a/src/sdk/utils/math.test.ts +++ b/src/sdk/utils/math.test.ts @@ -150,14 +150,24 @@ describe("computeAPR", () => { expected: 6.016763389193883, }, { - name: "NaN", + name: "real - no stake", + in: { + myStake: 0, + totalStaked: 10_000_000, + params, + period: 0, + }, + expected: 6.016769405957272, + }, + { + name: "infinity", in: { myStake: 0, totalStaked: 0, params, period: 0, }, - expected: NaN, + expected: Infinity, }, ] diff --git a/src/sdk/utils/math.ts b/src/sdk/utils/math.ts index d6e8bd3c..460e92d1 100644 --- a/src/sdk/utils/math.ts +++ b/src/sdk/utils/math.ts @@ -21,7 +21,7 @@ export const calculateEpochMintProvision = ( return polynomialValue.lt(0) || params.epochsPerPeriod.eq(0) || - period.gt(params.maxPeriod.toString()).toString() + period.gt(params.maxPeriod.toString()) ? BigNumber(0) : polynomialValue }