DefiLlama / yield-server

140 stars 779 forks source link

Fix Fluid lending rates #1554

Closed bergben closed 1 day ago

bergben commented 1 day ago

Fixes calculation of Fluid lending rates and expands support for all fTokens on all active chains.

Makes use of our on-chain resolver contract, similarly to other DefiLlama repos: TVL and fees / revenue.

Sample test run: image

llamatester commented 1 day ago

Error while running fluid adapter:

Test Suites: 1 failed, 1 total Tests: 6 failed, 82 passed, 88 total Snapshots: 0 total Time: 0.333 s Ran all test suites.

Nb of pools: 14

Sample pools:
┌─────────┬─────────┬──────────────────────────────────────────────┬────────────────────┬──────────┬──────────────────────────────────────────────────┬────────────┬─────────┬───────────┐
│ (index) │ project │                     pool                     │       tvlUsd       │  symbol  │                 underlyingTokens                 │   chain    │ apyBase │ apyReward │
├─────────┼─────────┼──────────────────────────────────────────────┼────────────────────┼──────────┼──────────────────────────────────────────────────┼────────────┼─────────┼───────────┤
│    0    │ 'fluid' │ '0x5C20B550819128074FD538Edf79791733ccEdd18' │ 88070351.82809663  │  'USDT'  │ [ '0xdAC17F958D2ee523a2206206994597C13D831ec7' ] │ 'ethereum' │  4.25   │   2.77    │
│    1    │ 'fluid' │ '0x9Fb7b4477576Fe5B32be4C1843aFB1e55F251B33' │ 74662787.84653077  │  'USDC'  │ [ '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48' ] │ 'ethereum' │  5.48   │   3.27    │
│    2    │ 'fluid' │ '0x2411802D8BEA09be0aF8fD8D08314a63e706b29C' │ 14597960.073536754 │ 'wstETH' │ [ '0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0' ] │ 'ethereum' │  0.06   │     0     │
│    3    │ 'fluid' │ '0xf42f5795D9ac7e9D757dB633D693cD548Cfd9169' │ 8595597.322315866  │  'USDC'  │ [ '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913' ] │   'base'   │  1.75   │   7.09    │
│    4    │ 'fluid' │ '0x1A996cb54bb95462040408C06122D45D6Cdb6096' │  8072373.25896101  │  'USDC'  │ [ '0xaf88d065e77c8cC2239327C5EDb3A432268e5831' ] │ 'arbitrum' │  4.62   │   3.77    │
│    5    │ 'fluid' │ '0x4A03F37e7d3fC243e3f99341d36f4b829BEe5E03' │ 6076070.579608017  │  'USDT'  │ [ '0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9' ] │ 'arbitrum' │  2.38   │     5     │
│    6    │ 'fluid' │ '0x1943FA26360f038230442525Cf1B9125b5DCB401' │ 3740557.3866921673 │  'EURC'  │ [ '0x60a3E35Cc302bFA44Cb288Bc5a4F316Fdb1adb42' ] │   'base'   │  0.78   │   8.88    │
│    7    │ 'fluid' │ '0x90551c1795392094FE6D29B758EcCD233cFAa260' │ 2185986.6569596524 │  'WETH'  │ [ '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2' ] │ 'ethereum' │  2.23   │     0     │
│    8    │ 'fluid' │ '0x45Df0656F8aDf017590009d2f1898eeca4F0a205' │ 225315.37036120574 │  'WETH'  │ [ '0x82aF49447D8a07e3bd95BD0d56f35241523fBab1' ] │ 'arbitrum' │  1.54   │     0     │
│    9    │ 'fluid' │ '0x66C25Cd75EBdAA7E04816F643d8E46cecd3183c9' │ 66192.99633029044  │ 'wstETH' │ [ '0x5979D7b546E38E414F7E9822514be443A4800529' ] │ 'arbitrum' │  0.02   │     0     │
└─────────┴─────────┴──────────────────────────────────────────────┴────────────────────┴──────────┴──────────────────────────────────────────────────┴────────────┴─────────┴───────────┘
This adapter contains some pools with <10k TVL, these pools won't be shown in DefiLlama
}
llamatester commented 1 day ago

The fluid adapter exports pools:

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

Nb of pools: 14

Sample pools:
┌─────────┬─────────┬──────────────────────────────────────────────┬────────────────────┬──────────┬──────────────────────────────────────────────────┬──────────────────────────────────────────────────┬────────────┬─────────┬───────────┐
│ (index) │ project │                     pool                     │       tvlUsd       │  symbol  │                 underlyingTokens                 │                   rewardTokens                   │   chain    │ apyBase │ apyReward │
├─────────┼─────────┼──────────────────────────────────────────────┼────────────────────┼──────────┼──────────────────────────────────────────────────┼──────────────────────────────────────────────────┼────────────┼─────────┼───────────┤
│    0    │ 'fluid' │ '0x5C20B550819128074FD538Edf79791733ccEdd18' │ 87975579.65903842  │  'USDT'  │ [ '0xdAC17F958D2ee523a2206206994597C13D831ec7' ] │ [ '0xdAC17F958D2ee523a2206206994597C13D831ec7' ] │ 'ethereum' │  4.25   │   2.77    │
│    1    │ 'fluid' │ '0x9Fb7b4477576Fe5B32be4C1843aFB1e55F251B33' │ 74662864.93759415  │  'USDC'  │ [ '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48' ] │ [ '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48' ] │ 'ethereum' │  5.48   │   3.27    │
│    2    │ 'fluid' │ '0x2411802D8BEA09be0aF8fD8D08314a63e706b29C' │ 14597960.183692086 │ 'wstETH' │ [ '0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0' ] │ [ '0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0' ] │ 'ethereum' │  0.06   │     0     │
│    3    │ 'fluid' │ '0xf42f5795D9ac7e9D757dB633D693cD548Cfd9169' │ 8244906.154449876  │  'USDC'  │ [ '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913' ] │ [ '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913' ] │   'base'   │  1.91   │   7.39    │
│    4    │ 'fluid' │ '0x1A996cb54bb95462040408C06122D45D6Cdb6096' │ 8072381.168108256  │  'USDC'  │ [ '0xaf88d065e77c8cC2239327C5EDb3A432268e5831' ] │ [ '0xaf88d065e77c8cC2239327C5EDb3A432268e5831' ] │ 'arbitrum' │  4.62   │   3.77    │
│    5    │ 'fluid' │ '0x4A03F37e7d3fC243e3f99341d36f4b829BEe5E03' │ 6074798.522744262  │  'USDT'  │ [ '0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9' ] │ [ '0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9' ] │ 'arbitrum' │  2.38   │     5     │
│    6    │ 'fluid' │ '0x1943FA26360f038230442525Cf1B9125b5DCB401' │ 3740561.5805094345 │  'EURC'  │ [ '0x60a3E35Cc302bFA44Cb288Bc5a4F316Fdb1adb42' ] │ [ '0x60a3E35Cc302bFA44Cb288Bc5a4F316Fdb1adb42' ] │   'base'   │  0.78   │   8.88    │
│    7    │ 'fluid' │ '0x90551c1795392094FE6D29B758EcCD233cFAa260' │ 2189648.9804609776 │  'WETH'  │ [ '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2' ] │ [ '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2' ] │ 'ethereum' │  2.23   │     0     │
│    8    │ 'fluid' │ '0x45Df0656F8aDf017590009d2f1898eeca4F0a205' │ 225882.03072519877 │  'WETH'  │ [ '0x82aF49447D8a07e3bd95BD0d56f35241523fBab1' ] │ [ '0x82aF49447D8a07e3bd95BD0d56f35241523fBab1' ] │ 'arbitrum' │  1.54   │     0     │
│    9    │ 'fluid' │ '0x66C25Cd75EBdAA7E04816F643d8E46cecd3183c9' │ 66192.99653753698  │ 'wstETH' │ [ '0x5979D7b546E38E414F7E9822514be443A4800529' ] │ [ '0x5979D7b546E38E414F7E9822514be443A4800529' ] │ 'arbitrum' │  0.02   │     0     │
└─────────┴─────────┴──────────────────────────────────────────────┴────────────────────┴──────────┴──────────────────────────────────────────────────┴──────────────────────────────────────────────────┴────────────┴─────────┴───────────┘
This adapter contains some pools with <10k TVL, these pools won't be shown in DefiLlama