bounty.graphql 6.1 KB

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