Преглед на файлове

Merge pull request #3328 from Lezek123/olympia-missing-bounty-types

Bounty: Add missing types
Mokhtar Naamani преди 3 години
родител
ревизия
fbc282a86d
променени са 3 файла, в които са добавени 117 реда и са изтрити 12 реда
  1. 27 0
      types/augment/all/defs.json
  2. 41 0
      types/augment/all/types.ts
  3. 49 12
      types/src/bounty.ts

+ 27 - 0
types/augment/all/defs.json

@@ -621,6 +621,33 @@
         "work_submitted": "bool",
         "oracle_judgment_result": "Option<OracleJudgment>"
     },
+    "BountyMilestone_Created": {
+        "created_at": "u32",
+        "has_contributions": "bool"
+    },
+    "BountyMilestone_BountyMaxFundingReached": {
+        "max_funding_reached_at": "u32"
+    },
+    "BountyMilestone_WorkSubmitted": {
+        "work_period_started_at": "u32"
+    },
+    "BountyMilestone_JudgmentSubmitted": {
+        "successful_bounty": "bool"
+    },
+    "BountyMilestone": {
+        "_enum": {
+            "Created": "BountyMilestone_Created",
+            "BountyMaxFundingReached": "BountyMilestone_BountyMaxFundingReached",
+            "WorkSubmitted": "BountyMilestone_WorkSubmitted",
+            "JudgmentSubmitted": "BountyMilestone_JudgmentSubmitted"
+        }
+    },
+    "Bounty": {
+        "creation_params": "BountyCreationParameters",
+        "total_funding": "u128",
+        "milestone": "BountyMilestone",
+        "active_work_entry_count": "u32"
+    },
     "CuratorId": "u64",
     "CuratorGroupId": "u64",
     "CuratorGroup": {

+ 41 - 0
types/augment/all/types.ts

@@ -140,6 +140,14 @@ export interface BlockAndTime extends Struct {
   readonly time: u64;
 }
 
+/** @name Bounty */
+export interface Bounty extends Struct {
+  readonly creation_params: BountyCreationParameters;
+  readonly total_funding: u128;
+  readonly milestone: BountyMilestone;
+  readonly active_work_entry_count: u32;
+}
+
 /** @name BountyActor */
 export interface BountyActor extends Enum {
   readonly isCouncil: boolean;
@@ -162,6 +170,39 @@ export interface BountyCreationParameters extends Struct {
 /** @name BountyId */
 export interface BountyId extends u64 {}
 
+/** @name BountyMilestone */
+export interface BountyMilestone extends Enum {
+  readonly isCreated: boolean;
+  readonly asCreated: BountyMilestone_Created;
+  readonly isBountyMaxFundingReached: boolean;
+  readonly asBountyMaxFundingReached: BountyMilestone_BountyMaxFundingReached;
+  readonly isWorkSubmitted: boolean;
+  readonly asWorkSubmitted: BountyMilestone_WorkSubmitted;
+  readonly isJudgmentSubmitted: boolean;
+  readonly asJudgmentSubmitted: BountyMilestone_JudgmentSubmitted;
+}
+
+/** @name BountyMilestone_BountyMaxFundingReached */
+export interface BountyMilestone_BountyMaxFundingReached extends Struct {
+  readonly max_funding_reached_at: u32;
+}
+
+/** @name BountyMilestone_Created */
+export interface BountyMilestone_Created extends Struct {
+  readonly created_at: u32;
+  readonly has_contributions: bool;
+}
+
+/** @name BountyMilestone_JudgmentSubmitted */
+export interface BountyMilestone_JudgmentSubmitted extends Struct {
+  readonly successful_bounty: bool;
+}
+
+/** @name BountyMilestone_WorkSubmitted */
+export interface BountyMilestone_WorkSubmitted extends Struct {
+  readonly work_period_started_at: u32;
+}
+
 /** @name BuyMembershipParameters */
 export interface BuyMembershipParameters extends Struct {
   readonly root_account: AccountId;

+ 49 - 12
types/src/bounty.ts

@@ -1,5 +1,5 @@
-import { Null, u32, u64, u128, bool, Option, BTreeSet, BTreeMap } from '@polkadot/types'
-import { JoyEnum, JoyStructDecorated, MemberId, AccountId } from './common'
+import { Null, u32, u64, bool, Option, BTreeSet, BTreeMap } from '@polkadot/types'
+import { JoyEnum, JoyStructDecorated, MemberId, AccountId, Balance, BlockNumber } from './common'
 
 export class BountyId extends u64 {}
 export class EntryId extends u64 {}
@@ -17,13 +17,13 @@ export class AssuranceContractType extends JoyEnum({
 }) {}
 
 export class FundingType_Perpetual extends JoyStructDecorated({
-  target: u128, // Balance
+  target: Balance,
 }) {}
 
 export class FundingType_Limited extends JoyStructDecorated({
-  min_funding_amount: u128, // Balance
-  max_funding_amount: u128, // Balance
-  funding_period: u32, // BlockNumber
+  min_funding_amount: Balance,
+  max_funding_amount: Balance,
+  funding_period: BlockNumber,
 }) {}
 
 export class FundingType extends JoyEnum({
@@ -35,15 +35,15 @@ export class BountyCreationParameters extends JoyStructDecorated({
   oracle: BountyActor,
   contract_type: AssuranceContractType,
   creator: BountyActor,
-  cherry: u128, // Balance
-  entrant_stake: u128, // Balance
+  cherry: Balance,
+  entrant_stake: Balance,
   funding_type: FundingType,
-  work_period: u32, // BlockNumber
-  judging_period: u32, // BlockNumber
+  work_period: BlockNumber,
+  judging_period: BlockNumber,
 }) {}
 
 export class OracleWorkEntryJudgment_Winner extends JoyStructDecorated({
-  reward: u128, // Balance
+  reward: Balance,
 }) {}
 
 export class OracleWorkEntryJudgment extends JoyEnum({
@@ -56,11 +56,42 @@ export class OracleJudgment extends BTreeMap.with(EntryId, OracleWorkEntryJudgme
 export class Entry extends JoyStructDecorated({
   member_id: MemberId,
   staking_account_id: AccountId,
-  submitted_at: u32, // BlockNumber
+  submitted_at: BlockNumber,
   work_submitted: bool,
   oracle_judgment_result: Option.with(OracleJudgment),
 }) {}
 
+export class BountyMilestone_Created extends JoyStructDecorated({
+  created_at: BlockNumber,
+  has_contributions: bool,
+}) {}
+
+export class BountyMilestone_BountyMaxFundingReached extends JoyStructDecorated({
+  max_funding_reached_at: BlockNumber,
+}) {}
+
+export class BountyMilestone_WorkSubmitted extends JoyStructDecorated({
+  work_period_started_at: BlockNumber,
+}) {}
+
+export class BountyMilestone_JudgmentSubmitted extends JoyStructDecorated({
+  successful_bounty: bool,
+}) {}
+
+export class BountyMilestone extends JoyEnum({
+  Created: BountyMilestone_Created,
+  BountyMaxFundingReached: BountyMilestone_BountyMaxFundingReached,
+  WorkSubmitted: BountyMilestone_WorkSubmitted,
+  JudgmentSubmitted: BountyMilestone_JudgmentSubmitted,
+}) {}
+
+export class Bounty extends JoyStructDecorated({
+  creation_params: BountyCreationParameters,
+  total_funding: Balance,
+  milestone: BountyMilestone,
+  active_work_entry_count: u32,
+}) {}
+
 export const bountyTypes = {
   BountyId,
   EntryId,
@@ -75,6 +106,12 @@ export const bountyTypes = {
   OracleWorkEntryJudgment,
   OracleJudgment,
   Entry,
+  BountyMilestone_Created,
+  BountyMilestone_BountyMaxFundingReached,
+  BountyMilestone_WorkSubmitted,
+  BountyMilestone_JudgmentSubmitted,
+  BountyMilestone,
+  Bounty,
 }
 
 export default bountyTypes