Lending Table

The Lending Protocols Table in Increment aggregates data from various lending protocols, providing a unified view of lending activities across different protocols and chains. This table simplifies the analysis of lending data, allowing users to query and compare lending metrics across multiple protocols without the need to interact with each protocol's smart contracts individually. With the Lending Protocols Table, users can easily access and analyze lending data from a variety of sources.

Example Queries

Examine Deposit events per lending protocol on Ethereum over the last 30 days.

sql
SELECT 
      count(*) as Deposits
      , protocol_name as Protocol
      , date_trunc('day',signed_at) as Date 
FROM reports.lending
WHERE event = 'deposit'
  -- --other options include withdraw, borrow, flashloan, liquidation, repay
AND chain_name = 'eth_mainnet'
AND signed_at > now() - interval '30 day'  
GROUP BY Protocol, Date    

Table Columns

Column NameData TypeDescription
chain_namestringStores the chain name.
chain_idintegerEvery chain_name has a unique number that acts as a numerical identifier for that chain.
block_heightintegerStores the block height.
signed_atdatetimeStores the timestamp.
tx_hashstringEvery transaction on the blockchain has a transaction hash (tx_hash) that acts as a unique identifier for that transaction. The tx_hash column allows you to query specific information from a particular transaction.
protocol_namestringStores the name of the lending protocol that facilitated the event.
protocol_addressstringStores the contract address of the lending protocol that facilitated the event.
versionfloatLending protocols often have multiple version - e.g Aave V1, V2 and V3. The version column allows you to look at a specific version of the Lending protocol.
forkstringMany lending protocols are a fork of an already established protocol. The fork column allows you to see which lending protocol has been forked.
fork_versionstringSimilarly to the version column, fork_version gives you the version of the forked lending protocol. For example, most lending protocols in the space are a fork of Aave V2; therefore, fork = aave & fork_version = 2
eventstringStores the event taking place - e.g borrow, deposit, liquidation, 'repay' and 'withdraw'.
lp_token_namestringStores the name of the LP token issued by the lending protocol. LP tokens can be debt or interest bearing tokens.
lp_decimalsstringStores the number decimal of the LP token.
lp_ticker_symbolstringStores the ticker symbol of the LP token.
lp_token_addressstringStores the token address of the LP token.
lp_token_amount_unscaledstringStores the raw, on-chain amount of LP tokens involved in the event. Blockchains don't work with decimal numbers which is why they multiply values by 10^num_decimal to turn decimal numbers (price or token amount) into integers. For example, instead of a transaction's gas cost being 0.000000000000000001 ether, it's shown as 1 . Therefore, this field has all the raw token amounts that are multiplied by 10^num_decimal.
lp_token_amountstringStores the amount of LP token used in the event (e.g 1 aETH, 100 cUSDC, etc).
lp_token_pricestringStores the total USD amount of all the LP Token used in the event.
exchange_ratestringStores the exchange rate between the LP and underlying token.
exchange_rate_usdstringStores the USD price of the LP Token used in the event.
token_name_instringStores the name of the token going into the lending protocol (e.g the token getting deposited).
token_decimal_instringStores the number decimal of the token going into the lending protocol.
token_address_instringStores the address of the token going into the lending protocol.
token_ticker_instringStores the ticker symbol of the token going into the lending protocol.
token_amount_in_unscaledintegerStores the raw, on-chain amount of tokens going into the protocol. See the description for lp_token_amount_unscaled to learn more about unscaled amounts.
token_amount_inintegerStores the amount of tokens going into the lending protocol (e.g 1 ETH, 100 USDC, etc).
amount_in_usdfloatStores the total USD amount of all tokens going into the lending protocol.
token_name_outstringStores the name of the token going out of the lending protocol (e.g the token getting deposited).
token_decimal_outstringStores the number decimal of the token going out of the lending protocol.
token_address_outstringStores the address of the token going out of the lending protocol.
token_ticker_outstringStores the ticker symbol of the token going out of the lending protocol.
token_amount_out_unscaledintegerStores the raw, on-chain amount of tokens going out of the protocol. See the description for lp_token_amount_unscaled to learn more about unscaled amounts.
token_amount_outintegerStores the amount of tokens going out of the lending protocol (e.g 1 ETH, 100 USDC, etc).
amount_out_usdfloatStores the total USD amount of all tokens going out of the lending protocol.
borrow_rate_modestringStores the type of loan the user is taking out. Lending protocols enable you to take out a stable or variable loan. Only relevant to borrow events.
borrow_ratestringStores the interest rate of the loan. Only relevant to borrow events.
liquidatorstringStores the wallet address liquidating the loan. Only relevant to liquidation events.
userstringStores the wallet address of the user initiating the event.
gas_ethfloatStores the gas fee, denominated in ETH.
gas_usd_pricefloatStores the gas fee, denominated in USD.