mirror of
https://github.com/orionprotocol/sdk.git
synced 2026-03-18 03:45:02 +03:00
move constants
This commit is contained in:
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@orionprotocol/sdk",
|
||||
"version": "0.19.89-rc9",
|
||||
"version": "0.19.89-rc11",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@orionprotocol/sdk",
|
||||
"version": "0.19.89-rc9",
|
||||
"version": "0.19.89-rc11",
|
||||
"hasInstallScript": true,
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@orionprotocol/sdk",
|
||||
"version": "0.19.89-rc10",
|
||||
"version": "0.19.89-rc11",
|
||||
"description": "Orion Protocol SDK",
|
||||
"main": "./lib/index.cjs",
|
||||
"module": "./lib/index.js",
|
||||
|
||||
@@ -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