@stake-dao/reader 0.4.30 → 0.4.32
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/bytecodes/ccipFee.js +11 -0
- package/dist/esm/bytecodes/ccipFee.js.map +1 -0
- package/dist/esm/bytecodes/gaugeManager/curveGaugeRewardsData.js +1 -1
- package/dist/esm/bytecodes/gaugeManager/curveGaugeRewardsData.js.map +1 -1
- package/dist/esm/bytecodes/votemarket/batchCampaigns.js +5 -3
- package/dist/esm/bytecodes/votemarket/batchCampaigns.js.map +1 -1
- package/dist/esm/bytecodes/votemarket/curve/batchCurveGauges.js +3 -2
- package/dist/esm/bytecodes/votemarket/curve/batchCurveGauges.js.map +1 -1
- package/dist/esm/ccip/fetchCcipFee.js +25 -0
- package/dist/esm/ccip/fetchCcipFee.js.map +1 -0
- package/dist/esm/endpoints.js +3 -0
- package/dist/esm/endpoints.js.map +1 -1
- package/dist/esm/index.js +8 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/lockers/fetch/index.js +7 -4
- package/dist/esm/lockers/fetch/index.js.map +1 -1
- package/dist/esm/lockers/fetch/parseBoost.js +13 -0
- package/dist/esm/lockers/fetch/parseBoost.js.map +1 -0
- package/dist/esm/lockers/utils/cakeLockerAirdrop.js +1 -1
- package/dist/esm/lockers/utils/cakeLockerAirdrop.js.map +1 -1
- package/dist/esm/lockers/utils/callsForLockers/index.js +4 -3
- package/dist/esm/lockers/utils/callsForLockers/index.js.map +1 -1
- package/dist/esm/lockers/utils/callsForLockers/pegCalls.js +1 -2
- package/dist/esm/lockers/utils/callsForLockers/pegCalls.js.map +1 -1
- package/dist/esm/lockers/utils/callsForLockers/veBoosts.js +9 -0
- package/dist/esm/lockers/utils/callsForLockers/veBoosts.js.map +1 -0
- package/dist/esm/lockers/utils/getBribesRewardsData.js +1 -2
- package/dist/esm/lockers/utils/getBribesRewardsData.js.map +1 -1
- package/dist/esm/lockers/utils/getHttpCalls.js +3 -2
- package/dist/esm/lockers/utils/getHttpCalls.js.map +1 -1
- package/dist/esm/lockers/utils/index.js +1 -1
- package/dist/esm/lockers/utils/index.js.map +1 -1
- package/dist/esm/prices.js +17 -21
- package/dist/esm/prices.js.map +1 -1
- package/dist/esm/sdt/fetch.js +1 -2
- package/dist/esm/sdt/fetch.js.map +1 -1
- package/dist/esm/sdt.js +1 -5
- package/dist/esm/sdt.js.map +1 -1
- package/dist/esm/strategies/angle/fetch.js +1 -2
- package/dist/esm/strategies/angle/fetch.js.map +1 -1
- package/dist/esm/strategies/balancer/fetch.js +2 -2
- package/dist/esm/strategies/balancer/fetch.js.map +1 -1
- package/dist/esm/strategies/curve/build.js +5 -13
- package/dist/esm/strategies/curve/build.js.map +1 -1
- package/dist/esm/strategies/curve/fetch/curveApiData/getCurveApiData.js +2 -2
- package/dist/esm/strategies/curve/fetch/curveApiData/getCurveApiData.js.map +1 -1
- package/dist/esm/strategies/curve/fetch/getCvxApr.js +1 -1
- package/dist/esm/strategies/curve/fetch/getCvxApr.js.map +1 -1
- package/dist/esm/strategies/curve/fetch/index.js +1 -2
- package/dist/esm/strategies/curve/fetch/index.js.map +1 -1
- package/dist/esm/strategies/pancakeswap/endpoints.js +2 -1
- package/dist/esm/strategies/pancakeswap/endpoints.js.map +1 -1
- package/dist/esm/strategies/pancakeswap/fetch/getPancakeV3Vaults.js +2 -2
- package/dist/esm/strategies/pancakeswap/fetch/index.js +2 -1
- package/dist/esm/strategies/pancakeswap/fetch/index.js.map +1 -1
- package/dist/esm/strategies/pancakeswap/fetch/pancakeswapMath.js +2 -3
- package/dist/esm/strategies/pancakeswap/fetch/pancakeswapMath.js.map +1 -1
- package/dist/esm/strategies/pendle/fetch.js +2 -2
- package/dist/esm/strategies/pendle/fetch.js.map +1 -1
- package/dist/esm/strategies/utils/boost.js +1 -1
- package/dist/esm/strategies/utils/boost.js.map +1 -1
- package/dist/esm/strategies/utils/index.js +1 -4
- package/dist/esm/strategies/utils/index.js.map +1 -1
- package/dist/esm/strategies/yearn/build.js +5 -13
- package/dist/esm/strategies/yearn/build.js.map +1 -1
- package/dist/esm/strategies/yearn/fetch/index.js +2 -2
- package/dist/esm/strategies/yearn/fetch/index.js.map +1 -1
- package/dist/esm/tokens.js +34 -0
- package/dist/esm/tokens.js.map +1 -0
- package/dist/esm/tsconfig.build.tsbuildinfo +1 -1
- package/dist/esm/utils.js +27 -24
- package/dist/esm/utils.js.map +1 -1
- package/dist/esm/votemarket/curve/config.js +12 -1
- package/dist/esm/votemarket/curve/config.js.map +1 -1
- package/dist/esm/votemarket/curve/fetchCurveGauges.js +5 -3
- package/dist/esm/votemarket/curve/fetchCurveGauges.js.map +1 -1
- package/dist/esm/votemarket/curve/fetchCurveUserVotes.js +1 -1
- package/dist/esm/votemarket/curve/fetchCurveUserVotes.js.map +1 -1
- package/dist/esm/votemarket/curve/fetchUserVlCvxClaimable.js +81 -0
- package/dist/esm/votemarket/curve/fetchUserVlCvxClaimable.js.map +1 -0
- package/dist/esm/votemarket/fetchCampaigns.js +46 -49
- package/dist/esm/votemarket/fetchCampaigns.js.map +1 -1
- package/dist/esm/votemarket/fetchClaimableData.js +7 -12
- package/dist/esm/votemarket/fetchClaimableData.js.map +1 -1
- package/dist/esm/votemarket/generateProofs/getBlockProof.js +2 -1
- package/dist/esm/votemarket/generateProofs/getBlockProof.js.map +1 -1
- package/dist/types/bytecodes/ccipFee.d.ts +4 -0
- package/dist/types/bytecodes/ccipFee.d.ts.map +1 -0
- package/dist/types/bytecodes/votemarket/batchCampaigns.d.ts.map +1 -1
- package/dist/types/bytecodes/votemarket/curve/batchCurveGauges.d.ts.map +1 -1
- package/dist/types/ccip/fetchCcipFee.d.ts +15 -0
- package/dist/types/ccip/fetchCcipFee.d.ts.map +1 -0
- package/dist/types/endpoints.d.ts +3 -0
- package/dist/types/endpoints.d.ts.map +1 -1
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/lockers/fetch/index.d.ts +1 -0
- package/dist/types/lockers/fetch/index.d.ts.map +1 -1
- package/dist/types/lockers/fetch/parseBoost.d.ts +3 -0
- package/dist/types/lockers/fetch/parseBoost.d.ts.map +1 -0
- package/dist/types/lockers/utils/callsForLockers/index.d.ts +5 -1
- package/dist/types/lockers/utils/callsForLockers/index.d.ts.map +1 -1
- package/dist/types/lockers/utils/callsForLockers/pegCalls.d.ts.map +1 -1
- package/dist/types/lockers/utils/callsForLockers/veBoosts.d.ts +7 -0
- package/dist/types/lockers/utils/callsForLockers/veBoosts.d.ts.map +1 -0
- package/dist/types/lockers/utils/getBribesRewardsData.d.ts.map +1 -1
- package/dist/types/lockers/utils/getHttpCalls.d.ts.map +1 -1
- package/dist/types/prices.d.ts +1 -0
- package/dist/types/prices.d.ts.map +1 -1
- package/dist/types/sdt/fetch.d.ts.map +1 -1
- package/dist/types/sdt.d.ts.map +1 -1
- package/dist/types/strategies/angle/fetch.d.ts.map +1 -1
- package/dist/types/strategies/balancer/fetch.d.ts.map +1 -1
- package/dist/types/strategies/curve/build.d.ts.map +1 -1
- package/dist/types/strategies/curve/fetch/index.d.ts.map +1 -1
- package/dist/types/strategies/pancakeswap/endpoints.d.ts.map +1 -1
- package/dist/types/strategies/pancakeswap/fetch/index.d.ts.map +1 -1
- package/dist/types/strategies/pancakeswap/fetch/pancakeswapMath.d.ts.map +1 -1
- package/dist/types/strategies/pendle/fetch.d.ts.map +1 -1
- package/dist/types/strategies/utils/index.d.ts +0 -3
- package/dist/types/strategies/utils/index.d.ts.map +1 -1
- package/dist/types/strategies/yearn/build.d.ts.map +1 -1
- package/dist/types/tokens.d.ts +3 -0
- package/dist/types/tokens.d.ts.map +1 -0
- package/dist/types/utils.d.ts.map +1 -1
- package/dist/types/votemarket/curve/config.d.ts +12 -1
- package/dist/types/votemarket/curve/config.d.ts.map +1 -1
- package/dist/types/votemarket/curve/fetchCurveGauges.d.ts.map +1 -1
- package/dist/types/votemarket/curve/fetchUserVlCvxClaimable.d.ts +16 -0
- package/dist/types/votemarket/curve/fetchUserVlCvxClaimable.d.ts.map +1 -0
- package/dist/types/votemarket/fetchCampaigns.d.ts +4 -2
- package/dist/types/votemarket/fetchCampaigns.d.ts.map +1 -1
- package/dist/types/votemarket/fetchClaimableData.d.ts +1 -5
- package/dist/types/votemarket/fetchClaimableData.d.ts.map +1 -1
- package/dist/types/votemarket/generateProofs/getBlockProof.d.ts.map +1 -1
- package/dist/types/votemarket/types.d.ts +9 -1
- package/dist/types/votemarket/types.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/bytecodes/ccipFee.ts +14 -0
- package/src/bytecodes/gaugeManager/curveGaugeRewardsData.ts +1 -1
- package/src/bytecodes/votemarket/batchCampaigns.ts +5 -3
- package/src/bytecodes/votemarket/curve/batchCurveGauges.ts +3 -2
- package/src/ccip/fetchCcipFee.ts +46 -0
- package/src/endpoints.ts +4 -0
- package/src/index.ts +13 -0
- package/src/lockers/fetch/index.ts +8 -2
- package/src/lockers/fetch/parseBoost.ts +13 -0
- package/src/lockers/utils/cakeLockerAirdrop.ts +1 -1
- package/src/lockers/utils/callsForLockers/index.ts +7 -2
- package/src/lockers/utils/callsForLockers/pegCalls.ts +1 -2
- package/src/lockers/utils/callsForLockers/veBoosts.ts +15 -0
- package/src/lockers/utils/getBribesRewardsData.ts +1 -2
- package/src/lockers/utils/getHttpCalls.ts +3 -2
- package/src/lockers/utils/index.ts +1 -1
- package/src/prices.ts +18 -21
- package/src/sdt/fetch.ts +1 -2
- package/src/sdt.ts +10 -5
- package/src/strategies/angle/fetch.ts +1 -2
- package/src/strategies/balancer/fetch.ts +3 -1
- package/src/strategies/curve/build.ts +6 -20
- package/src/strategies/curve/fetch/curveApiData/getCurveApiData.ts +2 -2
- package/src/strategies/curve/fetch/getCvxApr.ts +1 -1
- package/src/strategies/curve/fetch/index.ts +1 -2
- package/src/strategies/pancakeswap/endpoints.ts +3 -2
- package/src/strategies/pancakeswap/fetch/getPancakeV3Vaults.ts +2 -2
- package/src/strategies/pancakeswap/fetch/index.ts +2 -1
- package/src/strategies/pancakeswap/fetch/pancakeswapMath.ts +2 -3
- package/src/strategies/pendle/fetch.ts +12 -2
- package/src/strategies/utils/boost.ts +1 -1
- package/src/strategies/utils/index.ts +1 -5
- package/src/strategies/yearn/build.ts +6 -20
- package/src/strategies/yearn/fetch/index.ts +2 -2
- package/src/tokens.ts +44 -0
- package/src/utils.ts +41 -29
- package/src/votemarket/curve/config.ts +12 -1
- package/src/votemarket/curve/fetchCurveGauges.ts +5 -3
- package/src/votemarket/curve/fetchCurveUserVotes.ts +1 -1
- package/src/votemarket/curve/fetchUserVlCvxClaimable.ts +132 -0
- package/src/votemarket/fetchCampaigns.ts +61 -55
- package/src/votemarket/fetchClaimableData.ts +11 -16
- package/src/votemarket/generateProofs/getBlockProof.ts +2 -1
- package/src/votemarket/types.ts +9 -1
|
@@ -2,7 +2,7 @@ import type { BatchMetaData } from '../../types.js'
|
|
|
2
2
|
|
|
3
3
|
const batchCurveGauges: BatchMetaData = {
|
|
4
4
|
bytecode: {
|
|
5
|
-
1: '
|
|
5
|
+
1: '0x608060405234801561000f575f80fd5b50604051610c5c380380610c5c83398181016040528101906100319190610817565b5f732f50d538606fa9edd2b11e2446beb18c9d5846bb90505f825190505f8167ffffffffffffffff811115610069576100686106a8565b5b6040519080825280602002602001820160405280156100a257816020015b61008f61061f565b8152602001906001900390816100875790505b5090505f5b828110156103c5575f8473ffffffffffffffffffffffffffffffffffffffff1663b05391878784815181106100df576100de61085e565b5b60200260200101516040518263ffffffff1660e01b8152600401610103919061089a565b602060405180830381865afa15801561011e573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610142919061090d565b905061014c61061f565b81815f019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050610192826103f460201b60201c565b8260a0018360c001828152508215151515815250505060018160c00151146101c8576101c38261048a60201b60201c565b6101ca565b815b816020019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250508573ffffffffffffffffffffffffffffffffffffffff16634e791a3a836040518263ffffffff1660e01b815260040161023a9190610947565b6020604051808303815f875af1158015610256573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061027a9190610960565b8160400181815250508573ffffffffffffffffffffffffffffffffffffffff166395cfcec3836040518263ffffffff1660e01b81526004016102bc9190610947565b6020604051808303815f875af11580156102d8573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906102fc9190610960565b8160600181815250508573ffffffffffffffffffffffffffffffffffffffff16636472eee18362093a804261033191906109b8565b6040518363ffffffff1660e01b815260040161034e9291906109eb565b6020604051808303815f875af115801561036a573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061038e9190610960565b816080018181525050808484815181106103ab576103aa61085e565b5b6020026020010181905250505080806001019150506100a7565b505f816040516020016103d89190610b7e565b6040516020818303038152906040529050602081018059038082f35b5f805f8390508073ffffffffffffffffffffffffffffffffffffffff16639c868ac06040518163ffffffff1660e01b8152600401602060405180830381865afa92505050801561046257506040513d601f19601f8201168201806040525081019061045f9190610bc8565b60015b61046e575f9250610473565b809350505b6104828461059f60201b60201c565b915050915091565b5f805f8373ffffffffffffffffffffffffffffffffffffffff166040516024016040516020818303038152906040527f9dbb1517000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506040516105349190610c45565b5f60405180830381855afa9150503d805f811461056c576040519150601f19603f3d011682016040523d82523d5f602084013e610571565b606091505b509150915081801561058357505f8151115b156105945760208101519250610598565b8392505b5050919050565b5f8173ffffffffffffffffffffffffffffffffffffffff16633af973b16040518163ffffffff1660e01b8152600401602060405180830381865afa92505050801561060857506040513d601f19601f820116820180604052508101906106059190610960565b60015b610615576001905061061a565b809150505b919050565b6040518060e001604052805f73ffffffffffffffffffffffffffffffffffffffff1681526020015f73ffffffffffffffffffffffffffffffffffffffff1681526020015f81526020015f81526020015f81526020015f151581526020015f81525090565b5f604051905090565b5f80fd5b5f80fd5b5f80fd5b5f601f19601f8301169050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b6106de82610698565b810181811067ffffffffffffffff821117156106fd576106fc6106a8565b5b80604052505050565b5f61070f610683565b905061071b82826106d5565b919050565b5f67ffffffffffffffff82111561073a576107396106a8565b5b602082029050602081019050919050565b5f80fd5b5f819050919050565b6107618161074f565b811461076b575f80fd5b50565b5f8151905061077c81610758565b92915050565b5f61079461078f84610720565b610706565b905080838252602082019050602084028301858111156107b7576107b661074b565b5b835b818110156107e057806107cc888261076e565b8452602084019350506020810190506107b9565b5050509392505050565b5f82601f8301126107fe576107fd610694565b5b815161080e848260208601610782565b91505092915050565b5f6020828403121561082c5761082b61068c565b5b5f82015167ffffffffffffffff81111561084957610848610690565b5b610855848285016107ea565b91505092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b6108948161074f565b82525050565b5f6020820190506108ad5f83018461088b565b92915050565b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6108dc826108b3565b9050919050565b6108ec816108d2565b81146108f6575f80fd5b50565b5f81519050610907816108e3565b92915050565b5f602082840312156109225761092161068c565b5b5f61092f848285016108f9565b91505092915050565b610941816108d2565b82525050565b5f60208201905061095a5f830184610938565b92915050565b5f602082840312156109755761097461068c565b5b5f6109828482850161076e565b91505092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f6109c28261074f565b91506109cd8361074f565b92508282019050808211156109e5576109e461098b565b5b92915050565b5f6040820190506109fe5f830185610938565b610a0b602083018461088b565b9392505050565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b610a44816108d2565b82525050565b610a538161074f565b82525050565b5f8115159050919050565b610a6d81610a59565b82525050565b60e082015f820151610a875f850182610a3b565b506020820151610a9a6020850182610a3b565b506040820151610aad6040850182610a4a565b506060820151610ac06060850182610a4a565b506080820151610ad36080850182610a4a565b5060a0820151610ae660a0850182610a64565b5060c0820151610af960c0850182610a4a565b50505050565b5f610b0a8383610a73565b60e08301905092915050565b5f602082019050919050565b5f610b2c82610a12565b610b368185610a1c565b9350610b4183610a2c565b805f5b83811015610b71578151610b588882610aff565b9750610b6383610b16565b925050600181019050610b44565b5085935050505092915050565b5f6020820190508181035f830152610b968184610b22565b905092915050565b610ba781610a59565b8114610bb1575f80fd5b50565b5f81519050610bc281610b9e565b92915050565b5f60208284031215610bdd57610bdc61068c565b5b5f610bea84828501610bb4565b91505092915050565b5f81519050919050565b5f81905092915050565b8281835e5f83830152505050565b5f610c1f82610bf3565b610c298185610bfd565b9350610c39818560208601610c07565b80840191505092915050565b5f610c508284610c15565b91508190509291505056fe',
|
|
6
6
|
},
|
|
7
7
|
inputType: {
|
|
8
8
|
1: ['uint256[] memory gaugesIds'],
|
|
@@ -10,7 +10,7 @@ const batchCurveGauges: BatchMetaData = {
|
|
|
10
10
|
outputTypeHr: {
|
|
11
11
|
1: [
|
|
12
12
|
'ReturnData[] memory returnData',
|
|
13
|
-
'struct ReturnData { address gauge; uint256 weight; uint256 relativeWeight; uint256 futureRelativeWeight; bool isKilled; uint256 chainId; }',
|
|
13
|
+
'struct ReturnData { address gauge; address childGauge; uint256 weight; uint256 relativeWeight; uint256 futureRelativeWeight; bool isKilled; uint256 chainId; }',
|
|
14
14
|
],
|
|
15
15
|
},
|
|
16
16
|
outputType: {
|
|
@@ -20,6 +20,7 @@ const batchCurveGauges: BatchMetaData = {
|
|
|
20
20
|
name: 'returnData',
|
|
21
21
|
components: [
|
|
22
22
|
{ type: 'address', name: 'gauge' },
|
|
23
|
+
{ type: 'address', name: 'childGauge' },
|
|
23
24
|
{ type: 'uint256', name: 'weight' },
|
|
24
25
|
{ type: 'uint256', name: 'relativeWeight' },
|
|
25
26
|
{ type: 'uint256', name: 'futureRelativeWeight' },
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { contract } from '@stake-dao/constants'
|
|
2
|
+
import { encodeAbiParameters, parseAbiParameters } from 'viem'
|
|
3
|
+
import ccipFee from '../bytecodes/ccipFee.js'
|
|
4
|
+
import { batchJsonRpc, concatBytecode } from '../utils.js'
|
|
5
|
+
|
|
6
|
+
interface FetchCcipFeeProps {
|
|
7
|
+
rpc: string
|
|
8
|
+
sourceChainId: number
|
|
9
|
+
destChainId: number
|
|
10
|
+
destChainSelector: string
|
|
11
|
+
receiver: string
|
|
12
|
+
executionGasLimit: string
|
|
13
|
+
tokens: { address: string; amount: string }[]
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const fetchCcipFee = async ({
|
|
17
|
+
rpc,
|
|
18
|
+
sourceChainId,
|
|
19
|
+
destChainId,
|
|
20
|
+
destChainSelector,
|
|
21
|
+
receiver,
|
|
22
|
+
executionGasLimit,
|
|
23
|
+
tokens,
|
|
24
|
+
}: FetchCcipFeeProps): Promise<bigint> => {
|
|
25
|
+
const inputParams = [
|
|
26
|
+
contract('ccipRouter', sourceChainId),
|
|
27
|
+
destChainSelector,
|
|
28
|
+
destChainId,
|
|
29
|
+
receiver,
|
|
30
|
+
executionGasLimit,
|
|
31
|
+
tokens.map((t) => [t.address, t.amount]),
|
|
32
|
+
]
|
|
33
|
+
|
|
34
|
+
const inputData = encodeAbiParameters(parseAbiParameters(ccipFee.inputType) as any, inputParams)
|
|
35
|
+
const call = concatBytecode(ccipFee.bytecode, inputData)
|
|
36
|
+
|
|
37
|
+
const rawCcipFee = await batchJsonRpc({
|
|
38
|
+
rpc,
|
|
39
|
+
calls: [call],
|
|
40
|
+
outputTypeAbi: ccipFee.outputType,
|
|
41
|
+
parse: false,
|
|
42
|
+
callsKey: `ccip/getCcipFee.ts: rawCcipFee - chainId ${sourceChainId} - rpc ${rpc}`,
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
return rawCcipFee?.length > 0 ? rawCcipFee[0] : BigInt('10000000000000000')
|
|
46
|
+
}
|
package/src/endpoints.ts
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
export const GH_STAKE_DAO_RAW_ORG = 'https://raw.githubusercontent.com/stake-dao'
|
|
2
|
+
export const GH_STAKE_DAO_BOUNTIES_REPORT = `${GH_STAKE_DAO_RAW_ORG}/bounties-report`
|
|
3
|
+
export const GH_STAKE_DAO_VM_DATA = `${GH_STAKE_DAO_RAW_ORG}/votemarket-data`
|
|
4
|
+
|
|
1
5
|
export const LLAMA_API_URL = 'https://coins.llama.fi'
|
|
2
6
|
export const THE_GRAPH_BASE_URL =
|
|
3
7
|
'https://gateway-arbitrum.network.thegraph.com/api/e3c2ef8231c88703a5b450c188ce2db6/subgraphs/id'
|
package/src/index.ts
CHANGED
|
@@ -77,6 +77,10 @@ export { generateBlockProof } from './votemarket/generateProofs/getBlockProof.js
|
|
|
77
77
|
export { generateGaugeProof } from './votemarket/generateProofs/getGaugeProof.js'
|
|
78
78
|
export { generateUserProof } from './votemarket/generateProofs/getUserProof.js'
|
|
79
79
|
|
|
80
|
+
// vlCVX Claims
|
|
81
|
+
|
|
82
|
+
export { fetchUserVlCvxClaimable } from './votemarket/curve/fetchUserVlCvxClaimable.js'
|
|
83
|
+
|
|
80
84
|
/// --- END VOTEMARKET
|
|
81
85
|
///////////////////////////////////////////////////////////////
|
|
82
86
|
|
|
@@ -89,3 +93,12 @@ export type { GmGaugeData } from './gaugeManager/curve/gmFetchGauge.js'
|
|
|
89
93
|
|
|
90
94
|
/// --- END GAUGE MANAGER
|
|
91
95
|
///////////////////////////////////////////////////////////////
|
|
96
|
+
|
|
97
|
+
////////////////////////////////////////////////////////////////
|
|
98
|
+
/// --- CCIP
|
|
99
|
+
|
|
100
|
+
// Curve
|
|
101
|
+
export { fetchCcipFee } from './ccip/fetchCcipFee.js'
|
|
102
|
+
|
|
103
|
+
/// --- CCIP
|
|
104
|
+
///////////////////////////////////////////////////////////////
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { type Locker, ONE_YEAR, delegationWithId, lockers } from '@stake-dao/constants'
|
|
1
|
+
import { type Locker, ONE_YEAR, Zero, delegationWithId, lockers } from '@stake-dao/constants'
|
|
2
2
|
import { formatUnits, parseAbi, zeroAddress } from 'viem'
|
|
3
3
|
import { fraxtal, mainnet } from 'viem/chains'
|
|
4
4
|
import lockersMulticallAbi from '../../abis/lockersMulticall.js'
|
|
5
|
-
import {
|
|
5
|
+
import { getSdtInflationData } from '../../index.js'
|
|
6
6
|
import type { Price } from '../../prices.js'
|
|
7
7
|
import { handlePromise } from '../../strategies/utils/promise.js'
|
|
8
8
|
import { type Call, type MultiChainCall, equalTlc, multicall, multichainMulticall } from '../../utils.js'
|
|
@@ -14,6 +14,7 @@ import getFees from '../utils/getFees.js'
|
|
|
14
14
|
import getHttpCalls from '../utils/getHttpCalls.js'
|
|
15
15
|
import { lockedAmountCallSideChain } from '../utils/index.js'
|
|
16
16
|
import substractFees from '../utils/substractFees.js'
|
|
17
|
+
import { parseBoost } from './parseBoost.js'
|
|
17
18
|
import { parsePeg } from './parsePeg.js'
|
|
18
19
|
import { parseVoteBoosterData } from './parseVoteBoosterData.js'
|
|
19
20
|
|
|
@@ -59,6 +60,7 @@ export const fetchLockers = async ({ provider, chainId, prices, withAirdropGraph
|
|
|
59
60
|
locker.modules.locker,
|
|
60
61
|
locker.secondaryMarket,
|
|
61
62
|
locker.voteBooster,
|
|
63
|
+
locker.veBoost,
|
|
62
64
|
),
|
|
63
65
|
)
|
|
64
66
|
lockersRewardsCalls.push(...callsForRewards(locker.modules.gauge, locker.rewards))
|
|
@@ -101,6 +103,7 @@ export const fetchLockers = async ({ provider, chainId, prices, withAirdropGraph
|
|
|
101
103
|
locker.modules.locker,
|
|
102
104
|
locker.secondaryMarket,
|
|
103
105
|
locker.voteBooster,
|
|
106
|
+
locker.veBoost,
|
|
104
107
|
).length
|
|
105
108
|
const chunkedRawLockersData = rawLockersData.splice(0, lockerCallsLength)
|
|
106
109
|
|
|
@@ -140,6 +143,8 @@ export const fetchLockers = async ({ provider, chainId, prices, withAirdropGraph
|
|
|
140
143
|
const veTokenRate =
|
|
141
144
|
locker.id === 'mav' ? formatUnits(chunkedRawLockersData[11].result[0], locker.token.decimals) : '4'
|
|
142
145
|
|
|
146
|
+
const veBoostTotalSupply = parseBoost(locker, chunkedRawLockersData)
|
|
147
|
+
|
|
143
148
|
const sideChains = locker.extensions.sideChains?.map((sideChain) => {
|
|
144
149
|
const rewards =
|
|
145
150
|
sideChain.rewards?.map((reward) => {
|
|
@@ -322,6 +327,7 @@ export const fetchLockers = async ({ provider, chainId, prices, withAirdropGraph
|
|
|
322
327
|
sideChains,
|
|
323
328
|
...(locker.id === 'cake' ? { airdropGraph } : {}),
|
|
324
329
|
},
|
|
330
|
+
veBoostTotalSupply,
|
|
325
331
|
}
|
|
326
332
|
})
|
|
327
333
|
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type Locker } from '@stake-dao/constants'
|
|
2
|
+
import { formatUnits } from 'viem'
|
|
3
|
+
|
|
4
|
+
export const parseBoost = (locker: Locker, chunkedRawLockersData: any) => {
|
|
5
|
+
let boost = '0'
|
|
6
|
+
if (locker.veBoost && locker.id === 'crv') {
|
|
7
|
+
boost = formatUnits(chunkedRawLockersData[15].result, locker.token.decimals)
|
|
8
|
+
} else if (locker.veBoost) {
|
|
9
|
+
boost = formatUnits(chunkedRawLockersData[11].result, locker.token.decimals)
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
return boost
|
|
13
|
+
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { FOUR_YEAR, type LockerSecondaryMarket } from '@stake-dao/constants'
|
|
2
|
-
import { OneEther } from '../../../index.js'
|
|
1
|
+
import { FOUR_YEAR, type LockerSecondaryMarket, OneEther } from '@stake-dao/constants'
|
|
3
2
|
|
|
4
3
|
import type { Address } from 'viem'
|
|
5
4
|
import depositorCalls from './depositorCalls.js'
|
|
6
5
|
import gaugeCalls from './gaugeCalls.js'
|
|
7
6
|
import pegCalls from './pegCalls.js'
|
|
7
|
+
import veBoosts from './veBoosts.js'
|
|
8
8
|
import veCalls from './veCalls.js'
|
|
9
9
|
import veSdtCalls from './veSdtCalls.js'
|
|
10
10
|
|
|
@@ -18,6 +18,10 @@ const callsForLockers = (
|
|
|
18
18
|
locker: string,
|
|
19
19
|
secondaryMarket: LockerSecondaryMarket | undefined,
|
|
20
20
|
voteBooster: any,
|
|
21
|
+
veBoost?: {
|
|
22
|
+
address: Address
|
|
23
|
+
delegator: Address
|
|
24
|
+
},
|
|
21
25
|
) => [
|
|
22
26
|
...veCalls(lockerId, votingEscrow, locker as Address, token),
|
|
23
27
|
...depositorCalls(depositor, locker as Address),
|
|
@@ -35,6 +39,7 @@ const callsForLockers = (
|
|
|
35
39
|
},
|
|
36
40
|
]
|
|
37
41
|
: []),
|
|
42
|
+
...veBoosts(veBoost),
|
|
38
43
|
]
|
|
39
44
|
|
|
40
45
|
export default callsForLockers
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { parseUnits, zeroAddress } from 'viem'
|
|
2
2
|
|
|
3
|
-
import { type LockerSecondaryMarket, contracts } from '@stake-dao/constants'
|
|
4
|
-
import { One, Zero } from '../../../index.js'
|
|
3
|
+
import { type LockerSecondaryMarket, One, Zero, contracts } from '@stake-dao/constants'
|
|
5
4
|
|
|
6
5
|
const pegCalls = (secondaryMarket: LockerSecondaryMarket | undefined, sdToken: string, token: string) => {
|
|
7
6
|
const secondaryMarketLabel = secondaryMarket?.label || ''
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Address } from 'viem'
|
|
2
|
+
|
|
3
|
+
const veBoosts = (veBoost?: {
|
|
4
|
+
address: Address
|
|
5
|
+
delegator: Address
|
|
6
|
+
}) => {
|
|
7
|
+
const calls: any[] = []
|
|
8
|
+
if (veBoost) {
|
|
9
|
+
calls.push({ address: veBoost.delegator, name: 'totalSupply', params: [] })
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
return calls
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export default veBoosts
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { bsc, fraxtal, mainnet } from 'viem/chains'
|
|
2
|
+
import { GH_STAKE_DAO_BOUNTIES_REPORT } from '../../endpoints.js'
|
|
2
3
|
|
|
3
4
|
const getHttpCalls = async (chainId: number) => {
|
|
4
5
|
switch (chainId) {
|
|
5
6
|
case mainnet.id: {
|
|
6
7
|
const httpCalls = [
|
|
7
|
-
(await fetch(
|
|
8
|
+
(await fetch(`${GH_STAKE_DAO_BOUNTIES_REPORT}/main/delegationsAPRs.json`)).json(),
|
|
8
9
|
fetch('https://api.frax.finance/v1/vefpisdata/1-day')
|
|
9
10
|
.then((result) => result.json())
|
|
10
11
|
.catch((error) => {
|
|
@@ -44,7 +45,7 @@ const getHttpCalls = async (chainId: number) => {
|
|
|
44
45
|
case fraxtal.id:
|
|
45
46
|
case bsc.id: {
|
|
46
47
|
const httpCalls = [
|
|
47
|
-
(await fetch(
|
|
48
|
+
(await fetch(`${GH_STAKE_DAO_BOUNTIES_REPORT}/main/delegationsAPRs.json`)).json(),
|
|
48
49
|
(await fetch('https://api.stakedao.org/api/lockers/sdfxs-working-supply.json')).json(),
|
|
49
50
|
]
|
|
50
51
|
|
package/src/prices.ts
CHANGED
|
@@ -57,33 +57,30 @@ export const getPricesFromCurve = async (chainId: number) => {
|
|
|
57
57
|
return httpRequest
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
+
export const getGeckoTerminalTokenPrefix = (chainId = 1): string => {
|
|
61
|
+
switch (chainId) {
|
|
62
|
+
case 1:
|
|
63
|
+
return 'eth'
|
|
64
|
+
case 56:
|
|
65
|
+
return 'bsc'
|
|
66
|
+
case 137:
|
|
67
|
+
return 'polygon_pos'
|
|
68
|
+
case 252:
|
|
69
|
+
return 'fraxtal'
|
|
70
|
+
case 42161:
|
|
71
|
+
return 'arbitrum'
|
|
72
|
+
default:
|
|
73
|
+
return 'eth'
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
60
77
|
export const getPricesFromGeckoTerminal = async (
|
|
61
78
|
tokens: any[],
|
|
62
79
|
chainId = 1,
|
|
63
80
|
defaultErrorValue?: any,
|
|
64
81
|
): Promise<Price[]> => {
|
|
65
82
|
try {
|
|
66
|
-
|
|
67
|
-
switch (chainId) {
|
|
68
|
-
case 1:
|
|
69
|
-
network = 'eth'
|
|
70
|
-
break
|
|
71
|
-
case 56:
|
|
72
|
-
network = 'bsc'
|
|
73
|
-
break
|
|
74
|
-
case 137:
|
|
75
|
-
network = 'polygon_pos'
|
|
76
|
-
break
|
|
77
|
-
case 252:
|
|
78
|
-
network = 'fraxtal'
|
|
79
|
-
break
|
|
80
|
-
case 42161:
|
|
81
|
-
network = 'arbitrum'
|
|
82
|
-
break
|
|
83
|
-
default:
|
|
84
|
-
network = 'eth'
|
|
85
|
-
break
|
|
86
|
-
}
|
|
83
|
+
const network: string = getGeckoTerminalTokenPrefix(chainId)
|
|
87
84
|
|
|
88
85
|
const httpArgs = uniq(tokens.map((t) => t.address)).join(',')
|
|
89
86
|
const url = `${GECKO_TERMINAL_API_URL}/simple/networks/${network}/token_price/${httpArgs}`
|
package/src/sdt/fetch.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { decodeAbiParameters, formatUnits, parseAbi, parseUnits } from 'viem'
|
|
2
2
|
|
|
3
|
-
import { ONE_DAY, type Token, contracts, explorers, tokenWithId } from '@stake-dao/constants'
|
|
4
|
-
import { Zero } from '../index.js'
|
|
3
|
+
import { ONE_DAY, type Token, Zero, contracts, explorers, tokenWithId } from '@stake-dao/constants'
|
|
5
4
|
import { type Price } from '../prices.js'
|
|
6
5
|
import { multicall } from '../utils.js'
|
|
7
6
|
import veSdtAlternativeYields from './veSdtAlternativeYields.js'
|
package/src/sdt.ts
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import {
|
|
2
|
+
ETH_SECONDS_PER_BLOCK,
|
|
3
|
+
LOCKERS_MASTERCHEF_PID,
|
|
4
|
+
ONE_WEEK,
|
|
5
|
+
ONE_YEAR,
|
|
6
|
+
OneEther,
|
|
7
|
+
STRATEGIES_MASTERCHEF_PID,
|
|
8
|
+
Zero,
|
|
9
|
+
contracts,
|
|
10
|
+
} from '@stake-dao/constants'
|
|
5
11
|
import { formatUnits, parseAbi, parseEther, parseUnits } from 'viem'
|
|
6
12
|
import type { RewardsData, SdtApr } from './strategies/types.js'
|
|
7
|
-
import { OneEther, Zero } from './strategies/utils/index.js'
|
|
8
13
|
import { multicall } from './utils.js'
|
|
9
14
|
|
|
10
15
|
export type SdtEmissionData = {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { STRAT_FEES, angleStrats, contracts } from '@stake-dao/constants'
|
|
1
|
+
import { STRAT_FEES, Zero, 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'
|
|
@@ -8,7 +8,6 @@ import { type Price, getPricesFromLlama } from '../../prices.js'
|
|
|
8
8
|
import { batchJsonRpc, equalTlc, multicall } from '../../utils.js'
|
|
9
9
|
import type { RewardsData, SdtApr } from '../types.js'
|
|
10
10
|
import { getAprBreakdown } from '../utils/getAprBreakdown.js'
|
|
11
|
-
import { Zero } from '../utils/index.js'
|
|
12
11
|
import { ANGLE_APR_URL, ANGLE_PRICE_URL } from './endpoints.js'
|
|
13
12
|
|
|
14
13
|
interface TFetchAngle {
|
|
@@ -6,13 +6,15 @@ import {
|
|
|
6
6
|
ETH_ONE_DAY_BLOCK,
|
|
7
7
|
ONE_WEEK,
|
|
8
8
|
ONE_YEAR,
|
|
9
|
+
OneEther,
|
|
9
10
|
STRAT_FEES,
|
|
11
|
+
Zero,
|
|
10
12
|
balancerStrats,
|
|
11
13
|
contracts,
|
|
12
14
|
tokenWithId,
|
|
13
15
|
} from '@stake-dao/constants'
|
|
14
16
|
import { batchBalancerStrats } from '../../bytecodes/index.js'
|
|
15
|
-
import {
|
|
17
|
+
import { concatBytecode, getBoost, getPricesFromLlama, getSdtApr } from '../../index.js'
|
|
16
18
|
import { equalTlc, graphql } from '../../utils.js'
|
|
17
19
|
import { FACTORY_EXPLORER_EVENTS } from '../curve/endpoints.js'
|
|
18
20
|
import type { BalancerGlobalData, RewardsData, Strategy, StrategyData, ValidChainId, ValidExplorer } from '../types.js'
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { chunk
|
|
1
|
+
import { chunk } from 'lodash-es'
|
|
2
2
|
import { decodeAbiParameters, encodeAbiParameters, parseAbi, parseAbiParameters } from 'viem'
|
|
3
3
|
|
|
4
|
-
import { contract
|
|
5
|
-
import type { FetchedToken
|
|
6
|
-
import { batchSdtGaugeRewards
|
|
4
|
+
import { contract } from '@stake-dao/constants'
|
|
5
|
+
import type { FetchedToken } from '@stake-dao/constants'
|
|
6
|
+
import { batchSdtGaugeRewards } from '../../bytecodes/index.js'
|
|
7
|
+
import { fetchTokensData } from '../../tokens.js'
|
|
7
8
|
import { equalTlc, getTokenInfo } from '../../utils.js'
|
|
8
9
|
import type { BuiltStrat } from '../types.js'
|
|
9
10
|
import { concatBytecode } from '../utils/index.js'
|
|
@@ -78,22 +79,7 @@ export const buildCurveStrategies = async (
|
|
|
78
79
|
.filter((s) => s.type !== 'error')
|
|
79
80
|
|
|
80
81
|
// Fetch tokens infos
|
|
81
|
-
const
|
|
82
|
-
remove(uniq(tokensToFetch), (t) => !tokens.find((token: Token) => token.address === t)),
|
|
83
|
-
40,
|
|
84
|
-
)
|
|
85
|
-
const decodedPromise = await Promise.allSettled(
|
|
86
|
-
inputArgsChunks.map(async (inputArgs) => {
|
|
87
|
-
const inputData = encodeAbiParameters(parseAbiParameters(batchTokenData.inputType || []) as any, [inputArgs])
|
|
88
|
-
const contractCreationCode = concatBytecode(batchTokenData.bytecode, inputData)
|
|
89
|
-
const returnedData = await provider.call({
|
|
90
|
-
data: contractCreationCode,
|
|
91
|
-
})
|
|
92
|
-
return decodeAbiParameters(parseAbiParameters(batchTokenData.outputTypeHr || []) as any, returnedData.data)
|
|
93
|
-
}),
|
|
94
|
-
)
|
|
95
|
-
|
|
96
|
-
const fetchedTokenData = decodedPromise.flatMap((d) => (d.status === 'fulfilled' ? d.value : [])).flat()
|
|
82
|
+
const fetchedTokenData = await fetchTokensData(provider, tokensToFetch)
|
|
97
83
|
|
|
98
84
|
// Fetch Sdt Gauge rewards tokens infos
|
|
99
85
|
const sdtGaugeInputArgsChunks = chunk(
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ONE_YEAR, tokenWithId } from '@stake-dao/constants'
|
|
1
|
+
import { ONE_YEAR, Zero, tokenWithId } from '@stake-dao/constants'
|
|
2
2
|
import { chunk, uniqBy } from 'lodash-es'
|
|
3
3
|
import { encodeAbiParameters, formatUnits, parseAbiParameters, zeroAddress } from 'viem'
|
|
4
4
|
import { mainnet } from 'viem/chains'
|
|
@@ -125,7 +125,7 @@ export const getCurveApiData = async (rpc: string, chainId: number, gaugesWeight
|
|
|
125
125
|
})
|
|
126
126
|
|
|
127
127
|
const usdTotal = coinsWithUsdBalance.reduce((total: number, x) => (total += x.usdBalance), 0)
|
|
128
|
-
const lpPriceInUsd = p.totalSupply >
|
|
128
|
+
const lpPriceInUsd = p.totalSupply > Zero ? usdTotal / Number(formatUnits(p.totalSupply, 18)) : 0
|
|
129
129
|
|
|
130
130
|
let gaugeFromPool = CUSTOM_GAUGES[p.lp] ? CUSTOM_GAUGES[p.lp] : p.gauge
|
|
131
131
|
const gaugeData = gauges.find((g) => equalTlc(g.gauge, gaugeFromPool) || equalTlc(g.lpToken, p.lp))
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { Zero } from '@stake-dao/constants'
|
|
1
2
|
import { formatUnits, parseUnits } from 'viem'
|
|
2
|
-
import { Zero } from '../../utils/index.js'
|
|
3
3
|
|
|
4
4
|
const CVX_CLIFF_SIZE = parseUnits('100000', 18) // new cliff every 100,000 tokens
|
|
5
5
|
const CVX_CLIFF_COUNT = BigInt(1000) // 1,000 cliffs
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { formatUnits } from 'viem'
|
|
2
2
|
|
|
3
|
-
import { ONE_YEAR, curveStrats, mainnet, tokenWithId } from '@stake-dao/constants'
|
|
3
|
+
import { ONE_YEAR, OneEther, Zero, curveStrats, mainnet, tokenWithId } from '@stake-dao/constants'
|
|
4
4
|
import type { Price } from '../../../prices.js'
|
|
5
5
|
import { type SdtEmissionData, getSdtApr } from '../../../sdt.js'
|
|
6
6
|
import { equalTlc } from '../../../utils.js'
|
|
@@ -15,7 +15,6 @@ import type {
|
|
|
15
15
|
import { getBoost } from '../../utils/boost.js'
|
|
16
16
|
import decodeEtherscanFactoryEvent, { decodeNewFactoryEvent } from '../../utils/decodeEtherscanFactoryEvent.js'
|
|
17
17
|
import { getAprBreakdown } from '../../utils/getAprBreakdown.js'
|
|
18
|
-
import { OneEther, Zero } from '../../utils/index.js'
|
|
19
18
|
import { buildCurveStrategies } from '../build.js'
|
|
20
19
|
import { getCurveHttpCalls } from '../httpCalls.js'
|
|
21
20
|
import { getOnChainSdCurveData } from '../onChainCalls.js'
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { GH_STAKE_DAO_VM_DATA } from '../../endpoints.js'
|
|
2
|
+
|
|
1
3
|
export const CHAINS_DENOMINATOR = {
|
|
2
4
|
1: 'ethereum',
|
|
3
5
|
56: 'bsc',
|
|
@@ -8,5 +10,4 @@ export const PANCAKESWAP_FEE_URL = (version: string, chainId: number) => {
|
|
|
8
10
|
return `https://explorer.pancakeswap.com/api/cached/pools/apr/${version}/${CHAINS_DENOMINATOR[chainId]}/farms-lp`
|
|
9
11
|
}
|
|
10
12
|
|
|
11
|
-
export const MANAGER_FEES_ENDPOINT =
|
|
12
|
-
'https://raw.githubusercontent.com/stake-dao/votemarket-data/main/tvls/pancakeManagersFees.json'
|
|
13
|
+
export const MANAGER_FEES_ENDPOINT = `${GH_STAKE_DAO_VM_DATA}/main/tvls/pancakeManagersFees.json`
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { NEW_FACTORY_EXPLORER_EVENTS } from '../../curve/endpoints.js'
|
|
2
2
|
|
|
3
3
|
import { contracts, pancakeswapErc20Strats } from '@stake-dao/constants'
|
|
4
|
+
import { GH_STAKE_DAO_VM_DATA } from '../../../endpoints.js'
|
|
4
5
|
import type { Price } from '../../../prices.js'
|
|
5
6
|
import type { ValidChainId, ValidExplorer } from '../../types.js'
|
|
6
7
|
import { getPancakeSwapFeesAPR, getPancakeSwapManagerFeesAPR } from './getPancakeApisData.js'
|
|
@@ -31,7 +32,7 @@ export const fetchPancakeswap = async ({
|
|
|
31
32
|
const [feesApr, managerFees, stakedTVLS, events] = await Promise.all([
|
|
32
33
|
getPancakeSwapFeesAPR(chainId),
|
|
33
34
|
getPancakeSwapManagerFeesAPR(chainId),
|
|
34
|
-
(await fetch(
|
|
35
|
+
(await fetch(`${GH_STAKE_DAO_VM_DATA}/main/tvls/cake.json`)).json(),
|
|
35
36
|
(
|
|
36
37
|
await fetch(
|
|
37
38
|
NEW_FACTORY_EXPLORER_EVENTS(
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { ONE_YEAR } from '@stake-dao/constants'
|
|
1
|
+
import { ONE_YEAR, One, Zero } from '@stake-dao/constants'
|
|
2
2
|
import { formatUnits, parseUnits } from 'viem'
|
|
3
|
-
import { Zero } from '../../../index.js'
|
|
4
3
|
|
|
5
4
|
const Q32 = BigInt(2 ** 32)
|
|
6
5
|
const Q96 = BigInt(2 ** 96)
|
|
@@ -79,7 +78,7 @@ function getSqrtRatioAtTick(tick: number): bigint {
|
|
|
79
78
|
if (tick > 0) ratio = MaxUint256 / ratio
|
|
80
79
|
|
|
81
80
|
// back to Q96
|
|
82
|
-
return ratio % Q32 > Zero ? ratio / Q32 +
|
|
81
|
+
return ratio % Q32 > Zero ? ratio / Q32 + One : ratio / Q32
|
|
83
82
|
}
|
|
84
83
|
|
|
85
84
|
function getAmount0Delta(sqrtRatioAX96: bigint, sqrtRatioBX96: bigint, liquidity: bigint): bigint {
|
|
@@ -2,7 +2,17 @@ import dayjs from 'dayjs'
|
|
|
2
2
|
import { chunk } from 'lodash-es'
|
|
3
3
|
import { encodeAbiParameters, formatUnits, parseAbiParameters } from 'viem'
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
ONE_YEAR,
|
|
7
|
+
OneEther,
|
|
8
|
+
STRAT_FEES,
|
|
9
|
+
Zero,
|
|
10
|
+
contract,
|
|
11
|
+
contracts,
|
|
12
|
+
mainnet,
|
|
13
|
+
pendleStrats,
|
|
14
|
+
tokenWithId,
|
|
15
|
+
} from '@stake-dao/constants'
|
|
6
16
|
import multicallPendleStratsAbi from '../../abis/pendleVaultsMulticall.js'
|
|
7
17
|
import { batchPendleStrats } from '../../bytecodes/index.js'
|
|
8
18
|
import type { Price } from '../../prices.js'
|
|
@@ -12,7 +22,7 @@ import type { RewardsData, SdtApr, ValidChainId, ValidExplorer } from '../types.
|
|
|
12
22
|
import { getBoost } from '../utils/boost.js'
|
|
13
23
|
import decodeEtherscanFactoryEvent from '../utils/decodeEtherscanFactoryEvent.js'
|
|
14
24
|
import { getAprBreakdown } from '../utils/getAprBreakdown.js'
|
|
15
|
-
import {
|
|
25
|
+
import { concatBytecode } from '../utils/index.js'
|
|
16
26
|
import { buildPendleStrategies } from './build.js'
|
|
17
27
|
import getPendleApiData from './getPendleApiData.js'
|
|
18
28
|
import pendlePoints from './pendlePoints.js'
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
import { decodeAbiParameters, fromBytes, hexToBytes, parseAbiParameters
|
|
2
|
-
|
|
3
|
-
export const Zero = BigInt(0)
|
|
4
|
-
export const One = BigInt(1)
|
|
5
|
-
export const OneEther = parseEther('1')
|
|
1
|
+
import { decodeAbiParameters, fromBytes, hexToBytes, parseAbiParameters } from 'viem'
|
|
6
2
|
|
|
7
3
|
export const bytes32ToString = (bytes32: `0x${string}`) => {
|
|
8
4
|
try {
|