Yield Farming API
Base URL: /api/defi/farming
Deposit LP tokens to earn YANI rewards with boosted yields.
Overview
Yield farming allows liquidity providers to earn additional YANI rewards by staking their LP tokens. Different farms offer varying APY based on token pair and incentive allocations.
Boost Multipliers
Stake YANI tokens to boost your farming rewards up to 2.5x. The more YANI you stake, the higher your multiplier.
YaniChain Yield Farming
Le yield farming YaniPay fonctionne nativement sur YaniChain, permettant des distributions de rewards optimisées avec des frais de gas minimaux. Notre architecture de farming offre des rendements compétitifs tout en maintenant une sécurité maximale.
Y.A.N.I. Optimise Vos Rendements
Endpoints
GET /api/defi/farming/farms
Retrieve all active farming pools with APY and allocation data.
curl -X GET "https://api.yanipay.com/api/defi/farming/farms"Response
{
"farms": [
{
"id": "farm-yani-usdc",
"name": "YANI-USDC Farm",
"lpToken": {
"symbol": "YANI-USDC-LP",
"address": "0xabcd...1234",
"pairId": "yani-usdc"
},
"rewardToken": "YANI",
"apy": "125.50",
"baseApy": "50.20",
"boostApy": "75.30",
"tvl": "15000000.00",
"rewardsPerDay": "10000.00",
"allocPoint": 40,
"depositFee": "0",
"active": true
},
{
"id": "farm-yani-eth",
"name": "YANI-ETH Farm",
"lpToken": {
"symbol": "YANI-ETH-LP",
"address": "0xefgh...5678",
"pairId": "yani-eth"
},
"rewardToken": "YANI",
"apy": "95.00",
"baseApy": "38.00",
"boostApy": "57.00",
"tvl": "8500000.00",
"rewardsPerDay": "5000.00",
"allocPoint": 30,
"depositFee": "0",
"active": true
}
],
"totalAllocPoint": 100,
"yaniPerBlock": "2.5"
}GET /api/defi/farming/positions
Get all farming positions for the authenticated user.
curl -X GET "https://api.yanipay.com/api/defi/farming/positions" \
-H "Authorization: Bearer YOUR_TOKEN"Response
{
"positions": [
{
"id": "pos_farm_abc123",
"farmId": "farm-yani-usdc",
"lpDeposited": "1000.00",
"pendingRewards": "125.50",
"boostMultiplier": "1.8",
"effectiveApy": "90.36",
"depositedAt": "2026-01-10T00:00:00Z",
"lastHarvestAt": "2026-01-20T00:00:00Z"
}
],
"totalPendingRewards": "125.50",
"totalValueLocked": "1500.00",
"averageApy": "90.36"
}POST /api/defi/farming/deposit
Deposit LP tokens into a farming pool.
curl -X POST "https://api.yanipay.com/api/defi/farming/deposit" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"farmId": "farm-yani-usdc",
"amount": "500.00"
}'Request Body
interface DepositRequest {
farmId: string; // Farm identifier
amount: string; // LP tokens to deposit
}Response
{
"transactionHash": "0x1234...abcd",
"position": {
"id": "pos_farm_def456",
"farmId": "farm-yani-usdc",
"lpDeposited": "500.00",
"pendingRewards": "0.00",
"boostMultiplier": "1.0",
"effectiveApy": "50.20",
"depositedAt": "2026-01-25T10:30:00Z"
}
}POST /api/defi/farming/withdraw
Withdraw LP tokens from a farming position. Pending rewards are automatically harvested.
curl -X POST "https://api.yanipay.com/api/defi/farming/withdraw" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"positionId": "pos_farm_abc123",
"amount": "250.00"
}'Response
{
"transactionHash": "0x5678...efgh",
"lpWithdrawn": "250.00",
"rewardsHarvested": "125.50",
"position": {
"id": "pos_farm_abc123",
"lpDeposited": "750.00",
"pendingRewards": "0.00"
}
}POST /api/defi/farming/harvest
Harvest pending YANI rewards without withdrawing LP tokens.
curl -X POST "https://api.yanipay.com/api/defi/farming/harvest" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"positionId": "pos_farm_abc123"
}'Response
{
"transactionHash": "0x9abc...ijkl",
"rewardsHarvested": "125.50",
"position": {
"id": "pos_farm_abc123",
"pendingRewards": "0.00",
"lastHarvestAt": "2026-01-25T10:35:00Z"
}
}TypeScript Types
1 export interface LpToken { 2 symbol: string; 3 address: string; 4 pairId: string; 5 } 6 7 export interface Farm { 8 id: string; 9 name: string; 10 lpToken: LpToken; 11 rewardToken: string; 12 apy: string; 13 baseApy: string; 14 boostApy: string; 15 tvl: string; 16 rewardsPerDay: string; 17 allocPoint: number; 18 depositFee: string; 19 active: boolean; 20 } 21 22 export interface FarmingPosition { 23 id: string; 24 farmId: string; 25 lpDeposited: string; 26 pendingRewards: string; 27 boostMultiplier: string; 28 effectiveApy: string; 29 depositedAt: string; 30 lastHarvestAt: string | null; 31 } 32 33 export interface DepositRequest { 34 farmId: string; 35 amount: string; 36 } 37 38 export interface WithdrawRequest { 39 positionId: string; 40 amount: string; 41 } 42 43 export interface HarvestRequest { 44 positionId: string; 45 } 46 47 export interface DepositResponse { 48 transactionHash: string; 49 position: FarmingPosition; 50 } 51 52 export interface WithdrawResponse { 53 transactionHash: string; 54 lpWithdrawn: string; 55 rewardsHarvested: string; 56 position: FarmingPosition; 57 } 58 59 export interface HarvestResponse { 60 transactionHash: string; 61 rewardsHarvested: string; 62 position: FarmingPosition; 63 } 64 65 export interface FarmsResponse { 66 farms: Farm[]; 67 totalAllocPoint: number; 68 yaniPerBlock: string; 69 } 70 71 export interface PositionsResponse { 72 positions: FarmingPosition[]; 73 totalPendingRewards: string; 74 totalValueLocked: string; 75 averageApy: string; 76 }
Error Handling
400 INSUFFICIENT_LP_BALANCENot enough LP tokens in wallet
400 WITHDRAW_EXCEEDS_DEPOSITWithdrawal amount exceeds deposited LP
400 NO_PENDING_REWARDSNo rewards to harvest
404 FARM_NOT_FOUNDInvalid farm identifier
404 POSITION_NOT_FOUNDFarming position does not exist