@evaafi/sdk 0.7.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/feeds.d.ts +30 -0
- package/dist/api/feeds.js +73 -0
- package/dist/api/liquidation.js +1 -1
- package/dist/api/math.js +1 -1
- package/dist/api/parser.d.ts +4 -2
- package/dist/api/parser.js +39 -18
- package/dist/api/parsers/AbstractOracleParser.d.ts +11 -0
- package/dist/api/parsers/AbstractOracleParser.js +9 -0
- package/dist/api/parsers/ClassicOracleParser.d.ts +10 -0
- package/dist/api/parsers/ClassicOracleParser.js +16 -0
- package/dist/api/parsers/PythOracleParser.d.ts +17 -0
- package/dist/api/parsers/PythOracleParser.js +22 -0
- package/dist/api/parsers/index.d.ts +3 -0
- package/dist/api/parsers/index.js +19 -0
- package/dist/api/prices.d.ts +6 -6
- package/dist/api/prices.js +37 -46
- package/dist/api/pyth.d.ts +16 -0
- package/dist/api/pyth.js +35 -0
- package/dist/constants/assets/assetId.d.ts +22 -0
- package/dist/constants/assets/assetId.js +29 -0
- package/dist/constants/assets/index.d.ts +3 -0
- package/dist/constants/assets/index.js +19 -0
- package/dist/constants/assets/mainnet.d.ts +19 -0
- package/dist/constants/assets/mainnet.js +114 -0
- package/dist/constants/assets/testnet.d.ts +14 -0
- package/dist/constants/assets/testnet.js +54 -0
- package/dist/constants/general/index.d.ts +65 -0
- package/dist/constants/general/index.js +93 -0
- package/dist/constants/general/mainnet.d.ts +24 -0
- package/dist/constants/general/mainnet.js +53 -0
- package/dist/constants/general/testnet.d.ts +12 -0
- package/dist/constants/general/testnet.js +15 -0
- package/dist/constants/general.d.ts +2 -2
- package/dist/constants/general.js +4 -4
- package/dist/constants/index.d.ts +3 -0
- package/dist/constants/index.js +19 -0
- package/dist/constants/pools/index.d.ts +2 -0
- package/dist/constants/pools/index.js +18 -0
- package/dist/constants/pools/mainnet.d.ts +14 -0
- package/dist/constants/pools/mainnet.js +145 -0
- package/dist/constants/pools/testnet.d.ts +9 -0
- package/dist/constants/pools/testnet.js +57 -0
- package/dist/constants/pools.js +7 -7
- package/dist/contracts/AbstractMaster.d.ts +185 -0
- package/dist/contracts/AbstractMaster.js +179 -0
- package/dist/contracts/ClassicMaster.d.ts +34 -0
- package/dist/contracts/ClassicMaster.js +87 -0
- package/dist/contracts/PythMaster.d.ts +61 -0
- package/dist/contracts/PythMaster.js +179 -0
- package/dist/contracts/UserContract.d.ts +1 -7
- package/dist/contracts/UserContract.js +1 -19
- package/dist/contracts/index.d.ts +5 -0
- package/dist/contracts/index.js +21 -0
- package/dist/index.d.ts +14 -14
- package/dist/index.js +20 -60
- package/dist/prices/Oracle.interface.d.ts +9 -0
- package/dist/prices/Oracle.interface.js +2 -0
- package/dist/prices/Prices.d.ts +5 -3
- package/dist/prices/Prices.js +13 -3
- package/dist/prices/PricesCollector.d.ts +17 -7
- package/dist/prices/PricesCollector.js +67 -51
- package/dist/prices/PythCollector.d.ts +22 -0
- package/dist/prices/PythCollector.js +217 -0
- package/dist/prices/Types.d.ts +17 -1
- package/dist/prices/Types.js +8 -1
- package/dist/prices/index.d.ts +4 -3
- package/dist/prices/index.js +4 -3
- package/dist/prices/sources/Backend.d.ts +5 -4
- package/dist/prices/sources/Backend.js +16 -13
- package/dist/prices/sources/Icp.d.ts +2 -1
- package/dist/prices/sources/Icp.js +12 -9
- package/dist/prices/sources/PriceSource.d.ts +7 -6
- package/dist/prices/utils.d.ts +10 -8
- package/dist/prices/utils.js +32 -46
- package/dist/types/Master.d.ts +10 -30
- package/dist/types/Master.js +3 -0
- package/dist/utils/userJettonWallet.js +0 -8
- package/dist/utils/utils.d.ts +8 -1
- package/dist/utils/utils.js +31 -2
- package/package.json +3 -2
- package/src/api/feeds.ts +90 -0
- package/src/api/liquidation.ts +1 -1
- package/src/api/math.ts +1 -1
- package/src/api/parser.ts +100 -38
- package/src/api/parsers/AbstractOracleParser.ts +16 -0
- package/src/api/parsers/ClassicOracleParser.ts +20 -0
- package/src/api/parsers/PythOracleParser.ts +34 -0
- package/src/api/parsers/index.ts +3 -0
- package/src/api/prices.ts +32 -41
- package/src/constants/assets/assetId.ts +30 -0
- package/src/constants/assets/index.ts +3 -0
- package/src/constants/{assets.ts → assets/mainnet.ts} +3 -96
- package/src/constants/assets/testnet.ts +74 -0
- package/src/constants/general/index.ts +91 -0
- package/src/constants/{general.ts → general/mainnet.ts} +48 -72
- package/src/constants/general/testnet.ts +25 -0
- package/src/constants/index.ts +3 -0
- package/src/constants/pools/index.ts +2 -0
- package/src/constants/pools/mainnet.ts +218 -0
- package/src/constants/pools/testnet.ts +75 -0
- package/src/contracts/AbstractMaster.ts +450 -0
- package/src/contracts/ClassicMaster.ts +149 -0
- package/src/contracts/PythMaster.ts +313 -0
- package/src/contracts/UserContract.ts +7 -28
- package/src/contracts/index.ts +7 -0
- package/src/index.ts +18 -85
- package/src/prices/Oracle.interface.ts +18 -0
- package/src/prices/Prices.ts +17 -4
- package/src/prices/PricesCollector.ts +91 -68
- package/src/prices/PythCollector.ts +294 -0
- package/src/prices/Types.ts +28 -6
- package/src/prices/index.ts +4 -3
- package/src/prices/sources/Backend.ts +21 -19
- package/src/prices/sources/Icp.ts +13 -10
- package/src/prices/sources/PriceSource.ts +6 -5
- package/src/prices/utils.ts +65 -68
- package/src/types/Master.ts +29 -52
- package/src/types/User.ts +15 -7
- package/src/utils/userJettonWallet.ts +0 -8
- package/src/utils/utils.ts +41 -2
- package/src/constants/pools.ts +0 -177
- package/src/contracts/MasterContract.ts +0 -410
package/src/api/parser.ts
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
import { beginCell, Cell, Dictionary, DictionaryValue, Slice } from '@ton/core';
|
|
2
|
-
import {
|
|
2
|
+
import { MasterConfig, MasterData, OracleInfo } from '../contracts/AbstractMaster';
|
|
3
|
+
import {
|
|
4
|
+
AssetConfig,
|
|
5
|
+
AssetData,
|
|
6
|
+
ExtendedAssetData,
|
|
7
|
+
ExtendedAssetsConfig,
|
|
8
|
+
ExtendedAssetsData,
|
|
9
|
+
MasterConstants,
|
|
10
|
+
PoolAssetsConfig,
|
|
11
|
+
PoolConfig,
|
|
12
|
+
} from '../types/Master';
|
|
13
|
+
import { BalanceType, UserBalance, UserData, UserLiteData, UserRewards } from '../types/User';
|
|
14
|
+
import { loadMaybeMyRef, loadMyRef } from './helpers';
|
|
3
15
|
import {
|
|
4
16
|
bigIntMax,
|
|
5
17
|
bigIntMin,
|
|
@@ -11,16 +23,14 @@ import {
|
|
|
11
23
|
getAvailableToBorrow,
|
|
12
24
|
presentValue,
|
|
13
25
|
} from './math';
|
|
14
|
-
import {
|
|
15
|
-
import { BalanceType, UserBalance, UserData, UserLiteData, UserRewards } from '../types/User';
|
|
16
|
-
import { checkNotInDebtAtAll } from "../api/math";
|
|
26
|
+
import { OracleParser } from './parsers/AbstractOracleParser';
|
|
17
27
|
|
|
18
28
|
export function createUserRewards(): DictionaryValue<UserRewards> {
|
|
19
29
|
return {
|
|
20
30
|
serialize: (src: any, buidler: any) => {
|
|
21
31
|
buidler.storeUint(src.trackingIndex, 64);
|
|
22
32
|
buidler.storeUint(src.trackingAccured, 64);
|
|
23
|
-
|
|
33
|
+
},
|
|
24
34
|
parse: (src: Slice) => {
|
|
25
35
|
const trackingIndex = BigInt(src.loadUint(64));
|
|
26
36
|
const trackingAccured = BigInt(src.loadUint(64));
|
|
@@ -51,9 +61,19 @@ export function createAssetData(): DictionaryValue<AssetData> {
|
|
|
51
61
|
const balance = BigInt(src.loadUintBig(64));
|
|
52
62
|
const trackingSupplyIndex = BigInt(src.loadUintBig(64));
|
|
53
63
|
const trackingBorrowIndex = BigInt(src.loadUintBig(64));
|
|
54
|
-
const awaitedSupply = BigInt(src.loadUintBig(64));
|
|
64
|
+
const awaitedSupply = BigInt(src.loadUintBig(64));
|
|
55
65
|
|
|
56
|
-
return {
|
|
66
|
+
return {
|
|
67
|
+
sRate,
|
|
68
|
+
bRate,
|
|
69
|
+
totalSupply,
|
|
70
|
+
totalBorrow,
|
|
71
|
+
lastAccural,
|
|
72
|
+
balance,
|
|
73
|
+
trackingSupplyIndex,
|
|
74
|
+
trackingBorrowIndex,
|
|
75
|
+
awaitedSupply,
|
|
76
|
+
};
|
|
57
77
|
},
|
|
58
78
|
};
|
|
59
79
|
}
|
|
@@ -61,7 +81,7 @@ export function createAssetData(): DictionaryValue<AssetData> {
|
|
|
61
81
|
export function createAssetConfig(): DictionaryValue<AssetConfig> {
|
|
62
82
|
return {
|
|
63
83
|
serialize: (src: any, builder: any) => {
|
|
64
|
-
builder.storeUint(src.
|
|
84
|
+
builder.storeUint(src.jwAddress, 256);
|
|
65
85
|
builder.storeUint(src.decimals, 8);
|
|
66
86
|
const refBuild = beginCell();
|
|
67
87
|
refBuild.storeUint(src.collateralFactor, 16);
|
|
@@ -81,10 +101,14 @@ export function createAssetConfig(): DictionaryValue<AssetConfig> {
|
|
|
81
101
|
refBuild.storeUint(src.minPrincipalForRewards, 64);
|
|
82
102
|
refBuild.storeUint(src.baseTrackingSupplySpeed, 64);
|
|
83
103
|
refBuild.storeUint(src.baseTrackingBorrowSpeed, 64);
|
|
104
|
+
refBuild.storeInt(src.borrowCap, 64);
|
|
105
|
+
refBuild.storeUint(src.heCategory, 8);
|
|
106
|
+
refBuild.storeUint(src.heCollateralFactor, 16);
|
|
107
|
+
refBuild.storeUint(src.heLiquidationThreshold, 16);
|
|
84
108
|
builder.storeRef(refBuild.endCell());
|
|
85
109
|
},
|
|
86
110
|
parse: (src: Slice) => {
|
|
87
|
-
const
|
|
111
|
+
const jwAddress = src.loadUintBig(256);
|
|
88
112
|
const decimals = BigInt(src.loadUint(8));
|
|
89
113
|
const ref = src.loadRef().beginParse();
|
|
90
114
|
const collateralFactor = ref.loadUintBig(16);
|
|
@@ -104,9 +128,13 @@ export function createAssetConfig(): DictionaryValue<AssetConfig> {
|
|
|
104
128
|
const minPrincipalForRewards = ref.loadUintBig(64);
|
|
105
129
|
const baseTrackingSupplySpeed = ref.loadUintBig(64);
|
|
106
130
|
const baseTrackingBorrowSpeed = ref.loadUintBig(64);
|
|
131
|
+
const borrowCap = ref.loadInt(64);
|
|
132
|
+
const heCategory = ref.loadUint(8);
|
|
133
|
+
const heCollateralFactor = ref.loadUint(16);
|
|
134
|
+
const heLiquidationThreshold = ref.loadUint(16);
|
|
107
135
|
|
|
108
136
|
return {
|
|
109
|
-
|
|
137
|
+
jwAddress,
|
|
110
138
|
decimals,
|
|
111
139
|
collateralFactor,
|
|
112
140
|
liquidationThreshold,
|
|
@@ -124,17 +152,25 @@ export function createAssetConfig(): DictionaryValue<AssetConfig> {
|
|
|
124
152
|
liquidationReserveFactor,
|
|
125
153
|
minPrincipalForRewards,
|
|
126
154
|
baseTrackingSupplySpeed,
|
|
127
|
-
baseTrackingBorrowSpeed
|
|
155
|
+
baseTrackingBorrowSpeed,
|
|
156
|
+
borrowCap,
|
|
157
|
+
heCategory,
|
|
158
|
+
heCollateralFactor,
|
|
159
|
+
heLiquidationThreshold,
|
|
128
160
|
};
|
|
129
161
|
},
|
|
130
162
|
};
|
|
131
163
|
}
|
|
132
164
|
|
|
133
|
-
export function parseMasterData(
|
|
165
|
+
export function parseMasterData(
|
|
166
|
+
masterDataBOC: string,
|
|
167
|
+
poolAssetsConfig: PoolAssetsConfig,
|
|
168
|
+
masterConstants: MasterConstants,
|
|
169
|
+
oracleParser: OracleParser,
|
|
170
|
+
): MasterData<MasterConfig<OracleInfo>> {
|
|
134
171
|
const masterSlice = Cell.fromBase64(masterDataBOC).beginParse();
|
|
135
172
|
const meta = masterSlice.loadRef().beginParse().loadStringTail();
|
|
136
173
|
const upgradeConfigParser = masterSlice.loadRef().beginParse();
|
|
137
|
-
|
|
138
174
|
const upgradeConfig = {
|
|
139
175
|
masterCodeVersion: Number(upgradeConfigParser.loadCoins()),
|
|
140
176
|
userCodeVersion: Number(upgradeConfigParser.loadCoins()),
|
|
@@ -146,31 +182,31 @@ export function parseMasterData(masterDataBOC: string, poolAssetsConfig: PoolAss
|
|
|
146
182
|
newUserCode: loadMaybeMyRef(upgradeConfigParser),
|
|
147
183
|
};
|
|
148
184
|
// upgradeConfigParser.endParse(); todo fix with new testnet contract
|
|
149
|
-
|
|
150
185
|
const masterConfigSlice = masterSlice.loadRef().beginParse();
|
|
186
|
+
|
|
151
187
|
const assetsConfigDict = masterConfigSlice.loadDict(Dictionary.Keys.BigUint(256), createAssetConfig());
|
|
152
188
|
const assetsDataDict = masterSlice.loadDict(Dictionary.Keys.BigUint(256), createAssetData());
|
|
153
|
-
|
|
154
189
|
const assetsExtendedData = Dictionary.empty<bigint, ExtendedAssetData>();
|
|
155
190
|
const assetsReserves = Dictionary.empty<bigint, bigint>();
|
|
156
191
|
const apy = {
|
|
157
192
|
supply: Dictionary.empty<bigint, number>(),
|
|
158
193
|
borrow: Dictionary.empty<bigint, number>(),
|
|
159
194
|
};
|
|
160
|
-
|
|
161
|
-
for (const [
|
|
195
|
+
|
|
196
|
+
for (const [, asset] of Object.entries(poolAssetsConfig)) {
|
|
162
197
|
const assetData = calculateAssetData(assetsConfigDict, assetsDataDict, asset.assetId, masterConstants);
|
|
163
198
|
assetsExtendedData.set(asset.assetId, assetData);
|
|
164
199
|
}
|
|
200
|
+
|
|
201
|
+
const ifActive = oracleParser.getIfActive(masterConfigSlice);
|
|
202
|
+
const oraclesInfo = oracleParser.parseOracleConfig(masterConfigSlice);
|
|
203
|
+
|
|
165
204
|
const masterConfig = {
|
|
166
|
-
ifActive
|
|
205
|
+
ifActive,
|
|
167
206
|
admin: masterConfigSlice.loadAddress(),
|
|
168
|
-
oraclesInfo
|
|
169
|
-
numOracles: masterConfigSlice.loadUint(16),
|
|
170
|
-
threshold: masterConfigSlice.loadUint(16),
|
|
171
|
-
oracles: loadMaybeMyRef(masterConfigSlice)
|
|
172
|
-
},
|
|
207
|
+
oraclesInfo,
|
|
173
208
|
tokenKeys: loadMaybeMyRef(masterConfigSlice),
|
|
209
|
+
supervisor: masterConfigSlice.loadMaybeAddress(),
|
|
174
210
|
};
|
|
175
211
|
masterConfigSlice.endParse();
|
|
176
212
|
|
|
@@ -179,11 +215,9 @@ export function parseMasterData(masterDataBOC: string, poolAssetsConfig: PoolAss
|
|
|
179
215
|
const totalSupply = calculatePresentValue(assetData.sRate, assetData.totalSupply, masterConstants);
|
|
180
216
|
const totalBorrow = calculatePresentValue(assetData.bRate, assetData.totalBorrow, masterConstants);
|
|
181
217
|
assetsReserves.set(asset.assetId, assetData.balance - totalSupply + totalBorrow);
|
|
182
|
-
|
|
183
218
|
apy.supply.set(asset.assetId, (1 + (Number(assetData.supplyInterest) / 1e12) * 24 * 3600) ** 365 - 1);
|
|
184
219
|
apy.borrow.set(asset.assetId, (1 + (Number(assetData.borrowInterest) / 1e12) * 24 * 3600) ** 365 - 1);
|
|
185
220
|
}
|
|
186
|
-
|
|
187
221
|
return {
|
|
188
222
|
meta: meta,
|
|
189
223
|
upgradeConfig: upgradeConfig,
|
|
@@ -200,7 +234,7 @@ export function parseUserLiteData(
|
|
|
200
234
|
assetsData: ExtendedAssetsData,
|
|
201
235
|
assetsConfig: ExtendedAssetsConfig,
|
|
202
236
|
poolConfig: PoolConfig,
|
|
203
|
-
applyDust: boolean = false
|
|
237
|
+
applyDust: boolean = false,
|
|
204
238
|
): UserLiteData {
|
|
205
239
|
const poolAssetsConfig = poolConfig.poolAssetsConfig;
|
|
206
240
|
const masterConstants = poolConfig.masterConstants;
|
|
@@ -232,7 +266,7 @@ export function parseUserLiteData(
|
|
|
232
266
|
backupCell1 = userSlice.loadMaybeRef();
|
|
233
267
|
backupCell2 = userSlice.loadMaybeRef();
|
|
234
268
|
}
|
|
235
|
-
|
|
269
|
+
|
|
236
270
|
userSlice.endParse();
|
|
237
271
|
const userBalances = Dictionary.empty<bigint, UserBalance>();
|
|
238
272
|
|
|
@@ -243,7 +277,7 @@ export function parseUserLiteData(
|
|
|
243
277
|
let principal = realPrincipals.get(asset.assetId) || 0n;
|
|
244
278
|
let balance = presentValue(assetData.sRate, assetData.bRate, principal, masterConstants);
|
|
245
279
|
|
|
246
|
-
if (applyDust &&
|
|
280
|
+
if (applyDust && principal > 0 && principal < assetConfig.dust) {
|
|
247
281
|
principal = 0n;
|
|
248
282
|
balance = {
|
|
249
283
|
amount: 0n,
|
|
@@ -270,7 +304,7 @@ export function parseUserLiteData(
|
|
|
270
304
|
dutchAuctionStart: dutchAuctionStart,
|
|
271
305
|
backupCell: backupCell,
|
|
272
306
|
fullyParsed: false,
|
|
273
|
-
|
|
307
|
+
|
|
274
308
|
rewards: rewards,
|
|
275
309
|
backupCell1: backupCell1,
|
|
276
310
|
backupCell2: backupCell2,
|
|
@@ -283,7 +317,7 @@ export function parseUserData(
|
|
|
283
317
|
assetsConfig: ExtendedAssetsConfig,
|
|
284
318
|
prices: Dictionary<bigint, bigint>,
|
|
285
319
|
poolConfig: PoolConfig,
|
|
286
|
-
applyDust: boolean = false
|
|
320
|
+
applyDust: boolean = false,
|
|
287
321
|
): UserData {
|
|
288
322
|
userLiteData.fullyParsed = true;
|
|
289
323
|
let havePrincipalWithoutPrice = false;
|
|
@@ -314,7 +348,7 @@ export function parseUserData(
|
|
|
314
348
|
let principal = userLiteData.principals.get(asset.assetId) || 0n;
|
|
315
349
|
const balance = presentValue(assetData.sRate, assetData.bRate, principal, masterConstants);
|
|
316
350
|
|
|
317
|
-
if (applyDust &&
|
|
351
|
+
if (applyDust && principal > 0 && principal < assetConfig.dust) {
|
|
318
352
|
principal = 0n;
|
|
319
353
|
userLiteData.principals.set(asset.assetId, 0n);
|
|
320
354
|
}
|
|
@@ -338,19 +372,35 @@ export function parseUserData(
|
|
|
338
372
|
}
|
|
339
373
|
}
|
|
340
374
|
|
|
341
|
-
const availableToBorrow = getAvailableToBorrow(
|
|
375
|
+
const availableToBorrow = getAvailableToBorrow(
|
|
376
|
+
assetsConfig,
|
|
377
|
+
assetsData,
|
|
378
|
+
userLiteData.realPrincipals,
|
|
379
|
+
prices,
|
|
380
|
+
masterConstants,
|
|
381
|
+
);
|
|
342
382
|
|
|
343
383
|
for (const [_, asset] of Object.entries(poolAssetsConfig)) {
|
|
344
384
|
const balance = userLiteData.balances.get(asset.assetId) as UserBalance;
|
|
345
385
|
const assetConfig = assetsConfig.get(asset.assetId) as AssetConfig;
|
|
346
386
|
const assetData = assetsData.get(asset.assetId) as ExtendedAssetData;
|
|
347
|
-
|
|
387
|
+
|
|
348
388
|
const assetLiquidityMinusReserves = getAssetLiquidityMinusReserves(assetData, masterConstants);
|
|
349
389
|
|
|
350
390
|
if (balance.type === BalanceType.supply) {
|
|
351
391
|
withdrawalLimits.set(
|
|
352
392
|
asset.assetId,
|
|
353
|
-
bigIntMin(
|
|
393
|
+
bigIntMin(
|
|
394
|
+
calculateMaximumWithdrawAmount(
|
|
395
|
+
assetsConfig,
|
|
396
|
+
assetsData,
|
|
397
|
+
userLiteData.realPrincipals,
|
|
398
|
+
prices,
|
|
399
|
+
masterConstants,
|
|
400
|
+
asset.assetId,
|
|
401
|
+
),
|
|
402
|
+
assetData.balance,
|
|
403
|
+
),
|
|
354
404
|
);
|
|
355
405
|
}
|
|
356
406
|
|
|
@@ -361,7 +411,13 @@ export function parseUserData(
|
|
|
361
411
|
|
|
362
412
|
borrowLimits.set(
|
|
363
413
|
asset.assetId,
|
|
364
|
-
bigIntMax(
|
|
414
|
+
bigIntMax(
|
|
415
|
+
0n,
|
|
416
|
+
bigIntMin(
|
|
417
|
+
(availableToBorrow * 10n ** assetConfig.decimals) / prices.get(asset.assetId)!,
|
|
418
|
+
assetLiquidityMinusReserves,
|
|
419
|
+
),
|
|
420
|
+
),
|
|
365
421
|
);
|
|
366
422
|
}
|
|
367
423
|
|
|
@@ -374,10 +430,16 @@ export function parseUserData(
|
|
|
374
430
|
let healthFactor = 1;
|
|
375
431
|
let liquidationData;
|
|
376
432
|
if (!havePrincipalWithoutPrice) {
|
|
377
|
-
liquidationData = calculateLiquidationData(
|
|
433
|
+
liquidationData = calculateLiquidationData(
|
|
434
|
+
assetsConfig,
|
|
435
|
+
assetsData,
|
|
436
|
+
userLiteData.realPrincipals,
|
|
437
|
+
prices,
|
|
438
|
+
poolConfig,
|
|
439
|
+
);
|
|
378
440
|
if (liquidationData.totalLimit != 0n) {
|
|
379
441
|
healthFactor = 1 - Number(liquidationData.totalDebt) / Number(liquidationData.totalLimit);
|
|
380
|
-
}
|
|
442
|
+
}
|
|
381
443
|
}
|
|
382
444
|
return {
|
|
383
445
|
...userLiteData,
|
|
@@ -390,6 +452,6 @@ export function parseUserData(
|
|
|
390
452
|
limitUsed: limitUsed,
|
|
391
453
|
liquidationData: liquidationData,
|
|
392
454
|
healthFactor: healthFactor,
|
|
393
|
-
havePrincipalWithoutPrice: havePrincipalWithoutPrice
|
|
455
|
+
havePrincipalWithoutPrice: havePrincipalWithoutPrice,
|
|
394
456
|
};
|
|
395
457
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Slice } from '@ton/core';
|
|
2
|
+
import { ClassicOracleInfo } from './ClassicOracleParser';
|
|
3
|
+
import { PythOracleInfo } from './PythOracleParser';
|
|
4
|
+
|
|
5
|
+
export interface OracleParser {
|
|
6
|
+
parseOracleConfig(masterConfigSlice: Slice): ClassicOracleInfo | PythOracleInfo;
|
|
7
|
+
getIfActive(masterConfigSlice: Slice): number;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export abstract class AbstractOracleParser implements OracleParser {
|
|
11
|
+
abstract parseOracleConfig(masterConfigSlice: Slice): ClassicOracleInfo | PythOracleInfo;
|
|
12
|
+
|
|
13
|
+
getIfActive(masterConfigSlice: Slice): number {
|
|
14
|
+
return masterConfigSlice.loadInt(8);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Cell, Slice } from '@ton/core';
|
|
2
|
+
import { loadMaybeMyRef } from '../helpers';
|
|
3
|
+
import { AbstractOracleParser } from './AbstractOracleParser';
|
|
4
|
+
|
|
5
|
+
export type ClassicOracleInfo = {
|
|
6
|
+
numOracles: number;
|
|
7
|
+
threshold: number;
|
|
8
|
+
oracles: Cell | null;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export class ClassicOracleParser extends AbstractOracleParser {
|
|
12
|
+
parseOracleConfig(masterConfigSlice: Slice): ClassicOracleInfo {
|
|
13
|
+
const oraclesSlice = masterConfigSlice.loadRef().beginParse();
|
|
14
|
+
return {
|
|
15
|
+
numOracles: oraclesSlice.loadUint(16),
|
|
16
|
+
threshold: oraclesSlice.loadUint(16),
|
|
17
|
+
oracles: loadMaybeMyRef(oraclesSlice),
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Address, Dictionary, Slice } from '@ton/core';
|
|
2
|
+
import { AbstractOracleParser } from './AbstractOracleParser';
|
|
3
|
+
|
|
4
|
+
export type OracleConfig = {
|
|
5
|
+
pythAddress: Address;
|
|
6
|
+
// FYI: The Pyth max feeds count is 7, but it can add more in the future
|
|
7
|
+
feedsMap: Dictionary<bigint, Buffer>;
|
|
8
|
+
allowedRefTokens: Dictionary<bigint, bigint>;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export type PythOracleInfo = OracleConfig & {
|
|
12
|
+
pricesTtl: number;
|
|
13
|
+
pythComputeBaseGas: bigint;
|
|
14
|
+
pythComputePerUpdateGas: bigint;
|
|
15
|
+
pythSingleUpdateFee: bigint;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export class PythOracleParser extends AbstractOracleParser {
|
|
19
|
+
parseOracleConfig(masterConfigSlice: Slice): PythOracleInfo {
|
|
20
|
+
const oraclesSlice = masterConfigSlice.loadRef().beginParse();
|
|
21
|
+
const feedDataCell = oraclesSlice.loadRef();
|
|
22
|
+
const feedDataSlice = feedDataCell.beginParse();
|
|
23
|
+
|
|
24
|
+
return {
|
|
25
|
+
pythAddress: oraclesSlice.loadAddress(),
|
|
26
|
+
feedsMap: feedDataSlice.loadDict(Dictionary.Keys.BigUint(256), Dictionary.Values.Buffer(64)),
|
|
27
|
+
allowedRefTokens: feedDataSlice.loadDict(Dictionary.Keys.BigUint(256), Dictionary.Values.BigUint(256)),
|
|
28
|
+
pricesTtl: oraclesSlice.loadUint(32),
|
|
29
|
+
pythComputeBaseGas: oraclesSlice.loadUintBig(64),
|
|
30
|
+
pythComputePerUpdateGas: oraclesSlice.loadUintBig(64),
|
|
31
|
+
pythSingleUpdateFee: oraclesSlice.loadUintBig(64),
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
}
|
package/src/api/prices.ts
CHANGED
|
@@ -1,10 +1,35 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { HexString } from '@pythnetwork/hermes-client';
|
|
2
|
+
import { createCellChain } from '@pythnetwork/pyth-ton-js';
|
|
3
|
+
import { Cell } from '@ton/core';
|
|
4
|
+
import { beginCell } from '@ton/ton';
|
|
5
|
+
import { Buffer } from 'buffer';
|
|
6
|
+
|
|
7
|
+
export function composeFeedsCell(feeds: HexString[]): Cell {
|
|
8
|
+
if (feeds.length === 0) {
|
|
9
|
+
return beginCell().storeUint(0, 8).endCell();
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const reversedTail = feeds.slice(1).reverse();
|
|
13
|
+
const packedTail = reversedTail.reduce((prev: Cell | null, curr) => {
|
|
14
|
+
const builder = beginCell().storeUint(BigInt(curr), 256);
|
|
15
|
+
if (prev !== null) builder.storeRef(prev);
|
|
16
|
+
return builder.endCell();
|
|
17
|
+
}, null);
|
|
18
|
+
const firstFeed = feeds[0];
|
|
19
|
+
const builder = beginCell().storeUint(feeds.length, 8).storeUint(BigInt(firstFeed), 256);
|
|
20
|
+
if (packedTail !== null) {
|
|
21
|
+
builder.storeRef(packedTail!);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return builder.endCell();
|
|
25
|
+
}
|
|
4
26
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
27
|
+
export function packPythUpdatesData(pythUpdates: Buffer | Cell): Cell {
|
|
28
|
+
return pythUpdates instanceof Cell ? pythUpdates : createCellChain(pythUpdates);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/*
|
|
32
|
+
old code:
|
|
8
33
|
export async function getPrices(endpoints: string[] = ["api.stardust-mainnet.iotaledger.net"], poolConfig: PoolConfig = MAINNET_POOL_CONFIG): Promise<PriceData> {
|
|
9
34
|
if (endpoints.length == 0) {
|
|
10
35
|
throw new Error("Empty endpoint list");
|
|
@@ -19,39 +44,5 @@ export async function getPrices(endpoints: string[] = ["api.stardust-mainnet.iot
|
|
|
19
44
|
const prices = await priceCollector.getPrices();
|
|
20
45
|
|
|
21
46
|
return { dict: prices.dict, dataCell: prices.dataCell };
|
|
22
|
-
/*
|
|
23
|
-
Old code
|
|
24
|
-
const prices = await Promise.all(poolConfig.oracles.map(async x => await parsePrices(await loadPrices(x.address, endpoints), x.id)));
|
|
25
|
-
|
|
26
|
-
let acceptedPrices: RawPriceData[] = prices.filter(verifyPrices(poolConfig.poolAssetsConfig));
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
if (acceptedPrices.length < poolConfig.minimalOracles) {
|
|
30
|
-
throw new Error("Prices are outdated");
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
if (acceptedPrices.length > poolConfig.minimalOracles && acceptedPrices.length % 2 == 0) {
|
|
34
|
-
acceptedPrices = acceptedPrices.slice(0, acceptedPrices.length - 1); // to reduce fees, MINIMAL_ORACLES_NUMBER is odd
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
if (acceptedPrices.length != poolConfig.minimalOracles) {
|
|
38
|
-
const sortedByTimestamp = acceptedPrices.slice().sort((a, b) => b.timestamp - a.timestamp);
|
|
39
|
-
const newerPrices = sortedByTimestamp.slice(0, poolConfig.minimalOracles);
|
|
40
|
-
acceptedPrices = newerPrices.sort((a, b) => a.oracleId - b.oracleId);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
const medianData = poolConfig.poolAssetsConfig.map(asset => ({ assetId: asset.assetId, medianPrice: getMedianPrice(acceptedPrices, asset.assetId)}));
|
|
45
|
-
const packedMedianData = packAssetsData(medianData);
|
|
46
|
-
|
|
47
|
-
const oraclesData = acceptedPrices.map(x => ({oracle: {id: x.oracleId, pubkey: x.pubkey}, data: {timestamp: x.timestamp, prices: x.dict}, signature: x.signature}));
|
|
48
|
-
const packedOracleData = packOraclesData(oraclesData, poolConfig.poolAssetsConfig.map(x => x.assetId));
|
|
49
|
-
|
|
50
|
-
const dict = Dictionary.empty<bigint, bigint>();
|
|
51
|
-
medianData.forEach(x => dict.set(x.assetId, x.medianPrice));
|
|
52
|
-
|
|
53
|
-
return {
|
|
54
|
-
dict: dict,
|
|
55
|
-
dataCell: packPrices(packedMedianData, packedOracleData)
|
|
56
|
-
};*/
|
|
57
47
|
}
|
|
48
|
+
*/
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { sha256Hash } from '../../utils/sha256BigInt';
|
|
2
|
+
|
|
3
|
+
export const ASSET_ID = {
|
|
4
|
+
TON: sha256Hash('TON'),
|
|
5
|
+
USDT: sha256Hash('USDT'),
|
|
6
|
+
jUSDT: sha256Hash('jUSDT'),
|
|
7
|
+
jUSDC: sha256Hash('jUSDC'),
|
|
8
|
+
stTON: sha256Hash('stTON'),
|
|
9
|
+
tsTON: sha256Hash('tsTON'),
|
|
10
|
+
tgBTC: sha256Hash('tgBTC'),
|
|
11
|
+
USDe: sha256Hash('USDe'),
|
|
12
|
+
tsUSDe: sha256Hash('tsUSDe'),
|
|
13
|
+
PT_tsUSDe_01Sep2025: sha256Hash('PT_tsUSDe_01Sep2025'),
|
|
14
|
+
|
|
15
|
+
// LP
|
|
16
|
+
TONUSDT_DEDUST: sha256Hash('TONUSDT_DEDUST'),
|
|
17
|
+
TONUSDT_STONFI: sha256Hash('TONUSDT_STONFI'),
|
|
18
|
+
TON_STORM: sha256Hash('TON_STORM'),
|
|
19
|
+
USDT_STORM: sha256Hash('USDT_STORM'),
|
|
20
|
+
|
|
21
|
+
// ALTS
|
|
22
|
+
NOT: sha256Hash('NOT'),
|
|
23
|
+
DOGS: sha256Hash('DOGS'),
|
|
24
|
+
CATI: sha256Hash('CATI'),
|
|
25
|
+
STON: sha256Hash('STON'),
|
|
26
|
+
|
|
27
|
+
// Testnet assets, faucet t.me/evaabuidl
|
|
28
|
+
EUSDT: sha256Hash('EUSDT'),
|
|
29
|
+
EUSDC: sha256Hash('EUSDC'),
|
|
30
|
+
};
|
|
@@ -1,37 +1,7 @@
|
|
|
1
1
|
import { Address, Cell } from '@ton/core';
|
|
2
|
-
import { PoolAssetConfig } from '
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
export const ASSET_ID = {
|
|
7
|
-
TON: sha256Hash('TON'),
|
|
8
|
-
USDT: sha256Hash('USDT'),
|
|
9
|
-
jUSDT: sha256Hash('jUSDT'),
|
|
10
|
-
jUSDC: sha256Hash('jUSDC'),
|
|
11
|
-
stTON: sha256Hash('stTON'),
|
|
12
|
-
tsTON: sha256Hash('tsTON'),
|
|
13
|
-
uTON: sha256Hash('uTON'),
|
|
14
|
-
tgBTC: sha256Hash('tgBTC'),
|
|
15
|
-
USDe: sha256Hash('USDe'),
|
|
16
|
-
tsUSDe: sha256Hash('tsUSDe'),
|
|
17
|
-
PT_tsUSDe_01Sep2025: sha256Hash('PT_tsUSDe_01Sep2025'),
|
|
18
|
-
|
|
19
|
-
// LP
|
|
20
|
-
TONUSDT_DEDUST: sha256Hash('TONUSDT_DEDUST'),
|
|
21
|
-
TONUSDT_STONFI: sha256Hash('TONUSDT_STONFI'),
|
|
22
|
-
TON_STORM: sha256Hash('TON_STORM'),
|
|
23
|
-
USDT_STORM: sha256Hash('USDT_STORM'),
|
|
24
|
-
|
|
25
|
-
// ALTS
|
|
26
|
-
NOT: sha256Hash('NOT'),
|
|
27
|
-
DOGS: sha256Hash('DOGS'),
|
|
28
|
-
CATI: sha256Hash('CATI'),
|
|
29
|
-
STON: sha256Hash('STON'),
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
// Testnet assets
|
|
33
|
-
EUSDT: sha256Hash('EUSDT'),
|
|
34
|
-
};
|
|
2
|
+
import { PoolAssetConfig } from '../../types/Master';
|
|
3
|
+
import { JETTON_WALLET_STANDART_CODE, NULL_ADDRESS } from '../general';
|
|
4
|
+
import { ASSET_ID } from './assetId';
|
|
35
5
|
|
|
36
6
|
export const UNDEFINED_ASSET: PoolAssetConfig = {
|
|
37
7
|
name: 'undefined_asset',
|
|
@@ -46,7 +16,6 @@ export const TON_MAINNET: PoolAssetConfig = {
|
|
|
46
16
|
jettonMasterAddress: NULL_ADDRESS, // fake
|
|
47
17
|
jettonWalletCode: Cell.EMPTY,
|
|
48
18
|
};
|
|
49
|
-
export const TON_TESTNET = TON_MAINNET;
|
|
50
19
|
|
|
51
20
|
export const JUSDT_MAINNET: PoolAssetConfig = {
|
|
52
21
|
name: 'jUSDT',
|
|
@@ -92,32 +61,6 @@ export const USDT_MAINNET: PoolAssetConfig = {
|
|
|
92
61
|
)[0],
|
|
93
62
|
};
|
|
94
63
|
|
|
95
|
-
export const JUSDT_TESTNET: PoolAssetConfig = {
|
|
96
|
-
name: 'jUSDT',
|
|
97
|
-
assetId: ASSET_ID.jUSDT,
|
|
98
|
-
jettonMasterAddress: Address.parse('kQBe4gtSQMxM5RpMYLr4ydNY72F8JkY-icZXG1NJcsju8XM7'),
|
|
99
|
-
jettonWalletCode: JETTON_WALLET_STANDART_CODE_TESTNET,
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
export const JUSDC_TESTNET: PoolAssetConfig = {
|
|
103
|
-
name: 'jUSDC',
|
|
104
|
-
assetId: ASSET_ID.jUSDC,
|
|
105
|
-
jettonMasterAddress: Address.parse('kQDaY5yUatYnHei73HBqRX_Ox9LK2XnR7XuCY9MFC2INbfYI'),
|
|
106
|
-
jettonWalletCode: JETTON_WALLET_STANDART_CODE_TESTNET,
|
|
107
|
-
};
|
|
108
|
-
|
|
109
|
-
export const STTON_TESTNET: PoolAssetConfig = {
|
|
110
|
-
name: 'stTON',
|
|
111
|
-
assetId: ASSET_ID.stTON,
|
|
112
|
-
jettonMasterAddress: Address.parse('kQC3Duw3dg8k98xf5S7Bm7YOWVJ5QW8hm3iLqFfJfa_g9h07'),
|
|
113
|
-
jettonWalletCode: Cell.fromBoc(
|
|
114
|
-
Buffer.from(
|
|
115
|
-
'b5ee9c7201021201000362000114ff00f4a413f4bcf2c80b0102016202030202cc0405001ba0f605da89a1f401f481f481a8610201d40607020120090a01cf0831c02497c138007434c0c05c6c2544d7c0fc03383e903e900c7e800c5c75c87e800c7e800c1cea6d0000b4c7c8608403e29fa96ea54c4d167c027808608405e351466ea58c511100fc02b80860841657c1ef2ea54c4d167c02f80517c1300138c08c2103fcbc200800113e910c30003cb85360007ced44d0fa00fa40fa40d43010235f03018208989680a16d801072226eb32091719170e203c8cb055006cf165004fa02cb6a039358cc019130e201c901fb000201200b0c0081d40106b90f6a2687d007d207d206a1802698f90c1080bc6a28cdd0141083deecbef5d0958f97064699f98fd001809d02811e428027d012c678b00e78b6664f6aa401f1503d33ffa00fa4021f001ed44d0fa00fa40fa40d4305136a1522ac705f2e2c128c2fff2e2c254344270542013541403c85004fa0258cf1601cf16ccc922c8cb0112f400f400cb00c920f9007074c8cb02ca07cbffc9d004fa40f40431fa0020d749c200f2e2c4778018c8cb055008cf1670fa0217cb6b13cc80d0201200e0f009e8210178d4519c8cb1f19cb3f5007fa0222cf165006cf1625fa025003cf16c95005cc2391729171e25008a813a0820a625a00a014bcf2e2c504c98040fb001023c85004fa0258cf1601cf16ccc9ed5402f73b51343e803e903e90350c0234cffe80145468017e903e9014d6f1c1551cdb5c150804d50500f214013e809633c58073c5b33248b232c044bd003d0032c0327e401c1d3232c0b281f2fff274140371c1472c7cb8b0c2be80146a2860822625a019ad8228608239387028062849e5c412440e0dd7c138c34975c2c060101100c90c3b51343e803e903e90350c01b4cffe800c145128548df1c17cb8b04970bffcb8b0812082e4e1c02fbcb8b160841ef765f7b232c7c532cfd63e808873c5b25c60063232c14933c59c3e80b2dab33260103ec01004f214013e809633c58073c5b3327b552000705279a018a182107362d09cc8cb1f5230cb3f58fa025007cf165007cf16c9718010c8cb0524cf165006fa0215cb6a14ccc971fb0010241023007cc30023c200b08e218210d53276db708010c8cb055008cf165004fa0216cb6a12cb1f12cb3fc972fb0093356c21e203c85004fa0258cf1601cf16ccc9ed54',
|
|
116
|
-
'hex',
|
|
117
|
-
),
|
|
118
|
-
)[0],
|
|
119
|
-
};
|
|
120
|
-
|
|
121
64
|
export const TONUSDT_DEDUST_MAINNET: PoolAssetConfig = {
|
|
122
65
|
name: 'TONUSDT_DEDUST',
|
|
123
66
|
assetId: ASSET_ID.TONUSDT_DEDUST,
|
|
@@ -190,42 +133,6 @@ export const NOT_MAINNET: PoolAssetConfig = {
|
|
|
190
133
|
)[0],
|
|
191
134
|
};
|
|
192
135
|
|
|
193
|
-
export const UTON_MAINNET: PoolAssetConfig = {
|
|
194
|
-
name: 'uTON',
|
|
195
|
-
assetId: ASSET_ID.uTON,
|
|
196
|
-
jettonMasterAddress: Address.parse('EQAfF5j3JMIpZlLmACv7Ub7RH7WmiVMuV4ivcgNYHvNnqHTz'),
|
|
197
|
-
jettonWalletCode: Cell.fromBoc(
|
|
198
|
-
Buffer.from(
|
|
199
|
-
'b5ee9c7201021301000439000114ff00f4a413f4bcf2c80b0102016202030202cc0405020120111200bbd906380492f827000e8698180b8d84a89af81f807707d207d2018fd0018b8eb90fd0018fd001801698f90c10807c53f52dd4a989a2cf805f010c1080bc6a28cdd4b18a22201f8067000c1082caf83de5d4aa22201f806f02f82c207f9784020120060701f7f01e99ffd007d20381140816000fd23182c5d797a76a2687d00699ffd207d206a18027c30817c317c31fc327c32fc2091d0fc30fc21a8036382f97160fc20e17ff971617c227c22b82a300209aa0a82e42802fd0109e59f80e78b00e78b666490e4658089fa00097a00658064907c80383a6465816503e5ffe4e802c080201200a0b01fefa40f40431fa0020d749c200f2e2c4778018c8cb055009cf1670fa0218cb6b13cc8210178d4519c8cb1f15cb3f5003fa02f843cf1658cf1621fa025004cf16c901cc2291729171e25004a812a08208989680a08208989680a08208989680a0bcf2e2c5f841f842f843f844f845c85005fa0213cb3f01cf1601cf16ccc9ed5409000ac98040fb000201200c0d00b948020d721ed44d0fa00d33ffa40fa40d43004f86102f862f863f864f865d31f218210178d4519ba0282107bdd97deba12b1f2e2c5d33f31fa0030f84101a0f861f841f842f843f844f845c85005fa0213cb3f01cf1601cf16ccc9ed54801f53b51343e8034cffe903e90350c013e1840be18be18fe193e194134cffe803e1048a83e187e903e903e113e1149165c15180104d505417214017e8084f2cfc073c58073c5b332487232c044fd0004bd0032c0327e401c1d3232c0b281f2fff2740a31c17e11140271c1462c7cb8b0c1be80145a2860822625a019a00e01f73b51343e8034cffe903e90350c013e1840be18be18fe193e194134cffe803e903d010c1c0060083d03dbe87cb8b13434c7fe80204c0048b0803cbd350c3e10be10a93e18be1049a87e187e10d402b1c17cb8b07e1070bffcb8b0945e6860822625a019ad82284820822625a0281401e820822625a028086814a42f201001f2b608a18208989680a018a1278e355275a014a182107362d09cc8cb1f5230cb3f58fa025003cf165003cf16c9718018c8cb05f843cf165006fa0215cb6a14ccc971fb0094375b6c21e221d70b01c30023c200b08e208210d53276db708010c8cb055004cf165004fa0212cb6a12cb1fcb3fc972fb00925f03e20f0038f841f842f843f844f845c85005fa0213cb3f01cf1601cf16ccc9ed5400c0f2e2c5058208989680a018a1f841f842f843f844f845c85005fa0213cb3f01cf1601cf16ccc9ed5482107bdd97dec8cb1f14cb3ff843cf1616cb3f01fa0215cb1f5003cf1658fa02ccc9718018c8cb05f844cf165003fa0212cb6accc970fb000047bfd8176a2687d00699ffd207d206a18027c30817c317c31fc327c32fc20fc21fc227c22c004bbdd79f6a2687d00699ffd207d206a18027c30817c317c31fc327c32fc20fc217c21fc227c22c',
|
|
200
|
-
'hex',
|
|
201
|
-
),
|
|
202
|
-
)[0],
|
|
203
|
-
};
|
|
204
|
-
|
|
205
|
-
export const TGBTC_TESTNET: PoolAssetConfig = {
|
|
206
|
-
name: 'tgBTC',
|
|
207
|
-
assetId: ASSET_ID.tgBTC,
|
|
208
|
-
jettonMasterAddress: Address.parse('kQDoy1cUAbGq253vwfoPcqSloODVAWkDBniR12PJFUHnK6Yf'),
|
|
209
|
-
jettonWalletCode: Cell.fromBoc(
|
|
210
|
-
Buffer.from(
|
|
211
|
-
'b5ee9c72010210010003ac000114ff00f4a413f4bcf2c80b01020162020302f8d001d0d3030171b08e48135f038020d721ed44d0d303fa00fa40fa40d104d31f01840f218210178d4519ba0282107bdd97deba12b1f2f48040d721fa003012a0401303c8cb0358fa0201cf1601cf16c9ed54e0fa40fa4031fa0031f401fa0031fa00013170f83a02d31f012082100f8a7ea5ba8e85303459db3ce03304050201200e0f01f603d33f0101fa00fa4021fa4430c000f2e14ded44d0d303fa00fa40fa40d1521ac705f2e0495115a120c2fff2aff82a54259070546004131503c8cb0358fa0201cf1601cf16c921c8cb0113f40012f400cb00c920f9007074c8cb02ca07cbffc9d004fa40f401fa002020d70b009ad74bc00101c001b0f2b19130e206025c228210178d4519ba8e84325adb3ce034218210595f07bcba8e843101db3ce0135f038210d372158cbadc840ff2f008090174c88210178d451901cb1f500a01cb3f5008fa0223cf1601cf1626fa025007cf16c9c8801801cb055004cf1670fa024063775003cb6bccccc945370700bc2191729171e2f839206e938123289120e2216e94318127109101e2f82f5005a05023a812a0738103a370f83ca00170f836a00170f836a07381040982100966018070f837a0bcf2b0048050fb005803c8cb0358fa0201cf1601cf16c9ed5403e6ed44d0d303fa00fa40fa40d107d33f0101fa005141a004fa40fa4053bac705f82a5464e070546004131503c8cb0358fa0201cf1601cf16c921c8cb0113f40012f400cb00c9f9007074c8cb02ca07cbffc9d0500cc7051bb1f2e04a09fa0021925f04e30d26d70b01c000b393306c33e30d55020a0b0c01d2ed44d0d303fa00fa40fa40d106d33f0101fa00fa40f404d120206ef271d0d74bc000018100f8beb0f2b15152a15249c705f2e04927c2fff2afc882107bdd97de01cb1f500301cb3f01fa0222cf1601cf1612f400c9c8801801cb0526cf1670fa02017158cb6accc9030d0060c882107362d09c01cb1f2501cb3f5004fa0258cf1658cf16c9c8801001cb0524cf1658fa02017158cb6accc98011fb00007a5054a1f82fa07381040982100966018070f837b60972fb02c8801001cb055005cf1670fa027001cb6a8210d53276db01cb1f5801cb3fc9810082fb0059002003c8cb0358fa0201cf1601cf16c9ed54006cf839206e9430811770de728106f170f8380170f836a0811b5870f836a0bcf2b0028050fb000303c8cb0358fa0201cf1601cf16c9ed540027bfd8176a2686981fd007d207d206899fc15209840021bc508f6a2686981fd007d207d2068af81c',
|
|
212
|
-
'hex',
|
|
213
|
-
),
|
|
214
|
-
)[0],
|
|
215
|
-
};
|
|
216
|
-
|
|
217
|
-
export const EUSDT_TESTNET: PoolAssetConfig = {
|
|
218
|
-
name: 'EUSDT',
|
|
219
|
-
assetId: ASSET_ID.EUSDT,
|
|
220
|
-
jettonMasterAddress: Address.parse('kQBe4gtSQMxM5RpMYLr4ydNY72F8JkY-icZXG1NJcsju8XM7'),
|
|
221
|
-
jettonWalletCode: Cell.fromBoc(
|
|
222
|
-
Buffer.from(
|
|
223
|
-
'b5ee9c7201021101000323000114ff00f4a413f4bcf2c80b0102016202030202cc0405001ba0f605da89a1f401f481f481a8610201d40607020120080900c30831c02497c138007434c0c05c6c2544d7c0fc03383e903e900c7e800c5c75c87e800c7e800c1cea6d0000b4c7e08403e29fa954882ea54c4d167c0278208405e3514654882ea58c511100fc02b80d60841657c1ef2ea4d67c02f817c12103fcbc2000113e910c1c2ebcb853600201200a0b0083d40106b90f6a2687d007d207d206a1802698fc1080bc6a28ca9105d41083deecbef09dd0958f97162e99f98fd001809d02811e428027d012c678b00e78b6664f6aa401f1503d33ffa00fa4021f001ed44d0fa00fa40fa40d4305136a1522ac705f2e2c128c2fff2e2c254344270542013541403c85004fa0258cf1601cf16ccc922c8cb0112f400f400cb00c920f9007074c8cb02ca07cbffc9d004fa40f40431fa0020d749c200f2e2c4778018c8cb055008cf1670fa0217cb6b13cc80c0201200d0e009e8210178d4519c8cb1f19cb3f5007fa0222cf165006cf1625fa025003cf16c95005cc2391729171e25008a813a08209c9c380a014bcf2e2c504c98040fb001023c85004fa0258cf1601cf16ccc9ed5402f73b51343e803e903e90350c0234cffe80145468017e903e9014d6f1c1551cdb5c150804d50500f214013e809633c58073c5b33248b232c044bd003d0032c0327e401c1d3232c0b281f2fff274140371c1472c7cb8b0c2be80146a2860822625a019ad822860822625a028062849e5c412440e0dd7c138c34975c2c0600f1000d73b51343e803e903e90350c01f4cffe803e900c145468549271c17cb8b049f0bffcb8b08160824c4b402805af3cb8b0e0841ef765f7b232c7c572cfd400fe8088b3c58073c5b25c60063232c14933c59c3e80b2dab33260103ec01004f214013e809633c58073c5b3327b552000705279a018a182107362d09cc8cb1f5230cb3f58fa025007cf165007cf16c9718010c8cb0524cf165006fa0215cb6a14ccc971fb0010241023007cc30023c200b08e218210d53276db708010c8cb055008cf165004fa0216cb6a12cb1f12cb3fc972fb0093356c21e203c85004fa0258cf1601cf16ccc9ed54',
|
|
224
|
-
'hex',
|
|
225
|
-
),
|
|
226
|
-
)[0],
|
|
227
|
-
};
|
|
228
|
-
|
|
229
136
|
export const USDE_MAINNET: PoolAssetConfig = {
|
|
230
137
|
name: 'USDe',
|
|
231
138
|
assetId: ASSET_ID.USDe,
|