@stake-dao/reader 0.4.111 → 0.5.0
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/abis/lockersMulticall.js +30 -2
- package/dist/esm/abis/lockersMulticall.js.map +1 -1
- package/dist/esm/index.js +2 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/lockers/fetch/index.js +53 -224
- package/dist/esm/lockers/fetch/index.js.map +1 -1
- package/dist/esm/lockers/fetch/parse.js +174 -0
- package/dist/esm/lockers/fetch/parse.js.map +1 -0
- package/dist/esm/lockers/fetch/protocols/angle.js +136 -0
- package/dist/esm/lockers/fetch/protocols/angle.js.map +1 -0
- package/dist/esm/lockers/fetch/protocols/balancer.js +172 -0
- package/dist/esm/lockers/fetch/protocols/balancer.js.map +1 -0
- package/dist/esm/lockers/fetch/protocols/blackpool.js +130 -0
- package/dist/esm/lockers/fetch/protocols/blackpool.js.map +1 -0
- package/dist/esm/lockers/fetch/protocols/curve.js +204 -0
- package/dist/esm/lockers/fetch/protocols/curve.js.map +1 -0
- package/dist/esm/lockers/fetch/protocols/frax-fpis.js +121 -0
- package/dist/esm/lockers/fetch/protocols/frax-fpis.js.map +1 -0
- package/dist/esm/lockers/fetch/protocols/frax-fxs.js +169 -0
- package/dist/esm/lockers/fetch/protocols/frax-fxs.js.map +1 -0
- package/dist/esm/lockers/fetch/protocols/fxn.js +131 -0
- package/dist/esm/lockers/fetch/protocols/fxn.js.map +1 -0
- package/dist/esm/lockers/fetch/protocols/maverick.js +172 -0
- package/dist/esm/lockers/fetch/protocols/maverick.js.map +1 -0
- package/dist/esm/lockers/fetch/protocols/pancakeswap.js +128 -0
- package/dist/esm/lockers/fetch/protocols/pancakeswap.js.map +1 -0
- package/dist/esm/lockers/fetch/protocols/pendle.js +144 -0
- package/dist/esm/lockers/fetch/protocols/pendle.js.map +1 -0
- package/dist/esm/lockers/fetch/protocols/spectra.js +133 -0
- package/dist/esm/lockers/fetch/protocols/spectra.js.map +1 -0
- package/dist/esm/lockers/fetch/protocols/yearn.js +138 -0
- package/dist/esm/lockers/fetch/protocols/yearn.js.map +1 -0
- package/dist/esm/lockers/fetch/protocols/yieldbasis.js +131 -0
- package/dist/esm/lockers/fetch/protocols/yieldbasis.js.map +1 -0
- package/dist/esm/lockers/fetch/protocols/yieldnest.js +135 -0
- package/dist/esm/lockers/fetch/protocols/yieldnest.js.map +1 -0
- package/dist/esm/lockers/fetch/protocols/zerolend.js +124 -0
- package/dist/esm/lockers/fetch/protocols/zerolend.js.map +1 -0
- package/dist/esm/lockers/fetch/static.js +33 -0
- package/dist/esm/lockers/fetch/static.js.map +1 -0
- package/dist/esm/lockers/fetch/types.js +2 -0
- package/dist/esm/lockers/fetch/types.js.map +1 -0
- package/dist/esm/lockers/utils/callsForLockers/pegCalls.js.map +1 -1
- package/dist/esm/lockers/utils/getBribesRewardsData.js +11 -9
- package/dist/esm/lockers/utils/getBribesRewardsData.js.map +1 -1
- package/dist/esm/lockers/utils/substractFees.js +1 -2
- package/dist/esm/lockers/utils/substractFees.js.map +1 -1
- package/dist/esm/strategies/curve/fetch/getOnlyboostData.js +8 -3
- package/dist/esm/strategies/curve/fetch/getOnlyboostData.js.map +1 -1
- package/dist/esm/strategies/curve/fetch/index.js +1 -1
- package/dist/esm/strategies/curve/fetch/index.js.map +1 -1
- package/dist/esm/strategies/v2/parse.js +6 -4
- package/dist/esm/strategies/v2/parse.js.map +1 -1
- package/dist/esm/utils.js +5 -0
- package/dist/esm/utils.js.map +1 -1
- package/dist/types/abis/lockersMulticall.d.ts +1 -1
- package/dist/types/abis/lockersMulticall.d.ts.map +1 -1
- package/dist/types/index.d.ts +2 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/lockers/fetch/index.d.ts +5 -99
- package/dist/types/lockers/fetch/index.d.ts.map +1 -1
- package/dist/types/lockers/fetch/parse.d.ts +52 -0
- package/dist/types/lockers/fetch/parse.d.ts.map +1 -0
- package/dist/types/lockers/fetch/protocols/angle.d.ts +9 -0
- package/dist/types/lockers/fetch/protocols/angle.d.ts.map +1 -0
- package/dist/types/lockers/fetch/protocols/balancer.d.ts +9 -0
- package/dist/types/lockers/fetch/protocols/balancer.d.ts.map +1 -0
- package/dist/types/lockers/fetch/protocols/blackpool.d.ts +9 -0
- package/dist/types/lockers/fetch/protocols/blackpool.d.ts.map +1 -0
- package/dist/types/lockers/fetch/protocols/curve.d.ts +9 -0
- package/dist/types/lockers/fetch/protocols/curve.d.ts.map +1 -0
- package/dist/types/lockers/fetch/protocols/frax-fpis.d.ts +9 -0
- package/dist/types/lockers/fetch/protocols/frax-fpis.d.ts.map +1 -0
- package/dist/types/lockers/fetch/protocols/frax-fxs.d.ts +9 -0
- package/dist/types/lockers/fetch/protocols/frax-fxs.d.ts.map +1 -0
- package/dist/types/lockers/fetch/protocols/fxn.d.ts +9 -0
- package/dist/types/lockers/fetch/protocols/fxn.d.ts.map +1 -0
- package/dist/types/lockers/fetch/protocols/maverick.d.ts +9 -0
- package/dist/types/lockers/fetch/protocols/maverick.d.ts.map +1 -0
- package/dist/types/lockers/fetch/protocols/pancakeswap.d.ts +9 -0
- package/dist/types/lockers/fetch/protocols/pancakeswap.d.ts.map +1 -0
- package/dist/types/lockers/fetch/protocols/pendle.d.ts +9 -0
- package/dist/types/lockers/fetch/protocols/pendle.d.ts.map +1 -0
- package/dist/types/lockers/fetch/protocols/spectra.d.ts +9 -0
- package/dist/types/lockers/fetch/protocols/spectra.d.ts.map +1 -0
- package/dist/types/lockers/fetch/protocols/yearn.d.ts +9 -0
- package/dist/types/lockers/fetch/protocols/yearn.d.ts.map +1 -0
- package/dist/types/lockers/fetch/protocols/yieldbasis.d.ts +9 -0
- package/dist/types/lockers/fetch/protocols/yieldbasis.d.ts.map +1 -0
- package/dist/types/lockers/fetch/protocols/yieldnest.d.ts +9 -0
- package/dist/types/lockers/fetch/protocols/yieldnest.d.ts.map +1 -0
- package/dist/types/lockers/fetch/protocols/zerolend.d.ts +9 -0
- package/dist/types/lockers/fetch/protocols/zerolend.d.ts.map +1 -0
- package/dist/types/lockers/fetch/static.d.ts +3 -0
- package/dist/types/lockers/fetch/static.d.ts.map +1 -0
- package/dist/types/lockers/fetch/types.d.ts +105 -0
- package/dist/types/lockers/fetch/types.d.ts.map +1 -0
- package/dist/types/lockers/utils/callsForLockers/pegCalls.d.ts +1 -1
- package/dist/types/lockers/utils/callsForLockers/pegCalls.d.ts.map +1 -1
- package/dist/types/lockers/utils/getBribesRewardsData.d.ts +1 -0
- package/dist/types/lockers/utils/getBribesRewardsData.d.ts.map +1 -1
- package/dist/types/lockers/utils/substractFees.d.ts.map +1 -1
- package/dist/types/strategies/curve/fetch/getOnlyboostData.d.ts +1 -1
- package/dist/types/strategies/curve/fetch/getOnlyboostData.d.ts.map +1 -1
- package/dist/types/strategies/curve/fetch/index.d.ts.map +1 -1
- package/dist/types/strategies/stakeDao/fetch.d.ts +1 -1
- package/dist/types/strategies/v2/parse.d.ts.map +1 -1
- package/dist/types/utils.d.ts +1 -0
- package/dist/types/utils.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/abis/lockersMulticall.ts +30 -2
- package/src/index.ts +2 -1
- package/src/lockers/fetch/index.ts +65 -329
- package/src/lockers/fetch/parse.ts +258 -0
- package/src/lockers/fetch/protocols/angle.ts +157 -0
- package/src/lockers/fetch/protocols/balancer.ts +195 -0
- package/src/lockers/fetch/protocols/blackpool.ts +151 -0
- package/src/lockers/fetch/protocols/curve.ts +229 -0
- package/src/lockers/fetch/protocols/frax-fpis.ts +139 -0
- package/src/lockers/fetch/protocols/frax-fxs.ts +193 -0
- package/src/lockers/fetch/protocols/fxn.ts +152 -0
- package/src/lockers/fetch/protocols/maverick.ts +193 -0
- package/src/lockers/fetch/protocols/pancakeswap.ts +149 -0
- package/src/lockers/fetch/protocols/pendle.ts +165 -0
- package/src/lockers/fetch/protocols/spectra.ts +154 -0
- package/src/lockers/fetch/protocols/yearn.ts +159 -0
- package/src/lockers/fetch/protocols/yieldbasis.ts +152 -0
- package/src/lockers/fetch/protocols/yieldnest.ts +157 -0
- package/src/lockers/fetch/protocols/zerolend.ts +144 -0
- package/src/lockers/fetch/static.ts +35 -0
- package/src/lockers/fetch/types.ts +112 -0
- package/src/lockers/utils/callsForLockers/pegCalls.ts +2 -1
- package/src/lockers/utils/getBribesRewardsData.ts +12 -11
- package/src/lockers/utils/substractFees.ts +1 -2
- package/src/strategies/curve/fetch/getOnlyboostData.ts +11 -2
- package/src/strategies/curve/fetch/index.ts +2 -0
- package/src/strategies/v2/parse.ts +11 -5
- package/src/utils.ts +5 -0
- package/dist/esm/lockers/fetch/parseBoost.js +0 -36
- package/dist/esm/lockers/fetch/parseBoost.js.map +0 -1
- package/dist/esm/lockers/fetch/parsePeg.js +0 -18
- package/dist/esm/lockers/fetch/parsePeg.js.map +0 -1
- package/dist/esm/lockers/fetch/parseVoteBoosterData.js +0 -28
- package/dist/esm/lockers/fetch/parseVoteBoosterData.js.map +0 -1
- package/dist/esm/lockers/utils/callsForLockers/depositorCalls.js +0 -24
- package/dist/esm/lockers/utils/callsForLockers/depositorCalls.js.map +0 -1
- package/dist/esm/lockers/utils/callsForLockers/feeCalls.js +0 -97
- package/dist/esm/lockers/utils/callsForLockers/feeCalls.js.map +0 -1
- package/dist/esm/lockers/utils/callsForLockers/gaugeCalls.js +0 -9
- package/dist/esm/lockers/utils/callsForLockers/gaugeCalls.js.map +0 -1
- package/dist/esm/lockers/utils/callsForLockers/index.js +0 -34
- package/dist/esm/lockers/utils/callsForLockers/index.js.map +0 -1
- package/dist/esm/lockers/utils/callsForLockers/veBoosts.js +0 -17
- package/dist/esm/lockers/utils/callsForLockers/veBoosts.js.map +0 -1
- package/dist/esm/lockers/utils/callsForLockers/veCalls.js +0 -33
- package/dist/esm/lockers/utils/callsForLockers/veCalls.js.map +0 -1
- package/dist/esm/lockers/utils/callsForLockers/veSdtCalls.js +0 -14
- package/dist/esm/lockers/utils/callsForLockers/veSdtCalls.js.map +0 -1
- package/dist/esm/lockers/utils/getFees.js +0 -27
- package/dist/esm/lockers/utils/getFees.js.map +0 -1
- package/dist/types/lockers/fetch/parseBoost.d.ts +0 -4
- package/dist/types/lockers/fetch/parseBoost.d.ts.map +0 -1
- package/dist/types/lockers/fetch/parsePeg.d.ts +0 -3
- package/dist/types/lockers/fetch/parsePeg.d.ts.map +0 -1
- package/dist/types/lockers/fetch/parseVoteBoosterData.d.ts +0 -13
- package/dist/types/lockers/fetch/parseVoteBoosterData.d.ts.map +0 -1
- package/dist/types/lockers/utils/callsForLockers/depositorCalls.d.ts +0 -4
- package/dist/types/lockers/utils/callsForLockers/depositorCalls.d.ts.map +0 -1
- package/dist/types/lockers/utils/callsForLockers/feeCalls.d.ts +0 -13
- package/dist/types/lockers/utils/callsForLockers/feeCalls.d.ts.map +0 -1
- package/dist/types/lockers/utils/callsForLockers/gaugeCalls.d.ts +0 -6
- package/dist/types/lockers/utils/callsForLockers/gaugeCalls.d.ts.map +0 -1
- package/dist/types/lockers/utils/callsForLockers/index.d.ts +0 -8
- package/dist/types/lockers/utils/callsForLockers/index.d.ts.map +0 -1
- package/dist/types/lockers/utils/callsForLockers/veBoosts.d.ts +0 -7
- package/dist/types/lockers/utils/callsForLockers/veBoosts.d.ts.map +0 -1
- package/dist/types/lockers/utils/callsForLockers/veCalls.d.ts +0 -4
- package/dist/types/lockers/utils/callsForLockers/veCalls.d.ts.map +0 -1
- package/dist/types/lockers/utils/callsForLockers/veSdtCalls.d.ts +0 -11
- package/dist/types/lockers/utils/callsForLockers/veSdtCalls.d.ts.map +0 -1
- package/dist/types/lockers/utils/getFees.d.ts +0 -4
- package/dist/types/lockers/utils/getFees.d.ts.map +0 -1
- package/src/lockers/fetch/parseBoost.ts +0 -46
- package/src/lockers/fetch/parsePeg.ts +0 -22
- package/src/lockers/fetch/parseVoteBoosterData.ts +0 -34
- package/src/lockers/utils/callsForLockers/depositorCalls.ts +0 -30
- package/src/lockers/utils/callsForLockers/feeCalls.ts +0 -124
- package/src/lockers/utils/callsForLockers/gaugeCalls.ts +0 -10
- package/src/lockers/utils/callsForLockers/index.ts +0 -51
- package/src/lockers/utils/callsForLockers/veBoosts.ts +0 -28
- package/src/lockers/utils/callsForLockers/veCalls.ts +0 -44
- package/src/lockers/utils/callsForLockers/veSdtCalls.ts +0 -15
- package/src/lockers/utils/getFees.ts +0 -31
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import { One, STAKE_DAO_ASSETS_BASE_URL, Zero, tokenWithId } from '@stake-dao/constants'
|
|
2
|
+
import { formatUnits, parseUnits } from 'viem'
|
|
3
|
+
import lockersMulticallAbi from '../../../abis/lockersMulticall.js'
|
|
4
|
+
import { type Call, getRes, multicall } from '../../../utils.js'
|
|
5
|
+
import { parse, parsePeg } from '../parse.js'
|
|
6
|
+
import type { Locker } from '../types.js'
|
|
7
|
+
|
|
8
|
+
export const locker: Locker = {
|
|
9
|
+
id: 'pendle',
|
|
10
|
+
symbol: 'PENDLE',
|
|
11
|
+
protocol: 'Pendle',
|
|
12
|
+
protocolDescription:
|
|
13
|
+
'Pendle is a permissionless yield-trading protocol where users can execute various yield-management strategies.',
|
|
14
|
+
website: 'https://pendle.finance/',
|
|
15
|
+
logoUrl: `${STAKE_DAO_ASSETS_BASE_URL}/assets/archive/pendle.svg`,
|
|
16
|
+
chainId: 1,
|
|
17
|
+
rgb: '21, 46, 81',
|
|
18
|
+
token: tokenWithId('pendle')!,
|
|
19
|
+
sdToken: tokenWithId('sdpendle')!,
|
|
20
|
+
rewards: [
|
|
21
|
+
{ ...tokenWithId('sdt')!, distribution: 'streamed', origin: 'sdtEmission' },
|
|
22
|
+
{ ...tokenWithId('pendle')!, distribution: 'streamed', origin: 'stratPerf' },
|
|
23
|
+
{ ...tokenWithId('weth')!, distribution: 'streamed', origin: 'native.common' },
|
|
24
|
+
{ ...tokenWithId('usdt')!, distribution: 'streamed', origin: 'native.common' },
|
|
25
|
+
{ ...tokenWithId('sdpendle')!, distribution: 'streamed', origin: 'native.common' },
|
|
26
|
+
{ ...tokenWithId('sdpendle')!, distribution: 'distributed', origin: 'bounties' },
|
|
27
|
+
],
|
|
28
|
+
delegation: ['sdpendle.eth'],
|
|
29
|
+
modules: {
|
|
30
|
+
depositor: '0x7F5c485D24fB1832A14f122C8722ef15C158Acb5',
|
|
31
|
+
locker: '0xD8fa8dC5aDeC503AcC5e026a98F32Ca5C1Fa289A',
|
|
32
|
+
veToken: '0x4f30A9D41B80ecC5B94306AB4364951AE3170210',
|
|
33
|
+
gauge: '0x50DC9aE51f78C593d4138263da7088A973b8184E',
|
|
34
|
+
accumulator: '0x65682CB35C8DEa1d3027CD37F37a245356BC4526',
|
|
35
|
+
},
|
|
36
|
+
secondaryMarket: {
|
|
37
|
+
label: 'Curve',
|
|
38
|
+
poolKey: 'factory-v2-306',
|
|
39
|
+
vaultKey: '',
|
|
40
|
+
pool: '0x26f3f26F46cBeE59d1F8860865e13Aa39e36A8c0',
|
|
41
|
+
pools: ['0x26f3f26F46cBeE59d1F8860865e13Aa39e36A8c0'],
|
|
42
|
+
pegBase: 2000,
|
|
43
|
+
},
|
|
44
|
+
fees: [
|
|
45
|
+
{
|
|
46
|
+
label: { key: 'liquidity', variable: 'sdPENDLE/PENDLE' },
|
|
47
|
+
value: 10,
|
|
48
|
+
key: 'liquidityFee',
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
label: { key: 'treasuryOn', variable: 'PENDLE, WETH' },
|
|
52
|
+
value: 5,
|
|
53
|
+
key: 'daoFee',
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
label: {
|
|
57
|
+
key: 'harvesterOn',
|
|
58
|
+
variable: 'PENDLE, WETH',
|
|
59
|
+
},
|
|
60
|
+
value: 0.1,
|
|
61
|
+
key: 'claimerFee',
|
|
62
|
+
},
|
|
63
|
+
],
|
|
64
|
+
extensions: {
|
|
65
|
+
coingeckoBaseSlug: 'pendle',
|
|
66
|
+
},
|
|
67
|
+
alternativeYields: {
|
|
68
|
+
aSdPendleConcentrator: {
|
|
69
|
+
label: 'asdPENDLE',
|
|
70
|
+
platform: 'Concentrator',
|
|
71
|
+
href: 'https://concentrator.aladdin.club/',
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
const pendleLocker = async ({ provider, common, prices }: { provider; common; prices }) => {
|
|
77
|
+
const token = locker.token.address
|
|
78
|
+
const sdToken = locker.sdToken.address
|
|
79
|
+
|
|
80
|
+
const gauge = locker.modules.gauge
|
|
81
|
+
const depositor = locker.modules.depositor
|
|
82
|
+
const votingEscrow = locker.modules.veToken
|
|
83
|
+
const lockerAddress = locker.modules.locker
|
|
84
|
+
|
|
85
|
+
const secondaryMarket = locker.secondaryMarket!
|
|
86
|
+
const rewards = locker.rewards
|
|
87
|
+
|
|
88
|
+
const pegBase = parseUnits(secondaryMarket?.pegBase?.toString() || '1', 18)
|
|
89
|
+
|
|
90
|
+
const format = (value: bigint) => formatUnits(value, locker.token.decimals)
|
|
91
|
+
const formatRes = (value: any) => format(getRes(value))
|
|
92
|
+
|
|
93
|
+
const calls: Call[] = [
|
|
94
|
+
/*********************************************************************************
|
|
95
|
+
*** Voting Escrow
|
|
96
|
+
*********************************************************************************/
|
|
97
|
+
|
|
98
|
+
// Token locked by the Locker
|
|
99
|
+
{ address: votingEscrow, name: 'positionData', params: [lockerAddress] },
|
|
100
|
+
// veToken Balance of the Locker
|
|
101
|
+
{ address: votingEscrow, name: 'balanceOf', params: [lockerAddress] },
|
|
102
|
+
// Total token locked
|
|
103
|
+
{ address: token, name: 'balanceOf', params: [votingEscrow] },
|
|
104
|
+
// Total veToken supply
|
|
105
|
+
{ address: votingEscrow, name: 'totalSupplyStored' },
|
|
106
|
+
|
|
107
|
+
/*********************************************************************************
|
|
108
|
+
*** Gauge
|
|
109
|
+
*********************************************************************************/
|
|
110
|
+
|
|
111
|
+
// Total sdToken staked
|
|
112
|
+
{ address: gauge, name: 'totalSupply' },
|
|
113
|
+
// Gauge working supply
|
|
114
|
+
{ address: gauge, name: 'working_supply' },
|
|
115
|
+
|
|
116
|
+
/*********************************************************************************
|
|
117
|
+
*** Token & sdToken
|
|
118
|
+
*********************************************************************************/
|
|
119
|
+
|
|
120
|
+
// Token balance not locked
|
|
121
|
+
{ address: token, name: 'balanceOf', params: [depositor] },
|
|
122
|
+
// sdToken in secondary market pool
|
|
123
|
+
{ address: sdToken, name: 'balanceOf', params: [secondaryMarket.pool] },
|
|
124
|
+
|
|
125
|
+
/*********************************************************************************
|
|
126
|
+
*** Peg
|
|
127
|
+
*********************************************************************************/
|
|
128
|
+
|
|
129
|
+
// Return amount when swapping {pegBase} sdToken to token -> get_dy(int128,int128,uint256)
|
|
130
|
+
{ address: secondaryMarket.pool, name: '0x5e0d443f', params: [One, Zero, pegBase] },
|
|
131
|
+
|
|
132
|
+
/*********************************************************************************
|
|
133
|
+
*** Rewards
|
|
134
|
+
*********************************************************************************/
|
|
135
|
+
|
|
136
|
+
// Streaming status for each reward token
|
|
137
|
+
...rewards.map((r) => ({ address: gauge, name: 'reward_data', params: [r.address] })),
|
|
138
|
+
]
|
|
139
|
+
|
|
140
|
+
const res = await multicall(provider, calls, lockersMulticallAbi(locker.id, locker.chainId))
|
|
141
|
+
const raw = {
|
|
142
|
+
tokenLocked: getRes(res.shift()),
|
|
143
|
+
veBalanceOfLocker: formatRes(res.shift()),
|
|
144
|
+
totalTokenLocked: formatRes(res.shift()),
|
|
145
|
+
veTotalSupply: formatRes(res.shift()),
|
|
146
|
+
totalSupplyStaked: formatRes(res.shift()),
|
|
147
|
+
gaugeWorkingSupply: formatRes(res.shift()),
|
|
148
|
+
amountTokenNotLock: formatRes(res.shift()),
|
|
149
|
+
sdTokenInPool: formatRes(res.shift()),
|
|
150
|
+
peg: getRes(res.shift()),
|
|
151
|
+
rewards: rewards.map(() => getRes(res.shift())),
|
|
152
|
+
veTokenRate: '4',
|
|
153
|
+
_workingSupply: '0',
|
|
154
|
+
_veBalanceOfLocker: '0',
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
raw.tokenLocked = format(raw.tokenLocked[0])
|
|
158
|
+
raw.peg = parsePeg(locker, raw.peg)
|
|
159
|
+
raw._workingSupply = raw.gaugeWorkingSupply
|
|
160
|
+
raw._veBalanceOfLocker = raw.veBalanceOfLocker
|
|
161
|
+
|
|
162
|
+
return parse({ locker, common, prices, raw })
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
export default pendleLocker
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { One, STAKE_DAO_ASSETS_BASE_URL, Zero, tokenWithId } from '@stake-dao/constants'
|
|
2
|
+
import { formatUnits, parseUnits } from 'viem'
|
|
3
|
+
import lockersMulticallAbi from '../../../abis/lockersMulticall.js'
|
|
4
|
+
import { STAKE_DAO_API } from '../../../endpoints.js'
|
|
5
|
+
import { type Call, getRes, multicall } from '../../../utils.js'
|
|
6
|
+
import { parse, parsePeg } from '../parse.js'
|
|
7
|
+
import type { Locker } from '../types.js'
|
|
8
|
+
|
|
9
|
+
export const locker: Locker = {
|
|
10
|
+
id: 'spectra',
|
|
11
|
+
symbol: 'SPECTRA',
|
|
12
|
+
protocol: 'Spectra',
|
|
13
|
+
protocolDescription: 'Spectra is the first protocol for future yield tokenisation.',
|
|
14
|
+
website: 'https://www.spectra.finance/',
|
|
15
|
+
logoUrl: `${STAKE_DAO_ASSETS_BASE_URL}/assets/archive/apw.svg`,
|
|
16
|
+
chainId: 8453,
|
|
17
|
+
rgb: '5, 211, 149',
|
|
18
|
+
token: tokenWithId('spectra', 8453)!,
|
|
19
|
+
sdToken: tokenWithId('sdspectra', 8453)!,
|
|
20
|
+
rewards: [
|
|
21
|
+
{ ...tokenWithId('sdspectra', 8453)!, distribution: 'streamed', origin: 'native.rebasing' },
|
|
22
|
+
{ ...tokenWithId('sdspectra', 8453)!, distribution: 'distributed', origin: 'bounties' },
|
|
23
|
+
],
|
|
24
|
+
delegation: ['sdspectra.eth'],
|
|
25
|
+
modules: {
|
|
26
|
+
depositor: '0x9A7B5505c91b1add06188C665B588D4CC5227F27',
|
|
27
|
+
locker: '0xC0295F271c4fD531d436F55b0ceF4Cc316188046',
|
|
28
|
+
veToken: '0x6a89228055C7C28430692E342F149f37462B478B',
|
|
29
|
+
gauge: '0xeFd0248D2C05075815e0c38f0Bd9C1645706DF3F',
|
|
30
|
+
accumulator: '0x8E18cbfceBC24800170108D57AbC1AF2459548a5',
|
|
31
|
+
veNFT: '0x6a89228055C7C28430692E342F149f37462B478B',
|
|
32
|
+
},
|
|
33
|
+
secondaryMarket: {
|
|
34
|
+
label: 'Curve',
|
|
35
|
+
poolKey: 'factory-stable-ng-270',
|
|
36
|
+
vaultKey: '8453-0xa995984f70422b6Cac6927461F96555550C98CaF',
|
|
37
|
+
pool: '0x02D55aF4813a3a6826Ef185935E4FC1dEfA45FB0',
|
|
38
|
+
pools: ['0x02D55aF4813a3a6826Ef185935E4FC1dEfA45FB0'],
|
|
39
|
+
pegBase: 5000,
|
|
40
|
+
},
|
|
41
|
+
alternativeYields: {
|
|
42
|
+
sdSpectraSpectraStakeDao: {
|
|
43
|
+
label: 'sdSPECTRA/SPECTRA',
|
|
44
|
+
platform: 'Stake DAO',
|
|
45
|
+
href: '/yield?search=0xa995984f70422b6Cac6927461F96555550C98CaF',
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
fees: [
|
|
49
|
+
{
|
|
50
|
+
label: { key: 'liquidity', variable: 'sdSPECTRA/SPECTRA' },
|
|
51
|
+
value: 10,
|
|
52
|
+
key: 'liquidityFee',
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
label: { key: 'treasury' },
|
|
56
|
+
value: 5,
|
|
57
|
+
key: 'daoFee',
|
|
58
|
+
},
|
|
59
|
+
],
|
|
60
|
+
extensions: {
|
|
61
|
+
coingeckoBaseSlug: 'apwine',
|
|
62
|
+
},
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const spectraLocker = async ({ provider, common, prices }: { provider; common; prices }) => {
|
|
66
|
+
const token = locker.token.address
|
|
67
|
+
const sdToken = locker.sdToken.address
|
|
68
|
+
|
|
69
|
+
const gauge = locker.modules.gauge
|
|
70
|
+
const depositor = locker.modules.depositor
|
|
71
|
+
const votingEscrow = locker.modules.veToken
|
|
72
|
+
|
|
73
|
+
const secondaryMarket = locker.secondaryMarket!
|
|
74
|
+
const rewards = locker.rewards
|
|
75
|
+
|
|
76
|
+
const pegBase = parseUnits(secondaryMarket?.pegBase?.toString() || '1', 18)
|
|
77
|
+
|
|
78
|
+
const format = (value: bigint) => formatUnits(value, locker.token.decimals)
|
|
79
|
+
const formatRes = (value: any) => format(getRes(value))
|
|
80
|
+
|
|
81
|
+
const calls: Call[] = [
|
|
82
|
+
/*********************************************************************************
|
|
83
|
+
*** Voting Escrow
|
|
84
|
+
*********************************************************************************/
|
|
85
|
+
|
|
86
|
+
// Token locked by the Locker
|
|
87
|
+
{ address: votingEscrow, name: 'locked', params: [1263] },
|
|
88
|
+
// Total token locked
|
|
89
|
+
{ address: votingEscrow, name: 'supply' },
|
|
90
|
+
// Total veToken supply
|
|
91
|
+
{ address: votingEscrow, name: 'totalSupply' },
|
|
92
|
+
|
|
93
|
+
/*********************************************************************************
|
|
94
|
+
*** Gauge
|
|
95
|
+
*********************************************************************************/
|
|
96
|
+
|
|
97
|
+
// Total sdToken staked
|
|
98
|
+
{ address: gauge, name: 'totalSupply' },
|
|
99
|
+
|
|
100
|
+
/*********************************************************************************
|
|
101
|
+
*** Token & sdToken
|
|
102
|
+
*********************************************************************************/
|
|
103
|
+
|
|
104
|
+
// Token balance not locked
|
|
105
|
+
{ address: token, name: 'balanceOf', params: [depositor] },
|
|
106
|
+
// sdToken in secondary market pool
|
|
107
|
+
{ address: sdToken, name: 'balanceOf', params: [secondaryMarket.pool] },
|
|
108
|
+
|
|
109
|
+
/*********************************************************************************
|
|
110
|
+
*** Peg
|
|
111
|
+
*********************************************************************************/
|
|
112
|
+
|
|
113
|
+
// Return amount when swapping {pegBase} sdToken to token -> get_dy(int128,int128,uint256)
|
|
114
|
+
{ address: secondaryMarket.pool, name: '0x5e0d443f', params: [One, Zero, pegBase] },
|
|
115
|
+
|
|
116
|
+
/*********************************************************************************
|
|
117
|
+
*** Rewards
|
|
118
|
+
*********************************************************************************/
|
|
119
|
+
|
|
120
|
+
// Streaming status for each reward token
|
|
121
|
+
...rewards.map((r) => ({ address: gauge, name: 'reward_data', params: [r.address] })),
|
|
122
|
+
]
|
|
123
|
+
|
|
124
|
+
const [res, sdspectraData] = await Promise.all([
|
|
125
|
+
multicall(provider, calls, lockersMulticallAbi(locker.id, locker.chainId)),
|
|
126
|
+
fetch(`${STAKE_DAO_API}/main/api/lockers/sdspectra-working-supply.json`).then((res) => res.json()),
|
|
127
|
+
])
|
|
128
|
+
|
|
129
|
+
const raw = {
|
|
130
|
+
tokenLocked: getRes(res.shift()),
|
|
131
|
+
veBalanceOfLocker: '0',
|
|
132
|
+
totalTokenLocked: formatRes(res.shift()),
|
|
133
|
+
veTotalSupply: formatRes(res.shift()),
|
|
134
|
+
totalSupplyStaked: formatRes(res.shift()),
|
|
135
|
+
gaugeWorkingSupply: '0',
|
|
136
|
+
amountTokenNotLock: formatRes(res.shift()),
|
|
137
|
+
sdTokenInPool: formatRes(res.shift()),
|
|
138
|
+
peg: getRes(res.shift()),
|
|
139
|
+
rewards: rewards.map(() => getRes(res.shift())),
|
|
140
|
+
veTokenRate: '4',
|
|
141
|
+
_workingSupply: sdspectraData.working_supply.toString(),
|
|
142
|
+
_veBalanceOfLocker: '0',
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
raw.tokenLocked = format(raw.tokenLocked[0])
|
|
146
|
+
raw.veBalanceOfLocker = raw.tokenLocked
|
|
147
|
+
raw.gaugeWorkingSupply = raw.totalSupplyStaked
|
|
148
|
+
raw.peg = parsePeg(locker, raw.peg)
|
|
149
|
+
raw._veBalanceOfLocker = raw.veBalanceOfLocker
|
|
150
|
+
|
|
151
|
+
return parse({ locker, common, prices, raw })
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
export default spectraLocker
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { One, STAKE_DAO_ASSETS_BASE_URL, Zero, tokenWithId } from '@stake-dao/constants'
|
|
2
|
+
import { formatUnits, parseUnits } from 'viem'
|
|
3
|
+
import lockersMulticallAbi from '../../../abis/lockersMulticall.js'
|
|
4
|
+
import { type Call, getRes, multicall } from '../../../utils.js'
|
|
5
|
+
import { parse, parsePeg } from '../parse.js'
|
|
6
|
+
import type { Locker } from '../types.js'
|
|
7
|
+
|
|
8
|
+
export const locker: Locker = {
|
|
9
|
+
id: 'yfi',
|
|
10
|
+
symbol: 'YFI',
|
|
11
|
+
protocol: 'Yearn',
|
|
12
|
+
protocolDescription:
|
|
13
|
+
'Yearn Finance is a DeFi’s yield aggregator. Giving individuals, DAOs and other protocols a way to deposit digital assets and receive yield.',
|
|
14
|
+
website: 'https://yearn.finance/',
|
|
15
|
+
logoUrl: `${STAKE_DAO_ASSETS_BASE_URL}/assets/archive/yfi.svg`,
|
|
16
|
+
chainId: 1,
|
|
17
|
+
rgb: '4, 84, 252',
|
|
18
|
+
token: tokenWithId('yfi')!,
|
|
19
|
+
sdToken: tokenWithId('sdyfi')!,
|
|
20
|
+
rewards: [
|
|
21
|
+
{ ...tokenWithId('sdt')!, distribution: 'streamed', origin: 'sdtEmission' },
|
|
22
|
+
{ ...tokenWithId('yfi')!, distribution: 'streamed', origin: 'native.yearnPenalty' },
|
|
23
|
+
{ ...tokenWithId('dyfi')!, distribution: 'streamed', origin: 'native.yearn' },
|
|
24
|
+
],
|
|
25
|
+
delegation: ['sdyfi.eth'],
|
|
26
|
+
modules: {
|
|
27
|
+
depositor: '0xf908C0281f4bAfbca67e490edae816B8472608C8',
|
|
28
|
+
locker: '0xF750162fD81F9a436d74d737EF6eE8FC08e98220',
|
|
29
|
+
veToken: '0x90c1f9220d90d3966FbeE24045EDd73E1d588aD5',
|
|
30
|
+
gauge: '0x5AdF559f5D24aaCbE4FA3A3a4f44Fdc7431E6b52',
|
|
31
|
+
accumulator: '0xc74c0E02cbca62045C3a0375D31dAA40e49eE75B',
|
|
32
|
+
},
|
|
33
|
+
secondaryMarket: {
|
|
34
|
+
label: 'Curve',
|
|
35
|
+
poolKey: 'factory-v2-302',
|
|
36
|
+
vaultKey: '1-0xc7E1b27C836f78f6a10E416a30dd18e033E3Ec33',
|
|
37
|
+
pool: '0x852b90239c5034b5bb7a5e54ef1bef3ce3359cc8',
|
|
38
|
+
pools: ['0x852b90239c5034b5bb7a5e54ef1bef3ce3359cc8'],
|
|
39
|
+
pegBase: 2,
|
|
40
|
+
},
|
|
41
|
+
alternativeYields: {
|
|
42
|
+
sdYfiYfiStakeDao: {
|
|
43
|
+
label: 'sdYFI/YFI',
|
|
44
|
+
platform: 'Stake DAO',
|
|
45
|
+
href: '/yield?search=0xc7E1b27C836f78f6a10E416a30dd18e033E3Ec33',
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
fees: [
|
|
49
|
+
{
|
|
50
|
+
label: { key: 'liquidity', variable: 'sdYFI/YFI' },
|
|
51
|
+
value: 10,
|
|
52
|
+
key: 'liquidityFee',
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
label: { key: 'treasury' },
|
|
56
|
+
value: 5,
|
|
57
|
+
key: 'daoFee',
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
label: { key: 'harvester' },
|
|
61
|
+
value: 0.5,
|
|
62
|
+
key: 'claimerFee',
|
|
63
|
+
},
|
|
64
|
+
],
|
|
65
|
+
extensions: {
|
|
66
|
+
coingeckoBaseSlug: 'yearn-finance',
|
|
67
|
+
},
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const yearnLocker = async ({ provider, common, prices }: { provider; common; prices }) => {
|
|
71
|
+
const token = locker.token.address
|
|
72
|
+
const sdToken = locker.sdToken.address
|
|
73
|
+
|
|
74
|
+
const gauge = locker.modules.gauge
|
|
75
|
+
const depositor = locker.modules.depositor
|
|
76
|
+
const votingEscrow = locker.modules.veToken
|
|
77
|
+
const lockerAddress = locker.modules.locker
|
|
78
|
+
|
|
79
|
+
const secondaryMarket = locker.secondaryMarket!
|
|
80
|
+
const rewards = locker.rewards
|
|
81
|
+
|
|
82
|
+
const pegBase = parseUnits(secondaryMarket?.pegBase?.toString() || '1', 18)
|
|
83
|
+
|
|
84
|
+
const format = (value: bigint) => formatUnits(value, locker.token.decimals)
|
|
85
|
+
const formatRes = (value: any) => format(getRes(value))
|
|
86
|
+
|
|
87
|
+
const calls: Call[] = [
|
|
88
|
+
/*********************************************************************************
|
|
89
|
+
*** Voting Escrow
|
|
90
|
+
*********************************************************************************/
|
|
91
|
+
|
|
92
|
+
// Token locked by the Locker
|
|
93
|
+
{ address: votingEscrow, name: 'locked', params: [lockerAddress] },
|
|
94
|
+
// veToken Balance of the Locker
|
|
95
|
+
{ address: votingEscrow, name: 'balanceOf', params: [lockerAddress] },
|
|
96
|
+
// Total token locked
|
|
97
|
+
{ address: votingEscrow, name: 'supply' },
|
|
98
|
+
// Total veToken supply
|
|
99
|
+
{ address: votingEscrow, name: 'totalSupply' },
|
|
100
|
+
|
|
101
|
+
/*********************************************************************************
|
|
102
|
+
*** Gauge
|
|
103
|
+
*********************************************************************************/
|
|
104
|
+
|
|
105
|
+
// Total sdToken staked
|
|
106
|
+
{ address: gauge, name: 'totalSupply' },
|
|
107
|
+
// Gauge working supply
|
|
108
|
+
{ address: gauge, name: 'working_supply' },
|
|
109
|
+
|
|
110
|
+
/*********************************************************************************
|
|
111
|
+
*** Token & sdToken
|
|
112
|
+
*********************************************************************************/
|
|
113
|
+
|
|
114
|
+
// Token balance not locked
|
|
115
|
+
{ address: token, name: 'balanceOf', params: [depositor] },
|
|
116
|
+
// sdToken in secondary market pool
|
|
117
|
+
{ address: sdToken, name: 'balanceOf', params: [secondaryMarket.pool] },
|
|
118
|
+
|
|
119
|
+
/*********************************************************************************
|
|
120
|
+
*** Peg
|
|
121
|
+
*********************************************************************************/
|
|
122
|
+
|
|
123
|
+
// Return amount when swapping {pegBase} sdToken to token -> get_dy(int128,int128,uint256)
|
|
124
|
+
{ address: secondaryMarket.pool, name: '0x5e0d443f', params: [One, Zero, pegBase] },
|
|
125
|
+
|
|
126
|
+
/*********************************************************************************
|
|
127
|
+
*** Rewards
|
|
128
|
+
*********************************************************************************/
|
|
129
|
+
|
|
130
|
+
// Streaming status for each reward token
|
|
131
|
+
...rewards.map((r) => ({ address: gauge, name: 'reward_data', params: [r.address] })),
|
|
132
|
+
]
|
|
133
|
+
|
|
134
|
+
const res = await multicall(provider, calls, lockersMulticallAbi(locker.id, locker.chainId))
|
|
135
|
+
const raw = {
|
|
136
|
+
tokenLocked: getRes(res.shift()),
|
|
137
|
+
veBalanceOfLocker: formatRes(res.shift()),
|
|
138
|
+
totalTokenLocked: formatRes(res.shift()),
|
|
139
|
+
veTotalSupply: formatRes(res.shift()),
|
|
140
|
+
totalSupplyStaked: formatRes(res.shift()),
|
|
141
|
+
gaugeWorkingSupply: formatRes(res.shift()),
|
|
142
|
+
amountTokenNotLock: formatRes(res.shift()),
|
|
143
|
+
sdTokenInPool: formatRes(res.shift()),
|
|
144
|
+
peg: getRes(res.shift()),
|
|
145
|
+
rewards: rewards.map(() => getRes(res.shift())),
|
|
146
|
+
veTokenRate: '4',
|
|
147
|
+
_workingSupply: '0',
|
|
148
|
+
_veBalanceOfLocker: '0',
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
raw.tokenLocked = format(raw.tokenLocked[0])
|
|
152
|
+
raw.peg = parsePeg(locker, raw.peg)
|
|
153
|
+
raw._workingSupply = raw.gaugeWorkingSupply
|
|
154
|
+
raw._veBalanceOfLocker = raw.veBalanceOfLocker
|
|
155
|
+
|
|
156
|
+
return parse({ locker, common, prices, raw })
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
export default yearnLocker
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { STAKE_DAO_ASSETS_BASE_URL, tokenWithId } from '@stake-dao/constants'
|
|
2
|
+
import { formatUnits } from 'viem'
|
|
3
|
+
import lockersMulticallAbi from '../../../abis/lockersMulticall.js'
|
|
4
|
+
import { type Call, getRes, multicall } from '../../../utils.js'
|
|
5
|
+
import { parse, parsePeg } from '../parse.js'
|
|
6
|
+
import type { Locker } from '../types.js'
|
|
7
|
+
|
|
8
|
+
export const locker: Locker = {
|
|
9
|
+
id: 'yb',
|
|
10
|
+
symbol: 'YB',
|
|
11
|
+
protocol: 'YieldBasis',
|
|
12
|
+
protocolDescription:
|
|
13
|
+
'YieldBasis enables users to provide BTC as liquidity in an AMM pool without impermanent loss (IL), while still earning trading fees.',
|
|
14
|
+
website: 'https://yieldbasis.com/',
|
|
15
|
+
logoUrl: `${STAKE_DAO_ASSETS_BASE_URL}/assets/1/0x01791f726b4103694969820be083196cc7c045ff.svg`,
|
|
16
|
+
chainId: 1,
|
|
17
|
+
rgb: '73, 196, 201',
|
|
18
|
+
token: tokenWithId('yb')!,
|
|
19
|
+
sdToken: tokenWithId('sdyb')!,
|
|
20
|
+
rewards: [
|
|
21
|
+
{ ...tokenWithId('sdt')!, distribution: 'streamed', origin: 'sdtEmission' },
|
|
22
|
+
{ ...tokenWithId('sdyb')!, distribution: 'distributed', origin: 'bounties' },
|
|
23
|
+
],
|
|
24
|
+
delegation: ['sdyb.eth'],
|
|
25
|
+
modules: {
|
|
26
|
+
depositor: '0xFB9Aa699f1BaDb31A7C4B40F7Fa1f49469595785',
|
|
27
|
+
locker: '0x0070D9adC687a28FBAcC0a0Aab24B90c037AD24e',
|
|
28
|
+
veToken: '0x8235c179E9e84688FBd8B12295EfC26834dAC211',
|
|
29
|
+
gauge: '0x28604Ff7B4aEAE28d4d9e54d14038c910844343a',
|
|
30
|
+
accumulator: '0x0000000000000000000000000000000000000000',
|
|
31
|
+
},
|
|
32
|
+
secondaryMarket: {
|
|
33
|
+
label: '',
|
|
34
|
+
poolKey: '',
|
|
35
|
+
vaultKey: '',
|
|
36
|
+
pool: '0x0000000000000000000000000000000000000000',
|
|
37
|
+
pools: ['0x0000000000000000000000000000000000000000'],
|
|
38
|
+
pegBase: 10000,
|
|
39
|
+
},
|
|
40
|
+
alternativeYields: {},
|
|
41
|
+
fees: [
|
|
42
|
+
{
|
|
43
|
+
label: { key: 'liquidity', variable: 'sdYB/YB' },
|
|
44
|
+
value: 5,
|
|
45
|
+
key: 'liquidityFee',
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
label: { key: 'treasury' },
|
|
49
|
+
value: 5,
|
|
50
|
+
key: 'daoFee',
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
label: { key: 'vesdt' },
|
|
54
|
+
value: 5,
|
|
55
|
+
key: 'sdtFee',
|
|
56
|
+
},
|
|
57
|
+
],
|
|
58
|
+
extensions: {
|
|
59
|
+
coingeckoBaseSlug: 'yield-basis',
|
|
60
|
+
},
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const yieldbasisLocker = async ({ provider, common, prices }: { provider; common; prices }) => {
|
|
64
|
+
const token = locker.token.address
|
|
65
|
+
const sdToken = locker.sdToken.address
|
|
66
|
+
|
|
67
|
+
const gauge = locker.modules.gauge
|
|
68
|
+
const depositor = locker.modules.depositor
|
|
69
|
+
const votingEscrow = locker.modules.veToken
|
|
70
|
+
const lockerAddress = locker.modules.locker
|
|
71
|
+
|
|
72
|
+
const secondaryMarket = locker.secondaryMarket!
|
|
73
|
+
const rewards = locker.rewards
|
|
74
|
+
|
|
75
|
+
// const pegBase = parseUnits(secondaryMarket?.pegBase?.toString() || '1', 18)
|
|
76
|
+
|
|
77
|
+
const format = (value: bigint) => formatUnits(value, locker.token.decimals)
|
|
78
|
+
const formatRes = (value: any) => format(getRes(value))
|
|
79
|
+
|
|
80
|
+
const calls: Call[] = [
|
|
81
|
+
/*********************************************************************************
|
|
82
|
+
*** Voting Escrow
|
|
83
|
+
*********************************************************************************/
|
|
84
|
+
|
|
85
|
+
// Token locked by the Locker
|
|
86
|
+
{ address: votingEscrow, name: 'locked', params: [lockerAddress] },
|
|
87
|
+
// veToken Balance of the Locker
|
|
88
|
+
{ address: votingEscrow, name: 'getVotes', params: [lockerAddress] },
|
|
89
|
+
// Total token locked
|
|
90
|
+
{ address: votingEscrow, name: 'supply' },
|
|
91
|
+
// Total veToken supply
|
|
92
|
+
{ address: votingEscrow, name: 'totalVotes' },
|
|
93
|
+
|
|
94
|
+
/*********************************************************************************
|
|
95
|
+
*** Gauge
|
|
96
|
+
*********************************************************************************/
|
|
97
|
+
|
|
98
|
+
// Total sdToken staked
|
|
99
|
+
{ address: gauge, name: 'totalSupply' },
|
|
100
|
+
// Gauge working supply
|
|
101
|
+
{ address: gauge, name: 'working_supply' },
|
|
102
|
+
|
|
103
|
+
/*********************************************************************************
|
|
104
|
+
*** Token & sdToken
|
|
105
|
+
*********************************************************************************/
|
|
106
|
+
|
|
107
|
+
// Token balance not locked
|
|
108
|
+
{ address: token, name: 'balanceOf', params: [depositor] },
|
|
109
|
+
// sdToken in secondary market pool
|
|
110
|
+
{ address: sdToken, name: 'balanceOf', params: [secondaryMarket.pool] },
|
|
111
|
+
|
|
112
|
+
/*********************************************************************************
|
|
113
|
+
*** Peg
|
|
114
|
+
*********************************************************************************/
|
|
115
|
+
|
|
116
|
+
// Return amount when swapping {pegBase} sdToken to token -> get_dy(int128,int128,uint256)
|
|
117
|
+
// { address: secondaryMarket.pool, name: '0x5e0d443f', params: [One, Zero, pegBase] },
|
|
118
|
+
|
|
119
|
+
/*********************************************************************************
|
|
120
|
+
*** Rewards
|
|
121
|
+
*********************************************************************************/
|
|
122
|
+
|
|
123
|
+
// Streaming status for each reward token
|
|
124
|
+
...rewards.map((r) => ({ address: gauge, name: 'reward_data', params: [r.address] })),
|
|
125
|
+
]
|
|
126
|
+
|
|
127
|
+
const res = await multicall(provider, calls, lockersMulticallAbi(locker.id, locker.chainId))
|
|
128
|
+
const raw = {
|
|
129
|
+
tokenLocked: getRes(res.shift()),
|
|
130
|
+
veBalanceOfLocker: formatRes(res.shift()),
|
|
131
|
+
totalTokenLocked: formatRes(res.shift()),
|
|
132
|
+
veTotalSupply: formatRes(res.shift()),
|
|
133
|
+
totalSupplyStaked: formatRes(res.shift()),
|
|
134
|
+
gaugeWorkingSupply: formatRes(res.shift()),
|
|
135
|
+
amountTokenNotLock: formatRes(res.shift()),
|
|
136
|
+
sdTokenInPool: formatRes(res.shift()),
|
|
137
|
+
peg: '-',
|
|
138
|
+
rewards: rewards.map(() => getRes(res.shift())),
|
|
139
|
+
veTokenRate: '4',
|
|
140
|
+
_workingSupply: '0',
|
|
141
|
+
_veBalanceOfLocker: '0',
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
raw.tokenLocked = format(raw.tokenLocked[0])
|
|
145
|
+
raw.peg = parsePeg(locker, raw.peg)
|
|
146
|
+
raw._workingSupply = raw.gaugeWorkingSupply
|
|
147
|
+
raw._veBalanceOfLocker = raw.veBalanceOfLocker
|
|
148
|
+
|
|
149
|
+
return parse({ locker, common, prices, raw })
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
export default yieldbasisLocker
|