@merkl/api 0.10.198 → 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 -2
- 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/status/status.service.js +0 -1
- 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,392 +1,22 @@
|
|
1
|
-
import {
|
2
|
-
import { BN2Number, ERC20Interface, UniswapV2PoolInterface } from "@sdk";
|
3
|
-
import { BigNumber } from "ethers";
|
4
|
-
import { tokenType } from "./helpers/tokenType";
|
5
|
-
import { compoundInterface, fluidInterface } from "./subtypesRound1";
|
6
|
-
import { auraOperatorInterface, balancerPoolInterface, gearboxVaultInterface } from "./subtypesRound2";
|
7
|
-
export const BALANCER_VAULT_ADDRESS = "0xBA12222222228d8Ba445958a75a0704d566BF2C8"; // Same for all chains
|
8
|
-
const balancerVaultABI = [
|
9
|
-
{
|
10
|
-
constant: true,
|
11
|
-
inputs: [
|
12
|
-
{
|
13
|
-
name: "poolId",
|
14
|
-
type: "bytes32",
|
15
|
-
},
|
16
|
-
],
|
17
|
-
name: "getPoolTokens",
|
18
|
-
outputs: [
|
19
|
-
{
|
20
|
-
name: "tokens",
|
21
|
-
type: "address[]",
|
22
|
-
},
|
23
|
-
{
|
24
|
-
name: "balances",
|
25
|
-
type: "uint256[]",
|
26
|
-
},
|
27
|
-
{
|
28
|
-
name: "lastChangeBlock",
|
29
|
-
type: "uint256",
|
30
|
-
},
|
31
|
-
],
|
32
|
-
payable: false,
|
33
|
-
stateMutability: "view",
|
34
|
-
type: "function",
|
35
|
-
},
|
36
|
-
];
|
37
|
-
export const balancerVaultInterface = new Interface(balancerVaultABI);
|
1
|
+
import { processorMapping } from "./processor/processorMapping";
|
38
2
|
export function getTokenTypeRound3(index, type, typeInfo, calls) {
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
type === tokenType.akron) {
|
45
|
-
const symbolToken0 = ERC20Interface.decodeFunctionResult("symbol", calls[index].returnData)[0];
|
46
|
-
const symbolToken1 = ERC20Interface.decodeFunctionResult("symbol", calls[index + 1].returnData)[0];
|
47
|
-
const decimalsToken0 = ERC20Interface.decodeFunctionResult("decimals", calls[index + 2].returnData)[0];
|
48
|
-
const decimalsToken1 = ERC20Interface.decodeFunctionResult("decimals", calls[index + 3].returnData)[0];
|
49
|
-
const balanceToken0 = ERC20Interface.decodeFunctionResult("balanceOf", calls[index + 4].returnData)[0];
|
50
|
-
const balanceToken1 = ERC20Interface.decodeFunctionResult("balanceOf", calls[index + 5].returnData)[0];
|
51
|
-
return {
|
52
|
-
type: type,
|
53
|
-
calls: [],
|
54
|
-
typeInfo: {
|
55
|
-
...typeInfo,
|
56
|
-
symbolToken0,
|
57
|
-
symbolToken1,
|
58
|
-
decimalsToken0,
|
59
|
-
decimalsToken1,
|
60
|
-
balanceToken0: BN2Number(balanceToken0, decimalsToken0),
|
61
|
-
balanceToken1: BN2Number(balanceToken1, decimalsToken1),
|
62
|
-
},
|
63
|
-
};
|
64
|
-
}
|
65
|
-
if (type === tokenType.balancerGauge) {
|
66
|
-
// Call the get Price function on the gyroscope pool address
|
67
|
-
// Get the balance of the balancer contract of the gyroscope pool token
|
68
|
-
const balanceUnderlyingPoolTokens = ERC20Interface.decodeFunctionResult("balanceOf", calls[index].returnData)[0];
|
69
|
-
const totalSupplyUnderlyingPoolTokens = ERC20Interface.decodeFunctionResult("totalSupply", calls[index + 1].returnData)[0];
|
70
|
-
const poolId = balancerPoolInterface.decodeFunctionResult("getPoolId", calls[index + 2].returnData)[0];
|
71
|
-
const vault = balancerPoolInterface.decodeFunctionResult("getVault", calls[index + 3].returnData)[0];
|
72
|
-
return {
|
73
|
-
type: tokenType.balancerGauge,
|
74
|
-
calls: [
|
75
|
-
{
|
76
|
-
allowFailure: true,
|
77
|
-
callData: balancerVaultInterface.encodeFunctionData("getPoolTokens", [poolId]),
|
78
|
-
target: vault,
|
79
|
-
},
|
80
|
-
],
|
81
|
-
typeInfo: {
|
82
|
-
...typeInfo,
|
83
|
-
percentageOfSupplyUnderlyingPoolTokens: BN2Number(balanceUnderlyingPoolTokens, 18) / BN2Number(totalSupplyUnderlyingPoolTokens, 18),
|
84
|
-
poolId,
|
85
|
-
vault,
|
86
|
-
},
|
87
|
-
};
|
88
|
-
}
|
89
|
-
// symbol is ECLP-USDC-USDT
|
90
|
-
if (type === tokenType.balancerPool) {
|
91
|
-
const poolId = balancerPoolInterface.decodeFunctionResult("getPoolId", calls[index].returnData)[0];
|
92
|
-
const vault = balancerPoolInterface.decodeFunctionResult("getVault", calls[index + 1].returnData)[0];
|
93
|
-
return {
|
94
|
-
type: tokenType.balancerPool,
|
95
|
-
calls: [
|
96
|
-
{
|
97
|
-
allowFailure: true,
|
98
|
-
callData: balancerVaultInterface.encodeFunctionData("getPoolTokens", [poolId]),
|
99
|
-
target: vault,
|
100
|
-
},
|
101
|
-
],
|
102
|
-
typeInfo: {
|
103
|
-
...typeInfo,
|
104
|
-
poolId,
|
105
|
-
vault,
|
106
|
-
},
|
107
|
-
};
|
108
|
-
}
|
109
|
-
if (type === tokenType.aura) {
|
110
|
-
const poolId = balancerPoolInterface.decodeFunctionResult("getPoolId", calls[index].returnData)[0];
|
111
|
-
const vault = balancerPoolInterface.decodeFunctionResult("getVault", calls[index + 1].returnData)[0];
|
112
|
-
const totalSupplyBalancerPool = ERC20Interface.decodeFunctionResult("totalSupply", calls[index + 2].returnData)[0];
|
113
|
-
const gaugeContract = auraOperatorInterface.decodeFunctionResult("poolInfo", calls[index + 3].returnData)[2];
|
114
|
-
const auraStaker = auraOperatorInterface.decodeFunctionResult("staker", calls[index + 4].returnData)[0];
|
115
|
-
return {
|
116
|
-
type: type,
|
117
|
-
calls: [
|
118
|
-
{
|
119
|
-
allowFailure: true,
|
120
|
-
callData: balancerVaultInterface.encodeFunctionData("getPoolTokens", [poolId]),
|
121
|
-
target: vault,
|
122
|
-
},
|
123
|
-
{
|
124
|
-
allowFailure: true,
|
125
|
-
callData: ERC20Interface.encodeFunctionData("balanceOf", [gaugeContract]),
|
126
|
-
target: typeInfo.balancerPool,
|
127
|
-
},
|
128
|
-
{
|
129
|
-
allowFailure: true,
|
130
|
-
callData: ERC20Interface.encodeFunctionData("balanceOf", [auraStaker]),
|
131
|
-
target: gaugeContract,
|
132
|
-
},
|
133
|
-
{
|
134
|
-
allowFailure: true,
|
135
|
-
callData: ERC20Interface.encodeFunctionData("totalSupply"),
|
136
|
-
target: gaugeContract,
|
137
|
-
},
|
138
|
-
],
|
139
|
-
typeInfo: {
|
140
|
-
...typeInfo,
|
141
|
-
poolId,
|
142
|
-
totalSupplyBalancerPool: BN2Number(totalSupplyBalancerPool, 18),
|
143
|
-
gaugeContract,
|
144
|
-
auraStaker,
|
145
|
-
vault,
|
146
|
-
},
|
147
|
-
};
|
148
|
-
}
|
149
|
-
if (type === tokenType.gearbox) {
|
150
|
-
// Get the underlying gearbox token to fetch the final underlying token
|
151
|
-
const balanceStakingToken = ERC20Interface.decodeFunctionResult("balanceOf", calls[index].returnData)[0];
|
152
|
-
const totalSupplyStakingToken = ERC20Interface.decodeFunctionResult("totalSupply", calls[index + 1].returnData)[0];
|
153
|
-
const decimalsStakingToken = ERC20Interface.decodeFunctionResult("decimals", calls[index + 2].returnData)[0];
|
154
|
-
const underlyingToken = gearboxVaultInterface.decodeFunctionResult("underlyingToken", calls[index + 3].returnData)[0];
|
155
|
-
const totalAssets = gearboxVaultInterface.decodeFunctionResult("totalAssets", calls[index + 4].returnData)[0];
|
156
|
-
const percentageOfSupplyUnderlyingPoolTokens = BN2Number(balanceStakingToken, decimalsStakingToken) / BN2Number(totalSupplyStakingToken, decimalsStakingToken);
|
157
|
-
return {
|
158
|
-
type: tokenType.gearbox,
|
159
|
-
calls: [
|
160
|
-
{
|
161
|
-
allowFailure: true,
|
162
|
-
callData: ERC20Interface.encodeFunctionData("decimals"),
|
163
|
-
target: underlyingToken,
|
164
|
-
},
|
165
|
-
{
|
166
|
-
allowFailure: true,
|
167
|
-
callData: ERC20Interface.encodeFunctionData("symbol"),
|
168
|
-
target: underlyingToken,
|
169
|
-
},
|
170
|
-
],
|
171
|
-
typeInfo: {
|
172
|
-
...typeInfo,
|
173
|
-
decimalsStakingToken,
|
174
|
-
underlyingToken,
|
175
|
-
totalAssets: totalAssets,
|
176
|
-
balanceStakingToken: BN2Number(balanceStakingToken, decimalsStakingToken),
|
177
|
-
totalSupplyStakingToken: BN2Number(totalSupplyStakingToken, decimalsStakingToken),
|
178
|
-
percentageOfSupplyUnderlyingPoolTokens,
|
179
|
-
},
|
180
|
-
};
|
181
|
-
}
|
182
|
-
if (type === tokenType.compound) {
|
183
|
-
// Get the underlying gearbox token to fetch the final underlying token
|
184
|
-
const totalBorrow = compoundInterface.decodeFunctionResult("totalBorrow", calls[index].returnData)[0];
|
185
|
-
const balanceBaseToken = ERC20Interface.decodeFunctionResult("balanceOf", calls[index + 1].returnData)[0];
|
186
|
-
const symbolBaseToken = ERC20Interface.decodeFunctionResult("symbol", calls[index + 2].returnData)[0];
|
187
|
-
const decimalsBaseToken = ERC20Interface.decodeFunctionResult("decimals", calls[index + 3].returnData)[0];
|
188
|
-
return {
|
189
|
-
type: tokenType.compound,
|
190
|
-
calls: [],
|
191
|
-
typeInfo: {
|
192
|
-
...typeInfo,
|
193
|
-
totalBorrow: BN2Number(totalBorrow, decimalsBaseToken),
|
194
|
-
balanceBaseToken: BN2Number(balanceBaseToken, decimalsBaseToken),
|
195
|
-
symbolBaseToken,
|
196
|
-
decimalsBaseToken,
|
197
|
-
},
|
198
|
-
};
|
199
|
-
}
|
200
|
-
if (type === tokenType.ionic ||
|
201
|
-
type === tokenType.radiant_borrow ||
|
202
|
-
type === tokenType.radiant_lend ||
|
203
|
-
type === tokenType.layerbank ||
|
204
|
-
type === tokenType.metamorpho) {
|
205
|
-
let symbolUnderlyingToken;
|
206
|
-
try {
|
207
|
-
symbolUnderlyingToken = ERC20Interface.decodeFunctionResult("symbol", calls[index].returnData)[0];
|
208
|
-
}
|
209
|
-
catch (e) {
|
210
|
-
// usually if this fails its because of native ETH
|
211
|
-
symbolUnderlyingToken = "ETH";
|
212
|
-
}
|
213
|
-
return {
|
214
|
-
type: type,
|
215
|
-
calls: [],
|
216
|
-
typeInfo: {
|
217
|
-
...typeInfo,
|
218
|
-
symbolUnderlyingToken: symbolUnderlyingToken,
|
219
|
-
},
|
220
|
-
};
|
221
|
-
}
|
222
|
-
if (type === tokenType.moonwell) {
|
223
|
-
const symbolUnderlyingToken = ERC20Interface.decodeFunctionResult("symbol", calls[index].returnData)[0];
|
224
|
-
const decimalsUnderlyingToken = ERC20Interface.decodeFunctionResult("decimals", calls[index + 1].returnData)[0];
|
225
|
-
return {
|
226
|
-
type: tokenType.moonwell,
|
227
|
-
calls: [],
|
228
|
-
typeInfo: {
|
229
|
-
...typeInfo,
|
230
|
-
symbolUnderlyingToken,
|
231
|
-
decimalsUnderlyingToken,
|
232
|
-
},
|
233
|
-
};
|
234
|
-
}
|
235
|
-
if (type === tokenType.aave_lending || type === tokenType.aave_borrowing) {
|
236
|
-
const symbolUnderlyingToken = ERC20Interface.decodeFunctionResult("symbol", calls[index].returnData)[0];
|
237
|
-
return {
|
238
|
-
type: type,
|
239
|
-
calls: [],
|
240
|
-
typeInfo: {
|
241
|
-
...typeInfo,
|
242
|
-
symbolUnderlyingToken,
|
243
|
-
},
|
244
|
-
};
|
245
|
-
}
|
246
|
-
if (type === tokenType.fraxlend || type === tokenType.sturdy_aggregator || type === tokenType.sturdy_silo) {
|
247
|
-
const symbolUnderlyingToken = ERC20Interface.decodeFunctionResult("symbol", calls[index].returnData)[0];
|
248
|
-
if (type === tokenType.sturdy_silo) {
|
249
|
-
const symbolCollateral = ERC20Interface.decodeFunctionResult("symbol", calls[index + 1].returnData)[0];
|
250
|
-
return {
|
251
|
-
type: type,
|
252
|
-
calls: [],
|
253
|
-
typeInfo: {
|
254
|
-
...typeInfo,
|
255
|
-
symbolUnderlyingToken,
|
256
|
-
symbolCollateral,
|
257
|
-
},
|
258
|
-
};
|
3
|
+
try {
|
4
|
+
const ProcessorClass = processorMapping[type];
|
5
|
+
const returnValueOfCalls = calls.map(call => call.returnData);
|
6
|
+
if (!ProcessorClass) {
|
7
|
+
throw new Error(`Processor not found for key: ${type}`);
|
259
8
|
}
|
260
|
-
|
261
|
-
|
262
|
-
calls: [],
|
263
|
-
typeInfo: {
|
264
|
-
...typeInfo,
|
265
|
-
symbolUnderlyingToken,
|
266
|
-
},
|
267
|
-
};
|
9
|
+
const processorObject = new ProcessorClass();
|
10
|
+
return processorObject.computeRound3(index, type, typeInfo, returnValueOfCalls);
|
268
11
|
}
|
269
|
-
|
270
|
-
|
271
|
-
let i = 0;
|
272
|
-
for (const token of typeInfo.poolTokensList) {
|
273
|
-
const symbol = ERC20Interface.decodeFunctionResult("symbol", calls[index + i].returnData)[0];
|
274
|
-
poolTokens[token] = symbol;
|
275
|
-
i++;
|
276
|
-
}
|
12
|
+
catch (error) {
|
13
|
+
console.error(error);
|
277
14
|
return {
|
278
15
|
type: type,
|
279
16
|
calls: [],
|
280
17
|
typeInfo: {
|
281
18
|
...typeInfo,
|
282
|
-
poolTokens: poolTokens,
|
283
|
-
},
|
284
|
-
};
|
285
|
-
}
|
286
|
-
if (type === tokenType.fluid) {
|
287
|
-
const decimalsUnderlyingToken = ERC20Interface.decodeFunctionResult("decimals", calls[index].returnData)[0];
|
288
|
-
const symbolUnderlyingToken = ERC20Interface.decodeFunctionResult("symbol", calls[index + 1].returnData)[0];
|
289
|
-
// BigNumber.from(10).pow(decimals).toString()
|
290
|
-
return {
|
291
|
-
type: type,
|
292
|
-
calls: [
|
293
|
-
{
|
294
|
-
allowFailure: true,
|
295
|
-
callData: fluidInterface.encodeFunctionData("convertToAssets", [
|
296
|
-
BigNumber.from(10).pow(decimalsUnderlyingToken).toString(),
|
297
|
-
]),
|
298
|
-
target: typeInfo.tokenAddress,
|
299
|
-
},
|
300
|
-
],
|
301
|
-
typeInfo: {
|
302
|
-
...typeInfo,
|
303
|
-
decimalsUnderlyingToken: decimalsUnderlyingToken,
|
304
|
-
symbolUnderlyingToken: symbolUnderlyingToken,
|
305
|
-
},
|
306
|
-
};
|
307
|
-
}
|
308
|
-
if (type === tokenType.enzyme) {
|
309
|
-
const symbolUnderlyingToken = ERC20Interface.decodeFunctionResult("symbol", calls[index].returnData)[0];
|
310
|
-
return {
|
311
|
-
type: type,
|
312
|
-
calls: [],
|
313
|
-
typeInfo: {
|
314
|
-
...typeInfo,
|
315
|
-
symbolUnderlyingToken,
|
316
|
-
},
|
317
|
-
};
|
318
|
-
}
|
319
|
-
if (type === tokenType.euler_borrow || type === tokenType.euler_lend) {
|
320
|
-
const underlyingToken = fluidInterface.decodeFunctionResult("asset", calls[index].returnData)[0];
|
321
|
-
return {
|
322
|
-
type: type,
|
323
|
-
calls: [
|
324
|
-
{
|
325
|
-
allowFailure: true,
|
326
|
-
callData: ERC20Interface.encodeFunctionData("decimals"),
|
327
|
-
target: underlyingToken,
|
328
|
-
},
|
329
|
-
{
|
330
|
-
allowFailure: true,
|
331
|
-
callData: ERC20Interface.encodeFunctionData("symbol"),
|
332
|
-
target: underlyingToken,
|
333
|
-
},
|
334
|
-
],
|
335
|
-
typeInfo: {
|
336
|
-
...typeInfo,
|
337
|
-
underlyingToken: underlyingToken,
|
338
|
-
},
|
339
|
-
};
|
340
|
-
}
|
341
|
-
if (type === tokenType.beefy) {
|
342
|
-
const token0 = UniswapV2PoolInterface.decodeFunctionResult("token0", calls[index].returnData)[0];
|
343
|
-
const token1 = UniswapV2PoolInterface.decodeFunctionResult("token1", calls[index + 1].returnData)[0];
|
344
|
-
return {
|
345
|
-
type: type,
|
346
|
-
calls: [
|
347
|
-
{
|
348
|
-
allowFailure: true,
|
349
|
-
callData: ERC20Interface.encodeFunctionData("symbol"),
|
350
|
-
target: token0,
|
351
|
-
},
|
352
|
-
{
|
353
|
-
allowFailure: true,
|
354
|
-
callData: ERC20Interface.encodeFunctionData("symbol"),
|
355
|
-
target: token1,
|
356
|
-
},
|
357
|
-
{
|
358
|
-
allowFailure: true,
|
359
|
-
callData: ERC20Interface.encodeFunctionData("decimals"),
|
360
|
-
target: token0,
|
361
|
-
},
|
362
|
-
{
|
363
|
-
allowFailure: true,
|
364
|
-
callData: ERC20Interface.encodeFunctionData("decimals"),
|
365
|
-
target: token1,
|
366
|
-
},
|
367
|
-
{
|
368
|
-
allowFailure: true,
|
369
|
-
callData: ERC20Interface.encodeFunctionData("balanceOf", [typeInfo.underlyingToken]),
|
370
|
-
target: token0,
|
371
|
-
},
|
372
|
-
{
|
373
|
-
allowFailure: true,
|
374
|
-
callData: ERC20Interface.encodeFunctionData("balanceOf", [typeInfo.underlyingToken]),
|
375
|
-
target: token1,
|
376
|
-
},
|
377
|
-
],
|
378
|
-
typeInfo: {
|
379
|
-
...typeInfo,
|
380
|
-
token0,
|
381
|
-
token1,
|
382
19
|
},
|
383
20
|
};
|
384
21
|
}
|
385
|
-
return {
|
386
|
-
type: type,
|
387
|
-
calls: [],
|
388
|
-
typeInfo: {
|
389
|
-
...typeInfo,
|
390
|
-
},
|
391
|
-
};
|
392
22
|
}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import {
|
1
|
+
import type { Campaign, CampaignParameters } from "@sdk";
|
2
2
|
import type { Multicall3 } from "libs/sdk/src/generated/Multicall";
|
3
|
-
import { tokenType,
|
4
|
-
export declare function getTokenTypeRound4(index: number, type: tokenType, typeInfo: any, calls: Multicall3.ResultStructOutput[], campaign: CampaignParameters<Campaign.ERC20>): tokenTypeStruct;
|
3
|
+
import type { tokenType, tokenTypeStruct } from "./helpers/tokenType";
|
4
|
+
export declare function getTokenTypeRound4(index: number, type: tokenType, typeInfo: any, calls: Multicall3.ResultStructOutput[], campaign: CampaignParameters<Campaign.ERC20> | CampaignParameters<Campaign.EULER>): tokenTypeStruct;
|