From f1f8bc1c2330bba3449795fe6bf8af6055f3df72 Mon Sep 17 00:00:00 2001 From: Alan Donoso Naumczuk Date: Tue, 1 Jun 2021 23:40:53 -0300 Subject: [PATCH] Mapping functions added to be implemented --- src/mapping.ts | 40 ++++++++++++++++++++++++++++------------ 1 file changed, 28 insertions(+), 12 deletions(-) diff --git a/src/mapping.ts b/src/mapping.ts index 8371d59..a5e1ebe 100644 --- a/src/mapping.ts +++ b/src/mapping.ts @@ -1,9 +1,22 @@ import { BigInt } from '@graphprotocol/graph-ts'; -import { JurorSubscription, TopicCreation } from '../generated/Protocol Ropsten V1/Protocol' +import { JurorSubscription, TopicCreation, PublicationSubmission, VoteCommitment, VoteReveal, Withdrawal } from '../generated/Protocol Ropsten V1/Protocol' import { Publication, Topic, Juror, Voting, Vote } from '../generated/schema' const zero = new BigInt(0); +export function handleTopicCreation(event: TopicCreation): void { + let id = event.params._topicId.toString(); + let topic = new Topic(id); + topic.priceToPublish = event.params._priceToPublish; + topic.priceToBeJuror = event.params._priceToBeJuror; + topic.authorReward = event.params._authorReward; + topic.jurorReward = event.params._jurorReward; + topic.commitPhaseDuration = event.params._commitPhaseDuration; + topic.revealPhaseDuration = event.params._revealPhaseDuration; + topic.jurorQuantity = zero; + topic.save(); +} + export function handleJurorSubscription(event: JurorSubscription): void { let id = event.params._juror.toString(); let juror = Juror.load(id); @@ -19,15 +32,18 @@ export function handleJurorSubscription(event: JurorSubscription): void { juror.save(); } -function handleTopicCreation(event: TopicCreation): void { - let id = event.params._topicId.toString(); - let topic = new Topic(id); - topic.priceToPublish = event.params._priceToPublish; - topic.priceToBeJuror = event.params._priceToBeJuror; - topic.authorReward = event.params._authorReward; - topic.jurorReward = event.params._jurorReward; - topic.commitPhaseDuration = event.params._commitPhaseDuration; - topic.revealPhaseDuration = event.params._revealPhaseDuration; - topic.jurorQuantity = zero; - topic.save(); +export function handlePublicationSubmission(event: PublicationSubmission): void { + // TODO! +} + +export function handleVoteCommitment(event: VoteCommitment): void { + // TODO! +} + +export function handleVoteReveal(event: VoteReveal): void { + // TODO! +} + +export function handleWithdrawal(event: Withdrawal): void { + // TODO! }