Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: track bounties per request #21

Merged
merged 1 commit into from
Oct 18, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
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/[email protected].4":
version "2.8.4"
resolved "https://registry.yarnpkg.com/@oclif/core/-/core-2.8.4.tgz#7b453be6d4cd060ff4990bc8e31824a1de308354"
integrity sha512-VlFDhoAJ1RDwcpDF46wAlciWTIryapMUViACttY9GwX6Ci6Lud1awe/pC3k4jad5472XshnPQV4bHAl4a/yxpA==
"@oclif/[email protected].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