@merkl/api 0.10.199 → 0.10.200
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/src/eden/index.d.ts +2 -6398
- package/dist/src/errors/HttpError.d.ts +5 -0
- package/dist/src/errors/HttpError.js +6 -0
- package/dist/src/errors/NotFound.error.d.ts +4 -0
- package/dist/src/errors/NotFound.error.js +5 -0
- package/dist/src/index.d.ts +1 -2464
- package/dist/src/index.js +56 -7
- package/dist/src/libs/campaigns/campaignTypes/ERC20DynamicData.js +15 -22
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/helpers/factoryFinder.js +1 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/helpers/tokenType.d.ts +3 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/helpers/tokenType.js +8 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/GammaProcessor.d.ts +43 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/GammaProcessor.js +63 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/GenericProcessor.d.ts +3 -3
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/GenericProcessor.js +3 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/NoLinkVaultProcessor.d.ts +36 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/NoLinkVaultProcessor.js +51 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/StakingProcessor.d.ts +0 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/StakingProcessor.js +15 -7
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/processorMapping.js +4 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesPrices.d.ts +1 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesPrices.js +13 -572
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound1.d.ts +2 -21
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound1.js +197 -1174
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound2.d.ts +1 -5
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound2.js +11 -634
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound3.d.ts +1 -4
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound3.js +10 -380
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound4.d.ts +3 -3
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound4.js +11 -312
- package/dist/src/libs/campaigns/campaignTypes/EulerDynamicData.js +8 -8
- package/dist/src/libs/campaigns/campaignTypes/RadiantDynamicData.js +3 -4
- package/dist/src/libs/campaigns/campaignsDynamicData.js +0 -5
- package/dist/src/modules/v4/accounting/accounting.controller.js +1 -1
- package/dist/src/modules/v4/apr/apr.model.d.ts +26 -0
- package/dist/src/modules/v4/apr/apr.model.js +15 -1
- package/dist/src/modules/v4/blacklist/blacklist.controller.js +1 -1
- package/dist/src/modules/v4/campaign/campaign.controller.d.ts +4 -4
- package/dist/src/modules/v4/campaign/campaign.controller.js +14 -4
- package/dist/src/modules/v4/campaign/campaign.model.d.ts +50 -5
- package/dist/src/modules/v4/campaign/campaign.model.js +47 -13
- package/dist/src/modules/v4/campaign/campaign.repository.d.ts +2 -2
- package/dist/src/modules/v4/campaign/campaign.service.d.ts +2 -2
- package/dist/src/modules/v4/chain/chain.controller.d.ts +2 -2
- package/dist/src/modules/v4/chain/chain.controller.js +7 -2
- package/dist/src/modules/v4/chain/chain.model.d.ts +6 -1
- package/dist/src/modules/v4/chain/chain.model.js +8 -1
- package/dist/src/modules/v4/chain/chain.repository.js +1 -1
- package/dist/src/modules/v4/claims/claims.controller.js +1 -1
- package/dist/src/modules/v4/dynamicData/dynamicData.controller.js +4 -1
- package/dist/src/modules/v4/enso/enso.model.d.ts +1 -1
- package/dist/src/modules/v4/enso/enso.model.js +2 -1
- package/dist/src/modules/v4/enso/enso.service.d.ts +0 -1
- package/dist/src/modules/v4/enso/enso.service.js +4 -4
- package/dist/src/modules/v4/interaction/interaction.controller.d.ts +26 -17
- package/dist/src/modules/v4/interaction/interaction.controller.js +19 -28
- package/dist/src/modules/v4/interaction/interaction.model.d.ts +17 -5
- package/dist/src/modules/v4/interaction/interaction.model.js +3 -3
- package/dist/src/modules/v4/interaction/interaction.service.d.ts +18 -3
- package/dist/src/modules/v4/interaction/interaction.service.js +89 -11
- package/dist/src/modules/v4/kyberzap/kyberzap.model.d.ts +72 -0
- package/dist/src/modules/v4/kyberzap/kyberzap.model.js +79 -0
- package/dist/src/modules/v4/kyberzap/kyberzap.service.d.ts +15 -0
- package/dist/src/modules/v4/kyberzap/kyberzap.service.js +84 -0
- package/dist/src/modules/v4/liquidity/liquidity.controller.js +1 -1
- package/dist/src/modules/v4/merklRoot/merklRoot.controller.js +1 -1
- package/dist/src/modules/v4/opportunity/opportunity.controller.d.ts +224 -213
- package/dist/src/modules/v4/opportunity/opportunity.controller.js +39 -10
- package/dist/src/modules/v4/opportunity/opportunity.model.d.ts +252 -22
- package/dist/src/modules/v4/opportunity/opportunity.model.js +58 -15
- package/dist/src/modules/v4/opportunity/opportunity.repository.d.ts +11 -11
- package/dist/src/modules/v4/opportunity/opportunity.service.d.ts +12 -232
- package/dist/src/modules/v4/opportunity/opportunity.service.js +0 -32
- package/dist/src/modules/v4/price/price.controller.js +1 -1
- package/dist/src/modules/v4/protocol/protocol.controller.d.ts +23 -24
- package/dist/src/modules/v4/protocol/protocol.controller.js +15 -9
- package/dist/src/modules/v4/protocol/protocol.model.d.ts +13 -1
- package/dist/src/modules/v4/protocol/protocol.model.js +12 -8
- package/dist/src/modules/v4/reward/reward.controller.js +1 -1
- package/dist/src/modules/v4/reward/reward.model.d.ts +44 -1
- package/dist/src/modules/v4/reward/reward.model.js +15 -0
- package/dist/src/modules/v4/reward/reward.repository.d.ts +2 -2
- package/dist/src/modules/v4/reward/reward.service.d.ts +11 -11
- package/dist/src/modules/v4/reward/reward.service.js +1 -1
- package/dist/src/modules/v4/router.d.ts +287 -268
- package/dist/src/modules/v4/status/status.controller.js +2 -3
- package/dist/src/modules/v4/status/status.model.d.ts +12 -0
- package/dist/src/modules/v4/status/status.model.js +12 -0
- package/dist/src/modules/v4/token/token.controller.d.ts +4 -4
- package/dist/src/modules/v4/token/token.controller.js +1 -1
- package/dist/src/modules/v4/token/token.model.d.ts +12 -0
- package/dist/src/modules/v4/token/token.model.js +12 -0
- package/dist/src/modules/v4/token/token.repository.d.ts +2 -2
- package/dist/src/modules/v4/token/token.service.d.ts +7 -7
- package/dist/src/modules/v4/tvl/tvl.model.d.ts +24 -0
- package/dist/src/modules/v4/tvl/tvl.model.js +15 -1
- package/dist/src/modules/v4/uniswapV4/uniswapV4.controller.d.ts +1 -1
- package/dist/src/modules/v4/uniswapV4/uniswapV4.controller.js +9 -8
- package/dist/src/modules/v4/user/user.controller.d.ts +4 -4
- package/dist/src/modules/v4/user/user.controller.js +20 -17
- package/dist/src/modules/v4/user/user.model.d.ts +30 -0
- package/dist/src/modules/v4/user/user.model.js +27 -0
- package/dist/src/modules/v4/zyfi/zyfi.model.d.ts +45 -0
- package/dist/src/modules/v4/zyfi/zyfi.model.js +1 -0
- package/dist/src/modules/v4/zyfi/zyfi.service.d.ts +30 -0
- package/dist/src/modules/v4/zyfi/zyfi.service.js +35 -0
- package/dist/src/plugins/error-handling.plugin.d.ts +2 -2
- package/dist/src/plugins/error-handling.plugin.js +9 -3
- package/dist/src/plugins/logger.plugin.js +1 -20
- package/dist/src/routes/v1/allowances.d.ts +1 -1
- package/dist/src/routes/v1/allowances.js +1 -1
- package/dist/src/routes/v1/balances.d.ts +1 -1
- package/dist/src/routes/v1/balances.js +1 -1
- package/dist/src/routes/v1/prices.d.ts +1 -1
- package/dist/src/routes/v1/prices.js +1 -1
- package/dist/src/routes/v1/router.d.ts +102 -0
- package/dist/src/routes/v1/router.js +6 -0
- package/dist/src/routes/v1/tokens.d.ts +1 -1
- package/dist/src/routes/v1/tokens.js +1 -1
- package/dist/src/routes/v2/merkl.d.ts +5 -5
- package/dist/src/routes/v2/merkl.js +1 -1
- package/dist/src/routes/v2/router.d.ts +46 -0
- package/dist/src/routes/v2/router.js +3 -0
- package/dist/src/routes/v3/app.d.ts +1 -1
- package/dist/src/routes/v3/app.js +1 -1
- package/dist/src/routes/v3/blacklist.d.ts +1 -2479
- package/dist/src/routes/v3/blacklist.js +1 -1
- package/dist/src/routes/v3/campaignClaims.d.ts +1 -1
- package/dist/src/routes/v3/campaignClaims.js +1 -1
- package/dist/src/routes/v3/campaignReport.d.ts +1 -1
- package/dist/src/routes/v3/campaignReport.js +1 -1
- package/dist/src/routes/v3/campaignUnclaimed.d.ts +1 -1
- package/dist/src/routes/v3/campaignUnclaimed.js +1 -1
- package/dist/src/routes/v3/campaigns.d.ts +1 -2483
- package/dist/src/routes/v3/campaigns.js +1 -1
- package/dist/src/routes/v3/campaignsForMainParameter.d.ts +1 -1
- package/dist/src/routes/v3/campaignsForMainParameter.js +1 -1
- package/dist/src/routes/v3/campaignsInfo.d.ts +1 -2481
- package/dist/src/routes/v3/campaignsInfo.js +1 -1
- package/dist/src/routes/v3/campaignsRewardsReport.d.ts +1 -1
- package/dist/src/routes/v3/campaignsRewardsReport.js +1 -1
- package/dist/src/routes/v3/claims.d.ts +1 -1
- package/dist/src/routes/v3/claims.js +1 -1
- package/dist/src/routes/v3/compoundV2.d.ts +1 -1
- package/dist/src/routes/v3/compoundV2.js +1 -1
- package/dist/src/routes/v3/createCampaign.d.ts +1 -1
- package/dist/src/routes/v3/createCampaign.js +1 -1
- package/dist/src/routes/v3/dolomite.d.ts +1 -1
- package/dist/src/routes/v3/dolomite.js +1 -1
- package/dist/src/routes/v3/euler.d.ts +1 -1
- package/dist/src/routes/v3/euler.js +1 -1
- package/dist/src/routes/v3/fetch.d.ts +1 -1
- package/dist/src/routes/v3/fetch.js +1 -1
- package/dist/src/routes/v3/health.d.ts +1 -1
- package/dist/src/routes/v3/health.js +1 -1
- package/dist/src/routes/v3/lostyield.d.ts +1 -1
- package/dist/src/routes/v3/lostyield.js +1 -1
- package/dist/src/routes/v3/merkl.d.ts +1 -1
- package/dist/src/routes/v3/merkl.js +1 -1
- package/dist/src/routes/v3/morphoMarkets.d.ts +1 -1
- package/dist/src/routes/v3/morphoMarkets.js +1 -1
- package/dist/src/routes/v3/morphoVaults.d.ts +1 -1
- package/dist/src/routes/v3/morphoVaults.js +1 -1
- package/dist/src/routes/v3/multiChainPositions.d.ts +1 -2480
- package/dist/src/routes/v3/multiChainPositions.js +1 -1
- package/dist/src/routes/v3/opportunity.d.ts +1 -2483
- package/dist/src/routes/v3/opportunity.js +1 -1
- package/dist/src/routes/v3/overview.d.ts +1 -1
- package/dist/src/routes/v3/overview.js +1 -1
- package/dist/src/routes/v3/parse.d.ts +1 -1
- package/dist/src/routes/v3/parse.js +1 -1
- package/dist/src/routes/v3/payload.d.ts +1 -1
- package/dist/src/routes/v3/payload.js +1 -1
- package/dist/src/routes/v3/poolInfo.js +1 -1
- package/dist/src/routes/v3/positions.d.ts +1 -2479
- package/dist/src/routes/v3/positions.js +1 -1
- package/dist/src/routes/v3/radiant.d.ts +1 -1
- package/dist/src/routes/v3/radiant.js +1 -1
- package/dist/src/routes/v3/recipients.d.ts +1 -1
- package/dist/src/routes/v3/recipients.js +1 -1
- package/dist/src/routes/v3/rewards.d.ts +1 -2508
- package/dist/src/routes/v3/rewards.js +1 -1
- package/dist/src/routes/v3/rewardsReport.d.ts +1 -1
- package/dist/src/routes/v3/rewardsReport.js +1 -1
- package/dist/src/routes/v3/router.d.ts +1 -0
- package/dist/src/routes/v3/router.js +74 -0
- package/dist/src/routes/v3/silo.d.ts +1 -1
- package/dist/src/routes/v3/silo.js +1 -1
- package/dist/src/routes/v3/token.d.ts +1 -1
- package/dist/src/routes/v3/token.js +1 -1
- package/dist/src/routes/v3/tokenUnclaimed.d.ts +1 -1
- package/dist/src/routes/v3/tokenUnclaimed.js +1 -1
- package/dist/src/routes/v3/updates.d.ts +1 -2483
- package/dist/src/routes/v3/updates.js +1 -1
- package/dist/src/routes/v3/userRewards.d.ts +1 -2499
- package/dist/src/routes/v3/userRewards.js +1 -1
- package/dist/src/utils/decodeCalls.js +12 -1
- package/dist/src/utils/encodeCalls.js +26 -3
- package/dist/src/utils/generateCardName.js +2 -0
- package/dist/tsconfig.package.tsbuildinfo +1 -1
- package/package.json +2 -3
- package/dist/src/libs/campaigns/campaignTypes/ERC20DynamicDataRefacto.d.ts +0 -3
- package/dist/src/libs/campaigns/campaignTypes/ERC20DynamicDataRefacto.js +0 -155
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesPricesRefactoFinal.d.ts +0 -4
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesPricesRefactoFinal.js +0 -24
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound1RefactoFinal.d.ts +0 -4
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound1RefactoFinal.js +0 -230
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound2RefactoFinal.d.ts +0 -3
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound2RefactoFinal.js +0 -22
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound3RefactoFinal.d.ts +0 -3
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound3RefactoFinal.js +0 -22
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound4RefactoFinal.d.ts +0 -4
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound4RefactoFinal.js +0 -22
- package/dist/src/libs/campaigns/campaignsDynamicDataRefacto.d.ts +0 -3
- package/dist/src/libs/campaigns/campaignsDynamicDataRefacto.js +0 -75
@@ -1,7 +1,3 @@
|
|
1
|
-
import { Interface } from "@ethersproject/abi";
|
2
1
|
import type { Multicall3 } from "libs/sdk/src/generated/Multicall";
|
3
|
-
import { tokenType,
|
4
|
-
export declare const balancerPoolInterface: Interface;
|
5
|
-
export declare const gearboxVaultInterface: Interface;
|
6
|
-
export declare const auraOperatorInterface: Interface;
|
2
|
+
import type { tokenType, tokenTypeStruct } from "./helpers/tokenType";
|
7
3
|
export declare function getTokenTypeRound2(index: number, type: tokenType, typeInfo: any, calls: Multicall3.ResultStructOutput[]): tokenTypeStruct;
|
@@ -1,645 +1,22 @@
|
|
1
|
-
import {
|
2
|
-
import { BN2Number, ERC20Interface, UniswapV2PoolInterface } from "@sdk";
|
3
|
-
import { tokenType } from "./helpers/tokenType";
|
4
|
-
import { OneInchStakingInterface, aaveInterface, auraInterface, balancerGaugeInterface, beefyInterface, compoundInterface, curveInterface, enzymeInterface, eulerInterface, fluidInterface, fraxlendInterface, ionicInterface, layerBankInterface, metamorphoInterface, moonwellInterface, radiantInterface, sturdyInterface, } from "./subtypesRound1";
|
5
|
-
const balancerPoolABI = [
|
6
|
-
{
|
7
|
-
inputs: [],
|
8
|
-
name: "getPoolId",
|
9
|
-
outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }],
|
10
|
-
stateMutability: "view",
|
11
|
-
type: "function",
|
12
|
-
},
|
13
|
-
{
|
14
|
-
inputs: [],
|
15
|
-
name: "getVault",
|
16
|
-
outputs: [
|
17
|
-
{
|
18
|
-
name: "",
|
19
|
-
type: "address",
|
20
|
-
},
|
21
|
-
],
|
22
|
-
payable: false,
|
23
|
-
stateMutability: "view",
|
24
|
-
type: "function",
|
25
|
-
},
|
26
|
-
];
|
27
|
-
const gearboxVaultABI = [
|
28
|
-
{
|
29
|
-
inputs: [],
|
30
|
-
name: "totalAssets",
|
31
|
-
outputs: [
|
32
|
-
{
|
33
|
-
name: "",
|
34
|
-
type: "uint256",
|
35
|
-
},
|
36
|
-
],
|
37
|
-
payable: false,
|
38
|
-
stateMutability: "view",
|
39
|
-
type: "function",
|
40
|
-
},
|
41
|
-
{
|
42
|
-
inputs: [],
|
43
|
-
name: "underlyingToken",
|
44
|
-
outputs: [
|
45
|
-
{
|
46
|
-
name: "",
|
47
|
-
type: "address",
|
48
|
-
},
|
49
|
-
],
|
50
|
-
payable: false,
|
51
|
-
stateMutability: "view",
|
52
|
-
type: "function",
|
53
|
-
},
|
54
|
-
];
|
55
|
-
// lptoken address, token address, gauge address, crvRewards address, stash address, shutdown bool
|
56
|
-
const auraOperatorABI = [
|
57
|
-
{
|
58
|
-
inputs: [
|
59
|
-
{
|
60
|
-
name: "input",
|
61
|
-
type: "uint256",
|
62
|
-
},
|
63
|
-
],
|
64
|
-
name: "poolInfo",
|
65
|
-
outputs: [
|
66
|
-
{
|
67
|
-
name: "lptoken",
|
68
|
-
type: "address",
|
69
|
-
},
|
70
|
-
{
|
71
|
-
name: "token",
|
72
|
-
type: "address",
|
73
|
-
},
|
74
|
-
{
|
75
|
-
name: "gauge",
|
76
|
-
type: "address",
|
77
|
-
},
|
78
|
-
{
|
79
|
-
name: "crvRewards",
|
80
|
-
type: "address",
|
81
|
-
},
|
82
|
-
{
|
83
|
-
name: "stash",
|
84
|
-
type: "address",
|
85
|
-
},
|
86
|
-
{
|
87
|
-
name: "shutdown",
|
88
|
-
type: "bool",
|
89
|
-
},
|
90
|
-
],
|
91
|
-
stateMutability: "view",
|
92
|
-
type: "function",
|
93
|
-
},
|
94
|
-
{
|
95
|
-
inputs: [],
|
96
|
-
name: "staker",
|
97
|
-
outputs: [
|
98
|
-
{
|
99
|
-
name: "",
|
100
|
-
type: "address",
|
101
|
-
},
|
102
|
-
],
|
103
|
-
payable: false,
|
104
|
-
stateMutability: "view",
|
105
|
-
type: "function",
|
106
|
-
},
|
107
|
-
];
|
108
|
-
export const balancerPoolInterface = new Interface(balancerPoolABI);
|
109
|
-
export const gearboxVaultInterface = new Interface(gearboxVaultABI);
|
110
|
-
export const auraOperatorInterface = new Interface(auraOperatorABI);
|
1
|
+
import { processorMapping } from "./processor/processorMapping";
|
111
2
|
export function getTokenTypeRound2(index, type, typeInfo, calls) {
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
type === tokenType.akron) {
|
118
|
-
const token0 = UniswapV2PoolInterface.decodeFunctionResult("token0", calls[index].returnData)[0];
|
119
|
-
const token1 = UniswapV2PoolInterface.decodeFunctionResult("token1", calls[index + 1].returnData)[0];
|
120
|
-
return {
|
121
|
-
type: type,
|
122
|
-
calls: [
|
123
|
-
{
|
124
|
-
allowFailure: true,
|
125
|
-
callData: ERC20Interface.encodeFunctionData("symbol"),
|
126
|
-
target: token0,
|
127
|
-
},
|
128
|
-
{
|
129
|
-
allowFailure: true,
|
130
|
-
callData: ERC20Interface.encodeFunctionData("symbol"),
|
131
|
-
target: token1,
|
132
|
-
},
|
133
|
-
{
|
134
|
-
allowFailure: true,
|
135
|
-
callData: ERC20Interface.encodeFunctionData("decimals"),
|
136
|
-
target: token0,
|
137
|
-
},
|
138
|
-
{
|
139
|
-
allowFailure: true,
|
140
|
-
callData: ERC20Interface.encodeFunctionData("decimals"),
|
141
|
-
target: token1,
|
142
|
-
},
|
143
|
-
{
|
144
|
-
allowFailure: true,
|
145
|
-
callData: ERC20Interface.encodeFunctionData("balanceOf", [typeInfo.tokenAddress]),
|
146
|
-
target: token0,
|
147
|
-
},
|
148
|
-
{
|
149
|
-
allowFailure: true,
|
150
|
-
callData: ERC20Interface.encodeFunctionData("balanceOf", [typeInfo.tokenAddress]),
|
151
|
-
target: token1,
|
152
|
-
},
|
153
|
-
],
|
154
|
-
typeInfo: {
|
155
|
-
...typeInfo,
|
156
|
-
token0,
|
157
|
-
token1,
|
158
|
-
},
|
159
|
-
};
|
160
|
-
}
|
161
|
-
if (type === tokenType.balancerGauge) {
|
162
|
-
// Call the get Price function on the gyroscope pool address
|
163
|
-
// Get the balance of the balancer contract of the gyroscope pool token
|
164
|
-
const lp_token = balancerGaugeInterface.decodeFunctionResult("lp_token", calls[index].returnData)[0];
|
165
|
-
return {
|
166
|
-
type: tokenType.balancerGauge,
|
167
|
-
calls: [
|
168
|
-
{
|
169
|
-
allowFailure: true,
|
170
|
-
callData: ERC20Interface.encodeFunctionData("balanceOf", [typeInfo.tokenAddress]),
|
171
|
-
target: lp_token,
|
172
|
-
},
|
173
|
-
{
|
174
|
-
allowFailure: true,
|
175
|
-
callData: ERC20Interface.encodeFunctionData("totalSupply"),
|
176
|
-
target: lp_token,
|
177
|
-
},
|
178
|
-
{
|
179
|
-
allowFailure: true,
|
180
|
-
callData: balancerPoolInterface.encodeFunctionData("getPoolId"),
|
181
|
-
target: lp_token,
|
182
|
-
},
|
183
|
-
{
|
184
|
-
allowFailure: true,
|
185
|
-
callData: balancerPoolInterface.encodeFunctionData("getVault"),
|
186
|
-
target: lp_token,
|
187
|
-
},
|
188
|
-
],
|
189
|
-
typeInfo: {
|
190
|
-
...typeInfo,
|
191
|
-
gyroscopeToken: lp_token,
|
192
|
-
},
|
193
|
-
};
|
194
|
-
}
|
195
|
-
// symbol is ECLP-USDC-USDT
|
196
|
-
if (type === tokenType.balancerPool) {
|
197
|
-
// Call the get Price function on the gyroscope pool address
|
198
|
-
return {
|
199
|
-
type: tokenType.balancerPool,
|
200
|
-
calls: [
|
201
|
-
{
|
202
|
-
allowFailure: true,
|
203
|
-
callData: balancerPoolInterface.encodeFunctionData("getPoolId"),
|
204
|
-
target: typeInfo.tokenAddress,
|
205
|
-
},
|
206
|
-
{
|
207
|
-
allowFailure: true,
|
208
|
-
callData: balancerPoolInterface.encodeFunctionData("getVault"),
|
209
|
-
target: typeInfo.tokenAddress,
|
210
|
-
},
|
211
|
-
],
|
212
|
-
typeInfo: {
|
213
|
-
...typeInfo,
|
214
|
-
},
|
215
|
-
};
|
216
|
-
}
|
217
|
-
if (type === tokenType.aura) {
|
218
|
-
const balancerPool = auraInterface.decodeFunctionResult("asset", calls[index].returnData)[0];
|
219
|
-
const auraOperator = auraInterface.decodeFunctionResult("operator", calls[index + 1].returnData)[0];
|
220
|
-
const pid = auraInterface.decodeFunctionResult("pid", calls[index + 2].returnData)[0].toNumber();
|
221
|
-
return {
|
222
|
-
type: type,
|
223
|
-
calls: [
|
224
|
-
{
|
225
|
-
allowFailure: true,
|
226
|
-
callData: balancerPoolInterface.encodeFunctionData("getPoolId"),
|
227
|
-
target: balancerPool,
|
228
|
-
},
|
229
|
-
{
|
230
|
-
allowFailure: true,
|
231
|
-
callData: balancerPoolInterface.encodeFunctionData("getVault"),
|
232
|
-
target: balancerPool,
|
233
|
-
},
|
234
|
-
{
|
235
|
-
allowFailure: true,
|
236
|
-
callData: ERC20Interface.encodeFunctionData("totalSupply"),
|
237
|
-
target: balancerPool,
|
238
|
-
},
|
239
|
-
{
|
240
|
-
allowFailure: true,
|
241
|
-
callData: auraOperatorInterface.encodeFunctionData("poolInfo", [pid]),
|
242
|
-
target: auraOperator,
|
243
|
-
},
|
244
|
-
{
|
245
|
-
allowFailure: true,
|
246
|
-
callData: auraOperatorInterface.encodeFunctionData("staker"),
|
247
|
-
target: auraOperator,
|
248
|
-
},
|
249
|
-
],
|
250
|
-
typeInfo: {
|
251
|
-
...typeInfo,
|
252
|
-
balancerPool: balancerPool,
|
253
|
-
auraOperator: auraOperator,
|
254
|
-
auraPoolId: pid,
|
255
|
-
},
|
256
|
-
};
|
257
|
-
}
|
258
|
-
if (type === tokenType.gearbox) {
|
259
|
-
// Get the underlying gearbox token to fetch the final underlying token
|
260
|
-
const stakingToken = OneInchStakingInterface.decodeFunctionResult("stakingToken", calls[index].returnData)[0];
|
261
|
-
return {
|
262
|
-
type: tokenType.gearbox,
|
263
|
-
calls: [
|
264
|
-
{
|
265
|
-
allowFailure: true,
|
266
|
-
callData: ERC20Interface.encodeFunctionData("balanceOf", [typeInfo.tokenAddress]),
|
267
|
-
target: stakingToken,
|
268
|
-
},
|
269
|
-
{
|
270
|
-
allowFailure: true,
|
271
|
-
callData: ERC20Interface.encodeFunctionData("totalSupply"),
|
272
|
-
target: stakingToken,
|
273
|
-
},
|
274
|
-
{
|
275
|
-
allowFailure: true,
|
276
|
-
callData: ERC20Interface.encodeFunctionData("decimals"),
|
277
|
-
target: stakingToken,
|
278
|
-
},
|
279
|
-
{
|
280
|
-
allowFailure: true,
|
281
|
-
callData: gearboxVaultInterface.encodeFunctionData("underlyingToken"),
|
282
|
-
target: stakingToken,
|
283
|
-
},
|
284
|
-
{
|
285
|
-
allowFailure: true,
|
286
|
-
callData: gearboxVaultInterface.encodeFunctionData("totalAssets"),
|
287
|
-
target: stakingToken,
|
288
|
-
},
|
289
|
-
],
|
290
|
-
typeInfo: {
|
291
|
-
...typeInfo,
|
292
|
-
stakingToken: stakingToken,
|
293
|
-
},
|
294
|
-
};
|
295
|
-
}
|
296
|
-
if (type === tokenType.compound) {
|
297
|
-
// Get the underlying gearbox token to fetch the final underlying token
|
298
|
-
const baseToken = compoundInterface.decodeFunctionResult("baseToken", calls[index].returnData)[0];
|
299
|
-
return {
|
300
|
-
type: tokenType.compound,
|
301
|
-
calls: [
|
302
|
-
{
|
303
|
-
allowFailure: true,
|
304
|
-
callData: compoundInterface.encodeFunctionData("totalBorrow"),
|
305
|
-
target: typeInfo.tokenAddress,
|
306
|
-
},
|
307
|
-
{
|
308
|
-
allowFailure: true,
|
309
|
-
callData: ERC20Interface.encodeFunctionData("balanceOf", [typeInfo.tokenAddress]),
|
310
|
-
target: baseToken,
|
311
|
-
},
|
312
|
-
{
|
313
|
-
allowFailure: true,
|
314
|
-
callData: ERC20Interface.encodeFunctionData("symbol"),
|
315
|
-
target: baseToken,
|
316
|
-
},
|
317
|
-
{
|
318
|
-
allowFailure: true,
|
319
|
-
callData: ERC20Interface.encodeFunctionData("decimals"),
|
320
|
-
target: baseToken,
|
321
|
-
},
|
322
|
-
],
|
323
|
-
typeInfo: {
|
324
|
-
...typeInfo,
|
325
|
-
baseToken: baseToken,
|
326
|
-
},
|
327
|
-
};
|
328
|
-
}
|
329
|
-
if (type === tokenType.radiant_lend) {
|
330
|
-
const underlyingToken = radiantInterface.decodeFunctionResult("UNDERLYING_ASSET_ADDRESS", calls[index].returnData)[0];
|
331
|
-
const priceBN = radiantInterface.decodeFunctionResult("getAssetPrice", calls[index + 1].returnData)[0];
|
332
|
-
return {
|
333
|
-
type: tokenType.radiant_lend,
|
334
|
-
calls: [
|
335
|
-
{
|
336
|
-
allowFailure: true,
|
337
|
-
callData: ERC20Interface.encodeFunctionData("symbol"),
|
338
|
-
target: underlyingToken,
|
339
|
-
},
|
340
|
-
],
|
341
|
-
typeInfo: {
|
342
|
-
...typeInfo,
|
343
|
-
underlyingToken: underlyingToken,
|
344
|
-
priceTargetToken: BN2Number(priceBN, 8),
|
345
|
-
},
|
346
|
-
};
|
347
|
-
}
|
348
|
-
if (type === tokenType.radiant_borrow) {
|
349
|
-
const underlyingToken = radiantInterface.decodeFunctionResult("UNDERLYING_ASSET_ADDRESS", calls[index].returnData)[0];
|
350
|
-
const priceBN = radiantInterface.decodeFunctionResult("getAssetPrice", calls[index + 1].returnData)[0];
|
351
|
-
return {
|
352
|
-
type: tokenType.radiant_borrow,
|
353
|
-
calls: [
|
354
|
-
{
|
355
|
-
allowFailure: true,
|
356
|
-
callData: ERC20Interface.encodeFunctionData("symbol"),
|
357
|
-
target: underlyingToken,
|
358
|
-
},
|
359
|
-
],
|
360
|
-
typeInfo: {
|
361
|
-
...typeInfo,
|
362
|
-
underlyingToken: underlyingToken,
|
363
|
-
priceTargetToken: BN2Number(priceBN, 8),
|
364
|
-
},
|
365
|
-
};
|
366
|
-
}
|
367
|
-
// https://explorer.mode.network/address/0x71ef7EDa2Be775E5A7aa8afD02C45F059833e9d2
|
368
|
-
if (type === tokenType.ionic) {
|
369
|
-
const underlyingToken = ionicInterface.decodeFunctionResult("underlying", calls[index].returnData)[0];
|
370
|
-
const exchangeRate = ionicInterface.decodeFunctionResult("exchangeRateCurrent", calls[index + 1].returnData)[0];
|
371
|
-
return {
|
372
|
-
type: tokenType.ionic,
|
373
|
-
calls: [
|
374
|
-
{
|
375
|
-
allowFailure: true,
|
376
|
-
callData: ERC20Interface.encodeFunctionData("symbol"),
|
377
|
-
target: underlyingToken,
|
378
|
-
},
|
379
|
-
],
|
380
|
-
typeInfo: {
|
381
|
-
...typeInfo,
|
382
|
-
underlyingToken: underlyingToken,
|
383
|
-
exchangeRate: BN2Number(exchangeRate, 18),
|
384
|
-
},
|
385
|
-
};
|
386
|
-
}
|
387
|
-
if (type === tokenType.layerbank) {
|
388
|
-
const underlyingToken = layerBankInterface.decodeFunctionResult("underlying", calls[index].returnData)[0];
|
389
|
-
const exchangeRate = layerBankInterface.decodeFunctionResult("exchangeRate", calls[index + 1].returnData)[0];
|
390
|
-
return {
|
391
|
-
type: type,
|
392
|
-
calls: [
|
393
|
-
{
|
394
|
-
allowFailure: true,
|
395
|
-
callData: ERC20Interface.encodeFunctionData("symbol"),
|
396
|
-
target: underlyingToken,
|
397
|
-
},
|
398
|
-
],
|
399
|
-
typeInfo: {
|
400
|
-
...typeInfo,
|
401
|
-
underlyingToken: underlyingToken,
|
402
|
-
exchangeRate: BN2Number(exchangeRate, 18),
|
403
|
-
},
|
404
|
-
};
|
405
|
-
}
|
406
|
-
if (type === tokenType.metamorpho) {
|
407
|
-
const underlyingToken = metamorphoInterface.decodeFunctionResult("asset", calls[index].returnData)[0];
|
408
|
-
return {
|
409
|
-
type: tokenType.metamorpho,
|
410
|
-
calls: [
|
411
|
-
{
|
412
|
-
allowFailure: true,
|
413
|
-
callData: ERC20Interface.encodeFunctionData("symbol"),
|
414
|
-
target: underlyingToken,
|
415
|
-
},
|
416
|
-
],
|
417
|
-
typeInfo: {
|
418
|
-
...typeInfo,
|
419
|
-
underlyingToken,
|
420
|
-
},
|
421
|
-
};
|
422
|
-
}
|
423
|
-
if (type === tokenType.moonwell) {
|
424
|
-
const underlyingToken = moonwellInterface.decodeFunctionResult("underlying", calls[index].returnData)[0];
|
425
|
-
const exchangeRate = moonwellInterface.decodeFunctionResult("exchangeRateStored", calls[index + 1].returnData)[0];
|
426
|
-
return {
|
427
|
-
type: tokenType.moonwell,
|
428
|
-
calls: [
|
429
|
-
{
|
430
|
-
allowFailure: true,
|
431
|
-
callData: ERC20Interface.encodeFunctionData("symbol"),
|
432
|
-
target: underlyingToken,
|
433
|
-
},
|
434
|
-
{
|
435
|
-
allowFailure: true,
|
436
|
-
callData: ERC20Interface.encodeFunctionData("decimals"),
|
437
|
-
target: underlyingToken,
|
438
|
-
},
|
439
|
-
],
|
440
|
-
typeInfo: {
|
441
|
-
...typeInfo,
|
442
|
-
underlyingToken,
|
443
|
-
exchangeRate: BN2Number(exchangeRate, 18),
|
444
|
-
},
|
445
|
-
};
|
446
|
-
}
|
447
|
-
if (type === tokenType.aave_lending || type === tokenType.aave_borrowing) {
|
448
|
-
const underlyingToken = aaveInterface.decodeFunctionResult("UNDERLYING_ASSET_ADDRESS", calls[index].returnData)[0];
|
449
|
-
return {
|
450
|
-
type: type,
|
451
|
-
calls: [
|
452
|
-
{
|
453
|
-
allowFailure: true,
|
454
|
-
callData: ERC20Interface.encodeFunctionData("symbol"),
|
455
|
-
target: underlyingToken,
|
456
|
-
},
|
457
|
-
],
|
458
|
-
typeInfo: {
|
459
|
-
...typeInfo,
|
460
|
-
underlyingToken,
|
461
|
-
},
|
462
|
-
};
|
463
|
-
}
|
464
|
-
if (type === tokenType.fraxlend || type === tokenType.sturdy_aggregator || type === tokenType.sturdy_silo) {
|
465
|
-
const underlyingToken = fraxlendInterface.decodeFunctionResult("asset", calls[index].returnData)[0];
|
466
|
-
const sharePrice = fraxlendInterface.decodeFunctionResult("pricePerShare", calls[index + 1].returnData)[0];
|
467
|
-
if (type === tokenType.sturdy_silo) {
|
468
|
-
const collateral = sturdyInterface.decodeFunctionResult("collateralContract", calls[index + 2].returnData)[0];
|
469
|
-
return {
|
470
|
-
type: type,
|
471
|
-
calls: [
|
472
|
-
{
|
473
|
-
allowFailure: true,
|
474
|
-
callData: ERC20Interface.encodeFunctionData("symbol"),
|
475
|
-
target: underlyingToken,
|
476
|
-
},
|
477
|
-
{
|
478
|
-
allowFailure: true,
|
479
|
-
callData: ERC20Interface.encodeFunctionData("symbol"),
|
480
|
-
target: collateral,
|
481
|
-
},
|
482
|
-
],
|
483
|
-
typeInfo: {
|
484
|
-
...typeInfo,
|
485
|
-
underlyingToken,
|
486
|
-
sharePrice: BN2Number(sharePrice, 18),
|
487
|
-
collateral,
|
488
|
-
},
|
489
|
-
};
|
490
|
-
}
|
491
|
-
return {
|
492
|
-
type: type,
|
493
|
-
calls: [
|
494
|
-
{
|
495
|
-
allowFailure: true,
|
496
|
-
callData: ERC20Interface.encodeFunctionData("symbol"),
|
497
|
-
target: underlyingToken,
|
498
|
-
},
|
499
|
-
],
|
500
|
-
typeInfo: {
|
501
|
-
...typeInfo,
|
502
|
-
underlyingToken,
|
503
|
-
sharePrice: BN2Number(sharePrice, 18),
|
504
|
-
},
|
505
|
-
};
|
506
|
-
}
|
507
|
-
if (type === tokenType.curve || type === tokenType.curve_2) {
|
508
|
-
let lp_price;
|
509
|
-
if (type === tokenType.curve) {
|
510
|
-
lp_price = curveInterface.decodeFunctionResult("lp_price", calls[index].returnData)[0];
|
511
|
-
}
|
512
|
-
else {
|
513
|
-
lp_price = curveInterface.decodeFunctionResult("get_virtual_price", calls[index].returnData)[0];
|
514
|
-
}
|
515
|
-
let i = 1;
|
516
|
-
const poolTokensList = [];
|
517
|
-
while (i <= 3) {
|
518
|
-
try {
|
519
|
-
const token = curveInterface.decodeFunctionResult("coins", calls[index + i].returnData)[0];
|
520
|
-
poolTokensList.push(token);
|
521
|
-
}
|
522
|
-
catch (e) { }
|
523
|
-
i++;
|
3
|
+
try {
|
4
|
+
const returnValueOfCalls = calls.map(call => call.returnData);
|
5
|
+
const ProcessorClass = processorMapping[type];
|
6
|
+
if (!ProcessorClass) {
|
7
|
+
throw new Error(`Processor not found for key: ${type}`);
|
524
8
|
}
|
525
|
-
|
526
|
-
|
527
|
-
calls: poolTokensList.map(token => {
|
528
|
-
return {
|
529
|
-
allowFailure: true,
|
530
|
-
callData: ERC20Interface.encodeFunctionData("symbol"),
|
531
|
-
target: token,
|
532
|
-
};
|
533
|
-
}),
|
534
|
-
typeInfo: {
|
535
|
-
...typeInfo,
|
536
|
-
lp_price: BN2Number(lp_price, 18),
|
537
|
-
poolTokensList,
|
538
|
-
},
|
539
|
-
};
|
540
|
-
}
|
541
|
-
if (type === tokenType.fluid) {
|
542
|
-
const underlyingToken = fluidInterface.decodeFunctionResult("asset", calls[index].returnData)[0];
|
543
|
-
return {
|
544
|
-
type: type,
|
545
|
-
calls: [
|
546
|
-
{
|
547
|
-
allowFailure: true,
|
548
|
-
callData: ERC20Interface.encodeFunctionData("decimals"),
|
549
|
-
target: underlyingToken,
|
550
|
-
},
|
551
|
-
{
|
552
|
-
allowFailure: true,
|
553
|
-
callData: ERC20Interface.encodeFunctionData("symbol"),
|
554
|
-
target: underlyingToken,
|
555
|
-
},
|
556
|
-
],
|
557
|
-
typeInfo: {
|
558
|
-
...typeInfo,
|
559
|
-
underlyingToken: underlyingToken,
|
560
|
-
},
|
561
|
-
};
|
562
|
-
}
|
563
|
-
if (type === tokenType.enzyme) {
|
564
|
-
const underlyingToken = enzymeInterface.decodeFunctionResult("calcNetShareValue", calls[index].returnData)[0];
|
565
|
-
const exchangeRate = BN2Number(enzymeInterface.decodeFunctionResult("calcNetShareValue", calls[index].returnData)[1]);
|
566
|
-
return {
|
567
|
-
type: type,
|
568
|
-
calls: [
|
569
|
-
{
|
570
|
-
allowFailure: true,
|
571
|
-
callData: ERC20Interface.encodeFunctionData("symbol"),
|
572
|
-
target: underlyingToken,
|
573
|
-
},
|
574
|
-
],
|
575
|
-
typeInfo: {
|
576
|
-
...typeInfo,
|
577
|
-
underlyingToken,
|
578
|
-
exchangeRate,
|
579
|
-
},
|
580
|
-
};
|
581
|
-
}
|
582
|
-
if (type === tokenType.euler_borrow) {
|
583
|
-
const vault = eulerInterface.decodeFunctionResult("eVault", calls[index].returnData)[0];
|
584
|
-
return {
|
585
|
-
type: type,
|
586
|
-
calls: [
|
587
|
-
{
|
588
|
-
allowFailure: true,
|
589
|
-
callData: eulerInterface.encodeFunctionData("asset"),
|
590
|
-
target: vault,
|
591
|
-
},
|
592
|
-
],
|
593
|
-
typeInfo: {
|
594
|
-
...typeInfo,
|
595
|
-
vault,
|
596
|
-
},
|
597
|
-
};
|
598
|
-
}
|
599
|
-
if (type === tokenType.euler_lend) {
|
600
|
-
return {
|
601
|
-
type: type,
|
602
|
-
calls: [
|
603
|
-
{
|
604
|
-
allowFailure: true,
|
605
|
-
callData: eulerInterface.encodeFunctionData("asset"),
|
606
|
-
target: typeInfo.tokenAddress,
|
607
|
-
},
|
608
|
-
],
|
609
|
-
typeInfo: {
|
610
|
-
...typeInfo,
|
611
|
-
},
|
612
|
-
};
|
9
|
+
const processorObject = new ProcessorClass();
|
10
|
+
return processorObject.computeRound2(index, type, typeInfo, returnValueOfCalls);
|
613
11
|
}
|
614
|
-
|
615
|
-
|
616
|
-
const underlyingToken = beefyInterface.decodeFunctionResult("want", calls[index + 1].returnData)[0];
|
12
|
+
catch (error) {
|
13
|
+
console.error(error);
|
617
14
|
return {
|
618
15
|
type: type,
|
619
|
-
calls: [
|
620
|
-
{
|
621
|
-
allowFailure: true,
|
622
|
-
callData: UniswapV2PoolInterface.encodeFunctionData("token0"),
|
623
|
-
target: underlyingToken,
|
624
|
-
},
|
625
|
-
{
|
626
|
-
allowFailure: true,
|
627
|
-
callData: UniswapV2PoolInterface.encodeFunctionData("token1"),
|
628
|
-
target: underlyingToken,
|
629
|
-
},
|
630
|
-
],
|
16
|
+
calls: [],
|
631
17
|
typeInfo: {
|
632
18
|
...typeInfo,
|
633
|
-
underlyingToken,
|
634
|
-
pricePerShare,
|
635
19
|
},
|
636
20
|
};
|
637
21
|
}
|
638
|
-
return {
|
639
|
-
type: type,
|
640
|
-
calls: [],
|
641
|
-
typeInfo: {
|
642
|
-
...typeInfo,
|
643
|
-
},
|
644
|
-
};
|
645
22
|
}
|
@@ -1,6 +1,3 @@
|
|
1
|
-
import { Interface } from "@ethersproject/abi";
|
2
1
|
import type { Multicall3 } from "libs/sdk/src/generated/Multicall";
|
3
|
-
import { tokenType,
|
4
|
-
export declare const BALANCER_VAULT_ADDRESS = "0xBA12222222228d8Ba445958a75a0704d566BF2C8";
|
5
|
-
export declare const balancerVaultInterface: Interface;
|
2
|
+
import type { tokenType, tokenTypeStruct } from "./helpers/tokenType";
|
6
3
|
export declare function getTokenTypeRound3(index: number, type: tokenType, typeInfo: any, calls: Multicall3.ResultStructOutput[]): tokenTypeStruct;
|