File tree Expand file tree Collapse file tree 4 files changed +60
-35
lines changed Expand file tree Collapse file tree 4 files changed +60
-35
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ const utils = require('../utils');
4
4
5
5
const { farmAbi, pairAbi } = require ( './abi' ) ;
6
6
const { vstFraxStaking } = require ( './vstFraxStaking' ) ;
7
- const { getERC4626Info } = require ( '../helpers /erc4626' ) ;
7
+ const { getERC4626Info } = require ( '../../helper /erc4626' ) ;
8
8
9
9
const FRAXSWAP_POOLS_URL = 'https://api.frax.finance/v2/fraxswap/pools' ;
10
10
const STAKING_URL = 'https://api.frax.finance/v1/pools' ;
Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ const sdk = require ( '@defillama/sdk' ) ;
2
+ const utils = require ( '../adaptors/utils' ) ;
3
+
4
+ const DAY = 24 * 3600 ;
5
+
6
+ async function getERC4626Info (
7
+ address ,
8
+ chain ,
9
+ timestamp = Math . floor ( Date . now ( ) / 1e3 ) ,
10
+ {
11
+ assetUnit = '100000000000000000' ,
12
+ totalAssetsAbi = 'uint:totalAssets' ,
13
+ convertToAssetsAbi = 'function convertToAssets(uint256 shares) external view returns (uint256)' ,
14
+ } = { }
15
+ ) {
16
+ const [ blockNow , blockYesterday ] = await Promise . all (
17
+ [ timestamp , timestamp - DAY ] . map ( ( time ) =>
18
+ utils
19
+ . getData ( `https://coins.llama.fi/block/${ chain } /${ time } ` )
20
+ . then ( ( r ) => r . height )
21
+ )
22
+ ) ;
23
+ const [ tvl , priceNow , priceYesterday ] = await Promise . all ( [
24
+ sdk . api . abi . call ( {
25
+ target : address ,
26
+ block : blockNow ,
27
+ abi : totalAssetsAbi ,
28
+ } ) ,
29
+ sdk . api . abi . call ( {
30
+ target : address ,
31
+ block : blockNow ,
32
+ abi : convertToAssetsAbi ,
33
+ params : [ assetUnit ] ,
34
+ } ) ,
35
+ sdk . api . abi . call ( {
36
+ target : address ,
37
+ block : blockYesterday ,
38
+ abi : convertToAssetsAbi ,
39
+ params : [ assetUnit ] ,
40
+ } ) ,
41
+ ] ) ;
42
+ const apy = ( priceNow . output / priceYesterday . output ) ** 365 * 100 - 100 ;
43
+ return {
44
+ pool : address ,
45
+ chain : utils . formatChain ( chain ) ,
46
+ tvl : tvl . output ,
47
+ apyBase : apy ,
48
+ } ;
49
+ }
50
+
51
+ module . exports = {
52
+ getERC4626Info,
53
+ } ;
Original file line number Diff line number Diff line change @@ -120,6 +120,12 @@ const excludeAdaptors = [
120
120
'agave' ,
121
121
'blueshift' ,
122
122
'index-coop' ,
123
+ 'gyroscope-protocol' ,
124
+ 'blue-planet' ,
125
+ 'archimedes-finance' ,
126
+ 'koi-finance-amm' ,
127
+ 'kagla-finance' ,
128
+ 'plenty' ,
123
129
] ;
124
130
125
131
const excludePools = [
You can’t perform that action at this time.
0 commit comments