Querying SILO

You can build your own queries using a GraphQL Explorer and enter your endpoint to limit the data to exactly what you need.

Each entity has a plural version and a singular version. When querying for a single record response (e.g. account), you will need to supply the id for the entity. When querying for a list of responses (e.g. accounts), you may add filters using the 'where' clause.

Below are some sample queries you can use to gather information from the SILO contracts.

Main Market

fragment rates on Market {
  rates {
    side
    rate
    token {
      id
    }
  }
}

query Markets {
  lendingProtocols(block: { number: 18642057 }) {
    totalValueLockedUSD
  }
  markets(
    first: 5
    orderBy: totalValueLockedUSD
    orderDirection: desc
    where: { inputToken_: { activeOracle_not: "null" } }
    block: { number: 18642057 }
  ) {
    id
    name
    isActive
    archived
    marketAssets {
      asset {
        id
        symbol
        name
        decimals
        lastPriceUSD
      }
      balance
    }
    inputToken {
      id
    }
    outputToken {
      id
    }
    ...rates
  }
}

Basic Market

query BasicMarkets {
  silos(first: 5) {
    id
    archived
    baseAsset {
      id
    }
    bridgeAsset {
      id
    }
    market {
      inputToken {
        id
        name
        symbol
        decimals
      }
      sToken {
        id
      }
      spToken {
        id
      }
      dToken {
        id
      }
    }
  }
}

Most at risk of liquidation - V3 ONLY

fragment positionFields on Position {
  marketAsset: market {
    inputToken {
      id
    }
  }
  snapshots(first: 1, orderBy: blockNumber, orderDirection: desc) {
    blockNumber
    hash
  }
}

query QueryPositions {
  siloPositions(
    first: 5
    skip: 0
    where: { dTokenBalance_gt: 0, silo_: { id_not_in: [""] } }
    orderBy: riskFactor
    orderDirection: desc
    block: { number_gte: 19112526 }
  ) {
    id
    account {
      id
    }
    silo {
      id
      baseAsset {
        id
      }
      bridgeAsset {
        id
      }
      marketAssets: market {
        inputToken {
          id
          symbol
          decimals
          lastPriceUSD
        }
        liquidationThreshold
      }
    }
    totalCollateralValue
    totalBorrowValue
    riskFactor
    riskScore
    collateralPositions: positions(where: { sTokenBalance_gt: 0 }) {
      sTokenBalance
      sToken {
        derivativeConversion
      }
      ...positionFields
    }
    collateralOnlyPositions: positions(where: { spTokenBalance_gt: 0 }) {
      spTokenBalance
      ...positionFields
    }
    debtPositions: positions(where: { dTokenBalance_gt: 0 }) {
      dTokenBalance
      dToken {
        derivativeConversion
      }
      ...positionFields
    }
  }
}