bounty.graphql 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. type BountyEntrantWhitelist @entity {
  2. # Prevents "GraphQLError: Input Object type BountyEntrantWhitelistCreateInput must define one or more fields."
  3. _phantom: Int
  4. "Members authorized to submit entries to the bounty"
  5. members: [Membership!]!
  6. }
  7. type BountyFundingPerpetual @variant {
  8. "Desired funding"
  9. target: BigInt!
  10. }
  11. type BountyFundingLimited @variant {
  12. "Minimum amount of funds for a successful bounty"
  13. minFundingAmount: BigInt!
  14. "Upper boundary for a bounty funding"
  15. maxFundingAmount: BigInt!
  16. "Maximum allowed funding period"
  17. fundingPeriod: Int!
  18. }
  19. "Bounty funding types"
  20. union BountyFundingType = BountyFundingPerpetual | BountyFundingLimited
  21. "All valid bounty stages"
  22. enum BountyStage {
  23. Funding
  24. Expired
  25. WorkSubmission
  26. Judgment
  27. Successful
  28. Failed
  29. }
  30. type Bounty @entity {
  31. # Bounty creation parameters:
  32. "Bounty's runtime id"
  33. id: ID!
  34. "Bounty title"
  35. title: String
  36. "Bounty description"
  37. description: String
  38. "Bounty image uri"
  39. bannerImageUri: String
  40. "Amount of funding provided by the creator"
  41. cherry: BigInt!
  42. "Stake minimum amount required to submit work entry to the bounty"
  43. entrantStake: BigInt!
  44. "Bounty creator (if created by a member and not the council)"
  45. creator: Membership
  46. "Bounty oracle (if a member and not the council)"
  47. oracle: Membership
  48. "Bounty funding type"
  49. fundingType: BountyFundingType!
  50. "If specified only members listed in BountyEntrantWhitelist are allowed to submit work to the bounty"
  51. entrantWhitelist: BountyEntrantWhitelist
  52. "Number of blocks from end of funding period until people can no longer submit bounty submissions"
  53. workPeriod: Int!
  54. "Number of block from end of work period until oracle can no longer decide winners"
  55. judgingPeriod: Int!
  56. # Bounty current state:
  57. "Current bounty stage"
  58. stage: BountyStage!
  59. "Total amount once contributed to the bounty (excluding the cherry)"
  60. totalFunding: BigInt!
  61. "Bounty discussion thread"
  62. discussionThread: ForumThread
  63. "The contributions (in fund) made to the bounty"
  64. contributions: [BountyContribution] @derivedFrom(field: "bounty")
  65. "The work entries announce on the bounty"
  66. entries: [BountyEntry] @derivedFrom(field: "bounty")
  67. "If true the bounty lifecycle ended and its state will not change anymore"
  68. isTerminated: Boolean!
  69. # Events:
  70. "The event the bounty was created in"
  71. createdInEvent: BountyCreatedEvent! @derivedFrom(field: "bounty")
  72. "Event emitted if the bounty is canceled"
  73. canceledEvent: BountyCanceledEvent @derivedFrom(field: "bounty")
  74. "Event emitted if the bounty is vetoed"
  75. vetoedEvent: BountyVetoedEvent @derivedFrom(field: "bounty")
  76. "Event emitted if the bounty reached its maximum funding amount"
  77. maxFundingReachedEvent: BountyMaxFundingReachedEvent @derivedFrom(field: "bounty")
  78. "Event emitted when the bounty is removed (i.e terminated)"
  79. removedInEvent: BountyRemovedEvent @derivedFrom(field: "bounty")
  80. "Event emitted if the oracle judged the bounty work entries"
  81. judgment: OracleJudgmentSubmittedEvent @derivedFrom(field: "bounty")
  82. }
  83. "Initial status during creation in Working Period."
  84. type BountyEntryStatusWorking @variant {
  85. # no properties
  86. # TODO: remove me - variant needs to have at least 1 property now
  87. dummy: Int
  88. }
  89. "When withdrawn during the Working Period."
  90. type BountyEntryStatusWithdrawn @variant {
  91. # no properties
  92. # TODO: remove me - variant needs to have at least 1 property now
  93. dummy: Int
  94. }
  95. "Selected as winner during Judgment Period , and therefore is due an outstanding share of the bounty funds, called reward."
  96. type BountyEntryStatusWinner @variant {
  97. reward: BigInt!
  98. }
  99. "Not referenced by oracle in Judgment Period judgment, and therefore is not owed any share of the bounty funds, but has outstanding stake that can be recovered."
  100. type BountyEntryStatusPassed @variant {
  101. # no properties
  102. # TODO: remove me - variant needs to have at least 1 property now
  103. dummy: Int
  104. }
  105. "Rejected by oracle in Judgment Period as a malicious entry, and thus has had stake slashed."
  106. type BountyEntryStatusRejected @variant {
  107. # no properties
  108. # TODO: remove me - variant needs to have at least 1 property now
  109. dummy: Int
  110. }
  111. "Worker cashed out stake and/or share of bounty reward."
  112. type BountyEntryStatusCashedOut @variant {
  113. reward: BigInt
  114. }
  115. "All valid work entry statuses"
  116. union BountyEntryStatus =
  117. BountyEntryStatusWorking
  118. | BountyEntryStatusWithdrawn
  119. | BountyEntryStatusWinner
  120. | BountyEntryStatusPassed
  121. | BountyEntryStatusRejected
  122. | BountyEntryStatusCashedOut
  123. type BountyEntry @entity {
  124. # Work entry creation parameters:
  125. "Work Entry Id"
  126. id: ID!
  127. "Bounty to which the work entry corresponds"
  128. bounty: Bounty!
  129. "Member which submitted the work entry"
  130. worker: Membership!
  131. "Staking account with the work entry stake"
  132. stakingAccount: String
  133. # Work entry current state:
  134. "Whether at least one work has been submitted"
  135. workSubmitted: Boolean!
  136. "Work entry status"
  137. status: BountyEntryStatus!
  138. # Events
  139. "The event the work entry was created in"
  140. announcedInEvent: WorkEntryAnnouncedEvent! @derivedFrom(field: "entry")
  141. "Event emitted if the entry is withdrawn"
  142. withdrawnInEvent: WorkEntryWithdrawnEvent @derivedFrom(field: "entry")
  143. "Event emitted if the entry is withdrawn"
  144. slashedInEvent: WorkEntrySlashedEvent @derivedFrom(field: "entry")
  145. "All of the submitted work events"
  146. works: [WorkSubmittedEvent] @derivedFrom(field: "entry")
  147. "Event emitted if the entrant cashed out stake and/or share of bounty reward"
  148. cashedOutInEvent: WorkEntrantFundsWithdrawnEvent @derivedFrom(field: "entry")
  149. }
  150. type BountyContribution @entity {
  151. "Contribution Id"
  152. id: ID!
  153. "Bounty to which the contribution is made"
  154. bounty: Bounty!
  155. "Member making the contribution (if a member and not the council)"
  156. contributor: Membership
  157. # This exposes internal Hydra value related to `contributor`
  158. "The id of the contributor"
  159. contributorId: ID
  160. "Amount of the contribution"
  161. amount: BigInt!
  162. # Events
  163. "Events the contribution was created and updated in"
  164. bountyFundedEvents: [BountyFundedEvent!]! @derivedFrom(field: "contribution")
  165. "Event emitted if the contribution is withdrawn"
  166. withdrawnInEvent: BountyFundingWithdrawalEvent @derivedFrom(field: "contribution")
  167. }