This commit is contained in:
trizin 2023-08-22 12:58:02 +00:00 committed by GitHub
parent 922d5d7ee9
commit c0a008036d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 4 deletions

View File

@ -44,7 +44,7 @@ function getPredictSlot(
export function handlePredictionSubmitted(event: PredictionSubmitted): void { export function handlePredictionSubmitted(event: PredictionSubmitted): void {
const predictSlot = getPredictSlot( const predictSlot = getPredictSlot(
event.address.toHexString(), event.address.toHexString(),
parseInt(event.params.slot.toString()) event.params.slot.toI32()
) )
const user = getUser(event.params.predictoor.toHex()) const user = getUser(event.params.predictoor.toHex())
const id = const id =
@ -142,7 +142,7 @@ export function handleNewSubscription(event: NewSubscription): void {
export function handleTruevalSubmitted(event: TruevalSubmitted): void { export function handleTruevalSubmitted(event: TruevalSubmitted): void {
const predictSlot = getPredictSlot( const predictSlot = getPredictSlot(
event.address.toHexString(), event.address.toHexString(),
parseInt(event.params.slot.toString()) event.params.slot.toI32()
) )
const id = event.address.toHexString() + '-' + event.params.slot.toString() const id = event.address.toHexString() + '-' + event.params.slot.toString()
const newPredictTrueVals = new PredictTrueVal(id) // they share the same id const newPredictTrueVals = new PredictTrueVal(id) // they share the same id
@ -236,10 +236,9 @@ export function handleRevenueAdded(event: RevenueAdded): void {
const slot = event.params.slot const slot = event.params.slot
for (let i = BigInt.zero(); i.lt(numEpochs); i = i.plus(BigInt.fromI32(1))) { for (let i = BigInt.zero(); i.lt(numEpochs); i = i.plus(BigInt.fromI32(1))) {
const targetSlot = slot.plus(secondsPerEpoch.times(i)) const targetSlot = slot.plus(secondsPerEpoch.times(i))
const targetSlotInt = parseInt(targetSlot)
const predictSlot = getPredictSlot( const predictSlot = getPredictSlot(
event.address.toHexString(), event.address.toHexString(),
targetSlotInt targetSlot.toI32()
) )
predictSlot.revenue = predictSlot.revenue.plus(amountPerEpoch) predictSlot.revenue = predictSlot.revenue.plus(amountPerEpoch)
predictSlot.save() predictSlot.save()