Ir al contenido principal

Liquidity Provider Financial Reports

Overview

The Liquidity Provider Server provides financial reporting endpoints to monitor operations, track profitability, and analyze capital allocation. All reports are available through the Management UI (Reports section) or via API.

Common Conventions:

  • All amounts are in wei (1 BTC/RBTC = 10^18 wei, 1 satoshi = 10^10 wei)
  • Date parameters accept YYYY-MM-DD format (expands to full day) or ISO 8601 format (YYYY-MM-DDTHH:mm:ssZ)
  • All endpoints require Management API authentication
  • Amounts are returned as strings to preserve precision

Dashboard Summary

Endpoint: GET /reports/summaries

Parameters:

  • startDate (required): Start date for the report period
  • endDate (required): End date for the report period

Purpose: Aggregate statistics for both pegin and pegout operations during a time period.

Response Structure

{
"peginSummary": {
"totalQuotesCount": 100,
"acceptedQuotesCount": 85,
"totalAcceptedQuotesAmount": "8500000000000000000",
"paidQuotesCount": 75,
"paidQuotesAmount": "7500000000000000000",
"refundedQuotesCount": 70,
"totalRefundedQuotesAmount": "7000000000000000000",
"penalizationsCount": 5,
"totalPenalizationsAmount": "500000000000000000"
},
"pegoutSummary": {
"totalQuotesCount": 150,
"acceptedQuotesCount": 120,
"totalAcceptedQuotesAmount": "12000000000000000000",
"paidQuotesCount": 110,
"paidQuotesAmount": "11000000000000000000",
"refundedQuotesCount": 100,
"totalRefundedQuotesAmount": "10000000000000000000",
"penalizationsCount": 10,
"totalPenalizationsAmount": "1000000000000000000"
}
}

Metrics Definition

FieldDescription
totalQuotesCountAll quotes created in period (all states)
acceptedQuotesCountQuotes accepted by users (all retained quotes with deposit address assigned)
totalAcceptedQuotesAmountTotal value of accepted quotes (value + gasFee)
paidQuotesCountQuotes where LP successfully paid users (completed delivery states)
paidQuotesAmountTotal value paid to users (value + gasFee)
refundedQuotesCountQuotes where LP was successfully refunded (completed refund states)
totalRefundedQuotesAmountTotal value refunded to LP (value + gasFee + callFee)
penalizationsCountNumber of penalization events applied to LP
totalPenalizationsAmountTotal penalty amount deducted from LP

Note: Date filtering is based on quote creation timestamp.


Asset Overview

Endpoint: GET /reports/assets

Parameters: None

Purpose: Current snapshot of LP capital allocation across all locations and operational states.

Response Structure

{
"btcAssetReport": {
"total": "67500000000000000",
"location": {
"btcWallet": "50000000000000000",
"federation": "5000000000000000",
"rskWallet": "6500000000000000",
"lbc": "6000000000000000"
},
"allocation": {
"reservedForUsers": "4500000000000000",
"waitingForRefund": "11500000000000000",
"available": "45500000000000000"
}
},
"rbtcAssetReport": {
"total": "17000000000000000000",
"location": {
"rskWallet": "10000000000000000000",
"lbc": "5000000000000000000",
"federation": "2000000000000000000"
},
"allocation": {
"reservedForUsers": "3000000000000000000",
"waitingForRefund": "2000000000000000000",
"available": "12000000000000000000"
}
}
}

BTC Asset Breakdown

Location (where assets are):

FieldDescription
btcWalletBTC in Bitcoin wallet
federationBTC in bridge rebalancing process
rskWalletBTC represented as RBTC in RSK wallet (waiting for rebalancing threshold)
lbcBTC represented as RBTC in LBC contract (sent to users, awaiting refund)

Allocation (how assets are used):

FieldDescription
reservedForUsersBTC allocated to pending pegout quotes (waiting for user deposit or confirmations)
waitingForRefundBTC waiting to be refunded to LP (various refund/rebalancing stages)
availableBTC available for new quotes (btcWallet - reservedForUsers)

RBTC Asset Breakdown

Location (where assets are):

FieldDescription
rskWalletRBTC in RSK wallet (excluding BTC waiting for rebalancing)
lbcRBTC in LBC contract (available for pegin operations)
federationRBTC in native bridge (waiting for registerPegin)

Allocation (how assets are used):

FieldDescription
reservedForUsersRBTC allocated to pending pegin quotes (waiting for user deposit or confirmations)
waitingForRefundRBTC waiting to be recovered via registerPegin
availableRBTC available for new quotes ((rskWallet - reservedForUsers) + lbc)

Consistency Rules:

  • Total BTC equals the sum of all BTC location amounts (btcWallet, federation, rskWallet, lbc)
  • Total BTC equals the sum of all BTC allocation amounts (reservedForUsers, waitingForRefund, available)
  • Total RBTC equals the sum of all RBTC location amounts (rskWallet, lbc, federation)
  • Total RBTC equals the sum of all RBTC allocation amounts (reservedForUsers, waitingForRefund, available)

Revenue Report

Endpoint: GET /reports/revenue

Parameters:

  • startDate (required): Start date for the report period
  • endDate (required): End date for the report period

Purpose: Financial analysis of LP earnings, costs, and penalties.

Response Structure

{
"totalQuoteCallFees": "55000000000000000",
"totalGasFeesCollected": "148000000000000000",
"totalGasSpent": "132350000000000000",
"totalPenalizations": "1300000000000000"
}

Metrics Definition

FieldDescription
totalQuoteCallFeesCall fees collected from completed quotes (sum of callFee for both pegin and pegout)
totalGasFeesCollectedGas fees collected upfront from users (sum of gasFee from completed quotes)
totalGasSpentActual gas costs paid by LP (Pegin: CallForUser + RegisterPegin gas costs; Pegout: RefundPegout + BridgeRefund gas + SendPegout BTC fees)
totalPenalizationsPenalties applied to LP (sum of penalty amounts from penalization events)

Note: Only completed quotes are included. Date filtering based on quote creation timestamp.


Pegin Report

Endpoint: GET /reports/pegin

Parameters:

  • startDate (required): Start date for the report period
  • endDate (required): End date for the report period

Purpose: Statistical metrics for completed pegin operations.

Response Structure

{
"numberOfQuotes": 15,
"minimumQuoteValue": "5000000000000000",
"maximumQuoteValue": "3000000000000000000",
"averageQuoteValue": "1200000000000000000",
"totalFeesCollected": "1800000000000000",
"averageFeePerQuote": "1200000000000000"
}

Metrics Definition

FieldDescription
numberOfQuotesCount of completed pegin quotes (returns 0 if no quotes in period)
minimumQuoteValueSmallest quote value (returns "0" if no quotes)
maximumQuoteValueLargest quote value (returns "0" if no quotes)
averageQuoteValueMean quote value calculated as total sum / count (returns "0" if no quotes)
totalFeesCollectedSum of call fees, callFee only (excludes gas fees)
averageFeePerQuoteMean call fee calculated as total fees / count (returns "0" if no quotes)

Note: Only includes fully completed pegins where the entire process has finished successfully (user deposited BTC, LP delivered RBTC, and bridge registration completed).


Pegout Report

Endpoint: GET /reports/pegout

Parameters:

  • startDate (required): Start date for the report period
  • endDate (required): End date for the report period

Purpose: Statistical metrics for finalized pegout operations.

Response Structure

{
"numberOfQuotes": 20,
"minimumQuoteValue": "3000000000000000",
"maximumQuoteValue": "2000000000000000000",
"averageQuoteValue": "800000000000000000",
"totalFeesCollected": "2100000000000000",
"averageFeePerQuote": "1000000000000000"
}

Metrics Definition

FieldDescription
numberOfQuotesCount of finalized pegout quotes (returns 0 if no quotes in period)
minimumQuoteValueSmallest quote value (returns "0" if no quotes)
maximumQuoteValueLargest quote value (returns "0" if no quotes)
averageQuoteValueMean quote value calculated as total sum / count (returns "0" if no quotes)
totalFeesCollectedSum of call fees, callFee only (excludes gas fees)
averageFeePerQuoteMean call fee calculated as total fees / count (returns "0" if no quotes)

Note: Only includes finalized pegouts where the LP has been refunded (post-refund states including waiting for rebalance, being rebalanced, or rebalance completed).


Transaction History

Endpoint: GET /reports/transactions

Parameters:

  • type (required): Transaction type - "pegin" or "pegout"
  • startDate (required): Start date for the report period
  • endDate (required): End date for the report period
  • page (optional): Page number (default: 1)
  • perPage (optional): Items per page (default: 10, max: 100)

Purpose: Paginated list of individual transactions with detailed information.

Response Structure

{
"data": [
{
"quoteHash": "0x1234567890abcdef1234567890abcdef12345678",
"amount": "1000000000000000000",
"callFee": "50000000000000000",
"gasFee": "10000000000000000",
"status": "RegisterPegInSucceeded"
},
{
"quoteHash": "0xabcdef1234567890abcdef1234567890abcdef12",
"amount": "2000000000000000000",
"callFee": "75000000000000000",
"gasFee": "15000000000000000",
"status": "WaitingForDeposit"
}
],
"pagination": {
"total": 500,
"perPage": 10,
"totalPages": 50,
"page": 1
}
}

Transaction Fields

FieldDescription
quoteHashUnique identifier for the transaction
amountValue transferred to the user (excluding fees)
callFeeLP service fee
gasFeeGas fee collected from user
statusCurrent quote state

Pagination Fields

FieldDescription
totalTotal accepted transactions matching filters
perPageNumber of items per page
totalPagesTotal pages (Math.ceil(total / perPage))
pageCurrent page number (1-indexed)

Note: Only accepted quotes (retained quotes) are included. Quotes never accepted by the LP are excluded.


Quote State Reference

Pegin States

Waiting States:

  • PeginStateWaitingForDeposit - Quote accepted, waiting for user BTC deposit
  • PeginStateWaitingForDepositConfirmations - BTC deposit detected, waiting for confirmations

Completed States:

  • PeginStateCallForUserSucceeded - LP delivered RBTC to user
  • PeginStateRegisterPegInSucceeded - LP recovered funds via registerPegin
  • PeginStateRegisterPegInFailed - RegisterPegin attempted but failed

Failed/Expired States:

  • PeginStateTimeForDepositElapsed - User didn't deposit in time
  • PeginStateCallForUserFailed - LP failed to deliver RBTC

Pegout States

Waiting States:

  • PegoutStateWaitingForDeposit - Quote accepted, waiting for user RBTC deposit
  • PegoutStateWaitingForDepositConfirmations - RBTC deposit detected, waiting for confirmations

Completed States:

  • PegoutStateSendPegoutSucceeded - LP sent BTC to user
  • PegoutStateRefundPegOutSucceeded - LP recovered RBTC from LBC
  • PegoutStateBridgeTxSucceeded - Bridge rebalance transaction completed
  • PegoutStateBtcReleased - BTC released from bridge (final state)

Failed States:

  • PegoutStateTimeForDepositElapsed - User didn't deposit in time
  • PegoutStateSendPegoutFailed - LP failed to send BTC
  • PegoutStateRefundPegOutFailed - Refund attempt failed
  • PegoutStateBridgeTxFailed - Bridge transaction failed
Última actualización en por github-actions[bot]