Staking API
Base URL: /api/defi/staking
Stake YANI tokens to earn rewards and increase your governance voting power.
Overview
The Staking API allows users to stake YANI tokens in various pools with different lock periods and reward rates. Longer lock periods provide higher APY and increased voting power for governance.
DeFi Accessible
Flexible Pool
8% APY
No lock period
90-Day Lock
15% APY
1.5x voting power
365-Day Lock
25% APY
2x voting power
Intégration YaniChain
Le staking YANI fonctionne nativement sur YaniChain, notre blockchain hybride haute performance. Cette intégration offre des avantages uniques par rapport aux solutions de staking traditionnelles.
Y.A.N.I. Optimise Votre Staking
Pourquoi le Staking YANI ?
Le staking YANI offre bien plus que des rendements passifs. C'est un mécanisme central de l'écosystème qui aligne les intérêts des holders avec le succès de la plateforme.
Avantages du Staking
- Rendements Attractifs: Jusqu'à 25% APY pour les positions longues, bien au-dessus des taux bancaires traditionnels
- Pouvoir de Gouvernance : Les stakers influencent les décisions importantes (frais, nouvelles fonctionnalités, allocations)
- Réduction de l'Offre : Le staking réduit les tokens en circulation, soutenant la valeur à long terme
- Compound Automatique : Option de re-stake automatique des rewards pour maximiser les rendements
Stratégie Optimale
Cas d'Utilisation
Découvrez comment différents profils utilisent le staking YANI selon leurs objectifs.
Lucas
Investisseur long terme
Stake avec lock 365 jours
Lucas investit 50,000 YANI dans le pool 365 jours pour maximiser son APY à 25%. Il cumule également 2x de voting power pour participer à la gouvernance.
Sophie
Holder prudente
Stake flexible sans lock
Sophie préfère garder de la liquidité. Elle stake dans le pool flexible à 8% APY pour pouvoir unstake à tout moment sans pénalité.
Marc
DAO participant actif
Stake pour voting power
Marc stake pour obtenir du voting power et participer aux votes de gouvernance. Son multiplicateur 1.5x lui donne plus d'influence sur les décisions.
Emma
Yield farmer
Compound ses rewards
Emma réclame ses rewards hebdomadaires et les re-stake pour profiter de l'effet composé. En 1 an, elle a augmenté son capital de 28%.
Flux de Staking
Architecture du système de staking et interactions avec YaniChain.
Vue d'ensemble
Séquence de Stake
Voici le flux complet du processus de staking, de la sélection du pool à la confirmation de la position.
Early Unstake Penalty
Endpoints
GET /api/defi/staking/pools
Retrieve all available staking pools with their current APY and TVL.
curl -X GET "https://api.yanipay.com/api/defi/staking/pools"Response
{
"pools": [
{
"id": "flexible",
"name": "Flexible Staking",
"token": "YANI",
"apy": "8.00",
"tvl": "45000000.00",
"lockPeriod": 0,
"minStake": "100.00",
"maxStake": "10000000.00",
"votingMultiplier": 1.0,
"active": true
},
{
"id": "locked-90",
"name": "90-Day Lock",
"token": "YANI",
"apy": "15.00",
"tvl": "120000000.00",
"lockPeriod": 90,
"minStake": "1000.00",
"maxStake": "50000000.00",
"votingMultiplier": 1.5,
"active": true
},
{
"id": "locked-365",
"name": "365-Day Lock",
"token": "YANI",
"apy": "25.00",
"tvl": "280000000.00",
"lockPeriod": 365,
"minStake": "5000.00",
"maxStake": "100000000.00",
"votingMultiplier": 2.0,
"active": true
}
]
}GET /api/defi/staking/positions
Get all staking positions for the authenticated user.
curl -X GET "https://api.yanipay.com/api/defi/staking/positions" \
-H "Authorization: Bearer YOUR_TOKEN"Response
{
"positions": [
{
"id": "pos_abc123",
"poolId": "locked-90",
"amount": "50000.00",
"rewards": "1250.50",
"startDate": "2026-01-01T00:00:00Z",
"unlockDate": "2026-04-01T00:00:00Z",
"status": "active",
"votingPower": "75000.00"
}
],
"totalStaked": "50000.00",
"totalRewards": "1250.50",
"totalVotingPower": "75000.00"
}POST /api/defi/staking/stake
Stake YANI tokens in a pool.
curl -X POST "https://api.yanipay.com/api/defi/staking/stake" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"poolId": "locked-90",
"amount": "10000.00"
}'Request Body
interface StakeRequest {
poolId: string; // Pool identifier
amount: string; // Amount to stake (decimal string)
}Response
{
"position": {
"id": "pos_def456",
"poolId": "locked-90",
"amount": "10000.00",
"rewards": "0.00",
"startDate": "2026-01-25T10:30:00Z",
"unlockDate": "2026-04-25T10:30:00Z",
"status": "active",
"votingPower": "15000.00"
},
"transactionHash": "0x1234...abcd"
}POST /api/defi/staking/unstake
Unstake tokens from a position. For locked positions, this can only be done after the unlock date.
Early Unstake Penalty
Unstaking locked positions before the unlock date incurs a 10% penalty on the staked amount.
curl -X POST "https://api.yanipay.com/api/defi/staking/unstake" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"positionId": "pos_def456",
"amount": "5000.00"
}'POST /api/defi/staking/claim
Claim accumulated rewards from a staking position.
curl -X POST "https://api.yanipay.com/api/defi/staking/claim" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"positionId": "pos_def456"
}'Response
{
"claimed": "1250.50",
"transactionHash": "0x5678...efgh",
"position": {
"id": "pos_def456",
"rewards": "0.00"
}
}TypeScript Types
1 export interface StakingPool { 2 id: string; 3 name: string; 4 token: string; 5 apy: string; 6 tvl: string; 7 lockPeriod: number; // Days, 0 for flexible 8 minStake: string; 9 maxStake: string; 10 votingMultiplier: number; 11 active: boolean; 12 } 13 14 export interface StakingPosition { 15 id: string; 16 poolId: string; 17 amount: string; 18 rewards: string; 19 startDate: string; 20 unlockDate: string | null; 21 status: 'active' | 'unstaking' | 'completed'; 22 votingPower: string; 23 } 24 25 export interface StakeRequest { 26 poolId: string; 27 amount: string; 28 } 29 30 export interface UnstakeRequest { 31 positionId: string; 32 amount: string; 33 forceEarly?: boolean; // Accept penalty for early unstake 34 } 35 36 export interface ClaimRequest { 37 positionId: string; 38 } 39 40 export interface StakeResponse { 41 position: StakingPosition; 42 transactionHash: string; 43 } 44 45 export interface ClaimResponse { 46 claimed: string; 47 transactionHash: string; 48 position: StakingPosition; 49 }
Error Handling
400 INSUFFICIENT_BALANCENot enough YANI tokens in wallet
400 BELOW_MINIMUMStake amount below pool minimum
400 ABOVE_MAXIMUMStake amount exceeds pool maximum
400 POSITION_LOCKEDPosition is still locked (use forceEarly to unstake with penalty)
404 POOL_NOT_FOUNDInvalid pool identifier
Rewards Distribution
Références
Ressources officielles pour approfondir les concepts DeFi et staking.