@curvefi/llamalend-api 1.1.10 → 2.0.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/docs/MIGRATION.md +325 -0
- package/docs/SUPPORT_LLv2.md +409 -0
- package/lib/constants/abis/OneWayLendingFactoryV2ABI.json +543 -0
- package/lib/constants/aliases.d.ts +0 -11
- package/lib/constants/aliases.js +1 -86
- package/lib/constants/coins.d.ts +0 -11
- package/lib/constants/coins.js +0 -14
- package/lib/constants/utils.d.ts +2 -0
- package/lib/constants/utils.js +2 -0
- package/lib/index.d.ts +10 -4
- package/lib/interfaces.d.ts +3 -2
- package/lib/lendMarkets/LendMarketTemplate.d.ts +13 -502
- package/lib/lendMarkets/LendMarketTemplate.js +237 -2860
- package/lib/lendMarkets/fetch/fetchFactoryData.d.ts +13 -0
- package/lib/lendMarkets/fetch/fetchFactoryData.js +101 -0
- package/lib/lendMarkets/fetch/fetchLendMarkets.d.ts +3 -0
- package/lib/lendMarkets/fetch/fetchLendMarkets.js +94 -0
- package/lib/lendMarkets/interfaces/common/amm.d.ts +10 -0
- package/lib/lendMarkets/interfaces/common/amm.js +1 -0
- package/lib/lendMarkets/interfaces/common/index.d.ts +5 -0
- package/lib/lendMarkets/interfaces/common/index.js +5 -0
- package/lib/lendMarkets/interfaces/common/prices.d.ts +13 -0
- package/lib/lendMarkets/interfaces/common/prices.js +1 -0
- package/lib/lendMarkets/interfaces/common/userPosition.d.ts +39 -0
- package/lib/lendMarkets/interfaces/common/userPosition.js +1 -0
- package/lib/lendMarkets/interfaces/common/vault.d.ts +55 -0
- package/lib/lendMarkets/interfaces/common/vault.js +1 -0
- package/lib/lendMarkets/interfaces/common/wallet.d.ts +8 -0
- package/lib/lendMarkets/interfaces/common/wallet.js +1 -0
- package/lib/lendMarkets/interfaces/v1/index.d.ts +4 -0
- package/lib/lendMarkets/interfaces/v1/index.js +4 -0
- package/lib/lendMarkets/interfaces/v1/leverageV1.d.ts +90 -0
- package/lib/lendMarkets/interfaces/v1/leverageV1.js +1 -0
- package/lib/lendMarkets/interfaces/v1/loanV1.d.ts +73 -0
- package/lib/lendMarkets/interfaces/v1/loanV1.js +1 -0
- package/lib/lendMarkets/interfaces/v1/statsV1.d.ts +49 -0
- package/lib/lendMarkets/interfaces/v1/statsV1.js +1 -0
- package/lib/lendMarkets/interfaces/v2/index.d.ts +3 -0
- package/lib/lendMarkets/interfaces/v2/index.js +3 -0
- package/lib/lendMarkets/interfaces/v2/leverageV2.d.ts +90 -0
- package/lib/lendMarkets/interfaces/v2/leverageV2.js +1 -0
- package/lib/lendMarkets/interfaces/v2/loanV2.d.ts +73 -0
- package/lib/lendMarkets/interfaces/v2/loanV2.js +1 -0
- package/lib/lendMarkets/interfaces/v2/statsV2.d.ts +49 -0
- package/lib/lendMarkets/interfaces/v2/statsV2.js +1 -0
- package/lib/lendMarkets/lendMarketConstructor.js +1 -1
- package/lib/lendMarkets/modules/common/amm.d.ts +19 -0
- package/lib/lendMarkets/modules/common/amm.js +137 -0
- package/lib/lendMarkets/modules/common/index.d.ts +9 -0
- package/lib/lendMarkets/modules/common/index.js +9 -0
- package/lib/lendMarkets/modules/common/leverageZapV1Base.d.ts +118 -0
- package/lib/lendMarkets/modules/common/leverageZapV1Base.js +770 -0
- package/lib/lendMarkets/modules/{leverageZapV2.d.ts → common/leverageZapV2Base.d.ts} +10 -5
- package/lib/lendMarkets/modules/{leverageZapV2.js → common/leverageZapV2Base.js} +36 -32
- package/lib/lendMarkets/modules/common/loanBase.d.ts +115 -0
- package/lib/lendMarkets/modules/common/loanBase.js +793 -0
- package/lib/lendMarkets/modules/common/prices.d.ts +19 -0
- package/lib/lendMarkets/modules/common/prices.js +104 -0
- package/lib/lendMarkets/modules/common/statsBase.d.ts +69 -0
- package/lib/lendMarkets/modules/common/statsBase.js +291 -0
- package/lib/lendMarkets/modules/common/userPosition.d.ts +46 -0
- package/lib/lendMarkets/modules/common/userPosition.js +223 -0
- package/lib/lendMarkets/modules/common/vault.d.ts +69 -0
- package/lib/lendMarkets/modules/common/vault.js +535 -0
- package/lib/lendMarkets/modules/common/wallet.d.ts +13 -0
- package/lib/lendMarkets/modules/common/wallet.js +28 -0
- package/lib/lendMarkets/modules/index.d.ts +1 -1
- package/lib/lendMarkets/modules/index.js +1 -1
- package/lib/lendMarkets/modules/v1/index.d.ts +4 -0
- package/lib/lendMarkets/modules/v1/index.js +4 -0
- package/lib/lendMarkets/modules/v1/leverageV1ZapV1.d.ts +3 -0
- package/lib/lendMarkets/modules/v1/leverageV1ZapV1.js +3 -0
- package/lib/lendMarkets/modules/v1/leverageV1ZapV2.d.ts +3 -0
- package/lib/lendMarkets/modules/v1/leverageV1ZapV2.js +3 -0
- package/lib/lendMarkets/modules/v1/loanV1.d.ts +4 -0
- package/lib/lendMarkets/modules/v1/loanV1.js +3 -0
- package/lib/lendMarkets/modules/v1/statsV1.d.ts +3 -0
- package/lib/lendMarkets/modules/v1/statsV1.js +3 -0
- package/lib/lendMarkets/modules/v2/index.d.ts +4 -0
- package/lib/lendMarkets/modules/v2/index.js +4 -0
- package/lib/lendMarkets/modules/v2/leverageV2ZapV1.d.ts +3 -0
- package/lib/lendMarkets/modules/v2/leverageV2ZapV1.js +3 -0
- package/lib/lendMarkets/modules/v2/leverageV2ZapV2.d.ts +3 -0
- package/lib/lendMarkets/modules/v2/leverageV2ZapV2.js +3 -0
- package/lib/lendMarkets/modules/v2/loanV2.d.ts +4 -0
- package/lib/lendMarkets/modules/v2/loanV2.js +3 -0
- package/lib/lendMarkets/modules/v2/statsV2.d.ts +3 -0
- package/lib/lendMarkets/modules/v2/statsV2.js +3 -0
- package/lib/llamalend.d.ts +6 -6
- package/lib/llamalend.js +46 -210
- package/lib/utils.js +2 -33
- package/package.json +1 -1
- package/src/constants/abis/OneWayLendingFactoryV2ABI.json +543 -0
- package/src/constants/aliases.ts +1 -97
- package/src/constants/coins.ts +0 -25
- package/src/constants/utils.ts +4 -0
- package/src/interfaces.ts +3 -2
- package/src/lendMarkets/LendMarketTemplate.ts +318 -3222
- package/src/lendMarkets/fetch/fetchFactoryData.ts +113 -0
- package/src/lendMarkets/fetch/fetchLendMarkets.ts +108 -0
- package/src/lendMarkets/interfaces/common/amm.ts +11 -0
- package/src/lendMarkets/interfaces/common/index.ts +5 -0
- package/src/lendMarkets/interfaces/common/prices.ts +13 -0
- package/src/lendMarkets/interfaces/common/userPosition.ts +24 -0
- package/src/lendMarkets/interfaces/common/vault.ts +48 -0
- package/src/lendMarkets/interfaces/common/wallet.ts +3 -0
- package/src/lendMarkets/interfaces/v1/index.ts +4 -0
- package/src/lendMarkets/interfaces/v1/leverageV1.ts +84 -0
- package/src/lendMarkets/interfaces/v1/loanV1.ts +77 -0
- package/src/lendMarkets/interfaces/v1/statsV1.ts +21 -0
- package/src/lendMarkets/interfaces/v2/index.ts +3 -0
- package/src/lendMarkets/interfaces/v2/leverageV2.ts +84 -0
- package/src/lendMarkets/interfaces/v2/loanV2.ts +77 -0
- package/src/lendMarkets/interfaces/v2/statsV2.ts +21 -0
- package/src/lendMarkets/lendMarketConstructor.ts +1 -1
- package/src/lendMarkets/modules/common/amm.ts +132 -0
- package/src/lendMarkets/modules/common/index.ts +9 -0
- package/src/lendMarkets/modules/common/leverageZapV1Base.ts +912 -0
- package/src/lendMarkets/modules/{leverageZapV2.ts → common/leverageZapV2Base.ts} +41 -37
- package/src/lendMarkets/modules/common/loanBase.ts +773 -0
- package/src/lendMarkets/modules/common/prices.ts +111 -0
- package/src/lendMarkets/modules/common/statsBase.ts +313 -0
- package/src/lendMarkets/modules/common/userPosition.ts +243 -0
- package/src/lendMarkets/modules/common/vault.ts +551 -0
- package/src/lendMarkets/modules/common/wallet.ts +29 -0
- package/src/lendMarkets/modules/index.ts +1 -1
- package/src/lendMarkets/modules/v1/index.ts +4 -0
- package/src/lendMarkets/modules/v1/leverageV1ZapV1.ts +3 -0
- package/src/lendMarkets/modules/v1/leverageV1ZapV2.ts +3 -0
- package/src/lendMarkets/modules/v1/loanV1.ts +4 -0
- package/src/lendMarkets/modules/v1/statsV1.ts +3 -0
- package/src/lendMarkets/modules/v2/index.ts +4 -0
- package/src/lendMarkets/modules/v2/leverageV2ZapV1.ts +3 -0
- package/src/lendMarkets/modules/v2/leverageV2ZapV2.ts +3 -0
- package/src/lendMarkets/modules/v2/loanV2.ts +4 -0
- package/src/lendMarkets/modules/v2/statsV2.ts +3 -0
- package/src/llamalend.ts +47 -244
- package/src/utils.ts +2 -35
|
@@ -0,0 +1,409 @@
|
|
|
1
|
+
# Integration & Support Recommendations for lendMarket v2
|
|
2
|
+
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
## Fetching Lend Markets (v2 Update)
|
|
6
|
+
|
|
7
|
+
### Fetching Markets
|
|
8
|
+
|
|
9
|
+
Previously, lend markets were fetched using:
|
|
10
|
+
|
|
11
|
+
```ts
|
|
12
|
+
await llamalend.lendMarkets.fetchMarkets()
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Starting from v2, the method accepts a named parameters object. The market version must be explicitly specified:
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
// Fetch legacy (v1) markets
|
|
19
|
+
await llamalend.lendMarkets.fetchMarkets({ useApi: false, version: 'v1' })
|
|
20
|
+
|
|
21
|
+
// Fetch new (v2) markets
|
|
22
|
+
await llamalend.lendMarkets.fetchMarkets({ useApi: false, version: 'v2' })
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
At the moment there is no backend implementation for v2. All methods operate fully on-chain. Therefore, `useApi` must temporarily be set to `false`. API mode should not be enabled until backend support is introduced.
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
### Backward Compatibility
|
|
30
|
+
|
|
31
|
+
```ts
|
|
32
|
+
await llamalend.lendMarkets.fetchMarkets()
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Currently behaves the same as:
|
|
36
|
+
|
|
37
|
+
```ts
|
|
38
|
+
await llamalend.lendMarkets.fetchMarkets({ useApi: true, version: 'v1' })
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
However, it is strongly recommended to explicitly specify the market version (`'v1'` or `'v2'`) to avoid ambiguity and future issues.
|
|
42
|
+
|
|
43
|
+
For new integrations targeting v2 markets, use:
|
|
44
|
+
|
|
45
|
+
```ts
|
|
46
|
+
await llamalend.lendMarkets.fetchMarkets({ useApi: false, version: 'v2' })
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
### Market IDs
|
|
52
|
+
|
|
53
|
+
The list of all available market IDs can be obtained via:
|
|
54
|
+
|
|
55
|
+
```ts
|
|
56
|
+
llamalend.lendMarkets.getMarketList()
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
### Getting Market Instance
|
|
62
|
+
|
|
63
|
+
Getting a market instance works the same as before:
|
|
64
|
+
|
|
65
|
+
```ts
|
|
66
|
+
llamalend.getLendMarket(marketId)
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Key change: the market instance now includes a `version` property:
|
|
70
|
+
|
|
71
|
+
```ts
|
|
72
|
+
market.version // 'v1' | 'v2'
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
This allows frontend applications to explicitly determine which market version they are interacting with.
|
|
76
|
+
|
|
77
|
+
## v2 Integration Recommendations
|
|
78
|
+
|
|
79
|
+
### ✅ Backward Compatibility
|
|
80
|
+
|
|
81
|
+
The majority of methods and metrics remain unchanged in v2.
|
|
82
|
+
For frontend integration, **no significant changes are required**.
|
|
83
|
+
|
|
84
|
+
All tables below include every method exposed by `lendMarket`.
|
|
85
|
+
In most cases, the following aspects remain identical:
|
|
86
|
+
|
|
87
|
+
- Business logic (from an external perspective)
|
|
88
|
+
- Input parameters
|
|
89
|
+
- Return values / return types
|
|
90
|
+
|
|
91
|
+
This means existing frontend integrations should continue working without modification.
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
### ⚙️ Internal Changes (Handled by the Library)
|
|
96
|
+
|
|
97
|
+
Some methods have internal changes in v2:
|
|
98
|
+
|
|
99
|
+
- Updated calculation formulas
|
|
100
|
+
- Modified contract calls
|
|
101
|
+
- Adjusted internal method parameters
|
|
102
|
+
- Refactored modular structure
|
|
103
|
+
|
|
104
|
+
**Important:**
|
|
105
|
+
These changes are fully encapsulated within the library.
|
|
106
|
+
|
|
107
|
+
From the frontend perspective:
|
|
108
|
+
|
|
109
|
+
- Method signatures are unchanged
|
|
110
|
+
- Returned data structure is unchanged
|
|
111
|
+
- Behavioral expectations remain consistent
|
|
112
|
+
|
|
113
|
+
There is **no need** for frontend developers to adjust logic based on internal refactoring.
|
|
114
|
+
|
|
115
|
+
---
|
|
116
|
+
|
|
117
|
+
### 🚧 Temporary Limitations
|
|
118
|
+
|
|
119
|
+
- Leverage functionality is temporarily unavailable in v2.
|
|
120
|
+
- Upcoming updates will introduce adjustments related to `repay` methods due to the new `shrink` mechanism.
|
|
121
|
+
- Full leverage support will be restored in future releases.
|
|
122
|
+
|
|
123
|
+
# Methods supporting matrix
|
|
124
|
+
|
|
125
|
+
---
|
|
126
|
+
This document tracks feature support across market versions.
|
|
127
|
+
|
|
128
|
+
- ✅ Supported
|
|
129
|
+
- ❌ Not supported
|
|
130
|
+
|
|
131
|
+
## Stats Module (`market.stats`)
|
|
132
|
+
|
|
133
|
+
| Method | v1 | v2 | Logic Unchanged | Parameters Unchanged | Return Type Unchanged |
|
|
134
|
+
|--------|----|----|-----------------|----------------------|-----------------------|
|
|
135
|
+
| parameters() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
136
|
+
| rates() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
137
|
+
| futureRates() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
138
|
+
| balances() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
139
|
+
| bandsInfo() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
140
|
+
| bandBalances() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
141
|
+
| bandsBalances() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
142
|
+
| totalDebt() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
143
|
+
| ammBalances() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
144
|
+
| capAndAvailable() | ✅ | ✅ | ❌ | ✅ | ❌ |
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
## Wallet Module (`market.wallet`)
|
|
149
|
+
|
|
150
|
+
| Method | v1 | v2 | Logic Unchanged | Parameters Unchanged | Return Type Unchanged |
|
|
151
|
+
|--------|----|----|-----------------|----------------------|-----------------------|
|
|
152
|
+
| balances() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
153
|
+
|
|
154
|
+
---
|
|
155
|
+
|
|
156
|
+
## Vault Module (`market.vault`)
|
|
157
|
+
|
|
158
|
+
---
|
|
159
|
+
|
|
160
|
+
### Deposit Operations
|
|
161
|
+
|
|
162
|
+
| Method | v1 | v2 | Logic Unchanged | Parameters Unchanged | Return Type Unchanged |
|
|
163
|
+
|--------|----|----|-----------------|----------------------|-----------------------|
|
|
164
|
+
| maxDeposit() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
165
|
+
| previewDeposit() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
166
|
+
| depositIsApproved() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
167
|
+
| depositApprove() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
168
|
+
| deposit() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
169
|
+
|
|
170
|
+
---
|
|
171
|
+
|
|
172
|
+
### Mint Operations
|
|
173
|
+
|
|
174
|
+
| Method | v1 | v2 | Logic Unchanged | Parameters Unchanged | Return Type Unchanged |
|
|
175
|
+
|--------|----|----|-----------------|----------------------|-----------------------|
|
|
176
|
+
| maxMint() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
177
|
+
| previewMint() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
178
|
+
| mintIsApproved() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
179
|
+
| mintApprove() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
180
|
+
| mint() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
181
|
+
|
|
182
|
+
---
|
|
183
|
+
|
|
184
|
+
### Withdraw Operations
|
|
185
|
+
|
|
186
|
+
| Method | v1 | v2 | Logic Unchanged | Parameters Unchanged | Return Type Unchanged |
|
|
187
|
+
|--------|----|----|-----------------|----------------------|-----------------------|
|
|
188
|
+
| maxWithdraw() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
189
|
+
| previewWithdraw() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
190
|
+
| withdraw() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
191
|
+
|
|
192
|
+
---
|
|
193
|
+
|
|
194
|
+
### Redeem Operations
|
|
195
|
+
|
|
196
|
+
| Method | v1 | v2 | Logic Unchanged | Parameters Unchanged | Return Type Unchanged |
|
|
197
|
+
|--------|----|----|-----------------|----------------------|-----------------------|
|
|
198
|
+
| maxRedeem() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
199
|
+
| previewRedeem() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
200
|
+
| redeem() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
201
|
+
|
|
202
|
+
---
|
|
203
|
+
|
|
204
|
+
### Conversion & Utilities
|
|
205
|
+
|
|
206
|
+
| Method | v1 | v2 | Logic Unchanged | Parameters Unchanged | Return Type Unchanged |
|
|
207
|
+
|--------|----|----|-----------------|----------------------|-----------------------|
|
|
208
|
+
| convertToShares() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
209
|
+
| convertToAssets() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
210
|
+
| totalLiquidity() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
211
|
+
| rewardsOnly() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
212
|
+
|
|
213
|
+
---
|
|
214
|
+
|
|
215
|
+
### Staking Operations
|
|
216
|
+
|
|
217
|
+
| Method | v1 | v2 | Logic Unchanged | Parameters Unchanged | Return Type Unchanged |
|
|
218
|
+
|--------|----|----|-----------------|----------------------|-----------------------|
|
|
219
|
+
| stakeIsApproved() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
220
|
+
| stakeApprove() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
221
|
+
| stake() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
222
|
+
| unstake() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
223
|
+
|
|
224
|
+
---
|
|
225
|
+
|
|
226
|
+
### Rewards Operations
|
|
227
|
+
|
|
228
|
+
| Method | v1 | v2 | Logic Unchanged | Parameters Unchanged | Return Type Unchanged |
|
|
229
|
+
|--------|----|----|-----------------|----------------------|-----------------------|
|
|
230
|
+
| crvApr() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
231
|
+
| claimableCrv() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
232
|
+
| claimCrv() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
233
|
+
| rewardTokens() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
234
|
+
| rewardsApr() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
235
|
+
| claimableRewards() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
236
|
+
| claimRewards() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
237
|
+
|
|
238
|
+
---
|
|
239
|
+
|
|
240
|
+
## Prices Module (`market.prices`)
|
|
241
|
+
|
|
242
|
+
| Method | v1 | v2 | Logic Unchanged | Parameters Unchanged | Return Type Unchanged |
|
|
243
|
+
|--------|----|----|-----------------|----------------------|-----------------------|
|
|
244
|
+
| A() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
245
|
+
| basePrice() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
246
|
+
| oraclePrice() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
247
|
+
| oraclePriceBand() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
248
|
+
| price() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
249
|
+
| calcTickPrice() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
250
|
+
| calcBandPrices() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
251
|
+
| calcRangePct() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
252
|
+
| getPrices() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
253
|
+
| calcPrices() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
254
|
+
| checkRange() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
255
|
+
|
|
256
|
+
---
|
|
257
|
+
|
|
258
|
+
## AMM Module (`market.amm`)
|
|
259
|
+
|
|
260
|
+
| Method | v1 | v2 | Logic Unchanged | Parameters Unchanged | Return Type Unchanged |
|
|
261
|
+
|--------|----|----|-----------------|----------------------|-----------------------|
|
|
262
|
+
| maxSwappable() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
263
|
+
| swapExpected() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
264
|
+
| swapRequired() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
265
|
+
| swapPriceImpact() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
266
|
+
| swapIsApproved() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
267
|
+
| swapApprove() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
268
|
+
| swap() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
269
|
+
|
|
270
|
+
---
|
|
271
|
+
|
|
272
|
+
## Loan Module (`market.loan`)
|
|
273
|
+
|
|
274
|
+
### Create Loan
|
|
275
|
+
|
|
276
|
+
| Method | v1 | v2 | Logic Unchanged | Parameters Unchanged | Return Type Unchanged |
|
|
277
|
+
|--------|----|----|-----------------|----------------------|-----------------------|
|
|
278
|
+
| createLoanMaxRecv() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
279
|
+
| createLoanMaxRecvAllRanges() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
280
|
+
| getMaxRange() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
281
|
+
| createLoanBands() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
282
|
+
| createLoanBandsAllRanges() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
283
|
+
| createLoanPrices() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
284
|
+
| createLoanPricesAllRanges() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
285
|
+
| createLoanHealth() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
286
|
+
| createLoanIsApproved() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
287
|
+
| createLoanApprove() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
288
|
+
| createLoan() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
289
|
+
|
|
290
|
+
### Borrow More
|
|
291
|
+
|
|
292
|
+
| Method | v1 | v2 | Logic Unchanged | Parameters Unchanged | Return Type Unchanged |
|
|
293
|
+
|--------|----|----|-----------------|----------------------|-----------------------|
|
|
294
|
+
| borrowMoreMaxRecv() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
295
|
+
| borrowMoreBands() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
296
|
+
| borrowMorePrices() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
297
|
+
| borrowMoreHealth() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
298
|
+
| borrowMoreIsApproved() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
299
|
+
| borrowMoreApprove() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
300
|
+
| borrowMore() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
301
|
+
| borrowMoreFutureLeverage() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
302
|
+
|
|
303
|
+
### Add Collateral
|
|
304
|
+
|
|
305
|
+
| Method | v1 | v2 | Logic Unchanged | Parameters Unchanged | Return Type Unchanged |
|
|
306
|
+
|--------|----|----|-----------------|----------------------|-----------------------|
|
|
307
|
+
| addCollateralBands() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
308
|
+
| addCollateralPrices() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
309
|
+
| addCollateralHealth() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
310
|
+
| addCollateralIsApproved() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
311
|
+
| addCollateralApprove() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
312
|
+
| addCollateral() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
313
|
+
| addCollateralFutureLeverage() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
314
|
+
|
|
315
|
+
### Remove Collateral
|
|
316
|
+
|
|
317
|
+
| Method | v1 | v2 | Logic Unchanged | Parameters Unchanged | Return Type Unchanged |
|
|
318
|
+
|--------|----|----|-----------------|----------------------|-----------------------|
|
|
319
|
+
| maxRemovable() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
320
|
+
| removeCollateralBands() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
321
|
+
| removeCollateralPrices() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
322
|
+
| removeCollateralHealth() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
323
|
+
| removeCollateral() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
324
|
+
| removeCollateralFutureLeverage() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
325
|
+
|
|
326
|
+
### Repay (Partial)
|
|
327
|
+
|
|
328
|
+
| Method | v1 | v2 | Logic Unchanged | Parameters Unchanged | Return Type Unchanged |
|
|
329
|
+
|--------|----|----|-----------------|----------------------|-----------------------|
|
|
330
|
+
| repayBands() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
331
|
+
| repayPrices() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
332
|
+
| repayIsApproved() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
333
|
+
| repayApprove() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
334
|
+
| repayHealth() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
335
|
+
| repay() | ✅ | ✅ | ❌ | ❌ | ❌ |
|
|
336
|
+
| repayFutureLeverage() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
337
|
+
|
|
338
|
+
### Repay (Full)
|
|
339
|
+
|
|
340
|
+
| Method | v1 | v2 | Logic Unchanged | Parameters Unchanged | Return Type Unchanged |
|
|
341
|
+
|--------|----|----|-----------------|----------------------|-----------------------|
|
|
342
|
+
| fullRepayIsApproved() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
343
|
+
| fullRepayApprove() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
344
|
+
| fullRepay() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
345
|
+
|
|
346
|
+
### Liquidation (Other User)
|
|
347
|
+
|
|
348
|
+
| Method | v1 | v2 | Logic Unchanged | Parameters Unchanged | Return Type Unchanged |
|
|
349
|
+
|--------|----|----|-----------------|----------------------|-----------------------|
|
|
350
|
+
| tokensToLiquidate() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
351
|
+
| liquidateIsApproved() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
352
|
+
| liquidateApprove() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
353
|
+
| liquidate() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
354
|
+
|
|
355
|
+
### Self Liquidation (Full)
|
|
356
|
+
|
|
357
|
+
| Method | v1 | v2 | Logic Unchanged | Parameters Unchanged | Return Type Unchanged |
|
|
358
|
+
|--------|----|----|-----------------|----------------------|-----------------------|
|
|
359
|
+
| selfLiquidateIsApproved() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
360
|
+
| selfLiquidateApprove() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
361
|
+
| selfLiquidate() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
362
|
+
|
|
363
|
+
### Self Liquidation (Partial)
|
|
364
|
+
|
|
365
|
+
| Method | v1 | v2 | Logic Unchanged | Parameters Unchanged | Return Type Unchanged |
|
|
366
|
+
|--------|----|----|-----------------|----------------------|-----------------------|
|
|
367
|
+
| calcPartialFrac() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
368
|
+
| partialSelfLiquidateIsApproved() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
369
|
+
| partialSelfLiquidateApprove() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
370
|
+
| partialSelfLiquidate() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
371
|
+
|
|
372
|
+
---
|
|
373
|
+
|
|
374
|
+
## User Position Module (`market.userPosition`)
|
|
375
|
+
|
|
376
|
+
| Method | v1 | v2 | Logic Unchanged | Parameters Unchanged | Return Type Unchanged |
|
|
377
|
+
|--------|----|----|-----------------|----------------------|-----------------------|
|
|
378
|
+
| userLoanExists() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
379
|
+
| userState() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
380
|
+
| userStateBigInt() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
381
|
+
| userHealth() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
382
|
+
| userBands() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
383
|
+
| userBandsBigInt() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
384
|
+
| userRange() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
385
|
+
| userPrices() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
386
|
+
| userLoss() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
387
|
+
| userBandsBalances() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
388
|
+
| currentLeverage() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
389
|
+
| currentPnL() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
390
|
+
| userBoost() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
391
|
+
| forceUpdateUserState() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
392
|
+
| getCurrentLeverageParams() | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
393
|
+
|
|
394
|
+
---
|
|
395
|
+
|
|
396
|
+
## Leverage Module (`market.leverage`)
|
|
397
|
+
|
|
398
|
+
| Method | v1 | v2 |
|
|
399
|
+
|--------|----|----|
|
|
400
|
+
| leverage() | ✅ | ❌ |
|
|
401
|
+
| leverageZapV2() | ✅ | ❌ |
|
|
402
|
+
|
|
403
|
+
> ⚠️ **Temporary Status**
|
|
404
|
+
>
|
|
405
|
+
> Leverage functionality is temporarily unavailable in v2.
|
|
406
|
+
>
|
|
407
|
+
> It is expected that upcoming changes will primarily affect `repay`-related methods due to the introduction of the `shrink` mechanism.
|
|
408
|
+
>
|
|
409
|
+
> Full leverage support will be restored in upcoming versions.
|