Skip to content

Commit

Permalink
Merge pull request #21 from kleros/feat/track-deposits
Browse files Browse the repository at this point in the history
feat: track bounties per request
  • Loading branch information
jaybuidl authored Oct 18, 2023
2 parents 8a25e10 + a44b1b8 commit 54b896b
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 16 deletions.
4 changes: 4 additions & 0 deletions schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,8 @@ type LRequest @entity {
arbitrator: Bytes!
"The extra data for the trusted arbitrator of this request."
arbitratorExtraData: Bytes!
"The deposit that would be awarded to the challenger if challenge is successful"
deposit: BigInt!
"The outcome of the dispute, if any. Note that unsuccessful appeal fundings can invert the arbitrator ruling (so this may differ from the ruling given by the arbitrator)."
disputeOutcome: Ruling!
"Tracks each round of a dispute in the form rounds[roundID]."
Expand Down Expand Up @@ -375,6 +377,8 @@ type Request @entity {
arbitrator: Bytes!
"The extra data for the trusted arbitrator of this request."
arbitratorExtraData: Bytes!
"The deposit that would be awarded to the challenger if challenge is successful"
deposit: BigInt!
"The outcome of the dispute, if any. Note that unsuccessful appeal fundings can invert the arbitrator ruling (so this may differ from the ruling given by the arbitrator)."
disputeOutcome: Ruling!
"Tracks each round of a dispute in the form rounds[roundID]."
Expand Down
2 changes: 2 additions & 0 deletions src/GeneralizedTCRMapping.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,11 +157,13 @@ export function handleRequestSubmitted(event: RequestEvidenceGroupID): void {
.submissionBaseDeposit()
.plus(arbitrator.arbitrationCost(request.arbitratorExtraData));
request.metaEvidence = registry.registrationMetaEvidence;
request.deposit = tcr.submissionBaseDeposit();
} else {
round.amountPaidRequester = tcr
.removalBaseDeposit()
.plus(arbitrator.arbitrationCost(request.arbitratorExtraData));
request.metaEvidence = registry.clearingMetaEvidence;
request.deposit = tcr.removalBaseDeposit();
}

round.feeRewards = round.amountPaidRequester;
Expand Down
10 changes: 6 additions & 4 deletions src/LightGeneralizedTCRMapping.ts
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,6 @@ export function handleRequestSubmitted(event: RequestSubmitted): void {
]);
return;
}

// `previousStatus` and `newStatus` are used for accounting.
// Note that if this is the very first request of an item,
// item.status and item.dispute are dirty because they were set by
Expand Down Expand Up @@ -464,10 +463,13 @@ export function handleRequestSubmitted(event: RequestSubmitted): void {
request.requestType = item.status;
request.evidenceGroupID = event.params._evidenceGroupID;
request.creationTx = event.transaction.hash;
if (request.requestType == REGISTRATION_REQUESTED)
if (request.requestType == REGISTRATION_REQUESTED) {
request.deposit = tcr.submissionBaseDeposit();
request.metaEvidence = registry.registrationMetaEvidence;
else request.metaEvidence = registry.clearingMetaEvidence;

} else {
request.deposit = tcr.removalBaseDeposit();
request.metaEvidence = registry.clearingMetaEvidence;
}
let roundID = requestID + '-0';

// Note that everything related to the deposit (e.g. contribution creation)
Expand Down
3 changes: 0 additions & 3 deletions subgraph.template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ features:
repository: https://github.com/kleros/gtcr-subgraph
schema:
file: ./schema.graphql
features:
- fullTextSearch
- ipfsOnEthereumContracts
dataSources:
- kind: ethereum/contract
name: LightGTCRFactory
Expand Down
18 changes: 9 additions & 9 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -597,13 +597,13 @@
walk "^2.3.14"
web3 "^1.0.0-beta.35"

"@graphprotocol/graph-cli@^0.51.0":
version "0.51.0"
resolved "https://registry.yarnpkg.com/@graphprotocol/graph-cli/-/graph-cli-0.51.0.tgz#c9b864b249b98946b4b666045d7e7a56154c72ec"
integrity sha512-Yvwhx9Q31egUOVUQH2Hti9ysqPk1Ti9+si8Ii/xpGnXp6qZC/elSr/1rzEOgi84OSR1Y74GLwmNNGZImjD/uLg==
"@graphprotocol/graph-cli@^0.54.0":
version "0.54.0"
resolved "https://registry.yarnpkg.com/@graphprotocol/graph-cli/-/graph-cli-0.54.0.tgz#78c85423e284f6d24e781b66dadabe7ee43a9244"
integrity sha512-Q9dJZgjNHToJ+6DqoxU9WPwITjN6EHoONh05z5/atzrj1QTNqWQT0TYrVGX/Lvm9eqa6R+Knof1jiseBLJ43tg==
dependencies:
"@float-capital/float-subgraph-uncrashable" "^0.0.0-alpha.4"
"@oclif/core" "2.8.4"
"@oclif/core" "2.8.6"
"@whatwg-node/fetch" "^0.8.4"
assemblyscript "0.19.23"
binary-install-raw "0.0.13"
Expand Down Expand Up @@ -750,10 +750,10 @@
"@nodelib/fs.scandir" "2.1.5"
fastq "^1.6.0"

"@oclif/core@2.8.4":
version "2.8.4"
resolved "https://registry.yarnpkg.com/@oclif/core/-/core-2.8.4.tgz#7b453be6d4cd060ff4990bc8e31824a1de308354"
integrity sha512-VlFDhoAJ1RDwcpDF46wAlciWTIryapMUViACttY9GwX6Ci6Lud1awe/pC3k4jad5472XshnPQV4bHAl4a/yxpA==
"@oclif/core@2.8.6":
version "2.8.6"
resolved "https://registry.yarnpkg.com/@oclif/core/-/core-2.8.6.tgz#7eb6984108f471ad0d719d3c07cde14c47ab17c5"
integrity sha512-1QlPaHMhOORySCXkQyzjsIsy2GYTilOw3LkjeHkCgsPJQjAT4IclVytJusWktPbYNys9O+O4V23J44yomQvnBQ==
dependencies:
"@types/cli-progress" "^3.11.0"
ansi-escapes "^4.3.2"
Expand Down

0 comments on commit 54b896b

Please sign in to comment.