Skip to main content

transfers_for_token

Schema: lib

Description

The transfers_for_token function is used to retrieve data on token transfers within a specified time frame and for a specific token contract. It returns information on individual transfers, including the sender, recipient, amount transferred, etc..

Usage

Signature

lib.transfers_for_token(
token_contract text,
start_time timestamptz,
end_time timestamptz,
token_chain text
)

Parameters

NameTypeDescription
token_contracttextThe address of the token contract for which transfers will be retrieved.
start_timetimestamptzThe starting point for the data search. Only transfers that occurred at or after this time will be included.
end_timetimestamptzThe endpoint for the data search. Only transfers that occurred at or before this time will be included.
token_chaintext(Optional) The chain on which the token contract is located. If not specified, transfers from all chains will be included.

Results

NameTypeDescription
idtextThe unique identifier for the transfer.
chaintextThe chain on which the transfer occurred.
transaction_hashtextThe hash of the transaction in which the transfer occurred.
log_indexintegerThe index of the transfer within the transaction log.
consensus_timetimestamptzThe time at which the transfer was confirmed by the network.
contracttextThe address of the token contract.
aliased_contracttextThe alias of the token contract, if one exists. Otherwise, the contract address will be used.
entrypoint_contracttextThe address of the entrypoint contract, if applicable.
aliased_entrypoint_contracttextThe alias of the entrypoint contract, if one exists. Otherwise, the entrypoint contract address will be used.
sendertextThe address of the sender of the transfer.
aliased_sendertextThe alias of the sender, if one exists. Otherwise, the sender address will be used.
recipienttextThe address of the recipient of the transfer.
aliased_recipienttextThe alias of the recipient, if one exists. Otherwise, the recipient address will be used.
valnumericThe amount of tokens transferred.
decimaled_valnumericThe amount of tokens transferred, converted to the appropriate decimal value based on the token's metadata.

Examples

Retrieve the last day of transfers for the HOV token

The HOV token has address 0xce82db637a2d750380ef27063518eaa263fbe10e

select *
from lib.transfers_for_token(
'0xce82db637a2d750380ef27063518eaa263fbe10e', -- HOV token address
now() - '24 hours'::interval,
now()
);
Retrieve the last day of transfers for the HOV token from the Kava chain only

The HOV token has address 0xce82db637a2d750380ef27063518eaa263fbe10e

select *
from lib.transfers_for_token(
'0xce82db637a2d750380ef27063518eaa263fbe10e', -- HOV token address
now() - '24 hours'::interval,
now(),
'kava'
);