LogoLogo
AddressesAuditsGitHub
  • 📥Introduction
  • 🌀Products
    • Introduction
    • Best Yield
      • Overview
      • Guides
        • Deposit funds on BY
        • Redeem funds on BY
      • FAQs
    • Yield Tranches
      • Overview
      • Adaptive Yield Split
      • Security
        • Covered risks
      • Guides
        • Deposit funds on YTs
        • Redeem funds on YTs
        • Live YTs guides
          • Lido stETH
      • FAQs
    • Fee structure
    • Get involved
      • Integrators program
      • Institutions program
  • 💻Developers
    • Introduction
    • Networks and codebase
      • Ethereum mainnet
      • Polygon
      • Kovan testnet
      • ERC-4626 standard
    • Best Yield
      • Architecture
      • Deployed contracts
        • Ethereum
        • Optimism
      • Interface
      • Methods
        • mintIdleToken
        • redeemIdleToken
        • redeemInterestBearingTokens
        • rebalance
        • tokenPrice
        • tokenPriceWithFee
        • getAPRs
        • getAvgApr
        • userAvgPrices
        • getGovTokensAmounts
        • getAllocations
        • getGovTokens
        • getAllAvailableTokens
        • getProtocolTokenToGov
      • Edge cases
      • Security management policy
      • Get integrated as yield source
      • Get user earnings
    • Yield Tranches
      • Architecture
      • Deployed contracts
        • Ethereum
        • Polygon zkEVM
        • Optimism
      • Interface
      • Methods
        • AAStaking
        • BBStaking
        • AATranche
        • BBTranche
        • depositAA
        • depositAARef
        • depositBB
        • depositBBRef
        • fee
        • getApr
        • getContractValue
        • getCurrentAARatio
        • getIncentiveTokens
        • lastNAVAA
        • lastNAVBB
        • strategy
        • strategyToken
        • token
        • trancheAPRSplitRatio
        • tranchePrice
        • virtualPrice
        • withdrawAA
        • withdrawBB
      • Integration example
      • Edge cases
      • Security management policy
      • Subgraph
    • API
    • Security
      • Hats Finance vault
      • Hypernative monitoring
      • Immunefi bug bounty
      • Integration Standard Requirements
      • Risk Framework
      • Smart contract audits
  • 🏛️Governance
    • Introduction
    • Idle DAO
      • Governance process
        • Governance forum
        • Governance dashboard
        • Snapshot IDLE
        • Snapshot stkIDLE
      • Idle Leagues
        • Communication League
        • Development League
        • Treasury League
        • Leagues contributors
      • Treasury
        • Reports
      • Governance guides
        • How to monitor off-chain voting pools
        • How to propose an IIP
        • How to create an on-chain proposal
        • How to delegate votes
        • How to vote for an IIP
      • FAQs
    • IDLE token
      • Distribution
      • Use cases
        • Lending, borrowing & collateral
        • DEXs liquidity provision
      • Buybacks
      • Delegates
      • CoinGecko
    • IDLE staking
      • Prime staking
        • Examples
      • Staking integration
      • Guides
        • How to stake your IDLE
        • How to vote in Gauges
        • How to boost your $IDLE rewards
        • How to give VEV
  • 🗂️Other
    • Brand assets
    • Guides
      • How to see IDLE in your wallet
      • Deposit funds through Idle
      • Deposit funds through smart contracts
      • Redeem funds through Idle
      • Redeem funds through smart contracts
    • FAQs
    • Glossary
    • Resources
    • Archive
      • 👇Get in touch
        • 🏛️Governance Forum
        • 🏆Idle Grants Program
        • 👾Discord
        • 🐦Twitter
      • Gauges
        • Architecture
        • Deployed contracts
        • Gauges repository
        • stkIDLE repository
      • Gauges
        • Gauges integration
        • FAQs
      • Boost
      • DEXs liquidity provison
      • Risk Adjusted (deprecated)
      • Deployed contracts
      • Idle Smart Treasury (deprecated)
      • Ethereum LP staking (deprecated)
      • Polygon LP staking (deprecated)
      • Flash Loans (deprecated)
      • QuickSwap cxETH-WETH
      • Integrate PYTs
      • Idle Grants program
      • Idle on Polygon
        • Add Polygon network to MetaMask
        • Bridge $IDLE to Polygon
        • Deposit funds on Polygon
        • Add liquidity to $IDLE pools
        • Stake IDLE LP tokens on Polygon
Powered by GitBook

Ecosystem

  • Website
  • App
  • Governance
  • Brand assets

Developers

  • Feedback
  • GitHub
  • Bug bounty
  • Audits

Community

  • Blog
  • Twitter
  • Telegram
  • Discord

Analytics

  • Stats
  • Dune
  • DeFiLlama
  • CoinGecko
On this page
  • Useful entities
  • Querying YTs

Was this helpful?

  1. Developers
  2. Yield Tranches

Subgraph

Developers > Yield Tranches > Subgraph

Last updated 12 months ago

Was this helpful?

Idle uses a for indexing and organizing data from the Yield Tranches IdleCDO smart contract. This subgraph can be found on The Graph hosted service and can be used to query Idle YTs data:

  • YTs subgraph

  • Graphql endpoint

    • Ethereum

    • Polygon zkEVM

    • Optimism

  • Code

Useful entities

  • TrancheInfos: contains the data of each YTs tranche (type, apr, virtualPrice, totalSupply) updated every hour

  • Tranche: all deployed YTs tranches (id, type)

Querying YTs

Subgraph is case-sensitive. Remember to use all lowercase when inputting tranches' addresses.

Example 1

To obtain the latest TrancheInfos you can use the following query

{ 
    trancheInfos(orderBy:"timeStamp", orderDirection:"desc") { 
        id
        apr
        Tranche { 
            id 
        }
        timeStamp
        blockNumber
        totalSupply
        virtualPrice
    }
}

Example 2

To obtain the latest TrancheInfos for a specific tranche add a where filter. Let's query for example the Clearpool Portofino DAI Senior tranche 0xfc96989b3df087c96c806318436b16e44c697102

{ 
    trancheInfos(orderBy:"timeStamp", orderDirection:"desc", 
                 where:{ Tranche:"0xfc96989b3df087c96c806318436b16e44c697102" }) { 
        id
        apr
        Tranche { 
            id 
            CDO {
              id
            }
        }
        timeStamp
        blockNumber
        totalSupply
        virtualPrice
    }
}

For more info about GraphQL API, check .

💻
TheGraph Documentation
subgraph
https://thegraph.com/hosted-service/subgraph/samster91/idle-tranches
https://api.thegraph.com/subgraphs/name/samster91/idle-tranches
https://api.studio.thegraph.com/query/12583/idle-tranches-zkevm/version/latest
https://api.thegraph.com/subgraphs/name/samster91/idle-tranches-optimism
https://github.com/Idle-Labs/idle-tranches-subgraph