Repayment events are payments made by borrowers to repay their debts.

The <chain>.lending.repayments table contains repayment events from Aave v1, v2, v3 and Compound v2 and v3 and Morpho Blue protocols, consolidated into a single table for easy querying.

This table tracks all debt repayment activities across major lending protocols, providing comprehensive information about repayment amounts, tokens, participants, and transaction details.

Sample Query

Total repayments of all lending projects on Ethereum in the past 90 days.

select
    project, 
    sum(usd_amount) as usd 
from ethereum.lending.repayments
where block_timestamp  >= current_date - 90
group by all
order by usd desc

Total repayments by token of Aave on Ethereum in the past 90 days.

select
    project, 
    token_address,
    token_name,
    token_symbol,
    sum(usd_amount) as usd 
from ethereum.lending.repayments
where project = 'aave'
and block_timestamp  >= current_date - 90
group by all
order by usd desc

Table Columns

Unique Key: unique_id

ColumnData TypeDescription
projectVARCHARName of the lending project
protocolVARCHARUnderlying protocol that the lending protocol is utilising
lending_eventVARCHARType of lending event (always ‘repayments’ for this table)
event_nameVARCHARName of the event
market_addressVARCHARAddress of the lending market where the repayment occurred
borrower_addressVARCHARAddress of the original borrower of the debt
repayer_addressVARCHARAddress of the account repaying the debt (may be different from borrower)
token_addressVARCHARAddress of the token being repaid
token_nameVARCHARName of the token being repaid
token_symbolVARCHARSymbol of the token being repaid
token_decimalsINTEGERNumber of decimals of the token
raw_amount_strVARCHARRaw amount of tokens repaid, in string to retain precision
raw_amountFLOATRaw amount of tokens repaid
amount_strVARCHARNormalised amount of tokens repaid, in string to retain precision
amountFLOATNormalised amount of tokens repaid
usd_amountFLOATUSD value of the tokens repaid at the time of the transaction
usd_exchange_rateFLOATHourly USD exchange rate of the token
debt_token_addressVARCHARAddress of the debt token being repaid (if applicable for the protocol)
extra_fieldsVARIANTAdditional protocol-specific fields from the event
transaction_hashVARCHARTransaction hash of the repayment event
transaction_indexINTEGERIndex of the transaction in the block
transaction_from_addressVARCHARAddress of the sender of the repayment transaction
transaction_to_addressVARCHARAddress of the recipient of the repayment transaction
log_indexINTEGERIndex of the log in the transaction
topic0VARCHARTopic 0 of the event
block_numberINTEGERBlock number of the repayment event
block_timestampTIMESTAMP_NTZ(9)Timestamp of the block
block_hashVARCHARHash of the block
unique_idVARCHARUnique ID of the repayment event
_created_atTIMESTAMP_NTZ(9)Timestamp of when the event was created
_updated_atTIMESTAMP_NTZ(9)Timestamp of when the event was last updated