DocumentationfrontendProposal Templates

Proposal Templates

CredDAO includes 6 pre-built proposal templates for common governance scenarios.

Using Templates

TemplateSelector Component

import { TemplateSelector } from '@/components/proposals/TemplateSelector'
 
<TemplateSelector
  onSelect={(title, description, type) => {
    // Populate form with template
    setFormData({ title, description, type })
  }}
  onClose={() => setShowTemplates(false)}
/>

Programmatic Usage

import { 
  PROPOSAL_TEMPLATES, 
  getTemplateById, 
  applyTemplate 
} from '@/lib/proposalTemplates'
 
// Get specific template
const template = getTemplateById('treasury-transfer')
 
// Apply with field values
const { title, description } = applyTemplate(template, {
  amount: '1000',
  token: 'USDC',
  recipient: '7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU',
  justification: 'Development grant'
})

Available Templates

1. Treasury Transfer

Request transfer of funds from the DAO treasury.

FieldTypeRequired
amountnumber
tokentext
recipientaddress
recipient_nametext
justificationtextarea

Type: Standard


2. Governance Parameter Change

Propose changes to DAO governance parameters.

FieldTypeRequired
parameterselect
current_valuetext
proposed_valuetext
rationaletextarea

Options: Quorum, Voting Period, Time Lock, Proposal Threshold

Type: Standard


3. Smart Contract Upgrade

Propose an upgrade to DAO smart contracts.

FieldTypeRequired
contract_nametext
current_versiontext
new_versiontext
audit_linktext
changestextarea

Type: Expedited


4. Grant Funding Request

Request funding for a project or initiative.

FieldTypeRequired
project_nametext
team_leadtext
total_amountnumber
durationtext
descriptiontextarea

Type: Standard


5. Emergency Action

Critical action requiring immediate attention.

FieldTypeRequired
actiontext
risk_levelselect
impacttextarea
resolutiontextarea

Options: Critical, High

Type: Emergency


6. Partnership Proposal

Propose a partnership with another organization.

FieldTypeRequired
partner_nametext
partner_urltext
partnership_typeselect
benefitstextarea

Options: Strategic, Integration, Marketing, Technical

Type: Standard


Template Structure

interface ProposalTemplate {
  id: string
  name: string
  description: string
  category: 'treasury' | 'governance' | 'technical' | 'community'
  type: 'standard' | 'expedited' | 'emergency'
  template: {
    title: string      // Template with placeholders
    description: string // Markdown template
  }
  fields: TemplateField[]
}
 
interface TemplateField {
  id: string
  label: string
  placeholder: string
  type: 'text' | 'number' | 'address' | 'select' | 'textarea'
  required: boolean
  options?: { value: string; label: string }[]
}

Category Colors

CategoryBadge Style
treasuryGreen
governanceBlue
technicalPurple
communityOrange

Type Requirements

TypeMin TierVoting PeriodTime Lock
standardbronze7 days2 days
expeditedsilver3 days1 day
emergencygold1 day0 hours

Creating Custom Templates

Add templates to PROPOSAL_TEMPLATES array:

const customTemplate: ProposalTemplate = {
  id: 'custom-id',
  name: 'Custom Template',
  description: 'Description of template',
  category: 'governance',
  type: 'standard',
  template: {
    title: 'Proposal: [field_name]',
    description: `
## Section
[field_name] content here.
    `
  },
  fields: [
    {
      id: 'field_name',
      label: 'Field Label',
      placeholder: 'Enter value...',
      type: 'text',
      required: true
    }
  ]
}