mirror of
https://github.com/orionprotocol/sdk.git
synced 2026-04-06 04:57:53 +03:00
move constants
This commit is contained in:
@@ -9,5 +9,6 @@ export { default as exchangesMap } from './exchangesMap.js';
|
||||
export * from './chains.js';
|
||||
export * from './precisions.js';
|
||||
export * from './gasLimits.js';
|
||||
export * from './timings.js';
|
||||
|
||||
export const SERVICE_TOKEN = 'ORN';
|
||||
|
||||
3
src/constants/timings.ts
Normal file
3
src/constants/timings.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
export const LOCK_START_TIME = 1690848000;// Aug 01 2023 00:00:00 UTC
|
||||
export const DAY = 86400
|
||||
export const YEAR = 365 * DAY
|
||||
@@ -9,6 +9,7 @@ import {
|
||||
} from './schemas/index.js';
|
||||
import { fetchWithValidation } from 'simple-typed-fetch';
|
||||
import { BigNumber } from 'bignumber.js';
|
||||
import { DAY, LOCK_START_TIME, YEAR } from '../../constants/index.js';
|
||||
|
||||
type BasePayload = {
|
||||
chainId: number
|
||||
@@ -65,10 +66,6 @@ type Payload =
|
||||
| ListAmountPayload
|
||||
| GetAmountByORNPayload;
|
||||
|
||||
const START_TIME = 1690848000;// Aug 01 2023 00:00:00 UTC
|
||||
const DAY = 86400
|
||||
const YEAR = 365 * DAY
|
||||
|
||||
class IntegratorService {
|
||||
private readonly apiUrl: string;
|
||||
|
||||
@@ -179,9 +176,9 @@ class IntegratorService {
|
||||
}
|
||||
|
||||
private readonly getK = (time: number) => {
|
||||
const currentTime = time < START_TIME ? START_TIME : time;
|
||||
const currentTime = time < LOCK_START_TIME ? LOCK_START_TIME : time;
|
||||
|
||||
const deltaYears = BigNumber(currentTime).minus(START_TIME).dividedBy(YEAR);
|
||||
const deltaYears = BigNumber(currentTime).minus(LOCK_START_TIME).dividedBy(YEAR);
|
||||
return BigNumber(2).pow(BigNumber(deltaYears).pow(2));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user