A subgraph for indexing and querying data from Olympus Protocol's Yield Repurchase Facility contracts across multiple versions.
The Yield Repurchase Facility (YRF) is a mechanism for managing yield generated by Olympus Protocol's reserves. This subgraph tracks events from across multiple contract versions: 1.0, 1.1, 1.2
For more information about the YRF contracts, see the YieldRepurchaseFacility implementation in the olympus-v3 repository.
- Version-aware processing: Separate handlers for different contract versions
- Token metadata: Automatic lookup of ERC20 token information (symbol, name, decimals)
- Decimal conversion: Human-readable decimal amounts alongside raw values
- Contract tracking: Version detection and reserve token mapping
- Event indexing: Complete coverage of NextYieldSet, RepoMarket, and Shutdown events
- Contract: Contract instances with version info and reserve token
- Token: ERC20 token metadata (DAI and other reserve tokens)
- NextYieldSet: Yield adjustment events with decimal conversion
- RepoMarket: Market creation events with bid amounts
- Shutdown: Contract shutdown events
All monetary amounts include both raw (BigInt
) and decimal-adjusted (BigDecimal
) fields:
nextYield
/nextYieldDecimal
bidAmount
/bidAmountDecimal
src/handlers/
├── v1_0-handlers.ts # Handles v1.0 contract events
└── v1_1-handlers.ts # Handles v1.1+ contract events
src/utils/
├── contract-lookup-v1_0.ts # v1.0 contract creation (uses dai())
├── contract-lookup-v1_1.ts # v1.1+ contract creation (uses VERSION() and reserve())
├── token-lookup.ts # ERC20 token metadata fetching
└── decimal-conversion.ts # BigInt to BigDecimal conversion
Version | Address | Reserve Token | Method |
---|---|---|---|
v1.0 | 0x30A967eB957E5B1eE053B75F1A57ea6bfb2e907E |
DAI | dai() |
v1.1 | 0xcaA3d3E653A626e2656d2E799564fE952D39d855 |
DAI | reserve() |
v1.2 | 0x271e35a8555a62F6bA76508E85dfD76D580B0692 |
DAI | reserve() |
- Node.js 16+
- Yarn
- Graph CLI
# Install dependencies
yarn
# Generate code from schema and ABIs
yarn codegen
# Build the subgraph
yarn build
# Run tests
yarn test
# Deploy to The Graph Studio
yarn deploy
# Deploy locally (requires local graph node)
yarn deploy-local
# Run linting and formatting
yarn lint
# Check code style
yarn lint:check
{
contracts {
id
address
version
majorVersion
minorVersion
reserveToken {
symbol
name
decimals
}
}
}
{
nextYieldSets(first: 10, orderBy: blockTimestamp, orderDirection: desc) {
id
contract {
version
}
nextYield
nextYieldDecimal
blockTimestamp
transactionHash
}
}
{
repoMarkets(where: { contract_: { majorVersion: 1, minorVersion_gte: 1 } }) {
id
marketId
bidAmount
bidAmountDecimal
contract {
version
}
}
}
- Fork the repository
- Create a feature branch
- Make your changes
- Run tests and linting
- Submit a pull request