zcash-grant-system/frontend/types/proposal.ts

120 lines
2.8 KiB
TypeScript
Raw Normal View History

2018-12-27 09:41:26 -08:00
import { Zat } from 'utils/units';
2019-02-13 08:54:46 -08:00
import { PROPOSAL_CATEGORY, PROPOSAL_STAGE } from 'api/constants';
2019-01-09 13:57:15 -08:00
import { CreateMilestone, Update, User, Comment, ContributionWithUser } from 'types';
2018-12-27 09:41:26 -08:00
import { ProposalMilestone } from './milestone';
import { RFP } from './rfp';
2018-10-04 21:27:02 -07:00
2018-11-16 08:16:52 -08:00
export interface TeamInvite {
id: number;
dateCreated: number;
address: string;
accepted: boolean | null;
}
2018-10-04 21:27:02 -07:00
export interface Contributor {
address: string;
2018-12-27 09:41:26 -08:00
contributionAmount: Zat;
2018-10-04 21:27:02 -07:00
refundVote: boolean;
refunded: boolean;
proportionalContribution: string;
milestoneNoVotes: boolean[];
}
export interface ProposalArbiter {
user?: User; // only set if there is nomination/acceptance
proposal: Proposal;
status: PROPOSAL_ARBITER_STATUS;
}
export type ProposalProposalArbiter = Omit<ProposalArbiter, 'proposal'>;
export type UserProposalArbiter = Omit<ProposalArbiter, 'user'>;
2018-11-13 08:07:09 -08:00
export interface ProposalDraft {
proposalId: number;
dateCreated: number;
title: string;
brief: string;
category: PROPOSAL_CATEGORY;
content: string;
2019-02-13 08:54:46 -08:00
stage: PROPOSAL_STAGE;
target: string;
payoutAddress: string;
deadlineDuration: number;
milestones: CreateMilestone[];
team: User[];
2018-11-16 08:16:52 -08:00
invites: TeamInvite[];
status: STATUS;
isStaked: boolean;
rfp?: RFP;
rfpOptIn?: boolean;
2018-11-13 08:07:09 -08:00
}
2018-12-27 09:41:26 -08:00
export interface Proposal extends Omit<ProposalDraft, 'target' | 'invites'> {
proposalAddress: string;
proposalUrlId: string;
target: Zat;
funded: Zat;
percentFunded: number;
contributionMatching: number;
contributionBounty: Zat;
2018-10-04 21:27:02 -07:00
milestones: ProposalMilestone[];
2019-02-11 13:22:40 -08:00
currentMilestone?: ProposalMilestone;
datePublished: number | null;
dateApproved: number | null;
arbiter: ProposalProposalArbiter;
2019-02-11 13:22:40 -08:00
isTeamMember?: boolean; // FE derived
isArbiter?: boolean; // FE derived
2018-10-04 21:27:02 -07:00
}
2018-11-16 11:17:09 -08:00
export interface TeamInviteWithProposal extends TeamInvite {
proposal: Proposal;
}
2018-10-04 21:27:02 -07:00
export interface ProposalComments {
proposalId: Proposal['proposalId'];
2018-10-04 21:27:02 -07:00
totalComments: number;
comments: Comment[];
}
export interface ProposalUpdates {
proposalId: Proposal['proposalId'];
2018-10-04 21:27:02 -07:00
updates: Update[];
}
2019-01-09 12:48:41 -08:00
export interface ProposalContributions {
proposalId: Proposal['proposalId'];
top: ContributionWithUser[];
latest: ContributionWithUser[];
}
2018-10-04 21:27:02 -07:00
export interface UserProposal {
proposalId: number;
status: STATUS;
2018-10-04 21:27:02 -07:00
title: string;
brief: string;
funded: Zat;
target: Zat;
dateCreated: number;
dateApproved: number;
datePublished: number;
team: User[];
rejectReason: string;
}
// NOTE: sync with backend/grant/proposal/models.py STATUSES
export enum STATUS {
DRAFT = 'DRAFT',
STAKING = 'STAKING',
PENDING = 'PENDING',
APPROVED = 'APPROVED',
REJECTED = 'REJECTED',
LIVE = 'LIVE',
DELETED = 'DELETED',
2018-10-04 21:27:02 -07:00
}
export enum PROPOSAL_ARBITER_STATUS {
MISSING = 'MISSING',
NOMINATED = 'NOMINATED',
ACCEPTED = 'ACCEPTED',
}