@stake-dao/reader 0.4.69 → 0.4.71
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/abis/lockersMulticall.js +2 -2
- package/dist/esm/abis/lockersMulticall.js.map +1 -1
- package/dist/esm/bytecodes/index.js +5 -0
- package/dist/esm/bytecodes/index.js.map +1 -1
- package/dist/esm/bytecodes/lockers/veNFTUser.js +21 -0
- package/dist/esm/bytecodes/lockers/veNFTUser.js.map +1 -0
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/lockers/fetch/index.js +2 -8
- package/dist/esm/lockers/fetch/index.js.map +1 -1
- package/dist/esm/lockers/utils/callsForLockers/feeCalls.js +1 -0
- package/dist/esm/lockers/utils/callsForLockers/feeCalls.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/lockers/utils/getVeNFTUser.js +26 -0
- package/dist/esm/lockers/utils/getVeNFTUser.js.map +1 -0
- package/dist/esm/lockers/utils/index.js +1 -1
- package/dist/esm/lockers/utils/index.js.map +1 -1
- package/dist/esm/strategies/balancer/fetch.js +1 -1
- package/dist/esm/strategies/balancer/fetch.js.map +1 -1
- package/dist/esm/tsconfig.build.tsbuildinfo +1 -1
- package/dist/esm/utils.js +4 -1
- package/dist/esm/utils.js.map +1 -1
- package/dist/types/bytecodes/index.d.ts +1 -0
- package/dist/types/bytecodes/index.d.ts.map +1 -1
- package/dist/types/bytecodes/lockers/veNFTUser.d.ts +4 -0
- package/dist/types/bytecodes/lockers/veNFTUser.d.ts.map +1 -0
- package/dist/types/index.d.ts +1 -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/dist/types/lockers/utils/callsForLockers/feeCalls.d.ts.map +1 -1
- package/dist/types/lockers/utils/getVeNFTUser.d.ts +2 -0
- package/dist/types/lockers/utils/getVeNFTUser.d.ts.map +1 -0
- package/dist/types/utils.d.ts +1 -0
- package/dist/types/utils.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/abis/lockersMulticall.ts +2 -2
- package/src/bytecodes/index.ts +8 -0
- package/src/bytecodes/lockers/veNFTUser.ts +24 -0
- package/src/index.ts +1 -1
- package/src/lockers/fetch/index.ts +3 -10
- package/src/lockers/utils/callsForLockers/feeCalls.ts +1 -0
- package/src/lockers/utils/getHttpCalls.ts +2 -2
- package/src/lockers/utils/getVeNFTUser.ts +27 -0
- package/src/lockers/utils/index.ts +1 -1
- package/src/strategies/balancer/fetch.ts +1 -1
- package/src/utils.ts +5 -1
- 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
|
@@ -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
|
-
}
|