@stake-dao/reader 0.4.86 → 0.4.87
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.
- package/dist/esm/strategies/balancer/fetch.js +12 -3
- package/dist/esm/strategies/balancer/fetch.js.map +1 -1
- package/dist/esm/strategies/curve/endpoints.js +4 -2
- package/dist/esm/strategies/curve/endpoints.js.map +1 -1
- package/dist/esm/strategies/curve/httpCalls.js +22 -3
- package/dist/esm/strategies/curve/httpCalls.js.map +1 -1
- package/dist/esm/strategies/pancakeswap/fetch/index.js +12 -2
- package/dist/esm/strategies/pancakeswap/fetch/index.js.map +1 -1
- package/dist/esm/strategies/pendle/fetch.js +12 -2
- package/dist/esm/strategies/pendle/fetch.js.map +1 -1
- package/dist/esm/strategies/yearn/fetch/index.js +12 -2
- package/dist/esm/strategies/yearn/fetch/index.js.map +1 -1
- package/dist/esm/tsconfig.build.tsbuildinfo +1 -1
- package/dist/esm/utils/etherscan.js +5 -1
- package/dist/esm/utils/etherscan.js.map +1 -1
- package/dist/types/strategies/balancer/fetch.d.ts.map +1 -1
- package/dist/types/strategies/curve/endpoints.d.ts +2 -0
- package/dist/types/strategies/curve/endpoints.d.ts.map +1 -1
- package/dist/types/strategies/curve/httpCalls.d.ts.map +1 -1
- package/dist/types/strategies/pancakeswap/fetch/index.d.ts.map +1 -1
- package/dist/types/strategies/pendle/fetch.d.ts.map +1 -1
- package/dist/types/strategies/yearn/fetch/index.d.ts.map +1 -1
- package/dist/types/utils/etherscan.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/strategies/balancer/fetch.ts +12 -7
- package/src/strategies/curve/endpoints.ts +6 -2
- package/src/strategies/curve/httpCalls.ts +23 -24
- package/src/strategies/pancakeswap/fetch/index.ts +12 -6
- package/src/strategies/pendle/fetch.ts +12 -6
- package/src/strategies/yearn/fetch/index.ts +12 -12
- package/src/utils/etherscan.ts +9 -1
|
@@ -2,6 +2,10 @@ export const getLogsFromEtherscan = async ({ chainId, address, apikey, rawQueryP
|
|
|
2
2
|
const queryParams = rawQueryParams
|
|
3
3
|
? rawQueryParams
|
|
4
4
|
: { chainid: `${chainId}`, module: 'logs', action: 'getLogs', address, apikey, ...extraQueryParams };
|
|
5
|
-
|
|
5
|
+
const data = await fetch(`https://api.etherscan.io/v2/api?${new URLSearchParams(queryParams)}`).then((res) => res.json());
|
|
6
|
+
if (data.status !== '1') {
|
|
7
|
+
console.error(`🟥 - error on etherscan api call - ${data.message} - ${data.result}`);
|
|
8
|
+
}
|
|
9
|
+
return data;
|
|
6
10
|
};
|
|
7
11
|
//# sourceMappingURL=etherscan.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"etherscan.js","sourceRoot":"","sources":["../../../src/utils/etherscan.ts"],"names":[],"mappings":"AAQA,MAAM,CAAC,MAAM,oBAAoB,GAAG,KAAK,EAAE,EACzC,OAAO,EACP,OAAO,EACP,MAAM,EACN,cAAc,EACd,gBAAgB,GAAG,EAAE,GACI,EAAE,EAAE;IAC7B,MAAM,WAAW,GAAG,cAAc;QAChC,CAAC,CAAC,cAAc;QAChB,CAAC,CAAC,EAAE,OAAO,EAAE,GAAG,OAAO,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,gBAAgB,EAAE,CAAA;IAEtG,
|
|
1
|
+
{"version":3,"file":"etherscan.js","sourceRoot":"","sources":["../../../src/utils/etherscan.ts"],"names":[],"mappings":"AAQA,MAAM,CAAC,MAAM,oBAAoB,GAAG,KAAK,EAAE,EACzC,OAAO,EACP,OAAO,EACP,MAAM,EACN,cAAc,EACd,gBAAgB,GAAG,EAAE,GACI,EAAE,EAAE;IAC7B,MAAM,WAAW,GAAG,cAAc;QAChC,CAAC,CAAC,cAAc;QAChB,CAAC,CAAC,EAAE,OAAO,EAAE,GAAG,OAAO,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,gBAAgB,EAAE,CAAA;IAEtG,MAAM,IAAI,GAAG,MAAM,KAAK,CAAC,mCAAmC,IAAI,eAAe,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAC3G,GAAG,CAAC,IAAI,EAAE,CACX,CAAA;IAED,IAAI,IAAI,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;QACxB,OAAO,CAAC,KAAK,CAAC,sCAAsC,IAAI,CAAC,OAAO,MAAM,IAAI,CAAC,MAAM,EAAE,CAAC,CAAA;IACtF,CAAC;IAED,OAAO,IAAI,CAAA;AACb,CAAC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../../../../src/strategies/balancer/fetch.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAA6C,YAAY,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAMxG,UAAU,cAAc;IACtB,QAAQ,EAAE,GAAG,CAAA;IACb,cAAc,EAAE,MAAM,CAAA;IACtB,OAAO,EAAE,YAAY,CAAA;IACrB,eAAe,EAAE,GAAG,CAAA;CACrB;AAED,eAAO,MAAM,aAAa,4DAKvB,cAAc,KAAG,OAAO,CAAC,YAAY,
|
|
1
|
+
{"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../../../../src/strategies/balancer/fetch.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAA6C,YAAY,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAMxG,UAAU,cAAc;IACtB,QAAQ,EAAE,GAAG,CAAA;IACb,cAAc,EAAE,MAAM,CAAA;IACtB,OAAO,EAAE,YAAY,CAAA;IACrB,eAAe,EAAE,GAAG,CAAA;CACrB;AAED,eAAO,MAAM,aAAa,4DAKvB,cAAc,KAAG,OAAO,CAAC,YAAY,CA6OvC,CAAA"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
export declare const FACTORY_EVENT_TOPIC = "0x26ad9f07a47e389150a15677a365d64f42af0000b792c182ada6a3b5ab193a0b";
|
|
1
2
|
export declare const FACTORY_EXPLORER_EVENTS: (apiKey: string, chainId: number, contract: string, fromBlock: number, toBlock?: number | "latest") => string;
|
|
3
|
+
export declare const NEW_FACTORY_EVENT_TOPIC = "0x5f7560a5797edc6f72421362defa094d690eb9f7ced3cc5a5c13383502e4fcc5";
|
|
2
4
|
export declare const NEW_FACTORY_EXPLORER_EVENTS: (apiKey: string, chainId: number, contract: string, fromBlock: number, toBlock?: number | "latest") => string;
|
|
3
5
|
export declare const CURVE_API_URL = "https://api.curve.finance/api";
|
|
4
6
|
export declare const CONVEX_POOLS_URL = "https://curve.convexfinance.com/api/curve/pools";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"endpoints.d.ts","sourceRoot":"","sources":["../../../../src/strategies/curve/endpoints.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,uBAAuB,WAC1B,MAAM,WACL,MAAM,YACL,MAAM,aACL,MAAM,YACR,MAAM,GAAG,QAAQ,
|
|
1
|
+
{"version":3,"file":"endpoints.d.ts","sourceRoot":"","sources":["../../../../src/strategies/curve/endpoints.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,mBAAmB,uEAAuE,CAAA;AAEvG,eAAO,MAAM,uBAAuB,WAC1B,MAAM,WACL,MAAM,YACL,MAAM,aACL,MAAM,YACR,MAAM,GAAG,QAAQ,WAEkK,CAAA;AAE9L,eAAO,MAAM,uBAAuB,uEAAuE,CAAA;AAE3G,eAAO,MAAM,2BAA2B,WAC9B,MAAM,WACL,MAAM,YACL,MAAM,aACL,MAAM,YACR,MAAM,GAAG,QAAQ,WAEsK,CAAA;AAElM,eAAO,MAAM,aAAa,kCAAkC,CAAA;AAC5D,eAAO,MAAM,gBAAgB,oDAAoD,CAAA;AACjF,eAAO,MAAM,yBAAyB,6DAA6D,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"httpCalls.d.ts","sourceRoot":"","sources":["../../../../src/strategies/curve/httpCalls.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"httpCalls.d.ts","sourceRoot":"","sources":["../../../../src/strategies/curve/httpCalls.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,0CAA0C,CAAA;AAEjF,eAAO,MAAM,iBAAiB,mBACZ,MAAM,OACjB,MAAM,WACF,MAAM,aACJ,MAAM,WACR,MAAM,iBACA,iBAAiB;;;;;;;;;;;;EAoFjC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/strategies/pancakeswap/fetch/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/strategies/pancakeswap/fetch/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAE/C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAKlD,UAAU,iBAAiB;IACzB,QAAQ,EAAE,GAAG,CAAA;IACb,GAAG,EAAE,MAAM,CAAA;IACX,OAAO,EAAE,YAAY,CAAA;IACrB,MAAM,EAAE,KAAK,EAAE,CAAA;IACf,cAAc,EAAE,MAAM,CAAA;CACvB;AAED,eAAO,MAAM,gBAAgB,uDAA8D,iBAAiB;;;;;EA6B3G,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../../../../src/strategies/pendle/fetch.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAA;
|
|
1
|
+
{"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../../../../src/strategies/pendle/fetch.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAA;AAI5C,OAAO,KAAK,EAAE,WAAW,EAAU,YAAY,EAAE,MAAM,aAAa,CAAA;AAsBpE,UAAU,YAAY;IACpB,MAAM,EAAE,KAAK,EAAE,CAAA;IACf,QAAQ,EAAE,GAAG,CAAA;IACb,GAAG,EAAE,MAAM,CAAA;IACX,cAAc,EAAE,MAAM,CAAA;IACtB,OAAO,EAAE,YAAY,CAAA;CACtB;AAED,eAAO,MAAM,WAAW,uDAA8D,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6TjG,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/strategies/yearn/fetch/index.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/strategies/yearn/fetch/index.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAE/C,OAAO,KAAK,EAAuB,YAAY,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAiCrF,UAAU,WAAW;IACnB,MAAM,EAAE,KAAK,EAAE,CAAA;IACf,QAAQ,EAAE,GAAG,CAAA;IACb,GAAG,EAAE,MAAM,CAAA;IACX,cAAc,EAAE,MAAM,CAAA;IACtB,OAAO,EAAE,YAAY,CAAA;CACtB;AAED,eAAO,MAAM,UAAU,wDAMpB,WAAW,KAAG,OAAO,CAAC,YAAY,CAkMpC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"etherscan.d.ts","sourceRoot":"","sources":["../../../src/utils/etherscan.ts"],"names":[],"mappings":"AAAA,UAAU,wBAAwB;IAChC,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,EAAE,MAAM,CAAA;IACd,cAAc,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAA;IAC1C,gBAAgB,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAA;CAC7C;AAED,eAAO,MAAM,oBAAoB,oEAM9B,wBAAwB,
|
|
1
|
+
{"version":3,"file":"etherscan.d.ts","sourceRoot":"","sources":["../../../src/utils/etherscan.ts"],"names":[],"mappings":"AAAA,UAAU,wBAAwB;IAChC,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,EAAE,MAAM,CAAA;IACd,cAAc,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAA;IAC1C,gBAAgB,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAA;CAC7C;AAED,eAAO,MAAM,oBAAoB,oEAM9B,wBAAwB,iBAc1B,CAAA"}
|
package/package.json
CHANGED
|
@@ -14,9 +14,9 @@ import {
|
|
|
14
14
|
tokenWithId,
|
|
15
15
|
} from '@stake-dao/constants'
|
|
16
16
|
import { batchBalancerStrats } from '../../bytecodes/index.js'
|
|
17
|
-
import { concatBytecode, getBoost, getPricesFromLlama, getSdtApr } from '../../index.js'
|
|
17
|
+
import { concatBytecode, getBoost, getLogsFromEtherscan, getPricesFromLlama, getSdtApr } from '../../index.js'
|
|
18
18
|
import { equalTlc, graphql } from '../../utils.js'
|
|
19
|
-
import {
|
|
19
|
+
import { FACTORY_EVENT_TOPIC } from '../curve/endpoints.js'
|
|
20
20
|
import type { BalancerGlobalData, RewardsData, Strategy, StrategyData, ValidChainId } from '../types.js'
|
|
21
21
|
import decodeEtherscanFactoryEvent from '../utils/decodeEtherscanFactoryEvent.js'
|
|
22
22
|
import { getAprBreakdown } from '../utils/getAprBreakdown.js'
|
|
@@ -42,11 +42,16 @@ export const fetchBalancer = async ({
|
|
|
42
42
|
|
|
43
43
|
const httpCalls = [
|
|
44
44
|
// Etherscan Events
|
|
45
|
-
(
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
45
|
+
getLogsFromEtherscan({
|
|
46
|
+
chainId,
|
|
47
|
+
address: contracts.balancerVaultFactory![1]!,
|
|
48
|
+
apikey: explorerApiKey,
|
|
49
|
+
extraQueryParams: {
|
|
50
|
+
topic0: FACTORY_EVENT_TOPIC,
|
|
51
|
+
fromBlock: `${fromBlock}`,
|
|
52
|
+
toBlock: `${toBlock}`,
|
|
53
|
+
},
|
|
54
|
+
}),
|
|
50
55
|
]
|
|
51
56
|
|
|
52
57
|
const httpResponses = (await Promise.allSettled(httpCalls)).map((result) =>
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
export const FACTORY_EVENT_TOPIC = '0x26ad9f07a47e389150a15677a365d64f42af0000b792c182ada6a3b5ab193a0b'
|
|
2
|
+
|
|
1
3
|
export const FACTORY_EXPLORER_EVENTS = (
|
|
2
4
|
apiKey: string,
|
|
3
5
|
chainId: number,
|
|
@@ -5,7 +7,9 @@ export const FACTORY_EXPLORER_EVENTS = (
|
|
|
5
7
|
fromBlock: number,
|
|
6
8
|
toBlock: number | 'latest' = 'latest',
|
|
7
9
|
) =>
|
|
8
|
-
`https://api.etherscan.io/v2/api?chainid=${chainId}&module=logs&action=getLogs&address=${contract}&fromBlock=${fromBlock}&toBlock=${toBlock}&topic0
|
|
10
|
+
`https://api.etherscan.io/v2/api?chainid=${chainId}&module=logs&action=getLogs&address=${contract}&fromBlock=${fromBlock}&toBlock=${toBlock}&topic0=${FACTORY_EVENT_TOPIC}&apikey=${apiKey}`
|
|
11
|
+
|
|
12
|
+
export const NEW_FACTORY_EVENT_TOPIC = '0x5f7560a5797edc6f72421362defa094d690eb9f7ced3cc5a5c13383502e4fcc5'
|
|
9
13
|
|
|
10
14
|
export const NEW_FACTORY_EXPLORER_EVENTS = (
|
|
11
15
|
apiKey: string,
|
|
@@ -14,7 +18,7 @@ export const NEW_FACTORY_EXPLORER_EVENTS = (
|
|
|
14
18
|
fromBlock: number,
|
|
15
19
|
toBlock: number | 'latest' = 'latest',
|
|
16
20
|
) =>
|
|
17
|
-
`https://api.etherscan.io/v2/api?chainid=${chainId}&module=logs&action=getLogs&address=${contract}&fromBlock=${fromBlock}&toBlock=${toBlock}&topic0
|
|
21
|
+
`https://api.etherscan.io/v2/api?chainid=${chainId}&module=logs&action=getLogs&address=${contract}&fromBlock=${fromBlock}&toBlock=${toBlock}&topic0=${NEW_FACTORY_EVENT_TOPIC}&apikey=${apiKey}`
|
|
18
22
|
|
|
19
23
|
export const CURVE_API_URL = 'https://api.curve.finance/api'
|
|
20
24
|
export const CONVEX_POOLS_URL = 'https://curve.convexfinance.com/api/curve/pools'
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { contract } from '@stake-dao/constants'
|
|
2
|
+
import { getLogsFromEtherscan } from '../../utils/etherscan.js'
|
|
2
3
|
import { handlePromise } from '../utils/promise.js'
|
|
3
4
|
import {
|
|
4
5
|
CONVEX_LENDING_VAULTS_URL,
|
|
5
6
|
CONVEX_POOLS_URL,
|
|
6
7
|
CURVE_API_URL,
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
FACTORY_EVENT_TOPIC,
|
|
9
|
+
NEW_FACTORY_EVENT_TOPIC,
|
|
9
10
|
} from './endpoints.js'
|
|
10
11
|
import { getCurveApiData } from './fetch/curveApiData/getCurveApiData.js'
|
|
11
12
|
import { type GaugesWeightsData } from './fetch/curveApiData/getGaugesWeights.js'
|
|
@@ -22,17 +23,16 @@ export const getCurveHttpCalls = async (
|
|
|
22
23
|
case 1: {
|
|
23
24
|
const ethHttpCalls = [
|
|
24
25
|
// Etherscan Events
|
|
25
|
-
(
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
).json(),
|
|
26
|
+
getLogsFromEtherscan({
|
|
27
|
+
chainId,
|
|
28
|
+
address: contract('curveVaultFactory', chainId),
|
|
29
|
+
apikey: explorerApiKey,
|
|
30
|
+
extraQueryParams: {
|
|
31
|
+
topic0: NEW_FACTORY_EVENT_TOPIC,
|
|
32
|
+
fromBlock: `${fromBlock}`,
|
|
33
|
+
toBlock: `${toBlock}`,
|
|
34
|
+
},
|
|
35
|
+
}),
|
|
36
36
|
// Curve Data (replace APIs calls)
|
|
37
37
|
getCurveApiData(rpc, chainId, gaugesWeights.gauges),
|
|
38
38
|
// Curve Trading Apy API
|
|
@@ -61,17 +61,16 @@ export const getCurveHttpCalls = async (
|
|
|
61
61
|
case 42161: {
|
|
62
62
|
const arbitrumHttpCalls = [
|
|
63
63
|
// Etherscan Events
|
|
64
|
-
(
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
).json(),
|
|
64
|
+
getLogsFromEtherscan({
|
|
65
|
+
chainId,
|
|
66
|
+
address: contract('curveVaultFactory', chainId),
|
|
67
|
+
apikey: explorerApiKey,
|
|
68
|
+
extraQueryParams: {
|
|
69
|
+
topic0: FACTORY_EVENT_TOPIC,
|
|
70
|
+
fromBlock: `${fromBlock}`,
|
|
71
|
+
toBlock: `${toBlock}`,
|
|
72
|
+
},
|
|
73
|
+
}),
|
|
75
74
|
// Curve Data (replace APIs calls)
|
|
76
75
|
getCurveApiData(rpc, chainId, gaugesWeights.gauges),
|
|
77
76
|
// Curve Trading Apy API
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { NEW_FACTORY_EVENT_TOPIC } from '../../curve/endpoints.js'
|
|
2
2
|
|
|
3
3
|
import { contracts, pancakeswapErc20Strats } from '@stake-dao/constants'
|
|
4
4
|
import { GH_STAKE_DAO_VM_DATA } from '../../../endpoints.js'
|
|
5
5
|
import type { Price } from '../../../prices.js'
|
|
6
|
+
import { getLogsFromEtherscan } from '../../../utils/etherscan.js'
|
|
6
7
|
import type { ValidChainId } from '../../types.js'
|
|
7
8
|
import { getPancakeSwapFeesAPR, getPancakeSwapManagerFeesAPR } from './getPancakeApisData.js'
|
|
8
9
|
import { getPancakeErc20Vaults } from './getPancakeErc20Vaults.js'
|
|
@@ -24,11 +25,16 @@ export const fetchPancakeswap = async ({ provider, rpc, chainId, prices, explore
|
|
|
24
25
|
getPancakeSwapFeesAPR(chainId),
|
|
25
26
|
getPancakeSwapManagerFeesAPR(chainId),
|
|
26
27
|
(await fetch(`${GH_STAKE_DAO_VM_DATA}/main/tvls/cake.json`)).json(),
|
|
27
|
-
(
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
getLogsFromEtherscan({
|
|
29
|
+
chainId,
|
|
30
|
+
address: contracts.cakeVaultFactory![chainId]!,
|
|
31
|
+
apikey: explorerApiKey,
|
|
32
|
+
extraQueryParams: {
|
|
33
|
+
topic0: NEW_FACTORY_EVENT_TOPIC,
|
|
34
|
+
fromBlock: `${fromBlock}`,
|
|
35
|
+
toBlock: `${toBlock}`,
|
|
36
|
+
},
|
|
37
|
+
}),
|
|
32
38
|
])
|
|
33
39
|
|
|
34
40
|
const v3Vaults = await getPancakeV3Vaults(rpc, chainId, prices, feesApr, stakedTVLS)
|
|
@@ -17,7 +17,8 @@ import multicallPendleStratsAbi from '../../abis/pendleVaultsMulticall.js'
|
|
|
17
17
|
import { batchPendleStrats } from '../../bytecodes/index.js'
|
|
18
18
|
import type { Price } from '../../prices.js'
|
|
19
19
|
import { type Call, batchJsonRpc, equalTlc, lc, multicall } from '../../utils.js'
|
|
20
|
-
import {
|
|
20
|
+
import { getLogsFromEtherscan } from '../../utils/etherscan.js'
|
|
21
|
+
import { FACTORY_EVENT_TOPIC } from '../curve/endpoints.js'
|
|
21
22
|
import type { RewardsData, SdtApr, ValidChainId } from '../types.js'
|
|
22
23
|
import { getBoost } from '../utils/boost.js'
|
|
23
24
|
import decodeEtherscanFactoryEvent from '../utils/decodeEtherscanFactoryEvent.js'
|
|
@@ -62,11 +63,16 @@ export const fetchPendle = async ({ prices, provider, rpc, explorerApiKey, chain
|
|
|
62
63
|
|
|
63
64
|
const httpCalls = [
|
|
64
65
|
// Etherscan Events
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
66
|
+
getLogsFromEtherscan({
|
|
67
|
+
chainId,
|
|
68
|
+
address: contracts.pendleVaultFactory![chainId]!,
|
|
69
|
+
apikey: explorerApiKey,
|
|
70
|
+
extraQueryParams: {
|
|
71
|
+
topic0: FACTORY_EVENT_TOPIC,
|
|
72
|
+
fromBlock: `${fromBlock}`,
|
|
73
|
+
toBlock: `${toBlock}`,
|
|
74
|
+
},
|
|
75
|
+
}),
|
|
70
76
|
// Pende Api
|
|
71
77
|
getPendleApiData(),
|
|
72
78
|
]
|
|
@@ -4,13 +4,14 @@ import { formatUnits } from 'viem'
|
|
|
4
4
|
import { ONE_YEAR, yearnStrats } from '@stake-dao/constants'
|
|
5
5
|
import multicallYearnStratsAbi from '../../../abis/yearnVaultsMulticall.js'
|
|
6
6
|
import { equalTlc, multicall } from '../../../utils.js'
|
|
7
|
-
import {
|
|
7
|
+
import { NEW_FACTORY_EVENT_TOPIC } from '../../curve/endpoints.js'
|
|
8
8
|
import { getBoost } from '../../utils/boost.js'
|
|
9
9
|
import { buildYearnStrategies } from '../build.js'
|
|
10
10
|
import { computeYearnApr } from './computeYearnApr.js'
|
|
11
11
|
|
|
12
12
|
import { contracts } from '@stake-dao/constants'
|
|
13
13
|
import type { Price } from '../../../prices.js'
|
|
14
|
+
import { getLogsFromEtherscan } from '../../../utils/etherscan.js'
|
|
14
15
|
import type { RewardsData, SdtApr, StrategyData, ValidChainId } from '../../types.js'
|
|
15
16
|
import { getAprBreakdown } from '../../utils/getAprBreakdown.js'
|
|
16
17
|
import { decodeNewFactoryEvent } from '../../utils/index.js'
|
|
@@ -68,17 +69,16 @@ export const fetchYearn = async ({
|
|
|
68
69
|
|
|
69
70
|
const httpCalls = [
|
|
70
71
|
// Etherscan Events
|
|
71
|
-
(
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
).json(),
|
|
72
|
+
getLogsFromEtherscan({
|
|
73
|
+
chainId,
|
|
74
|
+
address: contracts.yearnVaultFactory![chainId]!,
|
|
75
|
+
apikey: explorerApiKey,
|
|
76
|
+
extraQueryParams: {
|
|
77
|
+
topic0: NEW_FACTORY_EVENT_TOPIC,
|
|
78
|
+
fromBlock: `${fromBlock}`,
|
|
79
|
+
toBlock: `${toBlock}`,
|
|
80
|
+
},
|
|
81
|
+
}),
|
|
82
82
|
// Yearn Api
|
|
83
83
|
(
|
|
84
84
|
await fetch(
|
package/src/utils/etherscan.ts
CHANGED
|
@@ -17,5 +17,13 @@ export const getLogsFromEtherscan = async ({
|
|
|
17
17
|
? rawQueryParams
|
|
18
18
|
: { chainid: `${chainId}`, module: 'logs', action: 'getLogs', address, apikey, ...extraQueryParams }
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
const data = await fetch(`https://api.etherscan.io/v2/api?${new URLSearchParams(queryParams)}`).then((res) =>
|
|
21
|
+
res.json(),
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
if (data.status !== '1') {
|
|
25
|
+
console.error(`🟥 - error on etherscan api call - ${data.message} - ${data.result}`)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return data
|
|
21
29
|
}
|