Skip to content
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

Add Size Credit #1675

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

Add Size Credit #1675

wants to merge 4 commits into from

Conversation

aviggiano
Copy link

@aviggiano aviggiano commented Jan 2, 2025

  • Create Pool.d.ts typescript type definition file that can be reused by different projects and avoid code duplication.
  • Add @SizeCredit yield information

@aviggiano aviggiano changed the title Add types directory with Pool interface Add Size Credit Jan 3, 2025
@llamatester
Copy link

The aave-v3 adapter exports pools:

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

Nb of pools: 127
 

Sample pools:
┌─────────┬───────────────────────────────────────────────────────┬────────────┬───────────┬──────────┬────────────────────┬─────────────────────────┬──────────────────────────────────────────────────┬────────────────────┬──────────────────────┬────────────────┬──────────────────────┬────────┬─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┬────────────┬────────────┬───────────────┐
│ (index) │ pool                                                  │ chain      │ project   │ symbol   │ tvlUsd             │ apyBase                 │ underlyingTokens                                 │ totalSupplyUsd     │ totalBorrowUsd       │ debtCeilingUsd │ apyBaseBorrow        │ ltv    │ url                                                                                                                             │ borrowable │ mintedCoin │ poolMeta      │
├─────────┼───────────────────────────────────────────────────────┼────────────┼───────────┼──────────┼────────────────────┼─────────────────────────┼──────────────────────────────────────────────────┼────────────────────┼──────────────────────┼────────────────┼──────────────────────┼────────┼─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼────────────┼────────────┼───────────────┤
│ 0       │ '0xbdfa7b7893081b35fb54027489e2bc7a38275129-ethereum' │ 'ethereum' │ 'aave-v3' │ 'weETH'  │ 4477735164.263067  │ 0.003293877724679768    │ [ '0xCd5fE23C85820F7B72D0926FC9b05b43E359b7ee' ] │ 4501714602.357532  │ 23979438.094464302   │ null           │ 1.1242918124624306   │ 0.775  │ 'https://app.aave.com/reserve-overview/?underlyingAsset=0xcd5fe23c85820f7b72d0926fc9b05b43e359b7ee&marketName=proto_mainnet_v3' │ true       │ null       │ null          │
│ 1       │ '0x5ee5bf7ae06d1be5997a1a72006fe6c607ec6de8-ethereum' │ 'ethereum' │ 'aave-v3' │ 'WBTC'   │ 3262041074.609994  │ 0.015883867842519956    │ [ '0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599' ] │ 3544574138.068059  │ 282533063.45806503   │ null           │ 0.3985457043115626   │ 0.73   │ 'https://app.aave.com/reserve-overview/?underlyingAsset=0x2260fac5e5542a773aa44fbcfedf7c193bc2c599&marketName=proto_mainnet_v3' │ true       │ null       │ null          │
│ 2       │ '0x0b925ed163218f6662a35e0f0371ac234f9e9371-ethereum' │ 'ethereum' │ 'aave-v3' │ 'wstETH' │ 3082424736.69757   │ 0.14946167764309784     │ [ '0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0' ] │ 4212006954.03624   │ 1129582217.3386703   │ null           │ 0.5866474058439609   │ 0.785  │ 'https://app.aave.com/reserve-overview/?underlyingAsset=0x7f39c581f595b53c5cb19bd0b3f8da6c935e2ca0&marketName=proto_mainnet_v3' │ true       │ null       │ null          │
│ 3       │ '0x2d62109243b87c4ba3ee7ba1d91b0dd0a074d7b1-ethereum' │ 'ethereum' │ 'aave-v3' │ 'rsETH'  │ 1244427817.4635067 │ 0.000008386965552866598 │ [ '0xA1290d69c65A6Fe4DF752f95823fae25cB99e5A7' ] │ 1245419712.730426  │ 991895.2669193745    │ null           │ 0.012388985079266609 │ 0.72   │ 'https://app.aave.com/reserve-overview/?underlyingAsset=0xa1290d69c65a6fe4df752f95823fae25cb99e5a7&marketName=proto_mainnet_v3' │ true       │ null       │ null          │
│ 4       │ '0x4579a27af00a62c0eb156349f31b345c08386419-ethereum' │ 'ethereum' │ 'aave-v3' │ 'sUSDe'  │ 1115276776.806814  │ 0                       │ [ '0x9D39A5DE30e57443BfF2A8307A4256c8797A3497' ] │ 1115276776.7646372 │ -0.04217672348022461 │ null           │ 0                    │ 0.72   │ 'https://app.aave.com/reserve-overview/?underlyingAsset=0x9d39a5de30e57443bff2a8307a4256c8797a3497&marketName=proto_mainnet_v3' │ false      │ null       │ null          │
│ 5       │ '0x4d5f47fa6a74757f35c14fd3a6ef8e3c9bc514e8-ethereum' │ 'ethereum' │ 'aave-v3' │ 'WETH'   │ 892667385.733092   │ 1.8744994854726322      │ [ '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2' ] │ 6258917691.696478  │ 5366250305.963386    │ null           │ 2.5721354040878626   │ 0.805  │ 'https://app.aave.com/reserve-overview/?underlyingAsset=0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2&marketName=proto_mainnet_v3' │ true       │ null       │ null          │
│ 6       │ '0x23878914efe38d27c4d67ab83ed1b93a74d4086a-ethereum' │ 'ethereum' │ 'aave-v3' │ 'USDT'   │ 625834764.7836063  │ 7.861011314795961       │ [ '0xdAC17F958D2ee523a2206206994597C13D831ec7' ] │ 3157225657.1524687 │ 2531390892.368862    │ null           │ 10.893791246548144   │ 0.75   │ 'https://app.aave.com/reserve-overview/?underlyingAsset=0xdac17f958d2ee523a2206206994597c13d831ec7&marketName=proto_mainnet_v3' │ true       │ null       │ null          │
│ 7       │ '0x74e5664394998f13b07af42446380acef637969f-lido'     │ 'ethereum' │ 'aave-v3' │ 'ezETH'  │ 494864446.91256696 │ 0                       │ [ '0xbf5495Efe5DB9ce00f80364C8B423567e58d2110' ] │ 494864446.91256696 │ 0                    │ null           │ 0                    │ 0.0005 │ 'https://app.aave.com/reserve-overview/?underlyingAsset=0xbf5495efe5db9ce00f80364c8b423567e58d2110&marketName=proto_lido_v3'    │ false      │ null       │ 'lido-market' │
│ 8       │ '0xc035a7cf15375ce2706766804551791ad035e0c2-lido'     │ 'ethereum' │ 'aave-v3' │ 'wstETH' │ 414965890.381468   │ 0.43393395591606015     │ [ '0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0' ] │ 805252659.0111089  │ 390286768.6296409    │ null           │ 0.9424271407475843   │ 0.8    │ 'https://app.aave.com/reserve-overview/?underlyingAsset=0x7f39c581f595b53c5cb19bd0b3f8da6c935e2ca0&marketName=proto_lido_v3'    │ true       │ null       │ 'lido-market' │
│ 9       │ '0x5c647ce0ae10658ec44fa4e11a51c96e94efd1dd-ethereum' │ 'ethereum' │ 'aave-v3' │ 'cbBTC'  │ 409799892.08248776 │ 0.015072692506257207    │ [ '0xcbB7C0000aB88B473b1f5aFd9ef808440eed33Bf' ] │ 429576975.8429662  │ 19777083.760478437   │ null           │ 0.40923631459174736  │ 0.73   │ 'https://app.aave.com/reserve-overview/?underlyingAsset=0xcbb7c0000ab88b473b1f5afd9ef808440eed33bf&marketName=proto_mainnet_v3' │ true       │ null       │ null          │
└─────────┴───────────────────────────────────────────────────────┴────────────┴───────────┴──────────┴────────────────────┴─────────────────────────┴──────────────────────────────────────────────────┴────────────────────┴──────────────────────┴────────────────┴──────────────────────┴────────┴─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┴────────────┴────────────┴───────────────┘
This adapter contains some pools with <10k TVL, these pools won't be shown in DefiLlama

@slasher125
Copy link
Collaborator

gm @aviggiano
pls remove the export from aave-v3 and just copy paste that provider object, otherwise i can't see the test output here from your adapter

@aviggiano
Copy link
Author

@slasher125 I think the tests don't work for typescript adapters. Do you have any recommendations?

@slasher125
Copy link
Collaborator

@slasher125 I think the tests don't work for typescript adapters. Do you have any recommendations?

we have other typescript adapters for which the tests work fine, best to resolve this locally, u can test with run test --adapter=size-credit

@llamatester
Copy link

The size-credit adapter exports pools:

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

Nb of pools: 5
 

Sample pools:
┌─────────┬───────────────────────────────────────────────────────┬────────────┬───────────────┬────────┬────────────────────┬───────────────────┬───────────┬──────────────────────────────────────────────────┬──────────────┬────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┬────────────────────┬─────────────────┬────────────────────┬────────────────┬───────────────────┐
│ (index) │ pool                                                  │ chain      │ project       │ symbol │ tvlUsd             │ apyBase           │ apyReward │ underlyingTokens                                 │ rewardTokens │ url                                                                                                                    │ apyBaseBorrow      │ apyRewardBorrow │ totalSupplyUsd     │ totalBorrowUsd │ ltv               │
├─────────┼───────────────────────────────────────────────────────┼────────────┼───────────────┼────────┼────────────────────┼───────────────────┼───────────┼──────────────────────────────────────────────────┼──────────────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼────────────────────┼─────────────────┼────────────────────┼────────────────┼───────────────────┤
│ 0       │ 'base-0xC2a429681CAd7C1ce36442fbf7A4a68B11eFF940'     │ 'Base'     │ 'size-credit' │ 'USDC' │ 333075.7195849196  │ 4.838461538461538 │ 0         │ [ '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913' ] │ []           │ 'https://app.size.credit/borrow?action=market&type=lend&market_id=base-0xC2a429681CAd7C1ce36442fbf7A4a68B11eFF940'     │ 3.0565517241379316 │ 0               │ 285597.50806716946 │ undefined      │ 83.33333333333333 │
│ 1       │ 'base-0xB21Bbe052F5cE9ae681c59725f0A313765Fd016c'     │ 'Base'     │ 'size-credit' │ 'USDC' │ 310557.67185057513 │ 4.733333333333333 │ 0         │ [ '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913' ] │ []           │ 'https://app.size.credit/borrow?action=market&type=lend&market_id=base-0xB21Bbe052F5cE9ae681c59725f0A313765Fd016c'     │ 5                  │ 0               │ 285597.50806716946 │ undefined      │ 83.33333333333333 │
│ 2       │ 'base-0x0728522FBe416B9dBB0c12E9e84870AA8E17Ad11'     │ 'Base'     │ 'size-credit' │ 'USDC' │ 287046.046190041   │ 8.230264410078789 │ 0         │ [ '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913' ] │ []           │ 'https://app.size.credit/borrow?action=market&type=lend&market_id=base-0x0728522FBe416B9dBB0c12E9e84870AA8E17Ad11'     │ 5.033333333333333  │ 0               │ 285597.50808116834 │ undefined      │ 83.33333333333333 │
│ 3       │ 'base-0x2a7168C467f97A4C56958b0DDE1144E450a60a36'     │ 'Base'     │ 'size-credit' │ 'USDC' │ 85613.22124883784  │ 8.230264410078789 │ 0         │ [ '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913' ] │ []           │ 'https://app.size.credit/borrow?action=market&type=lend&market_id=base-0x2a7168C467f97A4C56958b0DDE1144E450a60a36'     │ 8.666666666666668  │ 0               │ 76441.84713557725  │ undefined      │ 66.66666666666667 │
│ 4       │ 'ethereum-0x65767ab18A2854895D5287Ac689A18B54A17DFb1' │ 'Ethereum' │ 'size-credit' │ 'USDC' │ 0                  │ 8.340415119160406 │ 0         │ [ '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48' ] │ []           │ 'https://app.size.credit/borrow?action=market&type=lend&market_id=ethereum-0x65767ab18A2854895D5287Ac689A18B54A17DFb1' │ undefined          │ 0               │ 0                  │ undefined      │ 90.9090909090909  │
└─────────┴───────────────────────────────────────────────────────┴────────────┴───────────────┴────────┴────────────────────┴───────────────────┴───────────┴──────────────────────────────────────────────────┴──────────────┴────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┴────────────────────┴─────────────────┴────────────────────┴────────────────┴───────────────────┘
This adapter contains some pools with <10k TVL, these pools won't be shown in DefiLlama

@aviggiano
Copy link
Author

Fixed

@slasher125
Copy link
Collaborator

a few things:

  • ltv should be scaled to be btw 0-1
  • lets remove fields with any hardcoded 0, empty values (eg apyRewardBorrow, rewardsTokens etc)
  • the current adapter assumes which maturity date? best to add that to poolMeta
  • for lending protocols we use tvlUsd = available borrow liquidity
  • totalBorrowUsd is undefined?
  • totalSupplyUsd < tvlUsd ?

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.

3 participants