Skip to main content

Fee Accruals

Query protocol fee accrual records. Fee accruals track protocol fees accumulated per epoch, including the sender and transaction details.

Query Structure​

query GetFeeAccruals($limit: Int!, $offset: Int) {
protocol_fee_accruals(
order_by: { created_at: desc }
limit: $limit
offset: $offset
) {
id
amount
epoch
sender_id
sender {
label
image
}
block_number
created_at
transaction_hash
}
protocol_fee_accruals_aggregate {
aggregate {
count
sum {
amount
}
}
}
}

Response Fields​

FieldTypeNullableDescription
idStringNoAccrual record ID
amountnumericNoFee amount accrued (wei)
epochnumericNoProtocol epoch number
sender_idStringNoAccount that generated the fee
block_numbernumericNoBlock number
created_attimestamptzNoAccrual timestamp
transaction_hashStringNoTransaction hash

Relationships​

FieldTypeDescription
senderaccountsAccount that generated the fee

Interactive Example​

Query

query GetRecentAccruals($limit: Int!) {
  protocol_fee_accruals(
    order_by: { created_at: desc }
    limit: $limit
  ) {
    id
    amount
    epoch
    sender {
      label
    }
    created_at
    transaction_hash
  }
  protocol_fee_accruals_aggregate {
    aggregate {
      count
      sum { amount }
    }
  }
}

Variables

Click "Run Query" to execute the GraphQL query and see results

Filtering​

By Epoch​

protocol_fee_accruals(where: {
epoch: { _eq: "1" }
})

By Date Range​

protocol_fee_accruals(where: {
created_at: {
_gte: "2024-01-01T00:00:00Z",
_lte: "2024-01-31T23:59:59Z"
}
})

By Sender​

protocol_fee_accruals(where: {
sender_id: { _eq: "0x..." }
})

Fee Accruals vs Fee Transfers​

protocol_fee_accrualsfee_transfers
TracksFee accumulation per epochIndividual fee transfer events
GranularityPer-epoch aggregationPer-transaction
Has epochYesNo
Has receiverNoYes (receiver_id)