DeFi & payments3 min read

Accrued Interest in DeFi Lending Positions

Model lending interest with protocol indexes, shares and observation blocks, rather than expecting every balance increase to appear as a transfer.

Editorial illustration accompanying accrued interest in defi lending positions.

Overview

When translating these concepts into an integration, keep the scope described by the wallet history api with the result. The examples in wallet transaction history and smart contract event logs show how the same distinction affects neighbouring data questions.

A lending balance can accrue through an index or share conversion instead of a stream of transfer events. Data integrations need to preserve the protocol’s accounting variables and the point at which they were observed.

Understand the balance representation

A protocol can store scaled principal and derive a current balance from an interest index. Supply-side and debt-side indexes may differ. A displayed rate is not necessarily a realised return for an arbitrary period. Inspect the version-specific accounting rather than compounding a headline annual rate over every historical interval.

Worked example: an index change

A simplified account holds one hundred scaled units. The relevant index changes from 1.00 to 1.02, so its derived balance changes from one hundred to 102. No ordinary wallet transfer is needed to explain the two-unit difference under this model. Preserve both scaled quantity and index when available.

Reproduce the observation

Record reserve identity, block, index precision and rounding rules. Test deposits or repayments within the reporting interval and a rate change mid-period. Keep protocol accrual separate from external token movements so reconciliation does not create fictional deposits. If only snapshots are available, label the difference as a snapshot-derived change rather than exact event-level interest.

A practical acceptance test

Keep scaled principal at one hundred and move its relevant index from 1.00 to 1.02. Assert a derived balance change without a fictional deposit. Insert a repayment between observations and check that the calculation does not attribute the entire closing difference to interest. Preserve index precision and the position changes used by the interpretation.

Questions about the topic

Frequently asked questions

Does interest always emit a wallet transfer?

No. It can be represented through index-based accounting.

Can one annual rate reconstruct every past balance?

Not reliably when rates, positions or protocol rules change.

Standards & technical documentation

Further reading

{{TODO: author name}}

Practical explanations of blockchain data, software integration and the context behind a record.

About Indexbase
← Back to all articles

Build with better context.

Get an update when private beta opens.

Form setup in progress. Nothing entered here is sent or saved. {{TODO: endpoint}} See the full form and email alternative.