Skip to main content

DeFi accounting for positions and vaults

What it is

DeFi position and vault accounting is booking what a firm holds in DeFi protocols at period end: vault shares, lending deposits and debt, and rewards that have accrued but haven’t been claimed.

Asset managers and crypto banks do it at every close because these positions change value without any transfer in or out, so a wallet balance alone misstates them.

Goldsky decodes each protocol’s events into your warehouse and reads positions at the period-end block; your team sets the period, prices the positions and posts the journals.

Who it’s for

Asset managers, crypto funds and crypto-native banks that hold positions in DeFi vaults and lending markets, and the accounting teams that close their books.

How DeFi position accounting works at period end

The diagram follows one period close from the protocol activity that changes each position to the journal entries your accounting team posts, and shows who does each step. Your setup may differ.

Your business, step 3: Close the periodFinance sets the period-end block
Goldsky, step 2: TurboDecode protocol eventsVault, lending and reward events, in your warehouse
Blockchains, step 1: Positions changeDeposits, borrows and rewards across protocols
Your business, step 5: Calculate positions and PnLYour prices and cost-basis rules
Goldsky, step 4: EdgeRead positions at period endShares, debt and accrued rewards, by eth_call
Your business, step 6: Book the entriesYour accounting team posts journals
  • Goldsky

How to account for DeFi positions and vaults

A pipeline decodes deposits, withdrawals, borrows and reward events from the protocols you use into your warehouse. At period end, reads at the closing block return each position’s shares, debt and accrued rewards for your accounting rules.

What you’ll need

  • Goldsky Turbo
  • Goldsky Edge
  • The protocol contracts and ABIs for each position
  • A data warehouse
  • A pricing source for the tokens you hold
  • Your cost-basis and accounting policy
  • Your general ledger
  1. Move positions onchain

    Every deposit, withdrawal, borrow, repayment and reward claim changes what the firm holds in a protocol.

    Each change is recorded as an event in a block. Some value builds up with no event at all, such as interest on a loan or rewards not yet claimed, so events alone never tell the whole story.

  2. Decode every protocol event into your warehouse

    Handled by Goldsky Turbo

    Accountants need each position change as a readable row: what happened, how much and when.

    Decode each protocol’s events with its contract definition, from the day each position was opened. Missing history breaks cost basis, because the cost of a position depends on every deposit and withdrawal before the close.

    Goldsky’s Turbo Pipelines decodes each protocol’s raw logs with _gs_log_decode, and one decode can fan out into a table per event, such as deposits, borrows and reward claims, with history backfilled from start_at: earliest.

    Decode logs with an ABI (opens in a new tab)
  3. Close the period

    Everyone has to value the same moment, so finance fixes the cut-off before anything is read.

    Finance sets the period-end time and the block that matches it on each chain. If different positions are read at different blocks, the books describe a portfolio that never existed at any one time.

  4. Read positions at the period-end block

    Handled by Goldsky Edge

    Vault shares, debt with interest and unclaimed rewards only exist in each contract’s current state, not in its events.

    Call each contract for the firm’s shares, debt and accrued rewards as of the closing block. A read taken after the close includes interest and rewards that belong to the next period.

    Edge RPC responds to eth_call at the block you name, so a call to a vault’s share balance or a lending market’s debt function returns the figure as it stood at the close.

    Read state at a block (opens in a new tab)
  5. Calculate positions and PnL

    Shares and token amounts become numbers for the books only once each has a price and is compared with its cost.

    In your warehouse, convert shares to underlying tokens, price them, and work out gains, losses and income under your cost-basis rules. Totals and per-period sums are queries your team runs on the decoded rows, so the rules stay yours to change.

  6. Book the entries

    The close is done when the positions and income are in the general ledger.

    Your accounting team posts the journals and keeps the reads and calculations behind each one. An entry nobody can trace back to its block and price is hard to defend at audit.

What you control

Your team
  • Close the period
  • Calculate positions and PnL
  • Book the entries

Security and deployment

  • SOC 2 Type IIIndependently audited security controls.
  • Dedicated infrastructureSingle-tenant options for production workloads.
  • Data residencyCloud, on-premises or co-located.

Account for DeFi positions and vaults with Goldsky

We’ll map it to your systems and show you what Goldsky runs, so your team builds the product, not the pipelines underneath it.

© Endless Sky Inc. All rights reserved.

PrivacyTermsSecurity

System status