Skip to content

Gt3 adaptor #1904

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Gt3 adaptor #1904

wants to merge 2 commits into from

Conversation

sokardys
Copy link

@sokardys sokardys commented Jun 6, 2025

Overview of Changes

This PR introduces a new adapter integration for GT3 Finance into the DeFiLlama Yield Server. The adapter fetches on-chain yield data from GT3's GraphQL API, processes it, and formats it into the standard DeFiLlama yield format.

Details

  • feat: Add helper utilities for GT3 Finance

    • Created helpers.js with functions for GraphQL requests, chain name resolution, TVL calculations, token extraction, pool validation, and pool URL generation.
    • Included a fetch fallback using superagent for environments where fetch is not available.
    • Added comprehensive error handling and pagination support for data fetching.
  • feat: Implement main adapter logic in index.js

    • Defined the apy function which fetches project configuration and pool stats, transforms them into DeFiLlama format, and filters/sorts valid pools.
    • Utilized the utilities from helpers.js for modularity and reusability.
    • Included logic to compute APY from APR and ensure pools with low TVL (< $10k) are excluded.
  • feat: Add GraphQL queries in queries.js

    • Added static query PROJECT_CONFIG_QUERY to fetch GT3’s full project config.
    • Added createPoolStatsQuery(offset, limit) to support paginated retrieval of pool stats.

Motivation

The integration of GT3 Finance enables DeFiLlama to track additional yield farming opportunities from a decentralized protocol on Polygon. This improves coverage and data accuracy for users interested in GT3's pools and APYs.

Impact

  • Adds new DeFi protocol coverage (GT3 Finance) to the Yield Server.
  • Supports yield data aggregation from the GT3 subgraph via paginated GraphQL queries.
  • Enhances the ecosystem by including a Polygon-native yield platform.

Testing

  • Verified that the adapter correctly fetches configuration and pool data from GT3's GraphQL API.
  • Validated transformation logic produces compliant DeFiLlama pool objects.
  • Confirmed fallback for fetch works as expected in non-browser environments.

Additional Notes

  • timetravel: false is set, as historical data isn't supported by the current GraphQL API.
  • Currently assumes GT3 is only deployed on Polygon; can be expanded if multichain support is introduced.

@llamatester
Copy link

The gt3 adapter exports pools:

Test Suites: 1 passed, 1 total
Tests: 46 passed, 46 total
Snapshots: 0 total
Time: 0.255 s
Ran all test suites.

Nb of pools: 6
 

Sample pools:
┌─────────┬──────────────────────────────────────────────────────┬───────────┬─────────┬────────┬────────────────────┬────────────────────┬────────────────────────────────────────────────────────────────────────────────────────────────┬───────────────────────────────────────────────────┬────────────┬──────────────────────────────────────────────────┐
│ (index) │ pool                                                 │ chain     │ project │ symbol │ tvlUsd             │ apyBase            │ underlyingTokens                                                                               │ url                                               │ poolMeta   │ rewardTokens                                     │
├─────────┼──────────────────────────────────────────────────────┼───────────┼─────────┼────────┼────────────────────┼────────────────────┼────────────────────────────────────────────────────────────────────────────────────────────────┼───────────────────────────────────────────────────┼────────────┼──────────────────────────────────────────────────┤
│ 0       │ '0xb4aea291c29ed30968fbe648e7bb0c2e7d6dbaa1-polygon' │ 'Polygon' │ 'gt3'   │ 'ΜLP'  │ 191910.4969309436  │ 16.514384903195566 │ [ '0x06737d16ad9c1e41aa44fee2a952b26723b20673', '0x1bfd67037b42cf73acf2047067bd4f2c47d9bfd6' ] │ 'https://dapp.gt3.finance/explore/pools/GT3-WBTC' │ 'GT3-WBTC' │ [ '0x06737d16ad9c1e41aa44fee2a952b26723b20673' ] │
│ 1       │ '0xb6b93617a3eedd8139f2657b1aa7e605b8741ef5-polygon' │ 'Polygon' │ 'gt3'   │ 'ΜLP'  │ 102754.36072891101 │ 21.737424925370764 │ [ '0x06737d16ad9c1e41aa44fee2a952b26723b20673', '0xc2132d05d31c914a87c6611c10748aeb04b58e8f' ] │ 'https://dapp.gt3.finance/explore/pools/GT3-USDT' │ 'GT3-USDT' │ [ '0x06737d16ad9c1e41aa44fee2a952b26723b20673' ] │
│ 2       │ '0x42328911027615c629f989e5fbaaad5e971a688b-polygon' │ 'Polygon' │ 'gt3'   │ 'LP'   │ 60801.74145641004  │ 74.00136086852042  │ [ '0x06737d16ad9c1e41aa44fee2a952b26723b20673', '0x11b37c9388420d79d48e8d531227f43c9bf1bbf1' ] │ 'https://dapp.gt3.finance/explore/pools/GT3-FIT'  │ 'GT3-FIT'  │ [ '0x06737d16ad9c1e41aa44fee2a952b26723b20673' ] │
│ 3       │ '0xba58179d96d259f43d505436fd6cf468a84c3b54-polygon' │ 'Polygon' │ 'gt3'   │ 'ΜLP'  │ 36058.029462705934 │ 76.03882313043692  │ [ '0x11b37c9388420d79d48e8d531227f43c9bf1bbf1', '0xc2132d05d31c914a87c6611c10748aeb04b58e8f' ] │ 'https://dapp.gt3.finance/explore/pools/FIT-USDT' │ 'FIT-USDT' │ [ '0x06737d16ad9c1e41aa44fee2a952b26723b20673' ] │
│ 4       │ '0x08e40f4af9524eaff2af305864fa9c69caa495c9-polygon' │ 'Polygon' │ 'gt3'   │ 'LP'   │ 25338.027528970175 │ 69.44658026375565  │ [ '0x06737d16ad9c1e41aa44fee2a952b26723b20673', '0x90a9e2772d6b53c92ccbeaba6c31a02c22eac111' ] │ 'https://dapp.gt3.finance/explore/pools/GT3-ZHT'  │ 'GT3-ZHT'  │ [ '0x06737d16ad9c1e41aa44fee2a952b26723b20673' ] │
│ 5       │ '0xdd56e3f79820ae6b0da50473c677bdf24ccccf20-polygon' │ 'Polygon' │ 'gt3'   │ 'ΜLP'  │ 23472.673744289285 │ 77.59395362849277  │ [ '0x90a9e2772d6b53c92ccbeaba6c31a02c22eac111', '0xc2132d05d31c914a87c6611c10748aeb04b58e8f' ] │ 'https://dapp.gt3.finance/explore/pools/ZHT-USDT' │ 'ZHT-USDT' │ [ '0x06737d16ad9c1e41aa44fee2a952b26723b20673' ] │
└─────────┴──────────────────────────────────────────────────────┴───────────┴─────────┴────────┴────────────────────┴────────────────────┴────────────────────────────────────────────────────────────────────────────────────────────────┴───────────────────────────────────────────────────┴────────────┴──────────────────────────────────────────────────┘

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants