Skip to content
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/lrt/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ const primeLaunchDate = new Date('2024-02-05 12:00 PM PST')

const eth = (val: bigint) => val * 1_000000000_000000000n

export const xpEndTimestamp = 1724785200000 // 2024-08-27 12:00 PM PST

export interface PointCondition {
name: string
// The multiplier the point condition will apply.
Expand Down
10 changes: 10 additions & 0 deletions src/lrt/logic/points.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { LRTPointRecipientHistory, LRTSummary } from '../../model'
import { Block, Context } from '../../processor'
import { xpEndTimestamp } from '../config'
import { getLastSummary, state } from '../state'
import { campaigns } from './campaigns'
import { updateEigenPoints } from './eigen-points'
Expand Down Expand Up @@ -61,6 +62,15 @@ const createSummary = async (ctx: Context, block: Block) => {
points: totalPoints,
elPoints: lastSummary?.elPoints ?? 0n,
})
if (
block.header.timestamp >= xpEndTimestamp &&
summary.points > lastSummary.points
) {
throw new Error(
`Points should no longer be accruing after ${xpEndTimestamp}`,
)
}

state.summaries.set(summary.id, summary)

return { summary, recipients }
Expand Down
4 changes: 4 additions & 0 deletions src/lrt/logic/prime-points.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
pointConditions,
pointInterval,
referralConditions,
xpEndTimestamp,
} from '../config'
import { state } from '../state'
import { encodeAddress } from '../utils/encoding'
Expand Down Expand Up @@ -39,6 +40,9 @@ export const updateRecipientsPoints = async (
}
>(), // Who have we already calculated in this self-referencing function?
) => {
if (timestamp >= xpEndTimestamp) {
return { totalReferralPoints: [], count: memo.size }
}
const totalReferralPoints: ReferralPointData[] = []
for (const recipient of recipients) {
if (memo.has(recipient.id)) {
Expand Down