Skip to content

Commit

Permalink
chore: Refactor Autonolas.ts to use Math.floor instead of Math.round …
Browse files Browse the repository at this point in the history
…for calculating nowInSeconds
  • Loading branch information
truemiller committed Jun 19, 2024
1 parent 4d1a4c4 commit 195e3d8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions frontend/service/Autonolas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ const getAgentStakingRewardsInfo = async ({
uint256 inactivity;}
*/

const nowInSeconds = Math.round(Date.now() / 1000);
const nowInSeconds = Math.floor(Date.now() / 1000);

const requiredMechRequests =
(Math.ceil(Math.max(livenessPeriod, nowInSeconds - lastTsCheckpoint)) *
Expand Down Expand Up @@ -147,7 +147,7 @@ const getAvailableRewardsForEpoch = async (): Promise<number | undefined> => {

const [rewardsPerSecond, epochLength, tsCheckpoint] = multicallResponse;

const nowInSeconds = Math.round(Date.now() / 1000);
const nowInSeconds = Math.floor(Date.now() / 1000);

return Math.max(
rewardsPerSecond * epochLength,
Expand Down

0 comments on commit 195e3d8

Please sign in to comment.