> ## Documentation Index
> Fetch the complete documentation index at: https://docs.codex.io/llms.txt
> Use this file to discover all available pages before exploring further.

# FeeLedger

> Every fee, tax, tip and rebate one swap paid, with who paid it and who received it. Present on Confirmed swap events on networks where the fee ledger is switched on. Null on older events, on Processed events, and on mints and burns. `totalFeesUsd` is the sum of `swapShareUsd` over entries where `inTotalFees` is true. It is what this swap added to its pair's `totalFees` when the swap was indexed. Codex keeps refining how it classifies fees and names recipients. A later swap of the same kind can therefore carry a different `kind`, recipient name or `inTotalFees` than an earlier one: for example, a transfer shown as `OTHER_TRANSFER` today can be shown as a fee for later swaps as Codex's classification improves. A swap that is already indexed keeps the ledger it was given. Its amounts, tokens and transaction do not change. A `POOL_FEE` entry is the venue's whole fee for the swap. `PROTOCOL_SHARE`, `CREATOR_SHARE` and `PARTNER_SHARE` entries are parts of that fee, paid out to named recipients or set aside for them: they are shown for attribution and are never added on top of it. What the venue or its liquidity providers kept is the pool fee less its shares. `inTotalFees` marks which of them `totalFeesUsd` counts, and `settlement` says whether each amount left the venue during the trade. Every USD value in the ledger is rounded to 12 decimal places.

## GraphQL

```
type FeeLedger {
  entries: [FeeLedgerEntry!]!
  transactionSwapCount: Int!
  gaps: [FeeLedgerGap!]!
  totalFeesUsd: String!
  feeToVolumeRatio: String
}

enum FeeKind {
  POOL_FEE
  PROTOCOL_SHARE
  CREATOR_SHARE
  PARTNER_SHARE
  BASE_FEE
  PRIORITY_FEE
  L1_DATA_FEE
  TIP
  APP_FEE
  ROUTER_FEE
  TOKEN_TAX
  REBATE
  OTHER_TRANSFER
}

enum FeeAmountSource {
  OBSERVED
  REPORTED
  ESTIMATED
  RECEIPT
  UNKNOWN
}

enum FeeScope {
  SWAP
  TRANSACTION
  UNKNOWN
}

enum FeeRecipientRole {
  CREATOR
  PROTOCOL
  REFERRER
  HOST
  BUYBACK
  REWARDS
}

enum FeeSettlement {
  PAID_OUT
  HELD_BY_VENUE
  ACCRUED
}

type FeeLedgerEntry {
  kind: FeeKind!
  token: String!
  amountRaw: String!
  amount: String
  tokenDecimals: Int
  amountSource: FeeAmountSource!
  rate: String
  scope: FeeScope!
  amountUsd: String
  swapShareUsd: String
  inTotalFees: Boolean!
  recipient: String
  payer: String
  recipientName: String
  recipientId: String
  recipientRole: FeeRecipientRole
  settlement: FeeSettlement
}

enum FeeLedgerGap {
  POOL_FEE_UNKNOWN
  REGISTRY_UNAVAILABLE
  GAS_UNKNOWN
  INTERNAL_TRANSFERS_UNSEEN
  ENTRIES_MERGED
  UNBALANCED_TRANSFERS
  TRADER_UNKNOWN
  UNDECODED_VALUE
  UNINDEXED_TRADE
  FEE_UNCONFIRMED
  FEE_UNPRICED
  NO_STATED_FEE
  UNREADABLE_ENTRY
}
```

### Used By

**Returned by**

* [getTokenEvents](https://docs.codex.io/api-reference/queries/gettokenevents.md): Returns transactions for a pair.
* [getTokenEventsForMaker](https://docs.codex.io/api-reference/queries/gettokeneventsformaker.md): Returns a list of token events for a given maker (wallet address).
* [onEventsCreated](https://docs.codex.io/api-reference/subscriptions/oneventscreated.md): Live-streamed transactions for a pair.
* [onEventsCreatedByMaker](https://docs.codex.io/api-reference/subscriptions/oneventscreatedbymaker.md): Live-streamed transactions for a maker.
* [onTokenEventsCreated](https://docs.codex.io/api-reference/subscriptions/ontokeneventscreated.md): Live-streamed events for a given token across all it's pools


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.