Skip to content

Commit

Permalink
Mapping functions added to be implemented
Browse files Browse the repository at this point in the history
  • Loading branch information
Alan Donoso Naumczuk committed Jun 2, 2021
1 parent cf4ca14 commit f1f8bc1
Showing 1 changed file with 28 additions and 12 deletions.
40 changes: 28 additions & 12 deletions src/mapping.ts
Original file line number Diff line number Diff line change
@@ -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);
Expand All @@ -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!
}

0 comments on commit f1f8bc1

Please sign in to comment.