Skip to content

Commit a1650a7

Browse files
refactor(termmax): Simplify ABI definitions in multiCall functions for clarity
1 parent 1581deb commit a1650a7

File tree

1 file changed

+12
-72
lines changed

1 file changed

+12
-72
lines changed

src/adaptors/termmax/index.js

Lines changed: 12 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -158,65 +158,35 @@ async function getVaultsV1({ alias, chain, chainId, number, opportunities }) {
158158
sdk.api.abi.multiCall({
159159
chain,
160160
calls,
161-
abi: {
162-
name: 'apr',
163-
type: 'function',
164-
inputs: [],
165-
outputs: [{ type: 'uint256' }],
166-
},
161+
abi: 'uint256:apr',
167162
}),
168163
sdk.api.abi.multiCall({
169164
chain,
170165
calls,
171-
abi: {
172-
name: 'asset',
173-
type: 'function',
174-
inputs: [],
175-
outputs: [{ type: 'address' }],
176-
},
166+
abi: 'address:asset',
177167
}),
178168
sdk.api.abi.multiCall({
179169
chain,
180170
calls,
181-
abi: {
182-
name: 'decimals',
183-
type: 'function',
184-
inputs: [],
185-
outputs: [{ type: 'uint8' }],
186-
},
171+
abi: 'uint8:decimals',
187172
}),
188173
sdk.api.abi.multiCall({
189174
chain,
190175
calls,
191-
abi: {
192-
name: 'name',
193-
type: 'function',
194-
inputs: [],
195-
outputs: [{ type: 'string' }],
196-
},
176+
abi: 'string:name',
197177
}),
198178
sdk.api.abi.multiCall({
199179
chain,
200180
calls,
201-
abi: {
202-
name: 'totalAssets',
203-
type: 'function',
204-
inputs: [],
205-
outputs: [{ type: 'uint256' }],
206-
},
181+
abi: 'uint256:totalAssets',
207182
}),
208183
]);
209184

210185
const [assetNames, priceMap] = await Promise.all([
211186
sdk.api.abi.multiCall({
212187
chain,
213188
calls: assets.output.map((a) => ({ target: a.output })),
214-
abi: {
215-
name: 'name',
216-
type: 'function',
217-
inputs: [],
218-
outputs: [{ type: 'string' }],
219-
},
189+
abi: 'string:name',
220190
}),
221191
getPrices(
222192
chain,
@@ -318,65 +288,35 @@ async function getVaultV2({ alias, chain, chainId, number, opportunities }) {
318288
sdk.api.abi.multiCall({
319289
chain,
320290
calls,
321-
abi: {
322-
name: 'apy',
323-
type: 'function',
324-
inputs: [],
325-
outputs: [{ type: 'uint256' }],
326-
},
291+
abi: 'uint256:apy',
327292
}),
328293
sdk.api.abi.multiCall({
329294
chain,
330295
calls,
331-
abi: {
332-
name: 'asset',
333-
type: 'function',
334-
inputs: [],
335-
outputs: [{ type: 'address' }],
336-
},
296+
abi: 'address:asset',
337297
}),
338298
sdk.api.abi.multiCall({
339299
chain,
340300
calls,
341-
abi: {
342-
name: 'decimals',
343-
type: 'function',
344-
inputs: [],
345-
outputs: [{ type: 'uint8' }],
346-
},
301+
abi: 'uint8:decimals',
347302
}),
348303
sdk.api.abi.multiCall({
349304
chain,
350305
calls,
351-
abi: {
352-
name: 'name',
353-
type: 'function',
354-
inputs: [],
355-
outputs: [{ type: 'string' }],
356-
},
306+
abi: 'string:name',
357307
}),
358308
sdk.api.abi.multiCall({
359309
chain,
360310
calls,
361-
abi: {
362-
name: 'totalAssets',
363-
type: 'function',
364-
inputs: [],
365-
outputs: [{ type: 'uint256' }],
366-
},
311+
abi: 'uint256:totalAssets',
367312
}),
368313
]);
369314

370315
const [assetNames, priceMap] = await Promise.all([
371316
sdk.api.abi.multiCall({
372317
chain,
373318
calls: assets.output.map((a) => ({ target: a.output })),
374-
abi: {
375-
name: 'name',
376-
type: 'function',
377-
inputs: [],
378-
outputs: [{ type: 'string' }],
379-
},
319+
abi: 'string:name',
380320
}),
381321
getPrices(
382322
chain,

0 commit comments

Comments
 (0)