@merkl/api 0.10.137 → 0.10.139
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/eden/index.d.ts +291 -520
- package/dist/src/index.d.ts +99 -186
- package/dist/src/index.js +1 -1
- package/dist/src/libs/campaigns/campaignTypes/CompoundDynamicData.js +21 -7
- package/dist/src/libs/deprecated-merklv3/index.js +1 -1
- package/dist/src/libs/positions/compound/index.d.ts +0 -2
- package/dist/src/libs/positions/compound/index.js +3 -6
- package/dist/src/modules/v4/blacklist/blacklist.controller.d.ts +0 -21
- package/dist/src/modules/v4/blacklist/blacklist.controller.js +2 -2
- package/dist/src/modules/v4/blacklist/blacklist.repository.d.ts +0 -8
- package/dist/src/modules/v4/blacklist/blacklist.repository.js +1 -4
- package/dist/src/modules/v4/blacklist/blacklist.service.d.ts +1 -9
- package/dist/src/modules/v4/blacklist/blacklist.service.js +1 -4
- package/dist/src/modules/v4/campaign/campaign.controller.d.ts +3 -3
- package/dist/src/modules/v4/campaign/campaign.controller.js +8 -6
- package/dist/src/modules/v4/campaign/campaign.service.js +1 -2
- package/dist/src/modules/v4/chain/chain.controller.js +2 -1
- package/dist/src/modules/v4/dynamicData/dynamicData.controller.d.ts +20 -26
- package/dist/src/modules/v4/dynamicData/dynamicData.controller.js +5 -5
- package/dist/src/modules/v4/enso/enso.service.d.ts +1 -1
- package/dist/src/modules/v4/{participate/participate.controller.d.ts → interaction/interaction.controller.d.ts} +6 -6
- package/dist/src/modules/v4/{participate/participate.controller.js → interaction/interaction.controller.js} +12 -13
- package/dist/src/modules/v4/{participate/participate.model.d.ts → interaction/interaction.model.d.ts} +12 -12
- package/dist/src/modules/v4/{participate/participate.model.js → interaction/interaction.model.js} +3 -3
- package/dist/src/modules/v4/{participate/participate.service.d.ts → interaction/interaction.service.d.ts} +5 -5
- package/dist/src/modules/v4/{participate/participate.service.js → interaction/interaction.service.js} +3 -3
- package/dist/src/modules/v4/merklRoot/merklRoot.controller.d.ts +2 -2
- package/dist/src/modules/v4/merklRoot/merklRoot.controller.js +2 -2
- package/dist/src/modules/v4/opportunity/opportunity.controller.js +5 -1
- package/dist/src/modules/v4/price/price.controller.js +3 -0
- package/dist/src/modules/v4/reward/reward.controller.d.ts +31 -29
- package/dist/src/modules/v4/reward/reward.controller.js +3 -3
- package/dist/src/modules/v4/reward/{rewardConvertor.service.d.ts → subservices/converter.d.ts} +2 -2
- package/dist/src/modules/v4/reward/{rewardConvertor.service.js → subservices/converter.js} +1 -1
- package/dist/src/modules/v4/router.d.ts +99 -186
- package/dist/src/modules/v4/router.js +2 -2
- package/dist/src/modules/v4/status/status.controller.d.ts +40 -102
- package/dist/src/modules/v4/status/status.controller.js +16 -22
- package/dist/src/modules/v4/status/status.model.d.ts +33 -26
- package/dist/src/modules/v4/status/status.model.js +9 -20
- package/dist/src/modules/v4/status/status.repository.d.ts +12 -42
- package/dist/src/modules/v4/status/status.repository.js +10 -22
- package/dist/src/modules/v4/status/status.service.d.ts +4 -36
- package/dist/src/modules/v4/status/status.service.js +9 -18
- package/dist/src/modules/v4/uniswapV4/uniswapV4.controller.d.ts +1 -1
- package/dist/src/modules/v4/uniswapV4/uniswapV4.controller.js +1 -1
- package/dist/src/modules/v4/user/user.controller.js +3 -2
- package/dist/src/routes/v3/ERC20Campaigns.d.ts +99 -186
- package/dist/src/routes/v3/blacklist.d.ts +99 -186
- package/dist/src/routes/v3/campaigns.d.ts +99 -186
- package/dist/src/routes/v3/campaignsInfo.d.ts +99 -186
- package/dist/src/routes/v3/multiChainPositions.d.ts +99 -186
- package/dist/src/routes/v3/opportunity.d.ts +99 -186
- package/dist/src/routes/v3/positions.d.ts +99 -186
- package/dist/src/routes/v3/rewards.d.ts +99 -186
- package/dist/src/routes/v3/rewards.js +1 -1
- package/dist/src/routes/v3/updates.d.ts +99 -186
- package/dist/src/routes/v3/userRewards.d.ts +99 -186
- package/dist/src/routes/v3/userRewards.js +1 -1
- package/dist/tsconfig.package.tsbuildinfo +1 -1
- package/package.json +4 -5
- package/dist/src/modules/v4/apr/apr.repository.d.ts +0 -0
- package/dist/src/modules/v4/apr/apr.repository.js +0 -1
- package/dist/src/modules/v4/tvl/tvl.repository.d.ts +0 -0
- package/dist/src/modules/v4/tvl/tvl.repository.js +0 -1
package/dist/src/index.d.ts
CHANGED
@@ -598,7 +598,7 @@ declare const app: Elysia<"", false, {
|
|
598
598
|
};
|
599
599
|
};
|
600
600
|
} & {
|
601
|
-
|
601
|
+
"campaigns-to-process": {
|
602
602
|
index: {
|
603
603
|
get: {
|
604
604
|
body: unknown;
|
@@ -620,7 +620,7 @@ declare const app: Elysia<"", false, {
|
|
620
620
|
};
|
621
621
|
};
|
622
622
|
} & {
|
623
|
-
|
623
|
+
"campaigns-to-process": {
|
624
624
|
count: {
|
625
625
|
get: {
|
626
626
|
body: unknown;
|
@@ -636,7 +636,7 @@ declare const app: Elysia<"", false, {
|
|
636
636
|
};
|
637
637
|
};
|
638
638
|
} & {
|
639
|
-
|
639
|
+
"campaigns-to-process": {
|
640
640
|
index: {
|
641
641
|
post: {
|
642
642
|
body: unknown;
|
@@ -935,35 +935,37 @@ declare const app: Elysia<"", false, {
|
|
935
935
|
};
|
936
936
|
} & {
|
937
937
|
rewards: {
|
938
|
-
|
939
|
-
|
940
|
-
|
941
|
-
|
942
|
-
|
943
|
-
|
944
|
-
|
945
|
-
|
946
|
-
|
947
|
-
|
948
|
-
|
949
|
-
|
950
|
-
|
951
|
-
|
952
|
-
|
953
|
-
|
954
|
-
|
955
|
-
|
956
|
-
|
957
|
-
|
958
|
-
|
959
|
-
|
960
|
-
|
961
|
-
|
962
|
-
|
963
|
-
|
964
|
-
|
965
|
-
|
966
|
-
|
938
|
+
engine: {
|
939
|
+
pendings: {
|
940
|
+
post: {
|
941
|
+
body: {
|
942
|
+
distributionChainId: number;
|
943
|
+
campaignId: string;
|
944
|
+
root: string;
|
945
|
+
rewardToken: string;
|
946
|
+
toUpdate: {
|
947
|
+
auxiliaryData1?: string | undefined;
|
948
|
+
auxiliaryData2?: string | undefined;
|
949
|
+
reason: string;
|
950
|
+
pending: string;
|
951
|
+
recipient: string;
|
952
|
+
}[];
|
953
|
+
toCreate: {
|
954
|
+
auxiliaryData1?: string | undefined;
|
955
|
+
auxiliaryData2?: string | undefined;
|
956
|
+
reason: string;
|
957
|
+
pending: string;
|
958
|
+
recipient: string;
|
959
|
+
}[];
|
960
|
+
};
|
961
|
+
params: {};
|
962
|
+
query: unknown;
|
963
|
+
headers: {
|
964
|
+
authorization: string;
|
965
|
+
};
|
966
|
+
response: {
|
967
|
+
200: boolean;
|
968
|
+
};
|
967
969
|
};
|
968
970
|
};
|
969
971
|
};
|
@@ -1271,27 +1273,6 @@ declare const app: Elysia<"", false, {
|
|
1271
1273
|
v4: {
|
1272
1274
|
blacklists: {
|
1273
1275
|
index: {
|
1274
|
-
get: {
|
1275
|
-
body: unknown;
|
1276
|
-
params: {};
|
1277
|
-
query: unknown;
|
1278
|
-
headers: unknown;
|
1279
|
-
response: {
|
1280
|
-
200: {
|
1281
|
-
id: string;
|
1282
|
-
chainId: number;
|
1283
|
-
poolAddress: string;
|
1284
|
-
userAddress: string;
|
1285
|
-
arrestTimestamp: bigint;
|
1286
|
-
arrestDetails: import("database/api/.generated/runtime/library").JsonValue;
|
1287
|
-
}[];
|
1288
|
-
};
|
1289
|
-
};
|
1290
|
-
};
|
1291
|
-
};
|
1292
|
-
} & {
|
1293
|
-
blacklists: {
|
1294
|
-
all: {
|
1295
1276
|
get: {
|
1296
1277
|
body: unknown;
|
1297
1278
|
params: {};
|
@@ -1718,7 +1699,7 @@ declare const app: Elysia<"", false, {
|
|
1718
1699
|
} & {
|
1719
1700
|
v4: {
|
1720
1701
|
roots: {
|
1721
|
-
|
1702
|
+
index: {
|
1722
1703
|
get: {
|
1723
1704
|
body: unknown;
|
1724
1705
|
params: {};
|
@@ -1741,7 +1722,7 @@ declare const app: Elysia<"", false, {
|
|
1741
1722
|
};
|
1742
1723
|
} & {
|
1743
1724
|
roots: {
|
1744
|
-
|
1725
|
+
live: {
|
1745
1726
|
get: {
|
1746
1727
|
body: unknown;
|
1747
1728
|
params: {};
|
@@ -1760,7 +1741,7 @@ declare const app: Elysia<"", false, {
|
|
1760
1741
|
};
|
1761
1742
|
} & {
|
1762
1743
|
v4: {
|
1763
|
-
|
1744
|
+
interaction: {
|
1764
1745
|
targets: {
|
1765
1746
|
get: {
|
1766
1747
|
body: unknown;
|
@@ -1772,13 +1753,13 @@ declare const app: Elysia<"", false, {
|
|
1772
1753
|
};
|
1773
1754
|
headers: unknown;
|
1774
1755
|
response: {
|
1775
|
-
200: import("./modules/v4/
|
1756
|
+
200: import("./modules/v4/interaction/interaction.model").InteractionTarget[] | undefined;
|
1776
1757
|
};
|
1777
1758
|
};
|
1778
1759
|
};
|
1779
1760
|
};
|
1780
1761
|
} & {
|
1781
|
-
|
1762
|
+
interaction: {
|
1782
1763
|
protocols: {
|
1783
1764
|
get: {
|
1784
1765
|
body: unknown;
|
@@ -1801,7 +1782,7 @@ declare const app: Elysia<"", false, {
|
|
1801
1782
|
};
|
1802
1783
|
};
|
1803
1784
|
} & {
|
1804
|
-
|
1785
|
+
interaction: {
|
1805
1786
|
quote: {
|
1806
1787
|
get: {
|
1807
1788
|
body: unknown;
|
@@ -1827,7 +1808,7 @@ declare const app: Elysia<"", false, {
|
|
1827
1808
|
};
|
1828
1809
|
};
|
1829
1810
|
} & {
|
1830
|
-
|
1811
|
+
interaction: {
|
1831
1812
|
transaction: {
|
1832
1813
|
get: {
|
1833
1814
|
body: unknown;
|
@@ -2049,31 +2030,25 @@ declare const app: Elysia<"", false, {
|
|
2049
2030
|
};
|
2050
2031
|
} & {
|
2051
2032
|
v4: {
|
2052
|
-
|
2053
|
-
|
2054
|
-
|
2055
|
-
|
2056
|
-
|
2057
|
-
|
2058
|
-
|
2059
|
-
|
2060
|
-
|
2061
|
-
|
2062
|
-
|
2063
|
-
|
2064
|
-
|
2065
|
-
|
2066
|
-
|
2067
|
-
|
2068
|
-
|
2069
|
-
|
2070
|
-
|
2071
|
-
cardName: string;
|
2072
|
-
blacklistedSupply: number;
|
2073
|
-
priceTargetToken: number;
|
2074
|
-
};
|
2075
|
-
};
|
2076
|
-
};
|
2033
|
+
"dynamic-data": {
|
2034
|
+
index: {
|
2035
|
+
get: {
|
2036
|
+
body: unknown;
|
2037
|
+
params: {};
|
2038
|
+
query: {
|
2039
|
+
chainId: number;
|
2040
|
+
tokenAddress: string;
|
2041
|
+
};
|
2042
|
+
headers: {
|
2043
|
+
authorization: string;
|
2044
|
+
};
|
2045
|
+
response: {
|
2046
|
+
200: {
|
2047
|
+
tvl: number;
|
2048
|
+
totalSupply: number;
|
2049
|
+
cardName: string;
|
2050
|
+
blacklistedSupply: number;
|
2051
|
+
priceTargetToken: number;
|
2077
2052
|
};
|
2078
2053
|
};
|
2079
2054
|
};
|
@@ -2082,11 +2057,11 @@ declare const app: Elysia<"", false, {
|
|
2082
2057
|
};
|
2083
2058
|
} & {
|
2084
2059
|
v4: {
|
2085
|
-
|
2060
|
+
"campaign-status": {
|
2086
2061
|
engine: {
|
2087
|
-
|
2088
|
-
|
2089
|
-
|
2062
|
+
":campaignId": {
|
2063
|
+
put: {
|
2064
|
+
body: {
|
2090
2065
|
value: "SUCCESS";
|
2091
2066
|
computedUntil: number;
|
2092
2067
|
} | {
|
@@ -2100,90 +2075,74 @@ declare const app: Elysia<"", false, {
|
|
2100
2075
|
details: string;
|
2101
2076
|
value: "FAILED";
|
2102
2077
|
};
|
2103
|
-
|
2104
|
-
|
2105
|
-
|
2106
|
-
|
2107
|
-
|
2108
|
-
|
2109
|
-
|
2110
|
-
|
2111
|
-
|
2112
|
-
|
2078
|
+
params: {
|
2079
|
+
campaignId: string;
|
2080
|
+
};
|
2081
|
+
query: unknown;
|
2082
|
+
headers: {
|
2083
|
+
authorization: string;
|
2084
|
+
};
|
2085
|
+
response: {
|
2086
|
+
200: void;
|
2087
|
+
};
|
2113
2088
|
};
|
2114
2089
|
};
|
2115
2090
|
};
|
2116
2091
|
};
|
2117
2092
|
} & {
|
2118
|
-
|
2119
|
-
|
2120
|
-
|
2121
|
-
|
2122
|
-
|
2123
|
-
|
2124
|
-
|
2125
|
-
response: {
|
2126
|
-
200: {
|
2127
|
-
error: string;
|
2128
|
-
details: import("database/api/.generated/runtime/library").JsonValue;
|
2129
|
-
status: import("../database/api/.generated").$Enums.RunStatus;
|
2093
|
+
"campaign-status": {
|
2094
|
+
engine: {
|
2095
|
+
overlaps: {
|
2096
|
+
get: {
|
2097
|
+
body: unknown;
|
2098
|
+
params: {};
|
2099
|
+
query: {
|
2130
2100
|
campaignId: string;
|
2131
|
-
|
2132
|
-
|
2133
|
-
|
2101
|
+
distributionChain: number;
|
2102
|
+
};
|
2103
|
+
headers: {
|
2104
|
+
authorization: string;
|
2105
|
+
};
|
2106
|
+
response: {
|
2107
|
+
200: boolean;
|
2108
|
+
};
|
2134
2109
|
};
|
2135
2110
|
};
|
2136
2111
|
};
|
2137
2112
|
};
|
2138
2113
|
} & {
|
2139
|
-
|
2140
|
-
|
2114
|
+
"campaign-status": {
|
2115
|
+
index: {
|
2141
2116
|
get: {
|
2142
2117
|
body: unknown;
|
2143
2118
|
params: {};
|
2144
2119
|
query: {
|
2145
|
-
status
|
2120
|
+
status?: "PROCESSING" | "SUCCESS" | "FAILED" | "SKIPPED" | ("PROCESSING" | "SUCCESS" | "FAILED" | "SKIPPED")[] | undefined;
|
2121
|
+
computeChainId?: number | undefined;
|
2146
2122
|
};
|
2147
2123
|
headers: unknown;
|
2148
2124
|
response: {
|
2149
|
-
200:
|
2150
|
-
Campaign: {
|
2151
|
-
type: import("../database/api/.generated").$Enums.CampaignType;
|
2152
|
-
id: string;
|
2153
|
-
params: import("database/api/.generated/runtime/library").JsonValue;
|
2154
|
-
subType: number | null;
|
2155
|
-
startTimestamp: bigint;
|
2156
|
-
endTimestamp: bigint;
|
2157
|
-
computeChainId: number;
|
2158
|
-
distributionChainId: number;
|
2159
|
-
campaignId: string;
|
2160
|
-
rewardTokenId: string;
|
2161
|
-
amount: string;
|
2162
|
-
opportunityId: string;
|
2163
|
-
creatorAddress: string;
|
2164
|
-
};
|
2165
|
-
} & {
|
2125
|
+
200: {
|
2166
2126
|
error: string;
|
2167
2127
|
details: import("database/api/.generated/runtime/library").JsonValue;
|
2168
2128
|
status: import("../database/api/.generated").$Enums.RunStatus;
|
2169
2129
|
campaignId: string;
|
2170
2130
|
computedUntil: bigint;
|
2171
2131
|
processingStarted: bigint;
|
2172
|
-
}
|
2132
|
+
}[];
|
2173
2133
|
};
|
2174
2134
|
};
|
2175
2135
|
};
|
2176
2136
|
};
|
2177
2137
|
} & {
|
2178
|
-
|
2179
|
-
|
2138
|
+
"campaign-status": {
|
2139
|
+
":campaignId": {
|
2180
2140
|
get: {
|
2181
2141
|
body: unknown;
|
2182
|
-
params: {
|
2183
|
-
query: {
|
2142
|
+
params: {
|
2184
2143
|
campaignId: string;
|
2185
|
-
distributionChain: number;
|
2186
2144
|
};
|
2145
|
+
query: unknown;
|
2187
2146
|
headers: unknown;
|
2188
2147
|
response: {
|
2189
2148
|
200: {
|
@@ -2198,52 +2157,6 @@ declare const app: Elysia<"", false, {
|
|
2198
2157
|
};
|
2199
2158
|
};
|
2200
2159
|
};
|
2201
|
-
} & {
|
2202
|
-
campaignStatus: {
|
2203
|
-
computeChain: {
|
2204
|
-
":chainId": {
|
2205
|
-
get: {
|
2206
|
-
body: unknown;
|
2207
|
-
params: {
|
2208
|
-
chainId: number;
|
2209
|
-
};
|
2210
|
-
query: unknown;
|
2211
|
-
headers: unknown;
|
2212
|
-
response: {
|
2213
|
-
200: {
|
2214
|
-
error: string;
|
2215
|
-
details: import("database/api/.generated/runtime/library").JsonValue;
|
2216
|
-
status: import("../database/api/.generated").$Enums.RunStatus;
|
2217
|
-
campaignId: string;
|
2218
|
-
computedUntil: bigint;
|
2219
|
-
processingStarted: bigint;
|
2220
|
-
}[];
|
2221
|
-
};
|
2222
|
-
};
|
2223
|
-
};
|
2224
|
-
};
|
2225
|
-
};
|
2226
|
-
} & {
|
2227
|
-
campaignStatus: {
|
2228
|
-
engine: {
|
2229
|
-
overlaps: {
|
2230
|
-
get: {
|
2231
|
-
body: unknown;
|
2232
|
-
params: {};
|
2233
|
-
query: {
|
2234
|
-
campaignId: string;
|
2235
|
-
distributionChain: number;
|
2236
|
-
};
|
2237
|
-
headers: {
|
2238
|
-
authorization: string;
|
2239
|
-
};
|
2240
|
-
response: {
|
2241
|
-
200: boolean;
|
2242
|
-
};
|
2243
|
-
};
|
2244
|
-
};
|
2245
|
-
};
|
2246
|
-
};
|
2247
2160
|
};
|
2248
2161
|
}, {
|
2249
2162
|
derive: {};
|
package/dist/src/index.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { BN2Number, CTokenInterface, CompFork, CompoundSubCampaignType, LayerBankERC20Interface, YEAR, } from "@sdk";
|
1
|
+
import { BN2Number, CTokenInterface, CompFork, CompoundSubCampaignType, IonicERC20_INTERFACE, LayerBankERC20Interface, YEAR, } from "@sdk";
|
2
2
|
import { log } from "../../../utils/logger";
|
3
3
|
import { Pricer } from "../../../utils/pricer";
|
4
4
|
export async function CompoundDynamicData(_chainId, campaigns) {
|
@@ -6,11 +6,20 @@ export async function CompoundDynamicData(_chainId, campaigns) {
|
|
6
6
|
const calls = [];
|
7
7
|
for (const campaign of campaigns) {
|
8
8
|
if (campaign.campaignSubType === CompoundSubCampaignType.supply) {
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
9
|
+
if (campaign.campaignParameters.compFork === CompFork.Ionic) {
|
10
|
+
calls.push({
|
11
|
+
allowFailure: true,
|
12
|
+
callData: IonicERC20_INTERFACE.encodeFunctionData("getTotalUnderlyingSupplied"),
|
13
|
+
target: campaign.campaignParameters.targetToken,
|
14
|
+
});
|
15
|
+
}
|
16
|
+
else {
|
17
|
+
calls.push({
|
18
|
+
allowFailure: true,
|
19
|
+
callData: CTokenInterface.encodeFunctionData("totalSupply"),
|
20
|
+
target: campaign.campaignParameters.targetToken,
|
21
|
+
});
|
22
|
+
}
|
14
23
|
}
|
15
24
|
else {
|
16
25
|
if (campaign.campaignParameters.compFork === CompFork.LayerBank) {
|
@@ -41,7 +50,12 @@ export async function CompoundDynamicData(_chainId, campaigns) {
|
|
41
50
|
let totalSupplyTargetToken;
|
42
51
|
if (campaign.campaignSubType === CompoundSubCampaignType.supply) {
|
43
52
|
try {
|
44
|
-
|
53
|
+
if (campaign.campaignParameters.compFork === CompFork.Ionic) {
|
54
|
+
totalSupplyTargetToken = BN2Number(IonicERC20_INTERFACE.decodeFunctionResult("getTotalUnderlyingSupplied", result[i++])[0], campaign.campaignParameters.decimalsUnderlyingToken);
|
55
|
+
}
|
56
|
+
else {
|
57
|
+
totalSupplyTargetToken = BN2Number(CTokenInterface.decodeFunctionResult("totalSupply", result[i++])[0], campaign.campaignParameters.decimalsUnderlyingToken);
|
58
|
+
}
|
45
59
|
}
|
46
60
|
catch {
|
47
61
|
log.warn(`Error getting totalSupply for campaign ${campaign.campaignId} and token ${campaign.campaignParameters.targetToken}`);
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { Redis } from "../../cache";
|
2
|
-
import { RewardConvertorService } from "../../modules/v4/reward/
|
2
|
+
import { RewardConvertorService } from "../../modules/v4/reward/subservices/converter";
|
3
3
|
import { AMM, ANGLE_NETWORKS, Campaign, NETWORK_LABELS, } from "@sdk";
|
4
4
|
import Big from "big.js";
|
5
5
|
import { utils } from "ethers";
|
@@ -1,7 +1,5 @@
|
|
1
1
|
import { type Forwarder, type ForwarderParameters, type MerklChainId } from "@sdk";
|
2
|
-
import { utils } from "ethers";
|
3
2
|
import type { UncachedResult } from "../../../utils/execute";
|
4
|
-
export declare const IONICCERC20_INTERFACE: utils.Interface;
|
5
3
|
type FetchedCampaign = {
|
6
4
|
rewardToken: string;
|
7
5
|
symbolRewardToken: string;
|
@@ -1,7 +1,4 @@
|
|
1
|
-
import { BN2Number, CTokenInterface, CompFork, CompoundSubCampaignType, ERC20Interface, LayerBankERC20Interface, } from "@sdk";
|
2
|
-
import { utils } from "ethers";
|
3
|
-
const IONICCERC20_ABI = ["function borrowBalanceCurrent(address account) public view returns (uint256)"];
|
4
|
-
export const IONICCERC20_INTERFACE = new utils.Interface(IONICCERC20_ABI);
|
1
|
+
import { BN2Number, CTokenInterface, CompFork, CompoundSubCampaignType, ERC20Interface, IonicERC20_INTERFACE, LayerBankERC20Interface, } from "@sdk";
|
5
2
|
export async function getCompoundUserPositions(user, _chainId, campaigns) {
|
6
3
|
/**
|
7
4
|
* Fetch user positions
|
@@ -19,7 +16,7 @@ export async function getCompoundUserPositions(user, _chainId, campaigns) {
|
|
19
16
|
case CompFork.Ionic || CompFork.Venus:
|
20
17
|
calls.push({
|
21
18
|
allowFailure: true,
|
22
|
-
callData:
|
19
|
+
callData: IonicERC20_INTERFACE.encodeFunctionData("borrowBalanceCurrent", [user]),
|
23
20
|
target: campaigns[mainParameter].targetToken,
|
24
21
|
});
|
25
22
|
break;
|
@@ -62,7 +59,7 @@ export async function getCompoundUserPositions(user, _chainId, campaigns) {
|
|
62
59
|
switch (campaigns[mainParameter].compFork) {
|
63
60
|
case CompFork.Ionic:
|
64
61
|
case CompFork.Venus:
|
65
|
-
balance = BN2Number(
|
62
|
+
balance = BN2Number(IonicERC20_INTERFACE.decodeFunctionResult("borrowBalanceCurrent", result[i])[0], campaigns[mainParameter].decimalsUnderlyingToken);
|
66
63
|
break;
|
67
64
|
case CompFork.LayerBank:
|
68
65
|
balance = BN2Number(LayerBankERC20Interface.decodeFunctionResult("borrowBalanceOf", result[i])[0], campaigns[mainParameter].decimalsUnderlyingToken);
|
@@ -14,27 +14,6 @@ export declare const BlacklistController: Elysia<"/blacklists", false, {
|
|
14
14
|
}, {
|
15
15
|
blacklists: {
|
16
16
|
index: {
|
17
|
-
get: {
|
18
|
-
body: unknown;
|
19
|
-
params: {};
|
20
|
-
query: unknown;
|
21
|
-
headers: unknown;
|
22
|
-
response: {
|
23
|
-
200: {
|
24
|
-
id: string;
|
25
|
-
chainId: number;
|
26
|
-
poolAddress: string;
|
27
|
-
userAddress: string;
|
28
|
-
arrestTimestamp: bigint;
|
29
|
-
arrestDetails: import("database/api/.generated/runtime/library").JsonValue;
|
30
|
-
}[];
|
31
|
-
};
|
32
|
-
};
|
33
|
-
};
|
34
|
-
};
|
35
|
-
} & {
|
36
|
-
blacklists: {
|
37
|
-
all: {
|
38
17
|
get: {
|
39
18
|
body: unknown;
|
40
19
|
params: {};
|
@@ -7,8 +7,6 @@ import { BlacklistService } from "./blacklist.service";
|
|
7
7
|
export const BlacklistController = new Elysia({ prefix: "/blacklists", detail: { tags: ["Blacklists"] } })
|
8
8
|
// ─── Get Entire Blacklist ────────────────────────────────────────────
|
9
9
|
.get("/", async () => await BlacklistService.findMany())
|
10
|
-
// ─── Get Blacklist From Cache ────────────────────────────────────────
|
11
|
-
.get("/all", async () => await BlacklistService.getMany())
|
12
10
|
// ─── Check If An Address Is Blacklisted ──────────────────────────────
|
13
11
|
.get("/check/:address", async ({ params }) => await BlacklistService.isBlacklisted(params.address), {
|
14
12
|
params: CheckBlacklistDto,
|
@@ -29,6 +27,7 @@ export const BlacklistController = new Elysia({ prefix: "/blacklists", detail: {
|
|
29
27
|
body.poolAddress = throwOnInvalidRequiredAddress(body.poolAddress ?? NULL_ADDRESS);
|
30
28
|
throwOnUnsupportedChainId(body.chainId);
|
31
29
|
},
|
30
|
+
detail: { hide: true },
|
32
31
|
})
|
33
32
|
// ─── Remove A User From Blacklist ────────────────────────────────────
|
34
33
|
.delete("/user/:address", async ({ params }) => await BlacklistService.remove(params.address), {
|
@@ -38,4 +37,5 @@ export const BlacklistController = new Elysia({ prefix: "/blacklists", detail: {
|
|
38
37
|
await BackOfficeGuard({ headers });
|
39
38
|
params.address = throwOnInvalidRequiredAddress(params.address);
|
40
39
|
},
|
40
|
+
detail: { hide: true },
|
41
41
|
});
|
@@ -1,14 +1,6 @@
|
|
1
1
|
import type { AddBlacklistModel } from "./blacklist.model";
|
2
2
|
export declare class BlacklistRepository {
|
3
3
|
static findMany(): Promise<{
|
4
|
-
id: string;
|
5
|
-
chainId: number;
|
6
|
-
poolAddress: string;
|
7
|
-
userAddress: string;
|
8
|
-
arrestTimestamp: bigint;
|
9
|
-
arrestDetails: import("database/api/.generated/runtime/library").JsonValue;
|
10
|
-
}[]>;
|
11
|
-
static getMany(): Promise<{
|
12
4
|
[address: string]: boolean;
|
13
5
|
}>;
|
14
6
|
static check(address: string): Promise<boolean>;
|
@@ -3,10 +3,7 @@ import { NULL_ADDRESS } from "@sdk";
|
|
3
3
|
import { utils } from "ethers";
|
4
4
|
export class BlacklistRepository {
|
5
5
|
static async findMany() {
|
6
|
-
return await apiDbClient.blacklist.findMany()
|
7
|
-
}
|
8
|
-
static async getMany() {
|
9
|
-
return (await BlacklistRepository.findMany()).reduce((prev, { userAddress, arrestTimestamp }) => {
|
6
|
+
return (await apiDbClient.blacklist.findMany()).reduce((prev, { userAddress, arrestTimestamp }) => {
|
10
7
|
if (!!arrestTimestamp) {
|
11
8
|
prev[utils.getAddress(userAddress)] = true;
|
12
9
|
}
|
@@ -2,17 +2,9 @@ import type { ChainId } from "@sdk";
|
|
2
2
|
import type { AddBlacklistModel } from ".";
|
3
3
|
export declare class BlacklistService {
|
4
4
|
static hashId(chainId: ChainId, userAddress: string, poolAddress: string): string;
|
5
|
-
static
|
5
|
+
static findMany(): Promise<{
|
6
6
|
[address: string]: boolean;
|
7
7
|
}>;
|
8
|
-
static findMany(): Promise<{
|
9
|
-
id: string;
|
10
|
-
chainId: number;
|
11
|
-
poolAddress: string;
|
12
|
-
userAddress: string;
|
13
|
-
arrestTimestamp: bigint;
|
14
|
-
arrestDetails: import("database/api/.generated/runtime/library").JsonValue;
|
15
|
-
}[]>;
|
16
8
|
static isBlacklisted(address: string): Promise<boolean>;
|
17
9
|
static remove(address: string): Promise<boolean>;
|
18
10
|
static add(x: AddBlacklistModel): Promise<{
|
@@ -6,11 +6,8 @@ export class BlacklistService {
|
|
6
6
|
static hashId(chainId, userAddress, poolAddress) {
|
7
7
|
return Bun.hash(`${chainId}${userAddress}${poolAddress}`).toString();
|
8
8
|
}
|
9
|
-
static async getMany() {
|
10
|
-
return await CacheService.wrap(TTLPresets.MIN_5, BlacklistRepository.getMany);
|
11
|
-
}
|
12
9
|
static async findMany() {
|
13
|
-
return await BlacklistRepository.findMany
|
10
|
+
return await CacheService.wrap(TTLPresets.MIN_5, BlacklistRepository.findMany);
|
14
11
|
}
|
15
12
|
static async isBlacklisted(address) {
|
16
13
|
return BlacklistRepository.check(utils.getAddress(address));
|