@stake-dao/reader 0.2.17 → 0.2.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/dist/esm/abis/angleVaultsMulticall.js +85 -0
  2. package/dist/esm/abis/angleVaultsMulticall.js.map +1 -0
  3. package/dist/esm/abis/lockersMulticall.js +296 -0
  4. package/dist/esm/abis/lockersMulticall.js.map +1 -0
  5. package/dist/esm/abis/pendleVaultsMulticall.js +105 -0
  6. package/dist/esm/abis/pendleVaultsMulticall.js.map +1 -0
  7. package/dist/esm/abis/yearnVaultsMulticall.js +109 -0
  8. package/dist/esm/abis/yearnVaultsMulticall.js.map +1 -0
  9. package/dist/esm/lockers/fetch/index.js +1 -1
  10. package/dist/esm/lockers/fetch/index.js.map +1 -1
  11. package/dist/esm/strategies/angle/fetch.js +1 -1
  12. package/dist/esm/strategies/angle/fetch.js.map +1 -1
  13. package/dist/esm/strategies/curve/fetch/getStratsWithApr.js +9 -4
  14. package/dist/esm/strategies/curve/fetch/getStratsWithApr.js.map +1 -1
  15. package/dist/esm/strategies/curve/fetch/nameSuffixes.js +6 -0
  16. package/dist/esm/strategies/curve/fetch/nameSuffixes.js.map +1 -0
  17. package/dist/esm/strategies/pendle/fetch.js +1 -1
  18. package/dist/esm/strategies/pendle/fetch.js.map +1 -1
  19. package/dist/esm/strategies/yearn/fetch/fetchAllYearnGauges.js +1 -1
  20. package/dist/esm/strategies/yearn/fetch/fetchAllYearnGauges.js.map +1 -1
  21. package/dist/esm/strategies/yearn/fetch/index.js +1 -1
  22. package/dist/esm/strategies/yearn/fetch/index.js.map +1 -1
  23. package/dist/esm/tsconfig.build.tsbuildinfo +1 -1
  24. package/dist/types/abis/angleVaultsMulticall.d.ts +42 -0
  25. package/dist/types/abis/angleVaultsMulticall.d.ts.map +1 -0
  26. package/dist/types/abis/lockersMulticall.d.ts +52 -0
  27. package/dist/types/abis/lockersMulticall.d.ts.map +1 -0
  28. package/dist/types/abis/pendleVaultsMulticall.d.ts +31 -0
  29. package/dist/types/abis/pendleVaultsMulticall.d.ts.map +1 -0
  30. package/dist/types/abis/yearnVaultsMulticall.d.ts +46 -0
  31. package/dist/types/abis/yearnVaultsMulticall.d.ts.map +1 -0
  32. package/dist/types/strategies/curve/fetch/getStratsWithApr.d.ts.map +1 -1
  33. package/dist/types/strategies/curve/fetch/nameSuffixes.d.ts +5 -0
  34. package/dist/types/strategies/curve/fetch/nameSuffixes.d.ts.map +1 -0
  35. package/dist/types/strategies/pendle/fetch.d.ts.map +1 -1
  36. package/package.json +1 -1
  37. package/src/abis/angleVaultsMulticall.ts +85 -0
  38. package/src/abis/lockersMulticall.ts +296 -0
  39. package/src/abis/pendleVaultsMulticall.ts +105 -0
  40. package/src/abis/yearnVaultsMulticall.ts +109 -0
  41. package/src/lockers/fetch/index.ts +1 -1
  42. package/src/strategies/angle/fetch.ts +1 -1
  43. package/src/strategies/curve/fetch/getStratsWithApr.ts +10 -4
  44. package/src/strategies/curve/fetch/nameSuffixes.ts +6 -0
  45. package/src/strategies/pendle/fetch.ts +1 -1
  46. package/src/strategies/yearn/fetch/fetchAllYearnGauges.ts +1 -1
  47. package/src/strategies/yearn/fetch/index.ts +1 -1
  48. package/dist/esm/abis/MulticallAngleVaults.json +0 -83
  49. package/dist/esm/lockers/abis/MulticallLockers.json +0 -591
  50. package/dist/esm/strategies/pendle/abis/MulticallPendleStratsAbi.json +0 -103
  51. package/dist/esm/strategies/utils/abis/MulticallYearnStratsAbi.json +0 -107
@@ -0,0 +1,105 @@
1
+ const pendleVaultsMulticall = [
2
+ {
3
+ inputs: [{ internalType: 'address', name: 'account', type: 'address' }],
4
+ name: 'balanceOf',
5
+ outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],
6
+ payable: false,
7
+ stateMutability: 'view',
8
+ type: 'function',
9
+ },
10
+ {
11
+ inputs: [],
12
+ name: 'totalSupply',
13
+ outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],
14
+ payable: false,
15
+ stateMutability: 'view',
16
+ type: 'function',
17
+ },
18
+ {
19
+ inputs: [],
20
+ name: 'veSdtFeeFee',
21
+ outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],
22
+ payable: false,
23
+ stateMutability: 'view',
24
+ type: 'function',
25
+ },
26
+ {
27
+ inputs: [],
28
+ name: 'daoFee',
29
+ outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],
30
+ payable: false,
31
+ stateMutability: 'view',
32
+ type: 'function',
33
+ },
34
+ {
35
+ inputs: [],
36
+ name: 'accFee',
37
+ outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],
38
+ payable: false,
39
+ stateMutability: 'view',
40
+ type: 'function',
41
+ },
42
+ {
43
+ inputs: [],
44
+ name: 'claimerFee',
45
+ outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],
46
+ payable: false,
47
+ stateMutability: 'view',
48
+ type: 'function',
49
+ },
50
+ {
51
+ inputs: [{ internalType: 'address', name: 'account', type: 'address' }],
52
+ name: 'activeBalance',
53
+ outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],
54
+ payable: false,
55
+ stateMutability: 'view',
56
+ type: 'function',
57
+ },
58
+ {
59
+ inputs: [],
60
+ name: 'working_supply',
61
+ outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],
62
+ payable: false,
63
+ stateMutability: 'view',
64
+ type: 'function',
65
+ },
66
+ {
67
+ inputs: [{ internalType: 'address', name: 'account', type: 'address' }],
68
+ name: 'redeemRewards',
69
+ outputs: [{ internalType: 'uint256[]', name: '', type: 'uint256[]' }],
70
+ payable: false,
71
+ stateMutability: 'view',
72
+ type: 'function',
73
+ },
74
+ {
75
+ stateMutability: 'view',
76
+ type: 'function',
77
+ name: 'gauge_relative_weight',
78
+ inputs: [{ name: 'addr', type: 'address' }],
79
+ outputs: [{ name: '', type: 'uint256' }],
80
+ },
81
+ {
82
+ stateMutability: 'view',
83
+ type: 'function',
84
+ name: 'get_gauge_weight',
85
+ inputs: [{ name: 'addr', type: 'address' }],
86
+ outputs: [{ name: '', type: 'uint256' }],
87
+ },
88
+ {
89
+ stateMutability: 'view',
90
+ type: 'function',
91
+ name: 'get_total_weight',
92
+ inputs: [],
93
+ outputs: [{ name: '', type: 'uint256' }],
94
+ },
95
+ {
96
+ inputs: [],
97
+ name: 'expiry',
98
+ outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],
99
+ payable: false,
100
+ stateMutability: 'view',
101
+ type: 'function',
102
+ },
103
+ ]
104
+
105
+ export default pendleVaultsMulticall
@@ -0,0 +1,109 @@
1
+ const yearnVaultsMulticall = [
2
+ {
3
+ inputs: [{ internalType: 'address', name: 'account', type: 'address' }],
4
+ name: 'balanceOf',
5
+ outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],
6
+ payable: false,
7
+ stateMutability: 'view',
8
+ type: 'function',
9
+ },
10
+ {
11
+ inputs: [],
12
+ name: 'totalSupply',
13
+ outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],
14
+ payable: false,
15
+ stateMutability: 'view',
16
+ type: 'function',
17
+ },
18
+ {
19
+ inputs: [],
20
+ name: 'pricePerShare',
21
+ outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],
22
+ payable: false,
23
+ stateMutability: 'view',
24
+ type: 'function',
25
+ },
26
+ {
27
+ inputs: [],
28
+ name: 'working_supply',
29
+ outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],
30
+ payable: false,
31
+ stateMutability: 'view',
32
+ type: 'function',
33
+ },
34
+ {
35
+ inputs: [],
36
+ name: 'claimIncentiveFee',
37
+ outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],
38
+ payable: false,
39
+ stateMutability: 'view',
40
+ type: 'function',
41
+ },
42
+ {
43
+ inputs: [],
44
+ name: 'protocolFeesPercent',
45
+ outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],
46
+ payable: false,
47
+ stateMutability: 'view',
48
+ type: 'function',
49
+ },
50
+ {
51
+ inputs: [{ internalType: 'address', name: '_account', type: 'address' }],
52
+ name: 'nextBoostedBalanceOf',
53
+ outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],
54
+ stateMutability: 'view',
55
+ type: 'function',
56
+ },
57
+ {
58
+ inputs: [{ internalType: 'address', name: '_account', type: 'address' }],
59
+ name: 'earned',
60
+ outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],
61
+ stateMutability: 'view',
62
+ type: 'function',
63
+ },
64
+ {
65
+ inputs: [],
66
+ name: 'totalAssets',
67
+ outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],
68
+ stateMutability: 'view',
69
+ type: 'function',
70
+ },
71
+ {
72
+ inputs: [],
73
+ name: 'rewardRate',
74
+ outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],
75
+ stateMutability: 'view',
76
+ type: 'function',
77
+ },
78
+ {
79
+ inputs: [{ internalType: 'address', name: 'account', type: 'address' }],
80
+ name: 'redeemRewards',
81
+ outputs: [{ internalType: 'uint256[]', name: '', type: 'uint256[]' }],
82
+ payable: false,
83
+ stateMutability: 'view',
84
+ type: 'function',
85
+ },
86
+ {
87
+ stateMutability: 'view',
88
+ type: 'function',
89
+ name: 'gauge_relative_weight',
90
+ inputs: [{ name: 'addr', type: 'address' }],
91
+ outputs: [{ name: '', type: 'uint256' }],
92
+ },
93
+ {
94
+ stateMutability: 'view',
95
+ type: 'function',
96
+ name: 'get_gauge_weight',
97
+ inputs: [{ name: 'addr', type: 'address' }],
98
+ outputs: [{ name: '', type: 'uint256' }],
99
+ },
100
+ {
101
+ stateMutability: 'view',
102
+ type: 'function',
103
+ name: 'get_total_weight',
104
+ inputs: [],
105
+ outputs: [{ name: '', type: 'uint256' }],
106
+ },
107
+ ]
108
+
109
+ export default yearnVaultsMulticall
@@ -8,8 +8,8 @@ import { type Price } from '../../prices.js'
8
8
  import { type Call, multicall } from '../../utils.js'
9
9
  import { lockedAmountCallSideChain } from '../utils/index.js'
10
10
 
11
+ import lockersMulticallAbi from '../../abis/lockersMulticall.js'
11
12
  import { type MultiChainCall, multichainMulticall } from '../../utils.js'
12
- import lockersMulticallAbi from '../abis/MulticallLockers.json' assert { type: 'json' }
13
13
  import { getCherriesLeaderBoard } from '../utils/getCherriesLeaderBoard.js'
14
14
 
15
15
  import { extractFees, feeCalls } from '../utils/callsForLockers/feeCalls.js'
@@ -2,7 +2,7 @@ import { STRAT_FEES, angleStrats, contracts } from '@stake-dao/constants'
2
2
  import { chunk, uniq } from 'lodash-es'
3
3
  import { encodeAbiParameters, formatUnits, parseAbiParameters } from 'viem'
4
4
  import { mainnet } from 'viem/chains'
5
- import multicallAngleVaultsAbi from '../../abis/MulticallAngleVaults.json' assert { type: 'json' }
5
+ import multicallAngleVaultsAbi from '../../abis/angleVaultsMulticall.js'
6
6
  import { batchAngleStrats } from '../../bytecodes/index.js'
7
7
  import { type Price, getPricesFromLlama } from '../../prices.js'
8
8
  import { batchJsonRpc, equalTlc, multicall } from '../../utils.js'
@@ -2,6 +2,7 @@ import { STRAT_FEES } from '@stake-dao/constants'
2
2
  import { formatUnits, parseAbi } from 'viem'
3
3
  import { mainnet } from 'viem/chains'
4
4
  import { equalTlc, multicall } from '../../../utils.js'
5
+ import nameSuffixes from './nameSuffixes.js'
5
6
 
6
7
  const getConvexPool = (apisData: any, chainId: number, isLending: boolean, stratLpAddress: string) => {
7
8
  if (chainId === mainnet.id) {
@@ -14,13 +15,18 @@ const getConvexPool = (apisData: any, chainId: number, isLending: boolean, strat
14
15
  }
15
16
 
16
17
  const getName = (s: any) => {
18
+ let name = ''
19
+
17
20
  if (s.isLending) {
18
21
  const id = s.key.replace('lending-oneway-', '')
19
- return `${s.coins[0].symbol}${Number(id) > 8 ? ' Leverage' : ''}`
22
+ name = `${s.coins[0].symbol}${Number(id) > 8 ? ' Leverage' : ''}`
23
+ } else {
24
+ name = (s.isMetapool ? s.underlyingCoins : s.coins)
25
+ .reduce((res: string, current: any) => `${res}/${current.symbol}`, '')
26
+ .slice(1)
20
27
  }
21
- return (s.isMetapool ? s.underlyingCoins : s.coins)
22
- .reduce((res: string, current: any) => `${res}/${current.symbol}`, '')
23
- .slice(1)
28
+
29
+ return `${name}${nameSuffixes[s.vault] ? ` ${nameSuffixes[s.vault]}` : ''}`
24
30
  }
25
31
 
26
32
  export const getCurveStratsWithApr = async (provider: any, chainId: number, curveStrats: any[], apisData: any) => {
@@ -0,0 +1,6 @@
1
+ const nameSuffixes = {
2
+ // "vault address": suffix
3
+ '0xFf359A49Bf1197D6A2aaF7507041B03Fb27515E8': 'v2.1',
4
+ }
5
+
6
+ export default nameSuffixes
@@ -3,6 +3,7 @@ import { chunk } from 'lodash-es'
3
3
  import { encodeAbiParameters, formatUnits, parseAbiParameters } from 'viem'
4
4
 
5
5
  import { ONE_YEAR, STRAT_FEES, contract, contracts, mainnet, pendleStrats, tokenWithId } from '@stake-dao/constants'
6
+ import multicallPendleStratsAbi from '../../abis/pendleVaultsMulticall.js'
6
7
  import { batchPendleStrats } from '../../bytecodes/index.js'
7
8
  import type { Price } from '../../prices.js'
8
9
  import { type Call, batchJsonRpc, equalTlc, multicall } from '../../utils.js'
@@ -12,7 +13,6 @@ import { getBoost } from '../utils/boost.js'
12
13
  import decodeEtherscanFactoryEvent from '../utils/decodeEtherscanFactoryEvent.js'
13
14
  import { getAprBreakdown } from '../utils/getAprBreakdown.js'
14
15
  import { OneEther, Zero, concatBytecode } from '../utils/index.js'
15
- import multicallPendleStratsAbi from './abis/MulticallPendleStratsAbi.json' assert { type: 'json' }
16
16
  import { buildPendleStrategies } from './build.js'
17
17
  import getPendleApiData from './getPendleApiData.js'
18
18
  import pendlePoints from './pendlePoints.js'
@@ -2,9 +2,9 @@ import { chunk } from 'lodash-es'
2
2
  import { encodeAbiParameters, parseAbiParameters } from 'viem'
3
3
 
4
4
  import { contracts } from '@stake-dao/constants'
5
+ import multicallYearnStratsAbi from '../../../abis/yearnVaultsMulticall.js'
5
6
  import { fetchYearnGauges } from '../../../bytecodes/index.js'
6
7
  import { batchJsonRpc, multicall } from '../../../utils.js'
7
- import multicallYearnStratsAbi from '../../utils/abis/MulticallYearnStratsAbi.json' assert { type: 'json' }
8
8
  import { concatBytecode } from '../../utils/index.js'
9
9
  import { computeYearnApr } from './computeYearnApr.js'
10
10
 
@@ -2,9 +2,9 @@ import { chunk } from 'lodash-es'
2
2
  import { formatEther, formatUnits } from 'viem'
3
3
 
4
4
  import { ONE_YEAR, yearnStrats } from '@stake-dao/constants'
5
+ import multicallYearnStratsAbi from '../../../abis/yearnVaultsMulticall.js'
5
6
  import { equalTlc, multicall } from '../../../utils.js'
6
7
  import { NEW_FACTORY_EXPLORER_EVENTS } from '../../curve/endpoints.js'
7
- import multicallYearnStratsAbi from '../../utils/abis/MulticallYearnStratsAbi.json' assert { type: 'json' }
8
8
  import { getBoost } from '../../utils/boost.js'
9
9
  import { buildYearnStrategies } from '../build.js'
10
10
  import { computeYearnApr } from './computeYearnApr.js'
@@ -1,83 +0,0 @@
1
- [
2
- {
3
- "inputs": [],
4
- "name": "totalSupply",
5
- "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
6
- "payable": false,
7
- "stateMutability": "view",
8
- "type": "function"
9
- },
10
- {
11
- "inputs": [],
12
- "name": "working_supply",
13
- "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
14
- "payable": false,
15
- "stateMutability": "view",
16
- "type": "function"
17
- },
18
- {
19
- "inputs": [],
20
- "name": "getUnderlyingBalances",
21
- "outputs": [
22
- { "internalType": "uint256", "name": "", "type": "uint256" },
23
- { "internalType": "uint256", "name": "", "type": "uint256" }
24
- ],
25
- "payable": false,
26
- "stateMutability": "view",
27
- "type": "function"
28
- },
29
- {
30
- "inputs": [],
31
- "name": "getTotalAmounts",
32
- "outputs": [
33
- { "internalType": "uint256", "name": "", "type": "uint256" },
34
- { "internalType": "uint256", "name": "", "type": "uint256" }
35
- ],
36
- "payable": false,
37
- "stateMutability": "view",
38
- "type": "function"
39
- },
40
- {
41
- "inputs": [],
42
- "name": "getTotalAmounts",
43
- "outputs": [
44
- { "internalType": "uint256", "name": "", "type": "uint256" },
45
- { "internalType": "uint256", "name": "", "type": "uint256" }
46
- ],
47
- "payable": false,
48
- "stateMutability": "view",
49
- "type": "function"
50
- },
51
- {
52
- "inputs": [{ "name": "arg0", "type": "address" }],
53
- "name": "reward_data",
54
- "outputs": [
55
- { "name": "token", "type": "address" },
56
- { "name": "distributor", "type": "address" },
57
- { "name": "period_finish", "type": "uint256" },
58
- { "name": "rate", "type": "uint256" },
59
- { "name": "last_update", "type": "uint256" },
60
- { "name": "integral", "type": "uint256" }
61
- ],
62
- "stateMutability": "view",
63
- "type": "function"
64
- },
65
- {
66
- "inputs": [{ "internalType": "address", "name": "", "type": "address" }],
67
- "name": "rewardData",
68
- "outputs": [
69
- { "internalType": "address", "name": "rewardsDistributor", "type": "address" },
70
- { "internalType": "uint256", "name": "rewardsDuration", "type": "uint256" },
71
- { "internalType": "uint256", "name": "periodFinish", "type": "uint256" },
72
- { "internalType": "uint256", "name": "rewardRate", "type": "uint256" },
73
- { "internalType": "uint256", "name": "lastUpdateTime", "type": "uint256" },
74
- {
75
- "internalType": "uint256",
76
- "name": "rewardPerTokenStored",
77
- "type": "uint256"
78
- }
79
- ],
80
- "stateMutability": "view",
81
- "type": "function"
82
- }
83
- ]