Governance API
Base URL: /api/defi/governance
Create and vote on DAO proposals to shape the future of YaniPay.
Overview
The Governance API enables YANI token holders to participate in the YaniPay DAO. Create proposals, vote on protocol changes, and help steer the direction of the platform.
Proposal Threshold
1,000,000 YANI
Required to create proposal
Quorum
4%
Of total supply
Voting Period
7 Days
After 2-day pending period
YaniChain DAO
La gouvernance YaniPay est entièrement décentralisée et fonctionne on-chain sur YaniChain. Chaque vote est enregistré de manière immuable, garantissant transparence et auditabilité complètes.
Y.A.N.I. Analyse les Propositions
Endpoints
GET /api/defi/governance/proposals
List all governance proposals with optional status filtering.
curl -X GET "https://api.yanipay.com/api/defi/governance/proposals?status=active&page=1"Query Parameters
| Parameter | Type | Description |
|---|---|---|
status | string | Filter by status (pending, active, succeeded, defeated, queued, executed) |
page | number | Page number (default: 1) |
limit | number | Results per page (default: 20) |
Response
{
"proposals": [
{
"id": "prop_001",
"title": "[YIP-12] Increase Staking Rewards",
"description": "Proposal to increase staking APY by 5%...",
"category": "protocol",
"proposer": "0x1234...abcd",
"status": "active",
"forVotes": "45000000.00",
"againstVotes": "12000000.00",
"abstainVotes": "3000000.00",
"quorumVotes": "280000000.00",
"startTime": "2026-01-20T00:00:00Z",
"endTime": "2026-01-27T00:00:00Z",
"createdAt": "2026-01-18T00:00:00Z"
}
],
"totalCount": 45,
"page": 1,
"totalPages": 3
}GET /api/defi/governance/proposals/:id
Get detailed information about a specific proposal including actions.
curl -X GET "https://api.yanipay.com/api/defi/governance/proposals/prop_001"Response
{
"id": "prop_001",
"title": "[YIP-12] Increase Staking Rewards",
"description": "## Summary\n\nThis proposal aims to increase...",
"category": "protocol",
"proposer": "0x1234...abcd",
"status": "active",
"forVotes": "45000000.00",
"againstVotes": "12000000.00",
"abstainVotes": "3000000.00",
"quorumVotes": "280000000.00",
"startTime": "2026-01-20T00:00:00Z",
"endTime": "2026-01-27T00:00:00Z",
"actions": [
{
"target": "0xStakingContract",
"value": "0",
"signature": "setBaseAPY(uint256)",
"calldata": "0x000000000000000000000000000000000000000000000000000000000000000d"
}
],
"discussionUrl": "https://forum.yanipay.com/t/yip-12",
"createdAt": "2026-01-18T00:00:00Z"
}POST /api/defi/governance/proposals
Create a new governance proposal. Requires 1,000,000 YANI voting power.
curl -X POST "https://api.yanipay.com/api/defi/governance/proposals" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"title": "[YIP-XX] Proposal Title",
"description": "## Summary\n\nDetailed description...",
"category": "protocol",
"actions": [
{
"target": "0xContractAddress",
"value": "0",
"signature": "functionName(uint256)",
"calldata": "0x..."
}
],
"discussionUrl": "https://forum.yanipay.com/t/..."
}'Response
{
"id": "prop_046",
"title": "[YIP-XX] Proposal Title",
"status": "pending",
"startTime": "2026-01-27T00:00:00Z",
"endTime": "2026-02-03T00:00:00Z",
"transactionHash": "0xabcd...1234"
}POST /api/defi/governance/proposals/:id/vote
Cast a vote on an active proposal.
curl -X POST "https://api.yanipay.com/api/defi/governance/proposals/prop_001/vote" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"voteType": "for",
"reason": "I support this proposal because..."
}'Vote Types
for- Vote in favor of the proposalagainst- Vote against the proposalabstain- Abstain from voting (counts toward quorum)
Response
{
"proposalId": "prop_001",
"voter": "0x5678...efgh",
"voteType": "for",
"votingPower": "50000.00",
"reason": "I support this proposal because...",
"transactionHash": "0xijkl...5678",
"timestamp": "2026-01-25T10:30:00Z"
}Voting Power
Your voting power is calculated from your YANI holdings with multipliers for staked tokens:
curl -X GET "https://api.yanipay.com/api/defi/governance/voting-power" \
-H "Authorization: Bearer YOUR_TOKEN"Response
{
"address": "0x5678...efgh",
"yaniBalance": "25000.00",
"stakedYani": "100000.00",
"stakingMultiplier": "1.5",
"delegatedPower": "5000.00",
"totalPower": "180000.00",
"votingPowerPercent": "0.0026"
}Voting Power Formula
Total Power = Wallet Balance + (Staked Balance × Multiplier) + Delegated Power
- Flexible staking: 1.0x multiplier
- 90-day lock: 1.5x multiplier
- 365-day lock: 2.0x multiplier
TypeScript Types
1 export type ProposalStatus = 2 | 'pending' 3 | 'active' 4 | 'defeated' 5 | 'succeeded' 6 | 'queued' 7 | 'executed' 8 | 'cancelled'; 9 10 export type ProposalCategory = 11 | 'protocol' 12 | 'treasury' 13 | 'ecosystem' 14 | 'emergency'; 15 16 export type VoteType = 'for' | 'against' | 'abstain'; 17 18 export interface ProposalAction { 19 target: string; 20 value: string; 21 signature: string; 22 calldata: string; 23 } 24 25 export interface Proposal { 26 id: string; 27 title: string; 28 description: string; 29 category: ProposalCategory; 30 proposer: string; 31 status: ProposalStatus; 32 forVotes: string; 33 againstVotes: string; 34 abstainVotes: string; 35 quorumVotes: string; 36 startTime: string; 37 endTime: string; 38 actions: ProposalAction[]; 39 discussionUrl?: string; 40 createdAt: string; 41 } 42 43 export interface Vote { 44 proposalId: string; 45 voter: string; 46 voteType: VoteType; 47 votingPower: string; 48 reason?: string; 49 timestamp: string; 50 } 51 52 export interface VotingPower { 53 address: string; 54 yaniBalance: string; 55 stakedYani: string; 56 stakingMultiplier: string; 57 delegatedPower: string; 58 totalPower: string; 59 votingPowerPercent: string; 60 } 61 62 export interface CreateProposalRequest { 63 title: string; 64 description: string; 65 category: ProposalCategory; 66 actions: ProposalAction[]; 67 discussionUrl?: string; 68 } 69 70 export interface CastVoteRequest { 71 voteType: VoteType; 72 reason?: string; 73 }
Error Handling
400 INSUFFICIENT_VOTING_POWERBelow 1M YANI threshold to create proposal
400 PROPOSAL_NOT_ACTIVEProposal is not in active voting period
400 ALREADY_VOTEDUser has already voted on this proposal
400 INVALID_ACTIONSProposal actions are malformed or invalid
404 PROPOSAL_NOT_FOUNDProposal does not exist