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/statsReturns 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/configResponse:
{
"id": "cfg_xxx",
"quorumPercentage": 10,
"votingPeriod": 604800,
"minActiveDays": 30,
"emergencyBadgeCount": 5
}Update Configuration
PUT /api/admin/configBody:
{
"quorumPercentage": 15,
"votingPeriod": 432000,
"minActiveDays": 45
}Proposal Moderation
List Proposals
GET /api/admin/proposals?state=active&limit=50Pause Proposal
POST /api/admin/proposals/{id}/pauseBody:
{
"reason": "Pending investigation of reported issue"
}Resume Proposal
POST /api/admin/proposals/{id}/resumeVeto Proposal
POST /api/admin/proposals/{id}/vetoBody:
{
"reason": "Proposal violates DAO guidelines section 3.2"
}Member Management
List Members
GET /api/admin/members?tier=gold&search=walletResponse:
{
"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}/overrideBody:
{
"overrideScore": 100,
"reason": "Manual verification of off-chain credentials",
"expiresAt": "2024-12-31T23:59:59Z"
}Admin Management
List Admins
GET /api/admin/adminsAdd Admin (Super Admin Only)
POST /api/admin/adminsBody:
{
"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=100Response:
{
"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
| Action | Description |
|---|---|
UPDATE_CONFIG | DAO configuration changed |
PAUSE_PROPOSAL | Proposal paused |
RESUME_PROPOSAL | Proposal resumed |
VETO_PROPOSAL | Proposal vetoed |
OVERRIDE_SCORE | FairScore manually overridden |
ADD_ADMIN | New admin added |
REMOVE_ADMIN | Admin removed |
SYNC_SCORE | Score synced from oracle |
Roles
| Role | Permissions |
|---|---|
admin | View stats, moderate proposals, override scores |
superadmin | All admin permissions + manage admins |