USD and ETH exchange rates of all assets are pulled through Euler directly
All ratios have a fixed decimal precision of 1e27.
Entities
Asset
Contains information about all Euler markets, pulled from EulerGeneralView contract.
type Asset @entity {
"asset_address"
id: ID!
"Block hash at which asset was created"
blockHash: Bytes!
"Block number at which asset was created"
blockNumber: Int!
"Timestamp at which asset was created"
timestamp: Int!
"Block hash at which asset was last updated"
updatedBlockHash: Bytes!
"Block number at which asset was last updated"
updatedBlockNumber: Int!
"Timestamp at which asset was last updated"
updatedTimestamp: Int!
"Tx hash at which asset was created"
transactionHash: Bytes!
"Tx origin at which asset was created"
transactionOrigin: Bytes!
dTokenAddress: Bytes!
eTokenAddress: Bytes!
pTokenAddress: Bytes!
symbol: String!
name: String!
decimals: BigInt!
totalSupply: BigInt!
totalBalances: BigInt!
totalBalancesUsd: BigInt!
totalBalancesEth: BigInt!
totalBorrows: BigInt!
totalBorrowsUsd: BigInt!
totalBorrowsEth: BigInt!
reserveBalance: BigInt!
reserveBalanceEth: BigInt!
reserveBalanceUsd: BigInt!
reserveFee: BigInt!
borrowAPY: BigInt!
supplyAPY: BigInt!
twap: BigInt!
twapUsd: BigDecimal!
"Deprecated in favor of twapUsd. Do not use."
twapPrice: BigDecimal!
twapPeriod: BigInt!
currPrice: BigInt!
currPriceUsd: BigInt!
pricingType: Int!
pricingParameters: BigInt!
pricingForwarded: Bytes!
collateralValue: BigInt!
liabilityValue: BigInt!
numBorrows: BigInt!
borrowIsolated: Boolean!
poolSize: BigInt!
interestRate: BigInt!
interestAccumulator: BigInt!
config: AssetConfig
}
Sometimes, gouvernance will manually set asset configuration, it is displayed in the AssetConfig entity. If an asset has a null AssetConfig, it is safe to assume that it was never explicitly set and is isolated.
Every entity that has hourly, daily or monthly in its name can be queried by its ID. The documentation for those is located within each entity. Below lies the rules used to create the required timestamps.
Parameter
Value
start_of_hour_timestamp
unix timestamp at minute 0
start_of_day_timestamp
unix timestamp at hour 0, minute 0
start_of_month_timestamp
unix timestamp at first day of the month, hour 0, minute 0
Examples
Fetch the 5 biggest markets by total borrowed in USD
{
account(id: "0x0000000002732779240fe05873611dc4203dfb71") {
balanceChanges {
type
timestamp
amount
amountUsd
asset {
symbol
}
}
}
}
Get USD amount borrowed on February 10th 2022
First we need to create our ID using the parameters define in the Querying time based aggregates section. In this case, February 10th 2020 = 1644451200.
All transactions between February 1st 2022 and February 3rd 2022
{
balanceChanges(orderBy: timestamp, orderDirection: asc, where: {timestamp_gte: 1643673600, timestamp_lte: 1643932799}) {
timestamp
type
amount
amountUsd
account {
id
}
asset {
symbol
}
}
}
Querying time based aggregates
Every entity that has hourly, daily or monthly in its name can be queried by its ID. The documentation for those is located within each entity. Below lies the rules used to create the required timestamps.
Parameter
Value
start_of_hour_timestamp
unix timestamp at minute 0
start_of_day_timestamp
unix timestamp at hour 0, minute 0
start_of_month_timestamp
unix timestamp at first day of the month, hour 0, minute 0
Examples
Fetch the 5 biggest markets by total borrowed in USD
{
account(id: "0x0000000002732779240fe05873611dc4203dfb71") {
balanceChanges {
type
timestamp
amount
amountUsd
asset {
symbol
}
}
}
}
Get USD amount borrowed on February 10th 2022
First we need to create our ID using the parameters define in the Querying time based aggregates section. In this case, February 10th 2020 = 1644451200.