Skip to content

Commit

Permalink
fix: 🎨 fixed comments
Browse files Browse the repository at this point in the history
  • Loading branch information
sadiabbasi committed Jan 3, 2025
1 parent b311a45 commit 85f472c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
5 changes: 3 additions & 2 deletions src/sdk/services/blockchain/contracts/VestingContract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ export interface VestingAllocation {
}

const MICROSECONDS_PER_SECOND = 1000000;
const MICROSECONDS_PER_DAY = 24 * 60 * 60 * 1000000;
const SECONDS_PER_HOUR = 3600;
const MICROSECONDS_PER_DAY = 24 * SECONDS_PER_HOUR * MICROSECONDS_PER_SECOND;
const MICROSECONDS_PER_MONTH = 30 * MICROSECONDS_PER_DAY;
const MICROSECONDS_PER_YEAR = 365 * MICROSECONDS_PER_DAY;

Expand Down Expand Up @@ -379,7 +380,7 @@ export class VestingContract {
return `${vestingPeriodInSeconds.toFixed(0)} seconds`;
} else {
// Return hours if it's more than a minute but less than a day
return `${(vestingPeriodInSeconds / 3600).toFixed(1)} hours`;
return `${(vestingPeriodInSeconds / SECONDS_PER_HOUR).toFixed(1)} hours`;
}
} else if (vestingPeriodInDays < 30) {
// Return days if it's less than 30 days
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -865,11 +865,8 @@ describe('VestingContract class', () => {

// Calculate expected allocation date
const expectedAllocationDate = new Date(saleStart.getTime() + timeSinceSaleStart);

// Validate allocation date matches expected allocation date
const tolerance = 1000; // 1 second in milliseconds

expect(Math.abs(allocationDate.getTime() - expectedAllocationDate.getTime())).toBeLessThanOrEqual(tolerance);
expect(allocationDate.getTime()).toBeCloseTo(expectedAllocationDate.getTime(), -3);
});

});
Expand Down

0 comments on commit 85f472c

Please sign in to comment.