@stake-dao/reader 0.4.69 → 0.4.70
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/index.js +0 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/lockers/fetch/index.js +1 -7
- package/dist/esm/lockers/fetch/index.js.map +1 -1
- package/dist/esm/lockers/utils/getHttpCalls.js +2 -2
- package/dist/esm/lockers/utils/getHttpCalls.js.map +1 -1
- package/dist/esm/tsconfig.build.tsbuildinfo +1 -1
- package/dist/types/index.d.ts +0 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/lockers/fetch/index.d.ts +1 -3
- package/dist/types/lockers/fetch/index.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/index.ts +0 -1
- package/src/lockers/fetch/index.ts +1 -9
- package/src/lockers/utils/getHttpCalls.ts +2 -2
- package/dist/esm/lockers/utils/cakeLockerAirdrop.js +0 -46
- package/dist/esm/lockers/utils/cakeLockerAirdrop.js.map +0 -1
- package/dist/esm/lockers/utils/endpoints.js +0 -3
- package/dist/esm/lockers/utils/endpoints.js.map +0 -1
- package/dist/esm/lockers/utils/getCherries.js +0 -34
- package/dist/esm/lockers/utils/getCherries.js.map +0 -1
- package/dist/types/lockers/utils/cakeLockerAirdrop.d.ts +0 -8
- package/dist/types/lockers/utils/cakeLockerAirdrop.d.ts.map +0 -1
- package/dist/types/lockers/utils/endpoints.d.ts +0 -3
- package/dist/types/lockers/utils/endpoints.d.ts.map +0 -1
- package/dist/types/lockers/utils/getCherries.d.ts +0 -4
- package/dist/types/lockers/utils/getCherries.d.ts.map +0 -1
- package/src/lockers/utils/cakeLockerAirdrop.ts +0 -73
- package/src/lockers/utils/endpoints.ts +0 -2
- package/src/lockers/utils/getCherries.ts +0 -48
package/dist/types/index.d.ts
CHANGED
|
@@ -6,7 +6,6 @@ export { getSnapshotScores } from './utils/snapshot.js';
|
|
|
6
6
|
export type { BatchJsonRpcArgs } from './utils.js';
|
|
7
7
|
export { fetchSdt } from './sdt/fetch.js';
|
|
8
8
|
export { fetchLockers } from './lockers/fetch/index.js';
|
|
9
|
-
export { getUserCherries, getCherriesLeaderBoard, getUserSnapshotCherries } from './lockers/utils/getCherries.js';
|
|
10
9
|
export * from './strategies/utils/index.js';
|
|
11
10
|
export { buildCurveStrategies } from './strategies/curve/build.js';
|
|
12
11
|
export { fetchCurve } from './strategies/curve/fetch/index.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,kBAAkB,EAAE,0BAA0B,EAAE,SAAS,EAAE,SAAS,EAAE,KAAK,KAAK,EAAE,MAAM,aAAa,CAAA;AAC9G,cAAc,UAAU,CAAA;AACxB,cAAc,aAAa,CAAA;AAC3B,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AACrE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AACvD,YAAY,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAKlD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAKzC,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,kBAAkB,EAAE,0BAA0B,EAAE,SAAS,EAAE,SAAS,EAAE,KAAK,KAAK,EAAE,MAAM,aAAa,CAAA;AAC9G,cAAc,UAAU,CAAA;AACxB,cAAc,aAAa,CAAA;AAC3B,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AACrE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AACvD,YAAY,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAKlD,OAAO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AoD,CAAA;AACxF,OAAO,EAAE,2BAA2B,EAAE,MAAM,8CAA8C,CAAA;AAC1F,OAAO,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAA;AACrE,YAAY,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAGrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAA;AACzE,OAAO,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAA;AAC/E,OAAO,EAAE,qBAAqB,EAAE,MAAM,6CAA6C,CAAA;AAGnF,OAAO,EAAE,sBAAsB,EAAE,MAAM,iDAAiD,CAAA;AAGxF,OAAO,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAA;AAGzE,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAA;AAClE,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAA;AACvE,OAAO,EAAE,yBAAyB,EAAE,MAAM,2CAA2C,CAAA;AAIrF,OAAO,EAAE,kBAAkB,EAAE,MAAM,8CAA8C,CAAA;AACjF,OAAO,EAAE,kBAAkB,EAAE,MAAM,8CAA8C,CAAA;AACjF,OAAO,EAAE,iBAAiB,EAAE,MAAM,6CAA6C,CAAA;AAI/E,OAAO,EAAE,uBAAuB,EAAE,MAAM,+CAA+C,CAAA;AASvF,OAAO,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAA;AACnE,YAAY,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAA;AASvE,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAA;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAA"}
|
|
@@ -4,9 +4,8 @@ interface TFetchLockers {
|
|
|
4
4
|
provider: any;
|
|
5
5
|
chainId: number;
|
|
6
6
|
prices: Price[];
|
|
7
|
-
withAirdropGraph?: boolean;
|
|
8
7
|
}
|
|
9
|
-
export declare const fetchLockers: ({ provider, chainId, prices
|
|
8
|
+
export declare const fetchLockers: ({ provider, chainId, prices }: TFetchLockers) => Promise<{
|
|
10
9
|
parsed: {
|
|
11
10
|
rewards: {
|
|
12
11
|
token: import("@stake-dao/constants").LockerReward;
|
|
@@ -49,7 +48,6 @@ export declare const fetchLockers: ({ provider, chainId, prices, withAirdropGrap
|
|
|
49
48
|
} | undefined;
|
|
50
49
|
alternativeYields: any;
|
|
51
50
|
extensions: {
|
|
52
|
-
airdropGraph?: any;
|
|
53
51
|
sideChains: {
|
|
54
52
|
tokenLocked: string;
|
|
55
53
|
veBalanceOfLocker: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lockers/fetch/index.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAA;AAK5C,OAA6B,EAAE,KAAK,cAAc,EAAE,MAAM,kCAAkC,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lockers/fetch/index.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAA;AAK5C,OAA6B,EAAE,KAAK,cAAc,EAAE,MAAM,kCAAkC,CAAA;AAsB5F,UAAU,aAAa;IACrB,QAAQ,EAAE,GAAG,CAAA;IACb,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,EAAE,KAAK,EAAE,CAAA;CAChB;AAED,eAAO,MAAM,YAAY,kCAAyC,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2R9E,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stake-dao/reader",
|
|
3
3
|
"description": "",
|
|
4
|
-
"version": "0.4.
|
|
4
|
+
"version": "0.4.70",
|
|
5
5
|
"license": "AGPL-3.0-only",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"graphql-request": "^6.0.0",
|
|
36
36
|
"lodash-es": "^4.17.21",
|
|
37
37
|
"viem": "^2.21.53",
|
|
38
|
-
"@stake-dao/constants": "0.4.
|
|
38
|
+
"@stake-dao/constants": "0.4.33"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@types/lodash-es": "^4.17.12",
|
package/src/index.ts
CHANGED
|
@@ -17,7 +17,6 @@ export { fetchSdt } from './sdt/fetch.js'
|
|
|
17
17
|
/// --- LOCKERS
|
|
18
18
|
////////////////////////////////////////////////////////////////
|
|
19
19
|
export { fetchLockers } from './lockers/fetch/index.js'
|
|
20
|
-
export { getUserCherries, getCherriesLeaderBoard, getUserSnapshotCherries } from './lockers/utils/getCherries.js'
|
|
21
20
|
|
|
22
21
|
////////////////////////////////////////////////////////////////
|
|
23
22
|
/// --- STATEGIES
|
|
@@ -9,7 +9,6 @@ import { type Call, type MultiChainCall, equalTlc, multicall, multichainMultical
|
|
|
9
9
|
import { extractFees, feeCalls } from '../utils/callsForLockers/feeCalls.js'
|
|
10
10
|
import callsForLockers from '../utils/callsForLockers/index.js'
|
|
11
11
|
import getBribesRewardsData, { type TBribesRewards } from '../utils/getBribesRewardsData.js'
|
|
12
|
-
import { getCherriesLeaderBoard } from '../utils/getCherries.js'
|
|
13
12
|
import getFees from '../utils/getFees.js'
|
|
14
13
|
import getHttpCalls from '../utils/getHttpCalls.js'
|
|
15
14
|
import { lockedAmountCallSideChain } from '../utils/index.js'
|
|
@@ -35,10 +34,9 @@ interface TFetchLockers {
|
|
|
35
34
|
provider: any
|
|
36
35
|
chainId: number
|
|
37
36
|
prices: Price[]
|
|
38
|
-
withAirdropGraph?: boolean
|
|
39
37
|
}
|
|
40
38
|
|
|
41
|
-
export const fetchLockers = async ({ provider, chainId, prices
|
|
39
|
+
export const fetchLockers = async ({ provider, chainId, prices }: TFetchLockers) => {
|
|
42
40
|
const chainLockers: Locker[] = lockers.filter((l) => l.chainId === chainId)
|
|
43
41
|
|
|
44
42
|
const httpCalls = await getHttpCalls(chainId)
|
|
@@ -111,11 +109,6 @@ export const fetchLockers = async ({ provider, chainId, prices, withAirdropGraph
|
|
|
111
109
|
).length
|
|
112
110
|
const chunkedRawLockersData = rawLockersData.splice(0, lockerCallsLength)
|
|
113
111
|
|
|
114
|
-
let airdropGraph: any
|
|
115
|
-
if (locker.id === 'cake' && withAirdropGraph) {
|
|
116
|
-
airdropGraph = await getCherriesLeaderBoard()
|
|
117
|
-
}
|
|
118
|
-
|
|
119
112
|
const lockerFee = lockersFees.find((l) => l.lockerId === locker.id)
|
|
120
113
|
const fees = getFees(locker, lockerFee)
|
|
121
114
|
|
|
@@ -308,7 +301,6 @@ export const fetchLockers = async ({ provider, chainId, prices, withAirdropGraph
|
|
|
308
301
|
extensions: {
|
|
309
302
|
...locker.extensions,
|
|
310
303
|
sideChains,
|
|
311
|
-
...(locker.id === 'cake' ? { airdropGraph } : {}),
|
|
312
304
|
},
|
|
313
305
|
veBoostTotalSupply,
|
|
314
306
|
veBoostApr,
|
|
@@ -45,7 +45,7 @@ const getHttpCalls = async (chainId: number) => {
|
|
|
45
45
|
case fraxtal.id: {
|
|
46
46
|
const httpCalls = [
|
|
47
47
|
(await fetch(`${GH_STAKE_DAO_BOUNTIES_REPORT}/main/delegationsAPRs.json`)).json(),
|
|
48
|
-
(await fetch(`${STAKE_DAO_API}/lockers/sdfxs-working-supply.json`)).json(),
|
|
48
|
+
(await fetch(`${STAKE_DAO_API}/main/api/lockers/sdfxs-working-supply.json`)).json(),
|
|
49
49
|
]
|
|
50
50
|
|
|
51
51
|
const httpResponses = (await Promise.allSettled(httpCalls)).map((result) =>
|
|
@@ -57,7 +57,7 @@ const getHttpCalls = async (chainId: number) => {
|
|
|
57
57
|
case bsc.id: {
|
|
58
58
|
const httpCalls = [
|
|
59
59
|
(await fetch(`${GH_STAKE_DAO_BOUNTIES_REPORT}/main/delegationsAPRs.json`)).json(),
|
|
60
|
-
(await fetch(`${STAKE_DAO_API}/api/lockers/sdcake-working-supply.json`)).json(),
|
|
60
|
+
(await fetch(`${STAKE_DAO_API}/main/api/lockers/sdcake-working-supply.json`)).json(),
|
|
61
61
|
]
|
|
62
62
|
|
|
63
63
|
const httpResponses = (await Promise.allSettled(httpCalls)).map((result) =>
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { Zero } from '@stake-dao/constants';
|
|
2
|
-
const THREE_M_MULTIPLIER = BigInt(10);
|
|
3
|
-
const TEN_M_MULTIPLIER = BigInt(8);
|
|
4
|
-
const TWENTY_FIVE_M_MULTIPLIER = BigInt(5);
|
|
5
|
-
const FIFTY_M_MULTIPLIER = BigInt(3);
|
|
6
|
-
export const computeRatePoints = (rate, timestampStart, timestampEnd, global, basePoints = Zero) => {
|
|
7
|
-
if (global.fiftyMTimestamp > Zero && timestampStart >= global.fiftyMTimestamp) {
|
|
8
|
-
return basePoints + rate * (timestampEnd - timestampStart);
|
|
9
|
-
}
|
|
10
|
-
if (global.twentyFiveMTimestamp > Zero && timestampStart >= global.twentyFiveMTimestamp) {
|
|
11
|
-
if (global.fiftyMTimestamp > Zero && timestampEnd >= global.fiftyMTimestamp) {
|
|
12
|
-
const checkpointPoints = basePoints + FIFTY_M_MULTIPLIER * rate * (global.fiftyMTimestamp - timestampStart);
|
|
13
|
-
return computeRatePoints(rate, global.fiftyMTimestamp, timestampEnd, global, checkpointPoints);
|
|
14
|
-
}
|
|
15
|
-
return basePoints + FIFTY_M_MULTIPLIER * rate * (timestampEnd - timestampStart);
|
|
16
|
-
}
|
|
17
|
-
if (global.tenMTimestamp > Zero && timestampStart >= global.tenMTimestamp) {
|
|
18
|
-
if (global.twentyFiveMTimestamp > Zero && timestampEnd >= global.twentyFiveMTimestamp) {
|
|
19
|
-
const checkpointPoints = basePoints + TWENTY_FIVE_M_MULTIPLIER * rate * (global.twentyFiveMTimestamp - timestampStart);
|
|
20
|
-
return computeRatePoints(rate, global.twentyFiveMTimestamp, timestampEnd, global, checkpointPoints);
|
|
21
|
-
}
|
|
22
|
-
return basePoints + TWENTY_FIVE_M_MULTIPLIER * rate * (timestampEnd - timestampStart);
|
|
23
|
-
}
|
|
24
|
-
if (global.threeMTimestamp > Zero && timestampStart >= global.threeMTimestamp) {
|
|
25
|
-
if (global.tenMTimestamp > Zero && timestampEnd >= global.tenMTimestamp) {
|
|
26
|
-
const checkpointPoints = basePoints + TEN_M_MULTIPLIER * rate * (global.tenMTimestamp - timestampStart);
|
|
27
|
-
return computeRatePoints(rate, global.tenMTimestamp, timestampEnd, global, checkpointPoints);
|
|
28
|
-
}
|
|
29
|
-
return basePoints + TEN_M_MULTIPLIER * rate * (timestampEnd - timestampStart);
|
|
30
|
-
}
|
|
31
|
-
if (global.threeMTimestamp > Zero && timestampEnd >= global.threeMTimestamp) {
|
|
32
|
-
const checkpointPoints = basePoints + THREE_M_MULTIPLIER * rate * (global.threeMTimestamp - timestampStart);
|
|
33
|
-
return computeRatePoints(rate, global.threeMTimestamp, timestampEnd, global, checkpointPoints);
|
|
34
|
-
}
|
|
35
|
-
return basePoints + THREE_M_MULTIPLIER * rate * (timestampEnd - timestampStart);
|
|
36
|
-
};
|
|
37
|
-
export const getUpdatedPointsAmount = (userRate, userLastUpdate, userLastPoints, airdropGraph, timestamp) => {
|
|
38
|
-
const now = timestamp ? timestamp : Math.floor(Date.now() / 1000);
|
|
39
|
-
return computeRatePoints(userRate, BigInt(userLastUpdate), BigInt(now), {
|
|
40
|
-
threeMTimestamp: BigInt(airdropGraph.threeMTimestamp),
|
|
41
|
-
tenMTimestamp: BigInt(airdropGraph.tenMTimestamp),
|
|
42
|
-
twentyFiveMTimestamp: BigInt(airdropGraph.twentyFiveMTimestamp),
|
|
43
|
-
fiftyMTimestamp: BigInt(airdropGraph.fiftyMTimestamp),
|
|
44
|
-
}, userLastPoints);
|
|
45
|
-
};
|
|
46
|
-
//# s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AAG,cAAc,CAAC,CAAA;QAC3G,OAAO,iBAAiB,CAAC,IAAI,EAAE,MAAM,CAAC,eAAe,EAAE,YAAY,EAAE,MAAM,EAAE,gBAAgB,CAAC,CAAA;IAChG,CAAC;IACD,OAAO,UAAU,GAAG,kBAAkB,GAAG,IAAI,GAAG,CAAC,YAAY,GAAG,cAAc,CAAC,CAAA;AACjF,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,sBAAsB,GAAG,CACpC,QAAgB,EAChB,cAAsB,EACtB,cAAsB,EACtB,YAAiB,EACjB,SAAkB,EAClB,EAAE;IACF,MAAM,GAAG,GAAG,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAA;IAEjE,OAAO,iBAAiB,CACtB,QAAQ,EACR,MAAM,CAAC,cAAc,CAAC,EACtB,MAAM,CAAC,GAAG,CAAC,EACX;QACE,eAAe,EAAE,MAAM,CAAC,YAAY,CAAC,eAAe,CAAC;QACrD,aAAa,EAAE,MAAM,CAAC,YAAY,CAAC,aAAa,CAAC;QACjD,oBAAoB,EAAE,MAAM,CAAC,YAAY,CAAC,oBAAoB,CAAC;QAC/D,eAAe,EAAE,MAAM,CAAC,YAAY,CAAC,eAAe,CAAC;KACtD,EACD,cAAc,CACf,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"endpoints.js","sourceRoot":"","sources":["../../../../src/lockers/utils/endpoints.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,uBAAuB,GAAG,wCAAwC,CAAA;AAC/E,MAAM,CAAC,MAAM,yCAAyC,GAAG,6DAA6D,CAAA"}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { formatEther } from 'viem';
|
|
2
|
-
import { SDCAKE_CHERRIES_API_URL, SDCAKE_REFERRAL_SNAPSHOT_CHERRIES_API_URL } from './endpoints.js';
|
|
3
|
-
import { equalTlc } from '../../utils.js';
|
|
4
|
-
import { computeRatePoints } from './cakeLockerAirdrop.js';
|
|
5
|
-
export const getCherriesLeaderBoard = async () => {
|
|
6
|
-
const cherriesData = await (await fetch(SDCAKE_CHERRIES_API_URL)).json();
|
|
7
|
-
const global = cherriesData.global;
|
|
8
|
-
const now = Math.floor(Date.now() / 1000);
|
|
9
|
-
const leaderBoard = cherriesData?.global &&
|
|
10
|
-
cherriesData.users.map((user) => {
|
|
11
|
-
const currentPoints = computeRatePoints(BigInt(user.rate), BigInt(user.timestamp), BigInt(now), {
|
|
12
|
-
threeMTimestamp: BigInt(global.threeMTimestamp),
|
|
13
|
-
tenMTimestamp: BigInt(global.tenMTimestamp),
|
|
14
|
-
twentyFiveMTimestamp: BigInt(global.twentyFiveMTimestamp),
|
|
15
|
-
fiftyMTimestamp: BigInt(global.fiftyMTimestamp),
|
|
16
|
-
}, BigInt(user.points));
|
|
17
|
-
return {
|
|
18
|
-
...user,
|
|
19
|
-
currentPoints: Number(formatEther(currentPoints)),
|
|
20
|
-
};
|
|
21
|
-
});
|
|
22
|
-
return {
|
|
23
|
-
...global,
|
|
24
|
-
leaderBoard: leaderBoard?.sort((a, b) => b.currentPoints - a.currentPoints),
|
|
25
|
-
};
|
|
26
|
-
};
|
|
27
|
-
export const getUserSnapshotCherries = async () => {
|
|
28
|
-
const cherriesData = await (await fetch(SDCAKE_REFERRAL_SNAPSHOT_CHERRIES_API_URL)).json();
|
|
29
|
-
return cherriesData;
|
|
30
|
-
};
|
|
31
|
-
export const getUserCherries = (cherriesData, userAddress) => {
|
|
32
|
-
return cherriesData.find((user) => equalTlc(user.address, userAddress));
|
|
33
|
-
};
|
|
34
|
-
//# sourceMappingURL=getCherries.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getCherries.js","sourceRoot":"","sources":["../../../../src/lockers/utils/getCherries.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EA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,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,aAAa,GAAG,CAAC,CAAC,aAAa,CAAC;KAC5E,CAAA;AACH,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,uBAAuB,GAAG,KAAK,IAAI,EAAE;IAChD,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,KAAK,CAAC,yCAAyC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAA;IAC1F,OAAO,YAAY,CAAA;AACrB,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,YAAiB,EAAE,WAAmB,EAAE,EAAE;IACxE,OAAO,YAAY,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC,CAAA;AACzE,CAAC,CAAA"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export declare const computeRatePoints: (rate: bigint, timestampStart: bigint, timestampEnd: bigint, global: {
|
|
2
|
-
threeMTimestamp: bigint;
|
|
3
|
-
tenMTimestamp: bigint;
|
|
4
|
-
twentyFiveMTimestamp: bigint;
|
|
5
|
-
fiftyMTimestamp: bigint;
|
|
6
|
-
}, basePoints?: bigint) => bigint;
|
|
7
|
-
export declare const getUpdatedPointsAmount: (userRate: bigint, userLastUpdate: number, userLastPoints: bigint, airdropGraph: any, timestamp?: number) => bigint;
|
|
8
|
-
//# sourceMappingURL=cakeLockerAirdrop.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cakeLockerAirdrop.d.ts","sourceRoot":"","sources":["../../../../src/lockers/utils/cakeLockerAirdrop.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,iBAAiB,SACtB,MAAM,kBACI,MAAM,gBACR,MAAM,UACZ;IACN,eAAe,EAAE,MAAM,CAAA;IACvB,aAAa,EAAE,MAAM,CAAA;IACrB,oBAAoB,EAAE,MAAM,CAAA;IAC5B,eAAe,EAAE,MAAM,CAAA;CACxB,eACW,MAAM,KACjB,MA+BF,CAAA;AAED,eAAO,MAAM,sBAAsB,aACvB,MAAM,kBACA,MAAM,kBACN,MAAM,gBACR,GAAG,cACL,MAAM,WAgBnB,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"endpoints.d.ts","sourceRoot":"","sources":["../../../../src/lockers/utils/endpoints.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,uBAAuB,2CAA2C,CAAA;AAC/E,eAAO,MAAM,yCAAyC,gEAAgE,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getCherries.d.ts","sourceRoot":"","sources":["../../../../src/lockers/utils/getCherries.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,sBAAsB,oBA+BlC,CAAA;AAED,eAAO,MAAM,uBAAuB,oBAGnC,CAAA;AAED,eAAO,MAAM,eAAe,iBAAkB,GAAG,eAAe,MAAM,QAErE,CAAA"}
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import { Zero } from '@stake-dao/constants'
|
|
2
|
-
|
|
3
|
-
const THREE_M_MULTIPLIER = BigInt(10)
|
|
4
|
-
const TEN_M_MULTIPLIER = BigInt(8)
|
|
5
|
-
const TWENTY_FIVE_M_MULTIPLIER = BigInt(5)
|
|
6
|
-
const FIFTY_M_MULTIPLIER = BigInt(3)
|
|
7
|
-
|
|
8
|
-
export const computeRatePoints = (
|
|
9
|
-
rate: bigint,
|
|
10
|
-
timestampStart: bigint,
|
|
11
|
-
timestampEnd: bigint,
|
|
12
|
-
global: {
|
|
13
|
-
threeMTimestamp: bigint
|
|
14
|
-
tenMTimestamp: bigint
|
|
15
|
-
twentyFiveMTimestamp: bigint
|
|
16
|
-
fiftyMTimestamp: bigint
|
|
17
|
-
},
|
|
18
|
-
basePoints: bigint = Zero,
|
|
19
|
-
): bigint => {
|
|
20
|
-
if (global.fiftyMTimestamp > Zero && timestampStart >= global.fiftyMTimestamp) {
|
|
21
|
-
return basePoints + rate * (timestampEnd - timestampStart)
|
|
22
|
-
}
|
|
23
|
-
if (global.twentyFiveMTimestamp > Zero && timestampStart >= global.twentyFiveMTimestamp) {
|
|
24
|
-
if (global.fiftyMTimestamp > Zero && timestampEnd >= global.fiftyMTimestamp) {
|
|
25
|
-
const checkpointPoints = basePoints + FIFTY_M_MULTIPLIER * rate * (global.fiftyMTimestamp - timestampStart)
|
|
26
|
-
return computeRatePoints(rate, global.fiftyMTimestamp, timestampEnd, global, checkpointPoints)
|
|
27
|
-
}
|
|
28
|
-
return basePoints + FIFTY_M_MULTIPLIER * rate * (timestampEnd - timestampStart)
|
|
29
|
-
}
|
|
30
|
-
if (global.tenMTimestamp > Zero && timestampStart >= global.tenMTimestamp) {
|
|
31
|
-
if (global.twentyFiveMTimestamp > Zero && timestampEnd >= global.twentyFiveMTimestamp) {
|
|
32
|
-
const checkpointPoints =
|
|
33
|
-
basePoints + TWENTY_FIVE_M_MULTIPLIER * rate * (global.twentyFiveMTimestamp - timestampStart)
|
|
34
|
-
return computeRatePoints(rate, global.twentyFiveMTimestamp, timestampEnd, global, checkpointPoints)
|
|
35
|
-
}
|
|
36
|
-
return basePoints + TWENTY_FIVE_M_MULTIPLIER * rate * (timestampEnd - timestampStart)
|
|
37
|
-
}
|
|
38
|
-
if (global.threeMTimestamp > Zero && timestampStart >= global.threeMTimestamp) {
|
|
39
|
-
if (global.tenMTimestamp > Zero && timestampEnd >= global.tenMTimestamp) {
|
|
40
|
-
const checkpointPoints = basePoints + TEN_M_MULTIPLIER * rate * (global.tenMTimestamp - timestampStart)
|
|
41
|
-
return computeRatePoints(rate, global.tenMTimestamp, timestampEnd, global, checkpointPoints)
|
|
42
|
-
}
|
|
43
|
-
return basePoints + TEN_M_MULTIPLIER * rate * (timestampEnd - timestampStart)
|
|
44
|
-
}
|
|
45
|
-
if (global.threeMTimestamp > Zero && timestampEnd >= global.threeMTimestamp) {
|
|
46
|
-
const checkpointPoints = basePoints + THREE_M_MULTIPLIER * rate * (global.threeMTimestamp - timestampStart)
|
|
47
|
-
return computeRatePoints(rate, global.threeMTimestamp, timestampEnd, global, checkpointPoints)
|
|
48
|
-
}
|
|
49
|
-
return basePoints + THREE_M_MULTIPLIER * rate * (timestampEnd - timestampStart)
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export const getUpdatedPointsAmount = (
|
|
53
|
-
userRate: bigint,
|
|
54
|
-
userLastUpdate: number,
|
|
55
|
-
userLastPoints: bigint,
|
|
56
|
-
airdropGraph: any,
|
|
57
|
-
timestamp?: number,
|
|
58
|
-
) => {
|
|
59
|
-
const now = timestamp ? timestamp : Math.floor(Date.now() / 1000)
|
|
60
|
-
|
|
61
|
-
return computeRatePoints(
|
|
62
|
-
userRate,
|
|
63
|
-
BigInt(userLastUpdate),
|
|
64
|
-
BigInt(now),
|
|
65
|
-
{
|
|
66
|
-
threeMTimestamp: BigInt(airdropGraph.threeMTimestamp),
|
|
67
|
-
tenMTimestamp: BigInt(airdropGraph.tenMTimestamp),
|
|
68
|
-
twentyFiveMTimestamp: BigInt(airdropGraph.twentyFiveMTimestamp),
|
|
69
|
-
fiftyMTimestamp: BigInt(airdropGraph.fiftyMTimestamp),
|
|
70
|
-
},
|
|
71
|
-
userLastPoints,
|
|
72
|
-
)
|
|
73
|
-
}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { formatEther } from 'viem'
|
|
2
|
-
|
|
3
|
-
import { SDCAKE_CHERRIES_API_URL, SDCAKE_REFERRAL_SNAPSHOT_CHERRIES_API_URL } from './endpoints.js'
|
|
4
|
-
|
|
5
|
-
import { equalTlc } from '../../utils.js'
|
|
6
|
-
import { computeRatePoints } from './cakeLockerAirdrop.js'
|
|
7
|
-
|
|
8
|
-
export const getCherriesLeaderBoard = async () => {
|
|
9
|
-
const cherriesData = await (await fetch(SDCAKE_CHERRIES_API_URL)).json()
|
|
10
|
-
const global = cherriesData.global
|
|
11
|
-
|
|
12
|
-
const now = Math.floor(Date.now() / 1000)
|
|
13
|
-
|
|
14
|
-
const leaderBoard =
|
|
15
|
-
cherriesData?.global &&
|
|
16
|
-
cherriesData.users.map((user) => {
|
|
17
|
-
const currentPoints = computeRatePoints(
|
|
18
|
-
BigInt(user.rate),
|
|
19
|
-
BigInt(user.timestamp),
|
|
20
|
-
BigInt(now),
|
|
21
|
-
{
|
|
22
|
-
threeMTimestamp: BigInt(global.threeMTimestamp),
|
|
23
|
-
tenMTimestamp: BigInt(global.tenMTimestamp),
|
|
24
|
-
twentyFiveMTimestamp: BigInt(global.twentyFiveMTimestamp),
|
|
25
|
-
fiftyMTimestamp: BigInt(global.fiftyMTimestamp),
|
|
26
|
-
},
|
|
27
|
-
BigInt(user.points),
|
|
28
|
-
)
|
|
29
|
-
return {
|
|
30
|
-
...user,
|
|
31
|
-
currentPoints: Number(formatEther(currentPoints)),
|
|
32
|
-
}
|
|
33
|
-
})
|
|
34
|
-
|
|
35
|
-
return {
|
|
36
|
-
...global,
|
|
37
|
-
leaderBoard: leaderBoard?.sort((a, b) => b.currentPoints - a.currentPoints),
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export const getUserSnapshotCherries = async () => {
|
|
42
|
-
const cherriesData = await (await fetch(SDCAKE_REFERRAL_SNAPSHOT_CHERRIES_API_URL)).json()
|
|
43
|
-
return cherriesData
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export const getUserCherries = (cherriesData: any, userAddress: string) => {
|
|
47
|
-
return cherriesData.find((user) => equalTlc(user.address, userAddress))
|
|
48
|
-
}
|