DocumentationapiAdmin API

Admin API

Admin endpoints require wallet signature verification for access control.

Authentication

Admin authentication uses wallet signature verification:

// Generate auth token
const timestamp = Date.now()
const message = `admin-login:${timestamp}`
const signature = await wallet.signMessage(new TextEncoder().encode(message))
const token = `${walletAddress}:${signature}:${message}:${timestamp}`
 
// Use in requests
fetch('/api/admin/stats', {
  headers: { Authorization: `Bearer ${token}` }
})

Endpoints

Get Admin Stats

GET /api/admin/stats

Returns dashboard statistics for admin overview.

Response:

{
  "totalMembers": 1250,
  "totalProposals": 45,
  "activeProposals": 3,
  "totalVotes": 8432,
  "tierDistribution": [
    { "tier": "platinum", "_count": 12 },
    { "tier": "gold", "_count": 89 },
    { "tier": "silver", "_count": 345 },
    { "tier": "bronze", "_count": 678 }
  ],
  "oracleStatus": {
    "healthy": true,
    "lastChecked": "2024-01-15T10:30:00Z"
  }
}

Get DAO Configuration

GET /api/admin/config

Response:

{
  "id": "cfg_xxx",
  "quorumPercentage": 10,
  "votingPeriod": 604800,
  "minActiveDays": 30,
  "emergencyBadgeCount": 5
}

Update Configuration

PUT /api/admin/config

Body:

{
  "quorumPercentage": 15,
  "votingPeriod": 432000,
  "minActiveDays": 45
}

Proposal Moderation

List Proposals

GET /api/admin/proposals?state=active&limit=50

Pause Proposal

POST /api/admin/proposals/{id}/pause

Body:

{
  "reason": "Pending investigation of reported issue"
}

Resume Proposal

POST /api/admin/proposals/{id}/resume

Veto Proposal

POST /api/admin/proposals/{id}/veto

Body:

{
  "reason": "Proposal violates DAO guidelines section 3.2"
}

Member Management

List Members

GET /api/admin/members?tier=gold&search=wallet

Response:

{
  "members": [
    {
      "id": "mem_xxx",
      "wallet": "7xKXtg2CW...",
      "fairscore": 85,
      "tier": "gold",
      "activeDays": 156,
      "proposalsSubmitted": 3,
      "proposalsVoted": 42
    }
  ],
  "total": 89
}

Override FairScore

POST /api/admin/members/{wallet}/override

Body:

{
  "overrideScore": 100,
  "reason": "Manual verification of off-chain credentials",
  "expiresAt": "2024-12-31T23:59:59Z"
}

Admin Management

List Admins

GET /api/admin/admins

Add Admin (Super Admin Only)

POST /api/admin/admins

Body:

{
  "wallet": "NewAdminWalletAddress",
  "role": "admin"
}

Remove Admin (Super Admin Only)

DELETE /api/admin/admins/{id}

Audit Log

Get Audit Log

GET /api/admin/audit-log?action=VETO_PROPOSAL&limit=100

Response:

{
  "actions": [
    {
      "id": "act_xxx",
      "adminWallet": "AdminWallet...",
      "action": "VETO_PROPOSAL",
      "targetType": "Proposal",
      "targetId": "prop_xxx",
      "reason": "Violated guidelines",
      "createdAt": "2024-01-15T10:00:00Z"
    }
  ],
  "total": 150
}

Action Types

ActionDescription
UPDATE_CONFIGDAO configuration changed
PAUSE_PROPOSALProposal paused
RESUME_PROPOSALProposal resumed
VETO_PROPOSALProposal vetoed
OVERRIDE_SCOREFairScore manually overridden
ADD_ADMINNew admin added
REMOVE_ADMINAdmin removed
SYNC_SCOREScore synced from oracle

Roles

RolePermissions
adminView stats, moderate proposals, override scores
superadminAll admin permissions + manage admins