@evaafi/sdk 0.6.3 → 0.6.4-a
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/math.js +1 -1
- package/dist/api/prices.js +0 -1
- package/dist/constants/assets.d.ts +9 -0
- package/dist/constants/assets.js +35 -1
- package/dist/constants/general.d.ts +4 -0
- package/dist/constants/general.js +6 -2
- package/dist/constants/pools.d.ts +3 -0
- package/dist/constants/pools.js +39 -5
- package/dist/index.d.ts +2 -3
- package/dist/index.js +4 -44
- package/dist/prices/PricesCollector.js +9 -2
- package/dist/prices/Types.d.ts +0 -2
- package/dist/prices/Types.js +1 -2
- package/dist/prices/sources/index.d.ts +0 -1
- package/dist/prices/sources/index.js +0 -1
- package/dist/prices/utils.js +2 -3
- package/dist/utils/userJettonWallet.js +16 -0
- package/package.json +1 -1
- package/src/api/math.ts +1 -1
- package/src/api/prices.ts +0 -1
- package/src/constants/assets.ts +65 -0
- package/src/constants/general.ts +6 -1
- package/src/constants/pools.ts +50 -4
- package/src/index.ts +2 -46
- package/src/prices/PricesCollector.ts +10 -3
- package/src/prices/Types.ts +1 -5
- package/src/prices/sources/index.ts +0 -1
- package/src/prices/utils.ts +6 -7
- package/src/utils/userJettonWallet.ts +16 -0
- package/dist/prices/sources/Iota.d.ts +0 -39
- package/dist/prices/sources/Iota.js +0 -49
- package/src/prices/sources/Iota.ts +0 -90
package/dist/api/math.js
CHANGED
|
@@ -263,7 +263,7 @@ function calculateHealthParams(parameters) {
|
|
|
263
263
|
totalSupply += assetWorth;
|
|
264
264
|
totalLimit += assetWorth * assetConfig.liquidationThreshold / ASSET_LIQUIDATION_THRESHOLD_SCALE;
|
|
265
265
|
}
|
|
266
|
-
else if (assetBalance.type === User_1.BalanceType.borrow) {
|
|
266
|
+
else if (assetBalance.type === User_1.BalanceType.borrow && assetConfig.dust < assetBalance.amount) {
|
|
267
267
|
totalDebt += assetWorth;
|
|
268
268
|
}
|
|
269
269
|
}
|
package/dist/api/prices.js
CHANGED
|
@@ -11,7 +11,6 @@ async function getPrices(endpoints = ["api.stardust-mainnet.iotaledger.net"], po
|
|
|
11
11
|
throw new Error("Empty endpoint list");
|
|
12
12
|
}
|
|
13
13
|
const sources = {
|
|
14
|
-
iotaEndpoints: endpoints,
|
|
15
14
|
icpEndpoints: prices_1.DefaultPriceSourcesConfig.icpEndpoints,
|
|
16
15
|
backendEndpoints: prices_1.DefaultPriceSourcesConfig.backendEndpoints,
|
|
17
16
|
};
|
|
@@ -8,6 +8,9 @@ export declare const ASSET_ID: {
|
|
|
8
8
|
tsTON: bigint;
|
|
9
9
|
uTON: bigint;
|
|
10
10
|
tgBTC: bigint;
|
|
11
|
+
USDe: bigint;
|
|
12
|
+
tsUSDe: bigint;
|
|
13
|
+
PT_tsUSDe_01Sep2025: bigint;
|
|
11
14
|
TONUSDT_DEDUST: bigint;
|
|
12
15
|
TONUSDT_STONFI: bigint;
|
|
13
16
|
TON_STORM: bigint;
|
|
@@ -15,6 +18,7 @@ export declare const ASSET_ID: {
|
|
|
15
18
|
NOT: bigint;
|
|
16
19
|
DOGS: bigint;
|
|
17
20
|
CATI: bigint;
|
|
21
|
+
STON: bigint;
|
|
18
22
|
EUSDT: bigint;
|
|
19
23
|
};
|
|
20
24
|
export declare const UNDEFINED_ASSET: PoolAssetConfig;
|
|
@@ -37,3 +41,8 @@ export declare const NOT_MAINNET: PoolAssetConfig;
|
|
|
37
41
|
export declare const UTON_MAINNET: PoolAssetConfig;
|
|
38
42
|
export declare const TGBTC_TESTNET: PoolAssetConfig;
|
|
39
43
|
export declare const EUSDT_TESTNET: PoolAssetConfig;
|
|
44
|
+
export declare const USDE_MAINNET: PoolAssetConfig;
|
|
45
|
+
export declare const TSUSDE_MAINNET: PoolAssetConfig;
|
|
46
|
+
export declare const PT_tsUSDe_01Sep2025_MAINNET: PoolAssetConfig;
|
|
47
|
+
export declare const TONUSDT_STONFI_MAINNET: PoolAssetConfig;
|
|
48
|
+
export declare const STON_MAINNET: PoolAssetConfig;
|
package/dist/constants/assets.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.EUSDT_TESTNET = exports.TGBTC_TESTNET = exports.UTON_MAINNET = exports.NOT_MAINNET = exports.DOGS_MAINNET = exports.CATI_MAINNET = exports.USDT_STORM_MAINNET = exports.TON_STORM_MAINNET = exports.TONUSDT_DEDUST_MAINNET = exports.STTON_TESTNET = exports.JUSDC_TESTNET = exports.JUSDT_TESTNET = exports.USDT_MAINNET = exports.TSTON_MAINNET = exports.STTON_MAINNET = exports.JUSDC_MAINNET = exports.JUSDT_MAINNET = exports.TON_TESTNET = exports.TON_MAINNET = exports.UNDEFINED_ASSET = exports.ASSET_ID = void 0;
|
|
3
|
+
exports.STON_MAINNET = exports.TONUSDT_STONFI_MAINNET = exports.PT_tsUSDe_01Sep2025_MAINNET = exports.TSUSDE_MAINNET = exports.USDE_MAINNET = exports.EUSDT_TESTNET = exports.TGBTC_TESTNET = exports.UTON_MAINNET = exports.NOT_MAINNET = exports.DOGS_MAINNET = exports.CATI_MAINNET = exports.USDT_STORM_MAINNET = exports.TON_STORM_MAINNET = exports.TONUSDT_DEDUST_MAINNET = exports.STTON_TESTNET = exports.JUSDC_TESTNET = exports.JUSDT_TESTNET = exports.USDT_MAINNET = exports.TSTON_MAINNET = exports.STTON_MAINNET = exports.JUSDC_MAINNET = exports.JUSDT_MAINNET = exports.TON_TESTNET = exports.TON_MAINNET = exports.UNDEFINED_ASSET = exports.ASSET_ID = void 0;
|
|
4
4
|
const core_1 = require("@ton/core");
|
|
5
5
|
const sha256BigInt_1 = require("../utils/sha256BigInt");
|
|
6
6
|
const general_1 = require("./general");
|
|
@@ -13,6 +13,9 @@ exports.ASSET_ID = {
|
|
|
13
13
|
tsTON: (0, sha256BigInt_1.sha256Hash)('tsTON'),
|
|
14
14
|
uTON: (0, sha256BigInt_1.sha256Hash)('uTON'),
|
|
15
15
|
tgBTC: (0, sha256BigInt_1.sha256Hash)('tgBTC'),
|
|
16
|
+
USDe: (0, sha256BigInt_1.sha256Hash)('USDe'),
|
|
17
|
+
tsUSDe: (0, sha256BigInt_1.sha256Hash)('tsUSDe'),
|
|
18
|
+
PT_tsUSDe_01Sep2025: (0, sha256BigInt_1.sha256Hash)('PT_tsUSDe_01Sep2025'),
|
|
16
19
|
// LP
|
|
17
20
|
TONUSDT_DEDUST: (0, sha256BigInt_1.sha256Hash)('TONUSDT_DEDUST'),
|
|
18
21
|
TONUSDT_STONFI: (0, sha256BigInt_1.sha256Hash)('TONUSDT_STONFI'),
|
|
@@ -22,6 +25,7 @@ exports.ASSET_ID = {
|
|
|
22
25
|
NOT: (0, sha256BigInt_1.sha256Hash)('NOT'),
|
|
23
26
|
DOGS: (0, sha256BigInt_1.sha256Hash)('DOGS'),
|
|
24
27
|
CATI: (0, sha256BigInt_1.sha256Hash)('CATI'),
|
|
28
|
+
STON: (0, sha256BigInt_1.sha256Hash)('STON'),
|
|
25
29
|
// Testnet assets
|
|
26
30
|
EUSDT: (0, sha256BigInt_1.sha256Hash)('EUSDT'),
|
|
27
31
|
};
|
|
@@ -140,3 +144,33 @@ exports.EUSDT_TESTNET = {
|
|
|
140
144
|
jettonMasterAddress: core_1.Address.parse('kQBe4gtSQMxM5RpMYLr4ydNY72F8JkY-icZXG1NJcsju8XM7'),
|
|
141
145
|
jettonWalletCode: core_1.Cell.fromBoc(Buffer.from('b5ee9c7201021101000323000114ff00f4a413f4bcf2c80b0102016202030202cc0405001ba0f605da89a1f401f481f481a8610201d40607020120080900c30831c02497c138007434c0c05c6c2544d7c0fc03383e903e900c7e800c5c75c87e800c7e800c1cea6d0000b4c7e08403e29fa954882ea54c4d167c0278208405e3514654882ea58c511100fc02b80d60841657c1ef2ea4d67c02f817c12103fcbc2000113e910c1c2ebcb853600201200a0b0083d40106b90f6a2687d007d207d206a1802698fc1080bc6a28ca9105d41083deecbef09dd0958f97162e99f98fd001809d02811e428027d012c678b00e78b6664f6aa401f1503d33ffa00fa4021f001ed44d0fa00fa40fa40d4305136a1522ac705f2e2c128c2fff2e2c254344270542013541403c85004fa0258cf1601cf16ccc922c8cb0112f400f400cb00c920f9007074c8cb02ca07cbffc9d004fa40f40431fa0020d749c200f2e2c4778018c8cb055008cf1670fa0217cb6b13cc80c0201200d0e009e8210178d4519c8cb1f19cb3f5007fa0222cf165006cf1625fa025003cf16c95005cc2391729171e25008a813a08209c9c380a014bcf2e2c504c98040fb001023c85004fa0258cf1601cf16ccc9ed5402f73b51343e803e903e90350c0234cffe80145468017e903e9014d6f1c1551cdb5c150804d50500f214013e809633c58073c5b33248b232c044bd003d0032c0327e401c1d3232c0b281f2fff274140371c1472c7cb8b0c2be80146a2860822625a019ad822860822625a028062849e5c412440e0dd7c138c34975c2c0600f1000d73b51343e803e903e90350c01f4cffe803e900c145468549271c17cb8b049f0bffcb8b08160824c4b402805af3cb8b0e0841ef765f7b232c7c572cfd400fe8088b3c58073c5b25c60063232c14933c59c3e80b2dab33260103ec01004f214013e809633c58073c5b3327b552000705279a018a182107362d09cc8cb1f5230cb3f58fa025007cf165007cf16c9718010c8cb0524cf165006fa0215cb6a14ccc971fb0010241023007cc30023c200b08e218210d53276db708010c8cb055008cf165004fa0216cb6a12cb1f12cb3fc972fb0093356c21e203c85004fa0258cf1601cf16ccc9ed54', 'hex'))[0],
|
|
142
146
|
};
|
|
147
|
+
exports.USDE_MAINNET = {
|
|
148
|
+
name: 'USDe',
|
|
149
|
+
assetId: exports.ASSET_ID.USDe,
|
|
150
|
+
jettonMasterAddress: core_1.Address.parse('EQAIb6KmdfdDR7CN1GBqVJuP25iCnLKCvBlJ07Evuu2dzP5f'),
|
|
151
|
+
jettonWalletCode: core_1.Cell.fromBoc(Buffer.from('b5ee9c7201020f010003f0000114ff00f4a413f4bcf2c80b01020162020302f8d001d0d3030171b08e48135f038020d721ed44d0d303fa00fa40fa40d104d31f01840f218210178d4519ba0282107bdd97deba12b1f2f48040d721fa003012a0401303c8cb0358fa0201cf1601cf16c9ed54e0fa40fa4031fa0031f401fa0031fa00013170f83a02d31f012082100f8a7ea5ba8e85303459db3ce03304050201200d0e01f603d33f0101fa00fa4021fa4430c000f2e14ded44d0d303fa00fa40fa40d15305c705531ac7052571b0c00021b1f2ad523cc705500bb1f2e0495126a120c2fff2af04fa40f401fa002020d70b009ad74bc00101c001b0f2b19130e2c88210178d451901cb1f500a01cb3f5008fa0222cf1601cf1626fa025007cf160602d0228210178d4519ba8e84325adb3ce034218210595f07bcba8e843101db3ce032208210eed236d3ba8e2f30018040d721d303d1ed44d0d303fa00fa40fa40d1335142c705f2e04a403303c8cb0358fa0201cf1601cf16c9ed54e06c218210d372158cbadc840ff2f0080901d0c9088e1533c8801801cb0523cf1670fa0250077158cb6accc98e4af82a54244070546004131503c8cb0358fa0201cf1601cf16c921c8cb0113f40012f400cb00c920f9007074c8cb02ca07cbffc9d0c8801801cb0501cf1670fa024018775003cb6bccccc9e245370700b62191729171e2f839206e938124b89120e2216e94318128739101e25023a813a0738103a370f83ca00270f83612a00170f836a07381040982100966018070f837a0bcf2b0048050fb00430003c8cb0358fa0201cf1601cf16c9ed5403f4ed44d0d303fa00fa40fa40d12372b0c002f26d07d33f0101fa005141a004fa40fa4053bac705f82a5464e070546004131503c8cb0358fa0201cf1601cf16c921c8cb0113f40012f400cb00c9f9007074c8cb02ca07cbffc9d0500cc7051bb1f2e04a09fa0021925f04e30d26d70b01c000b393306c33e30d55020a0b0c01f2ed44d0d303fa00fa40fa40d106d33f0101fa00fa40f401d15141a15288c705f2e04926c2fff2afc882107bdd97de01cb1f5801cb3f01fa0221cf1658cf16c9c8801801cb0526cf1670fa02017158cb6accc903f839206e943081180fde718102f270f8380170f836a0811ba470f836a0bcf2b0028050fb00030c0060c882107362d09c01cb1f2501cb3f5004fa0258cf1658cf16c9c8801001cb0524cf1658fa02017158cb6accc98011fb00007a5054a1f82fa07381040982100966018070f837b60972fb02c8801001cb055005cf1670fa027001cb6a8210d53276db01cb1f5801cb3fc9810082fb0059002003c8cb0358fa0201cf1601cf16c9ed540027bfd8176a2686981fd007d207d206899fc15209840021bc508f6a2686981fd007d207d2068af81c', 'hex'))[0],
|
|
152
|
+
};
|
|
153
|
+
exports.TSUSDE_MAINNET = {
|
|
154
|
+
name: 'tsUSDe',
|
|
155
|
+
assetId: exports.ASSET_ID.tsUSDe,
|
|
156
|
+
jettonMasterAddress: core_1.Address.parse('EQDQ5UUyPHrLcQJlPAczd_fjxn8SLrlNQwolBznxCdSlfQwr'),
|
|
157
|
+
jettonWalletCode: core_1.Cell.fromBoc(Buffer.from('b5ee9c72010219010006bf000114ff00f4a413f4bcf2c80b01020162020302f6d001d0d3030171b08ef0135f038020d721ed44d0d303fa00fa40fa40fa00d33fd106d31f01840f218210178d4519ba228210b2583ed5bab12282107bdd97debab1f2f4018040d721fa0030218210178d4519ba0282107bdd97deba12b18e19a0550405c8cb035004fa0258cf1601cf1601fa02cb3fc9ed54e30de004050201201516003614a004413505c8cb035004fa0258cf1601cf1601fa02cb3fc9ed5404a0fa40fa4031fa0031f401fa0031fa00013170f83a02d31f012082100f8a7ea5ba8e85303459db3ce0208210d750cec9ba8e85303459db3ce033228210178d4519ba8e84325adb3ce0228210b2583ed5ba0607080901ec03d33f0101fa00fa4021fa4430c000f2e14ded44d0d303fa00fa40fa40fa00d33fd15327c705533cc7052771b0c00021b1f2ad525ec705500db1f2e0495148a120c2fff2af06fa40f401fa002020d70b009ad74bc00101c001b0f2b19130e22d8e1170c80101ca0001cf16c971c8cb00ccc9d0de70c80a01f603d33f0101fa00fa4021fa4430c000f2e14ded44d0d303fa00fa40fa40fa00d33fd15228c705532bc7052671b0c00021b1f2ad524dc705500cb1f2e049f82327bcf2e14e0af2e04b5196a120c2fff2af04fa40f401fa002020d70b009ad74bc00101c001b0f2b19130e27fc80101ca0001cf16c971c8cb00ccc9d00d01f4ed44d0d303fa00fa40fa40fa00d33fd12572b0c002f26d09d33f0101fa005161a006d33f31fa40fa40536cc705f82a5464907054700020103510241037102605c8cb035004fa0258cf1601cf1601fa02cb3fc921c8cb0113f40012f400cb00c9f9007074c8cb02ca07cbffc9d0500ec7051db1f2e04a0bfa00210f02d88e84325adb3ce034218210595f07bcba8e843101db3ce032208210eed236d3ba8e3b30018040d721d303d1ed44d0d303fa00fa40fa40fa00d33fd1355161c705f2e04a1045551205c8cb035004fa0258cf1601cf1601fa02cb3fc9ed54e06c218210d372158cbadc840ff2f0111202fe8210178d451901cb1f500d01cb3f500bfa021bcb3f24cf1601cf1629fa025008cf16c90a8e57f82a5426607054700020103510241037102605c8cb035004fa0258cf1601cf1601fa02cb3fc921c8cb0113f40012f400cb00c920f9007074c8cb02ca07cbffc9d0c8801801cb0501cf1670fa02401a775003cb6bccccc9e30d0b0c002a35c8801801cb0525cf1670fa0250097158cb6accc900cc47692191729171e2f839206e938126e29120e2216e9431812a169101e25023a813a0738103e770f83ca00270f83612a00170f836a07381044d82100966018070f837a0bcf2b0068050fb00103510340205c8cb035004fa0258cf1601cf1601fa02cb3fc9ed5401fe70c88210b2583ed501cb1f500b01cb3f5009fa0219cb3f22cf1601cf1627fa025006cf16c9c8801801cb0529cf1670fa02017158cb6accc947692191729171e2f839206e938126e29120e2216e9431812a169101e25023a813a0738103e770f83ca00270f83612a00170f836a07381044d82100966018070f837a0bcf2b0060e003c8050fb001035443005c8cb035004fa0258cf1601cf1601fa02cb3fc9ed5401be8e30c882107362d09c01cb1f2501cb3f5004fa0258cf1658cf16c9c8801001cb0526cf1658fa02017158cb6accc98011fb00925f04e228d70b01c000b396301027353530e30d55300505c8cb035004fa0258cf1601cf1601fa02cb3fc9ed541000825076a1f82fa07381044d82100966018070f837b60972fb02c8801001cb055007cf1670fa027001cb6a8210d53276db01cb1f500401cb3fc9810082fb001024102301b8ed44d0d303fa00fa40fa40fa00d33fd1302472b0c002f26d08d33f0101fa00d33f50b2a001fa4031fa4030523ac705f2e04a28d70b01c000b39710381027365f03e30d55300505c8cb035004fa0258cf1601cf1601fa02cb3fc9ed541301f6ed44d0d303fa00fa40fa40fa00d33fd108d33f0101fa00fa40f401d15161a1524ac705f2e04928c2fff2afc882107bdd97de01cb1f5801cb3f01fa0223cf165004cf16c9c8801801cb0522cf1670fa02017158cb6accc905f839206e943081187fde718102f270f8380170f836a081203770f836a0bcf2b004805014007e5076a1f82fa07381044d82100966018070f837b60972fb02c8801001cb055007cf1670fa027001cb6a8210d53276db01cb1f500501cb3fc9810082fb0010340036fb0045130205c8cb035004fa0258cf1601cf1601fa02cb3fc9ed5402015817180029bc508f6a2686981fd007d207d207d00699fe8af82c0029b74e5da89a1a607f401f481f481f401a67fa2d88500031b7605da89a1a607f401f481f481f401a67fa2b667f05482610', 'hex'))[0],
|
|
158
|
+
};
|
|
159
|
+
exports.PT_tsUSDe_01Sep2025_MAINNET = {
|
|
160
|
+
name: 'PT_tsUSDe_01Sep2025',
|
|
161
|
+
assetId: exports.ASSET_ID.PT_tsUSDe_01Sep2025,
|
|
162
|
+
jettonMasterAddress: core_1.Address.parse('EQDb90Bss5FnIyq7VMmnG2UeZIzZomQsILw9Hjo1wxaF1df3'),
|
|
163
|
+
jettonWalletCode: core_1.Cell.fromBoc(Buffer.from('b5ee9c7201020f010003c2000114ff00f4a413f4bcf2c80b0102016202030202ce0405001da0f605da89a1f401f481f48061f05504b3420c700925f04e001d0d3030171b08e85135f03db3ce0fa40fa4031fa003171d721fa0031fa003073a9b40002d31f012082100f8a7ea5ba8e85303459db3ce0208210178d4519ba8e8630444403db3ce035248210595f07bcba80607080900114fa4430c000f2e14d800848020d721ed44d0fa00fa40fa403003d31f018200fff0218210178d4519ba0282107bdd97deba12b1f2f4d33f0130fa003012a002c85003fa0201cf1601cf16c9ed5401f403d33f0101fa00fa4021f002ed44d0fa00fa40fa40305125a15219c705f2e2c127c2fff2e2c2f82a5424207054201314c85003fa0201cf1601cf16c922c8cb0112f400f400cb00c920f9007074c8cb02ca07cbffc9d003fa40f40431fa0020d749c200f2e2c4c88210178d451901cb1f500901cb3f5007fa02250a02f4ed44d0fa00fa40fa403007d33f0101fa005141a004fa40fa4053bac705f82a5464e07054201314c85003fa0201cf1601cf16c922c8cb0112f400f400cb00c9f9007074c8cb02ca07cbffc9d0500cc7051bb1f2e2c309fa005197a121951049385f04e30d038208989680b60972fb0224d70b01c30002c20012b00b0c02ce8e843459db3ce06c22ed44d0fa00fa40fa403030312382106d8e5e3cba8e37335222c705f2e2c1820898968070fb02c8801001cb0558cf1670fa027001cb6a8210d53276db01cb1f01d33f013101cb3fc9810082fb00e0038210768a50b2bae3025f03840ff2f00d0e009ccf1601cf1625fa025006cf16c9c8801801cb055003cf1670fa025052775003cb6bcccc2291729171e25007a812a082096e3600a013bcf2e2c503c98040fb0058c85003fa0201cf1601cf16c9ed5400725219a017a1c882107362d09c01cb1f2401cb3f5003fa0201cf165007cf16c9c8801001cb0523cf165005fa0250047158cb6accc971fb00102400748e25c8801001cb055004cf1670fa027001cb6a8210d53276db01cb1f5801cb3fc9810082fb0001926c22e202c85003fa0201cf1601cf16c9ed5400deed44d0fa00fa40fa403006d33f0101fa00fa40305141a15238c705f2e2c126c2fff2e2c2048208d59f80a015bcf2e2c3c882107bdd97de01cb1f500401cb3f58fa0222cf1601cf16c9c8801801cb0524cf1670fa02017158cb6accc98040fb0058c85003fa0201cf1601cf16c9ed5400965222c705f2e2c1d33f0101fa40fa00f40430c8801801cb055003cf1670fa0270c882100f8a7ea501cb1f500501cb3f58fa0224cf165004cf16f40070fa02ca00c97158cb6accc98040fb00', 'hex'))[0],
|
|
164
|
+
};
|
|
165
|
+
exports.TONUSDT_STONFI_MAINNET = {
|
|
166
|
+
name: 'TONUSDT_STONFI',
|
|
167
|
+
assetId: exports.ASSET_ID.TONUSDT_STONFI,
|
|
168
|
+
jettonMasterAddress: core_1.Address.parse('EQCGScrZe1xbyWqWDvdI6mzP-GAcAWFv6ZXuaJOuSqemxku4'),
|
|
169
|
+
jettonWalletCode: core_1.Cell.fromBoc(Buffer.from('b5ee9c7201010101002300084202c00836440d084e44fb94316132ac5a21417ef4f429ee09b5560b5678b334c3e8', 'hex'))[0],
|
|
170
|
+
};
|
|
171
|
+
exports.STON_MAINNET = {
|
|
172
|
+
name: 'STON',
|
|
173
|
+
assetId: exports.ASSET_ID.STON,
|
|
174
|
+
jettonMasterAddress: core_1.Address.parse('EQA2kCVNwVsil2EM2mB0SkXytxCqQjS4mttjDpnXmwG9T6bO'),
|
|
175
|
+
jettonWalletCode: core_1.Cell.fromBoc(Buffer.from('b5ee9c7201021201000334000114ff00f4a413f4bcf2c80b0102016202030202cc0405001ba0f605da89a1f401f481f481a8610201d40607020148080900c30831c02497c138007434c0c05c6c2544d7c0fc02f83e903e900c7e800c5c75c87e800c7e800c1cea6d0000b4c7e08403e29fa954882ea54c4d167c0238208405e3514654882ea58c511100fc02780d60841657c1ef2ea4d67c02b817c12103fcbc2000113e910c1c2ebcb853600201200a0b020120101101f100f4cffe803e90087c007b51343e803e903e90350c144da8548ab1c17cb8b04a30bffcb8b0950d109c150804d50500f214013e809633c58073c5b33248b232c044bd003d0032c032483e401c1d3232c0b281f2fff274013e903d010c7e800835d270803cb8b11de0063232c1540233c59c3e8085f2dac4f3200c03f73b51343e803e903e90350c0234cffe80145468017e903e9014d6f1c1551cdb5c150804d50500f214013e809633c58073c5b33248b232c044bd003d0032c0327e401c1d3232c0b281f2fff274140371c1472c7cb8b0c2be80146a2860822625a020822625a004ad8228608239387028062849f8c3c975c2c070c008e00d0e0f00ae8210178d4519c8cb1f19cb3f5007fa0222cf165006cf1625fa025003cf16c95005cc2391729171e25008a813a08208e4e1c0aa008208989680a0a014bcf2e2c504c98040fb001023c85004fa0258cf1601cf16ccc9ed5400705279a018a182107362d09cc8cb1f5230cb3f58fa025007cf165007cf16c9718010c8cb0524cf165006fa0215cb6a14ccc971fb0010241023000e10491038375f040076c200b08e218210d53276db708010c8cb055008cf165004fa0216cb6a12cb1f12cb3fc972fb0093356c21e203c85004fa0258cf1601cf16ccc9ed5400db3b51343e803e903e90350c01f4cffe803e900c145468549271c17cb8b049f0bffcb8b0a0823938702a8005a805af3cb8b0e0841ef765f7b232c7c572cfd400fe8088b3c58073c5b25c60063232c14933c59c3e80b2dab33260103ec01004f214013e809633c58073c5b3327b55200083200835c87b51343e803e903e90350c0134c7e08405e3514654882ea0841ef765f784ee84ac7cb8b174cfcc7e800c04e81408f214013e809633c58073c5b3327b5520', 'hex'))[0],
|
|
176
|
+
};
|
|
@@ -22,6 +22,10 @@ export declare const EVAA_LP_MAINNET: Address;
|
|
|
22
22
|
export declare const EVAA_LP_MAINNET_VERSION = 3;
|
|
23
23
|
export declare const EVAA_ALTS_MAINNET: Address;
|
|
24
24
|
export declare const EVAA_ALTS_MAINNET_VERSION = 0;
|
|
25
|
+
export declare const EVAA_STABLE_MAINNET: Address;
|
|
26
|
+
export declare const STABLE_VERSION = 0;
|
|
27
|
+
export declare const EVAA_ETHENA_MAINNET: Address;
|
|
28
|
+
export declare const EVAA_ETHENA_VERSION = 0;
|
|
25
29
|
export declare const EVAA_REWARDS_MASTER_TESTNET: Address;
|
|
26
30
|
export declare const EVAA_USDT_REWARDS_MASTER_MAINNET: Address;
|
|
27
31
|
export declare const EVAA_TON_REWARDS_MASTER_MAINNET: Address;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FEES = exports.OPCODES = exports.EVAA_REWARDS_USER_CODE_MAINNET = exports.EVAA_REWARDS_USER_CODE_TESTNET = exports.EVAA_REWARDS_MASTER_CODE_MAINNET = exports.EVAA_REWARDS_MASTER_CODE_TESTNET = exports.JETTON_WALLET_STANDART_CODE_TESTNET = exports.JETTON_WALLET_STANDART_CODE = exports.LENDING_CODE = exports.ORACLES_ALTS = exports.ORACLES_LP = exports.ORACLES_TESTNET = exports.ORACLES_MAINNET = exports.EVAA_TON_REWARDS_MASTER_MAINNET = exports.EVAA_USDT_REWARDS_MASTER_MAINNET = exports.EVAA_REWARDS_MASTER_TESTNET = exports.EVAA_ALTS_MAINNET_VERSION = exports.EVAA_ALTS_MAINNET = exports.EVAA_LP_MAINNET_VERSION = exports.EVAA_LP_MAINNET = exports.TESTNET_VERSION = exports.EVAA_MASTER_TESTNET = exports.MAINNET_VERSION = exports.EVAA_MASTER_MAINNET = exports.NULL_ADDRESS = exports.MASTER_CONSTANTS = void 0;
|
|
3
|
+
exports.FEES = exports.OPCODES = exports.EVAA_REWARDS_USER_CODE_MAINNET = exports.EVAA_REWARDS_USER_CODE_TESTNET = exports.EVAA_REWARDS_MASTER_CODE_MAINNET = exports.EVAA_REWARDS_MASTER_CODE_TESTNET = exports.JETTON_WALLET_STANDART_CODE_TESTNET = exports.JETTON_WALLET_STANDART_CODE = exports.LENDING_CODE = exports.ORACLES_ALTS = exports.ORACLES_LP = exports.ORACLES_TESTNET = exports.ORACLES_MAINNET = exports.EVAA_TON_REWARDS_MASTER_MAINNET = exports.EVAA_USDT_REWARDS_MASTER_MAINNET = exports.EVAA_REWARDS_MASTER_TESTNET = exports.EVAA_ETHENA_VERSION = exports.EVAA_ETHENA_MAINNET = exports.STABLE_VERSION = exports.EVAA_STABLE_MAINNET = exports.EVAA_ALTS_MAINNET_VERSION = exports.EVAA_ALTS_MAINNET = exports.EVAA_LP_MAINNET_VERSION = exports.EVAA_LP_MAINNET = exports.TESTNET_VERSION = exports.EVAA_MASTER_TESTNET = exports.MAINNET_VERSION = exports.EVAA_MASTER_MAINNET = exports.NULL_ADDRESS = exports.MASTER_CONSTANTS = void 0;
|
|
4
4
|
const core_1 = require("@ton/core");
|
|
5
5
|
const ASSET_PRICE_SCALE = BigInt(1e9);
|
|
6
6
|
exports.MASTER_CONSTANTS = {
|
|
@@ -25,9 +25,13 @@ exports.EVAA_LP_MAINNET = core_1.Address.parse('EQBIlZX2URWkXCSg3QF2MJZU-wC5XkBo
|
|
|
25
25
|
exports.EVAA_LP_MAINNET_VERSION = 3;
|
|
26
26
|
exports.EVAA_ALTS_MAINNET = core_1.Address.parse('EQANURVS3fhBO9bivig34iyJQi97FhMbpivo1aUEAS2GYSu-');
|
|
27
27
|
exports.EVAA_ALTS_MAINNET_VERSION = 0;
|
|
28
|
+
exports.EVAA_STABLE_MAINNET = core_1.Address.parse('EQCdIdXf1kA_2Hd9mbGzSFDEPA-Px-et8qTWHEXgRGo0K3zd');
|
|
29
|
+
exports.STABLE_VERSION = 0;
|
|
30
|
+
exports.EVAA_ETHENA_MAINNET = core_1.Address.parse('EQCn95X_qLJa5VUXfyIQkWDH2iq3PTatsO4esunMaIsnyyeW');
|
|
31
|
+
exports.EVAA_ETHENA_VERSION = 0;
|
|
28
32
|
exports.EVAA_REWARDS_MASTER_TESTNET = core_1.Address.parse('EQCnp0iRGcfDJAvnKhAEN9sB-nPYSPuc83Ff4y75s8AtoSW1');
|
|
29
33
|
exports.EVAA_USDT_REWARDS_MASTER_MAINNET = core_1.Address.parse('EQD22Fhylp1tX-xoVX81aMTSJNPV8j9klwApTLgjGmofISVD');
|
|
30
|
-
exports.EVAA_TON_REWARDS_MASTER_MAINNET = core_1.Address.parse('
|
|
34
|
+
exports.EVAA_TON_REWARDS_MASTER_MAINNET = core_1.Address.parse('EQDM_gdrntBg4fy5Rg9DgDF0AUu3FYoqxHEOsHNIC4_DTDuC');
|
|
31
35
|
exports.ORACLES_MAINNET = [
|
|
32
36
|
{ id: 0, address: '0xd3a8c0b9fd44fd25a49289c631e3ac45689281f2f8cf0744400b4c65bed38e5d', pubkey: Buffer.from('b404f4a2ebb62f2623b370c89189748a0276c071965b1646b996407f10d72eb9', 'hex') },
|
|
33
37
|
{ id: 1, address: '0x2c21cabdaa89739de16bde7bc44e86401fac334a3c7e55305fe5e7563043e191', pubkey: Buffer.from('9ad115087520d91b6b45d6a8521eb4616ee6914af07fabdc2e9d1826dbb17078', 'hex') },
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { PoolConfig } from '../types/Master';
|
|
2
2
|
import { EvaaRewardsConfig } from '../types/MasterRewards';
|
|
3
3
|
export declare const MAINNET_POOL_CONFIG: PoolConfig;
|
|
4
|
+
export declare const MAINNET_STABLE_POOL_CONFIG: PoolConfig;
|
|
5
|
+
export declare const MAINNET_TEST_ETHENA_POOL_CONFIG: PoolConfig;
|
|
4
6
|
export declare const TESTNET_POOL_CONFIG: PoolConfig;
|
|
5
7
|
export declare const MAINNET_LP_POOL_CONFIG: PoolConfig;
|
|
6
8
|
export declare const MAINNET_ALTS_POOL_CONFIG: PoolConfig;
|
|
@@ -8,3 +10,4 @@ export declare const TESTNET_MASTER_REWARD_CONFIG: EvaaRewardsConfig;
|
|
|
8
10
|
export declare const TESTNET_MASTER_EUSDT_REWARD_CONFIG: EvaaRewardsConfig;
|
|
9
11
|
export declare const MAINNET_MASTER_TON_REWARD_CONFIG: EvaaRewardsConfig;
|
|
10
12
|
export declare const MAINNET_MASTER_USDT_REWARD_CONFIG: EvaaRewardsConfig;
|
|
13
|
+
export declare const ALL_MAINNET_POOLS: PoolConfig[];
|
package/dist/constants/pools.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MAINNET_MASTER_USDT_REWARD_CONFIG = exports.MAINNET_MASTER_TON_REWARD_CONFIG = exports.TESTNET_MASTER_EUSDT_REWARD_CONFIG = exports.TESTNET_MASTER_REWARD_CONFIG = exports.MAINNET_ALTS_POOL_CONFIG = exports.MAINNET_LP_POOL_CONFIG = exports.TESTNET_POOL_CONFIG = exports.MAINNET_POOL_CONFIG = void 0;
|
|
3
|
+
exports.ALL_MAINNET_POOLS = exports.MAINNET_MASTER_USDT_REWARD_CONFIG = exports.MAINNET_MASTER_TON_REWARD_CONFIG = exports.TESTNET_MASTER_EUSDT_REWARD_CONFIG = exports.TESTNET_MASTER_REWARD_CONFIG = exports.MAINNET_ALTS_POOL_CONFIG = exports.MAINNET_LP_POOL_CONFIG = exports.TESTNET_POOL_CONFIG = exports.MAINNET_TEST_ETHENA_POOL_CONFIG = exports.MAINNET_STABLE_POOL_CONFIG = exports.MAINNET_POOL_CONFIG = void 0;
|
|
4
4
|
const core_1 = require("@ton/core");
|
|
5
5
|
const assets_1 = require("./assets");
|
|
6
6
|
const general_1 = require("./general");
|
|
@@ -17,7 +17,35 @@ exports.MAINNET_POOL_CONFIG = {
|
|
|
17
17
|
assets_1.STTON_MAINNET,
|
|
18
18
|
assets_1.TSTON_MAINNET,
|
|
19
19
|
assets_1.USDT_MAINNET,
|
|
20
|
-
|
|
20
|
+
assets_1.USDE_MAINNET,
|
|
21
|
+
assets_1.TSUSDE_MAINNET,
|
|
22
|
+
// UTON_MAINNET // announce xdddd fake announce
|
|
23
|
+
],
|
|
24
|
+
lendingCode: general_1.LENDING_CODE,
|
|
25
|
+
};
|
|
26
|
+
exports.MAINNET_STABLE_POOL_CONFIG = {
|
|
27
|
+
masterAddress: general_1.EVAA_STABLE_MAINNET,
|
|
28
|
+
masterVersion: general_1.STABLE_VERSION,
|
|
29
|
+
masterConstants: general_1.MASTER_CONSTANTS,
|
|
30
|
+
oracles: general_1.ORACLES_MAINNET,
|
|
31
|
+
minimalOracles: 3,
|
|
32
|
+
poolAssetsConfig: [
|
|
33
|
+
assets_1.USDT_MAINNET,
|
|
34
|
+
assets_1.USDE_MAINNET,
|
|
35
|
+
assets_1.TSUSDE_MAINNET,
|
|
36
|
+
assets_1.PT_tsUSDe_01Sep2025_MAINNET
|
|
37
|
+
],
|
|
38
|
+
lendingCode: general_1.LENDING_CODE,
|
|
39
|
+
};
|
|
40
|
+
exports.MAINNET_TEST_ETHENA_POOL_CONFIG = {
|
|
41
|
+
masterAddress: general_1.EVAA_ETHENA_MAINNET,
|
|
42
|
+
masterVersion: general_1.EVAA_ETHENA_VERSION,
|
|
43
|
+
masterConstants: general_1.MASTER_CONSTANTS,
|
|
44
|
+
oracles: general_1.ORACLES_MAINNET,
|
|
45
|
+
minimalOracles: 3,
|
|
46
|
+
poolAssetsConfig: [
|
|
47
|
+
assets_1.TON_MAINNET,
|
|
48
|
+
assets_1.USDE_MAINNET,
|
|
21
49
|
],
|
|
22
50
|
lendingCode: general_1.LENDING_CODE,
|
|
23
51
|
};
|
|
@@ -36,7 +64,7 @@ exports.MAINNET_LP_POOL_CONFIG = {
|
|
|
36
64
|
masterConstants: general_1.MASTER_CONSTANTS,
|
|
37
65
|
oracles: general_1.ORACLES_LP,
|
|
38
66
|
minimalOracles: 3,
|
|
39
|
-
poolAssetsConfig: [assets_1.TON_MAINNET, assets_1.USDT_MAINNET, assets_1.TONUSDT_DEDUST_MAINNET, assets_1.TON_STORM_MAINNET, assets_1.USDT_STORM_MAINNET],
|
|
67
|
+
poolAssetsConfig: [assets_1.TON_MAINNET, assets_1.USDT_MAINNET, assets_1.TONUSDT_DEDUST_MAINNET, assets_1.TON_STORM_MAINNET, assets_1.USDT_STORM_MAINNET, assets_1.TONUSDT_STONFI_MAINNET],
|
|
40
68
|
lendingCode: general_1.LENDING_CODE,
|
|
41
69
|
};
|
|
42
70
|
exports.MAINNET_ALTS_POOL_CONFIG = {
|
|
@@ -45,7 +73,7 @@ exports.MAINNET_ALTS_POOL_CONFIG = {
|
|
|
45
73
|
masterConstants: general_1.MASTER_CONSTANTS,
|
|
46
74
|
oracles: general_1.ORACLES_ALTS,
|
|
47
75
|
minimalOracles: 3,
|
|
48
|
-
poolAssetsConfig: [assets_1.TON_MAINNET, assets_1.USDT_MAINNET, assets_1.CATI_MAINNET, assets_1.NOT_MAINNET, assets_1.DOGS_MAINNET],
|
|
76
|
+
poolAssetsConfig: [assets_1.TON_MAINNET, assets_1.USDT_MAINNET, assets_1.CATI_MAINNET, assets_1.NOT_MAINNET, assets_1.DOGS_MAINNET /*, STON_MAINNET announce*/],
|
|
49
77
|
lendingCode: general_1.LENDING_CODE,
|
|
50
78
|
};
|
|
51
79
|
exports.TESTNET_MASTER_REWARD_CONFIG = {
|
|
@@ -73,7 +101,7 @@ exports.MAINNET_MASTER_TON_REWARD_CONFIG = {
|
|
|
73
101
|
rewardUserCode: general_1.EVAA_REWARDS_USER_CODE_MAINNET,
|
|
74
102
|
asset: assets_1.TON_MAINNET,
|
|
75
103
|
availableReward: 0,
|
|
76
|
-
publicKey: Buffer.from('
|
|
104
|
+
publicKey: Buffer.from('bfe9a30221db4dff4c17e55d985e0b13a8f597bbb28002f311dc4429dad1ca95', 'hex'), // adminAddress publicKey
|
|
77
105
|
};
|
|
78
106
|
exports.MAINNET_MASTER_USDT_REWARD_CONFIG = {
|
|
79
107
|
adminAddress: general_1.EVAA_USDT_REWARDS_MASTER_MAINNET,
|
|
@@ -84,3 +112,9 @@ exports.MAINNET_MASTER_USDT_REWARD_CONFIG = {
|
|
|
84
112
|
availableReward: 0,
|
|
85
113
|
publicKey: Buffer.from('9813725d6cead1c9bbc0e24b21d4fc62a7fa8ac4bb01b6758df30169a71dba67', 'hex'), // adminAddress publicKey
|
|
86
114
|
};
|
|
115
|
+
exports.ALL_MAINNET_POOLS = [
|
|
116
|
+
exports.MAINNET_POOL_CONFIG,
|
|
117
|
+
exports.MAINNET_LP_POOL_CONFIG,
|
|
118
|
+
exports.MAINNET_ALTS_POOL_CONFIG,
|
|
119
|
+
exports.MAINNET_STABLE_POOL_CONFIG,
|
|
120
|
+
];
|
package/dist/index.d.ts
CHANGED
|
@@ -14,9 +14,8 @@ export { JettonWallet as RewardJettonWallet, type JettonWalletConfig } from './r
|
|
|
14
14
|
export { EvaaUserRewards } from './rewards/EvaaRewards';
|
|
15
15
|
export { UpgradeConfig, AssetConfig, MasterConfig, AssetData, AssetInterest, AssetApy, ExtendedAssetData, MasterData, PoolConfig, ExtendedAssetsData, ExtendedAssetsConfig, PoolAssetConfig, PoolAssetsConfig, MasterConstants } from './types/Master';
|
|
16
16
|
export { BalanceType, UserBalance, UserLiqudationData, LiquidableData, NonLiquidableData, LiquidationData, UserDataInactive, UserDataActive, UserData, BalanceChangeType } from './types/User';
|
|
17
|
-
export
|
|
18
|
-
export
|
|
19
|
-
export { ASSET_ID, UNDEFINED_ASSET, TON_MAINNET, USDT_MAINNET, TONUSDT_DEDUST_MAINNET, TON_STORM_MAINNET, USDT_STORM_MAINNET, DOGS_MAINNET, CATI_MAINNET, UTON_MAINNET, NOT_MAINNET, JUSDT_MAINNET, JUSDC_MAINNET, STTON_MAINNET, TSTON_MAINNET, JUSDT_TESTNET, JUSDC_TESTNET, STTON_TESTNET } from './constants/assets';
|
|
17
|
+
export * from './constants/general';
|
|
18
|
+
export * from './constants/pools';
|
|
20
19
|
export * from './constants/assets';
|
|
21
20
|
export * from './utils/utils';
|
|
22
21
|
export * from './prices';
|
package/dist/index.js
CHANGED
|
@@ -14,8 +14,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.
|
|
18
|
-
exports.getUserJettonWallet =
|
|
17
|
+
exports.getTonConnectSender = exports.getLastSentBoc = exports.BalanceChangeType = exports.BalanceType = exports.EvaaUserRewards = exports.RewardJettonWallet = exports.RewardJettonMinter = exports.RewardUser = exports.RewardMaster = exports.EvaaUser = exports.Evaa = exports.JettonWallet = exports.getPrices = exports.parseUserLiteData = exports.parseUserData = exports.parseMasterData = exports.createAssetConfig = exports.createAssetData = exports.calculateAssetsValues = exports.selectGreatestAssets = exports.findAssetById = exports.prepareAssetInfo = exports.toAssetWorth = exports.toAssetAmount = exports.deductLiquidationBonus = exports.addLiquidationBonus = exports.deductReserve = exports.addReserve = exports.isBadDebt = exports.isLiquidatable = exports.calculateMinCollateralByTransferredAmount = exports.calculateLiquidationAmounts = exports.getAssetLiquidityMinusReserves = exports.BigMath = exports.predictAPY = exports.calculateInterestWithSupplyBorrow = exports.calculateHealthParams = exports.predictHealthFactor = exports.calculateLiquidationData = exports.presentValue = exports.calculateMaximumWithdrawAmount = exports.getAvailableToBorrow = exports.calculateAssetInterest = exports.calculateAssetData = exports.calculateCurrentRates = exports.calculatePresentValue = exports.bigIntMax = exports.bigIntMin = exports.mulDiv = exports.mulFactor = void 0;
|
|
18
|
+
exports.getUserJettonWallet = void 0;
|
|
19
19
|
// Math
|
|
20
20
|
var math_1 = require("./api/math");
|
|
21
21
|
Object.defineProperty(exports, "mulFactor", { enumerable: true, get: function () { return math_1.mulFactor; } });
|
|
@@ -83,48 +83,8 @@ var User_1 = require("./types/User");
|
|
|
83
83
|
Object.defineProperty(exports, "BalanceType", { enumerable: true, get: function () { return User_1.BalanceType; } });
|
|
84
84
|
Object.defineProperty(exports, "BalanceChangeType", { enumerable: true, get: function () { return User_1.BalanceChangeType; } });
|
|
85
85
|
// Constants
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
Object.defineProperty(exports, "MAINNET_VERSION", { enumerable: true, get: function () { return general_1.MAINNET_VERSION; } });
|
|
89
|
-
Object.defineProperty(exports, "EVAA_MASTER_TESTNET", { enumerable: true, get: function () { return general_1.EVAA_MASTER_TESTNET; } });
|
|
90
|
-
Object.defineProperty(exports, "TESTNET_VERSION", { enumerable: true, get: function () { return general_1.TESTNET_VERSION; } });
|
|
91
|
-
Object.defineProperty(exports, "LENDING_CODE", { enumerable: true, get: function () { return general_1.LENDING_CODE; } });
|
|
92
|
-
Object.defineProperty(exports, "OPCODES", { enumerable: true, get: function () { return general_1.OPCODES; } });
|
|
93
|
-
Object.defineProperty(exports, "FEES", { enumerable: true, get: function () { return general_1.FEES; } });
|
|
94
|
-
Object.defineProperty(exports, "MASTER_CONSTANTS", { enumerable: true, get: function () { return general_1.MASTER_CONSTANTS; } });
|
|
95
|
-
Object.defineProperty(exports, "EVAA_REWARDS_MASTER_TESTNET", { enumerable: true, get: function () { return general_1.EVAA_REWARDS_MASTER_TESTNET; } });
|
|
96
|
-
Object.defineProperty(exports, "EVAA_REWARDS_MASTER_CODE_TESTNET", { enumerable: true, get: function () { return general_1.EVAA_REWARDS_MASTER_CODE_TESTNET; } });
|
|
97
|
-
Object.defineProperty(exports, "EVAA_REWARDS_USER_CODE_TESTNET", { enumerable: true, get: function () { return general_1.EVAA_REWARDS_USER_CODE_TESTNET; } });
|
|
98
|
-
Object.defineProperty(exports, "EVAA_REWARDS_MASTER_CODE_MAINNET", { enumerable: true, get: function () { return general_1.EVAA_REWARDS_MASTER_CODE_MAINNET; } });
|
|
99
|
-
Object.defineProperty(exports, "EVAA_REWARDS_USER_CODE_MAINNET", { enumerable: true, get: function () { return general_1.EVAA_REWARDS_USER_CODE_MAINNET; } });
|
|
100
|
-
var pools_1 = require("./constants/pools");
|
|
101
|
-
Object.defineProperty(exports, "MAINNET_POOL_CONFIG", { enumerable: true, get: function () { return pools_1.MAINNET_POOL_CONFIG; } });
|
|
102
|
-
Object.defineProperty(exports, "TESTNET_POOL_CONFIG", { enumerable: true, get: function () { return pools_1.TESTNET_POOL_CONFIG; } });
|
|
103
|
-
Object.defineProperty(exports, "MAINNET_LP_POOL_CONFIG", { enumerable: true, get: function () { return pools_1.MAINNET_LP_POOL_CONFIG; } });
|
|
104
|
-
Object.defineProperty(exports, "MAINNET_ALTS_POOL_CONFIG", { enumerable: true, get: function () { return pools_1.MAINNET_ALTS_POOL_CONFIG; } });
|
|
105
|
-
// Reward Pools
|
|
106
|
-
Object.defineProperty(exports, "TESTNET_MASTER_REWARD_CONFIG", { enumerable: true, get: function () { return pools_1.TESTNET_MASTER_REWARD_CONFIG; } });
|
|
107
|
-
Object.defineProperty(exports, "MAINNET_MASTER_TON_REWARD_CONFIG", { enumerable: true, get: function () { return pools_1.MAINNET_MASTER_TON_REWARD_CONFIG; } });
|
|
108
|
-
Object.defineProperty(exports, "MAINNET_MASTER_USDT_REWARD_CONFIG", { enumerable: true, get: function () { return pools_1.MAINNET_MASTER_USDT_REWARD_CONFIG; } });
|
|
109
|
-
var assets_1 = require("./constants/assets");
|
|
110
|
-
Object.defineProperty(exports, "ASSET_ID", { enumerable: true, get: function () { return assets_1.ASSET_ID; } });
|
|
111
|
-
Object.defineProperty(exports, "UNDEFINED_ASSET", { enumerable: true, get: function () { return assets_1.UNDEFINED_ASSET; } });
|
|
112
|
-
Object.defineProperty(exports, "TON_MAINNET", { enumerable: true, get: function () { return assets_1.TON_MAINNET; } });
|
|
113
|
-
Object.defineProperty(exports, "USDT_MAINNET", { enumerable: true, get: function () { return assets_1.USDT_MAINNET; } });
|
|
114
|
-
Object.defineProperty(exports, "TONUSDT_DEDUST_MAINNET", { enumerable: true, get: function () { return assets_1.TONUSDT_DEDUST_MAINNET; } });
|
|
115
|
-
Object.defineProperty(exports, "TON_STORM_MAINNET", { enumerable: true, get: function () { return assets_1.TON_STORM_MAINNET; } });
|
|
116
|
-
Object.defineProperty(exports, "USDT_STORM_MAINNET", { enumerable: true, get: function () { return assets_1.USDT_STORM_MAINNET; } });
|
|
117
|
-
Object.defineProperty(exports, "DOGS_MAINNET", { enumerable: true, get: function () { return assets_1.DOGS_MAINNET; } });
|
|
118
|
-
Object.defineProperty(exports, "CATI_MAINNET", { enumerable: true, get: function () { return assets_1.CATI_MAINNET; } });
|
|
119
|
-
Object.defineProperty(exports, "UTON_MAINNET", { enumerable: true, get: function () { return assets_1.UTON_MAINNET; } });
|
|
120
|
-
Object.defineProperty(exports, "NOT_MAINNET", { enumerable: true, get: function () { return assets_1.NOT_MAINNET; } });
|
|
121
|
-
Object.defineProperty(exports, "JUSDT_MAINNET", { enumerable: true, get: function () { return assets_1.JUSDT_MAINNET; } });
|
|
122
|
-
Object.defineProperty(exports, "JUSDC_MAINNET", { enumerable: true, get: function () { return assets_1.JUSDC_MAINNET; } });
|
|
123
|
-
Object.defineProperty(exports, "STTON_MAINNET", { enumerable: true, get: function () { return assets_1.STTON_MAINNET; } });
|
|
124
|
-
Object.defineProperty(exports, "TSTON_MAINNET", { enumerable: true, get: function () { return assets_1.TSTON_MAINNET; } });
|
|
125
|
-
Object.defineProperty(exports, "JUSDT_TESTNET", { enumerable: true, get: function () { return assets_1.JUSDT_TESTNET; } });
|
|
126
|
-
Object.defineProperty(exports, "JUSDC_TESTNET", { enumerable: true, get: function () { return assets_1.JUSDC_TESTNET; } });
|
|
127
|
-
Object.defineProperty(exports, "STTON_TESTNET", { enumerable: true, get: function () { return assets_1.STTON_TESTNET; } });
|
|
86
|
+
__exportStar(require("./constants/general"), exports);
|
|
87
|
+
__exportStar(require("./constants/pools"), exports);
|
|
128
88
|
__exportStar(require("./constants/assets"), exports);
|
|
129
89
|
__exportStar(require("./utils/utils"), exports);
|
|
130
90
|
__exportStar(require("./prices"), exports);
|
|
@@ -95,10 +95,17 @@ _PricesCollector_prices = new WeakMap(), _PricesCollector_poolConfig = new WeakM
|
|
|
95
95
|
const newerPrices = sortedByTimestamp.slice(0, __classPrivateFieldGet(this, _PricesCollector_poolConfig, "f").minimalOracles);
|
|
96
96
|
pricesFiltered = newerPrices.sort((a, b) => a.oracleId - b.oracleId);
|
|
97
97
|
}
|
|
98
|
-
const medianData = assets.map(asset => ({
|
|
98
|
+
const medianData = assets.map((asset) => ({
|
|
99
|
+
assetId: asset.assetId,
|
|
100
|
+
medianPrice: (0, utils_1.getMedianPrice)(pricesFiltered, asset.assetId),
|
|
101
|
+
}));
|
|
99
102
|
const nonEmptymedianData = medianData.filter(x => x.medianPrice != null);
|
|
100
103
|
const packedMedianData = (0, utils_1.packAssetsData)(nonEmptymedianData);
|
|
101
|
-
const oraclesData =
|
|
104
|
+
const oraclesData = pricesFiltered.map((x) => ({
|
|
105
|
+
oracle: { id: x.oracleId, pubkey: x.pubkey },
|
|
106
|
+
data: { timestamp: x.timestamp, prices: x.dict },
|
|
107
|
+
signature: x.signature,
|
|
108
|
+
}));
|
|
102
109
|
const packedOracleData = (0, utils_1.packOraclesData)(oraclesData, nonEmptymedianData.map(x => x.assetId));
|
|
103
110
|
const dict = core_1.Dictionary.empty();
|
|
104
111
|
for (const medianDataAsset of nonEmptymedianData) {
|
package/dist/prices/Types.d.ts
CHANGED
|
@@ -6,8 +6,6 @@ import { Cell, Dictionary } from '@ton/core';
|
|
|
6
6
|
export type PriceSourcesConfig = {
|
|
7
7
|
/** Endpoints for backend price data */
|
|
8
8
|
backendEndpoints: string[];
|
|
9
|
-
/** Endpoints for IOTA price data */
|
|
10
|
-
iotaEndpoints: string[];
|
|
11
9
|
/** Endpoints for ICP price data */
|
|
12
10
|
icpEndpoints: string[];
|
|
13
11
|
};
|
package/dist/prices/Types.js
CHANGED
|
@@ -5,7 +5,6 @@ exports.DefaultPriceSourcesConfig = void 0;
|
|
|
5
5
|
* Default configuration for price source endpoints.
|
|
6
6
|
*/
|
|
7
7
|
exports.DefaultPriceSourcesConfig = {
|
|
8
|
-
backendEndpoints: ['evaa.space'],
|
|
9
|
-
iotaEndpoints: ['api.stardust-mainnet.iotaledger.net'],
|
|
8
|
+
backendEndpoints: ['api.evaa.space', 'evaa.space'],
|
|
10
9
|
icpEndpoints: ['6khmc-aiaaa-aaaap-ansfq-cai.raw.icp0.io'],
|
|
11
10
|
};
|
|
@@ -15,6 +15,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./Backend"), exports);
|
|
18
|
-
__exportStar(require("./Iota"), exports);
|
|
19
18
|
__exportStar(require("./Icp"), exports);
|
|
20
19
|
__exportStar(require("./PriceSource"), exports);
|
package/dist/prices/utils.js
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.verifyRawPriceDataSign = exports.unpackMedianPrices = exports.collectAndFilterPrices = exports.generatePriceSources = exports.sumDicts = exports.packOraclesData = exports.createOracleDataProof = exports.packPrices = exports.packAssetsData = exports.getMedianPrice = exports.verifyPricesSign = exports.verifyPricesTimestamp = void 0;
|
|
4
4
|
const core_1 = require("@ton/core");
|
|
5
|
+
const crypto_1 = require("@ton/crypto");
|
|
5
6
|
const __1 = require("..");
|
|
6
7
|
const merkleProof_1 = require("../utils/merkleProof");
|
|
7
|
-
const crypto_1 = require("@ton/crypto");
|
|
8
8
|
function verifyPricesTimestamp() {
|
|
9
9
|
return function (priceData) {
|
|
10
10
|
const timestamp = Date.now() / 1000;
|
|
@@ -104,14 +104,13 @@ exports.sumDicts = sumDicts;
|
|
|
104
104
|
function generatePriceSources(config = __1.DefaultPriceSourcesConfig, nfts = __1.MAINNET_POOL_CONFIG.oracles) {
|
|
105
105
|
let result = config.backendEndpoints.map(x => new __1.BackendPriceSource(x, nfts));
|
|
106
106
|
result.push(...config.icpEndpoints.map(x => new __1.IcpPriceSource(x, nfts)));
|
|
107
|
-
result.push(...config.iotaEndpoints.map(x => new __1.IotaPriceSource(x, nfts)));
|
|
108
107
|
return result;
|
|
109
108
|
}
|
|
110
109
|
exports.generatePriceSources = generatePriceSources;
|
|
111
110
|
async function collectAndFilterPrices(priceSource, poolConfig) {
|
|
112
111
|
const prices = await priceSource.getPrices();
|
|
113
112
|
//console.debug('[FILTERING] before filtering prices len ', priceSource.sourceName, prices.length);
|
|
114
|
-
return
|
|
113
|
+
return (async () => {
|
|
115
114
|
const acceptedPrices = prices.filter(price => verifyPricesTimestamp()(price) && verifyPricesSign(poolConfig.oracles)(price));
|
|
116
115
|
//console.debug('[FILTERING] after filtering prices len ', priceSource.sourceName, acceptedPrices.length);
|
|
117
116
|
if (acceptedPrices.length < poolConfig.minimalOracles) {
|
|
@@ -16,12 +16,28 @@ function getUserJettonData(ownerAddress, assetName, jettonWalletCode, jettonMast
|
|
|
16
16
|
case 'DOGS':
|
|
17
17
|
case 'NOT':
|
|
18
18
|
case 'USDT':
|
|
19
|
+
case 'USDe':
|
|
19
20
|
return (0, core_1.beginCell)()
|
|
20
21
|
.storeUint(0, 4)
|
|
21
22
|
.storeCoins(0)
|
|
22
23
|
.storeAddress(ownerAddress)
|
|
23
24
|
.storeAddress(jettonMasterAddress)
|
|
24
25
|
.endCell();
|
|
26
|
+
case 'PT_tsUSDe_01Sep2025':
|
|
27
|
+
return (0, core_1.beginCell)()
|
|
28
|
+
.storeCoins(0)
|
|
29
|
+
.storeAddress(ownerAddress)
|
|
30
|
+
.storeAddress(jettonMasterAddress)
|
|
31
|
+
.endCell();
|
|
32
|
+
case 'tsUSDe':
|
|
33
|
+
return (0, core_1.beginCell)()
|
|
34
|
+
.storeUint(0, 4)
|
|
35
|
+
.storeCoins(0)
|
|
36
|
+
.storeAddress(ownerAddress)
|
|
37
|
+
.storeAddress(jettonMasterAddress)
|
|
38
|
+
.storeCoins(0)
|
|
39
|
+
.storeUint(0, 64)
|
|
40
|
+
.endCell();
|
|
25
41
|
case 'tsTON':
|
|
26
42
|
return (0, core_1.beginCell)()
|
|
27
43
|
.storeCoins(0)
|
package/package.json
CHANGED
package/src/api/math.ts
CHANGED
|
@@ -369,7 +369,7 @@ export function calculateHealthParams(parameters: HealthParamsArgs) {
|
|
|
369
369
|
if (assetBalance.type === BalanceType.supply) {
|
|
370
370
|
totalSupply += assetWorth;
|
|
371
371
|
totalLimit += assetWorth * assetConfig.liquidationThreshold / ASSET_LIQUIDATION_THRESHOLD_SCALE;
|
|
372
|
-
} else if (assetBalance.type === BalanceType.borrow) {
|
|
372
|
+
} else if (assetBalance.type === BalanceType.borrow && assetConfig.dust < assetBalance.amount) {
|
|
373
373
|
totalDebt += assetWorth;
|
|
374
374
|
}
|
|
375
375
|
}
|
package/src/api/prices.ts
CHANGED
|
@@ -11,7 +11,6 @@ export async function getPrices(endpoints: string[] = ["api.stardust-mainnet.iot
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
const sources: PriceSourcesConfig = {
|
|
14
|
-
iotaEndpoints: endpoints,
|
|
15
14
|
icpEndpoints: DefaultPriceSourcesConfig.icpEndpoints,
|
|
16
15
|
backendEndpoints: DefaultPriceSourcesConfig.backendEndpoints,
|
|
17
16
|
}
|
package/src/constants/assets.ts
CHANGED
|
@@ -12,6 +12,9 @@ export const ASSET_ID = {
|
|
|
12
12
|
tsTON: sha256Hash('tsTON'),
|
|
13
13
|
uTON: sha256Hash('uTON'),
|
|
14
14
|
tgBTC: sha256Hash('tgBTC'),
|
|
15
|
+
USDe: sha256Hash('USDe'),
|
|
16
|
+
tsUSDe: sha256Hash('tsUSDe'),
|
|
17
|
+
PT_tsUSDe_01Sep2025: sha256Hash('PT_tsUSDe_01Sep2025'),
|
|
15
18
|
|
|
16
19
|
// LP
|
|
17
20
|
TONUSDT_DEDUST: sha256Hash('TONUSDT_DEDUST'),
|
|
@@ -23,6 +26,8 @@ export const ASSET_ID = {
|
|
|
23
26
|
NOT: sha256Hash('NOT'),
|
|
24
27
|
DOGS: sha256Hash('DOGS'),
|
|
25
28
|
CATI: sha256Hash('CATI'),
|
|
29
|
+
STON: sha256Hash('STON'),
|
|
30
|
+
|
|
26
31
|
|
|
27
32
|
// Testnet assets
|
|
28
33
|
EUSDT: sha256Hash('EUSDT'),
|
|
@@ -220,3 +225,63 @@ export const EUSDT_TESTNET: PoolAssetConfig = {
|
|
|
220
225
|
),
|
|
221
226
|
)[0],
|
|
222
227
|
};
|
|
228
|
+
|
|
229
|
+
export const USDE_MAINNET: PoolAssetConfig = {
|
|
230
|
+
name: 'USDe',
|
|
231
|
+
assetId: ASSET_ID.USDe,
|
|
232
|
+
jettonMasterAddress: Address.parse('EQAIb6KmdfdDR7CN1GBqVJuP25iCnLKCvBlJ07Evuu2dzP5f'),
|
|
233
|
+
jettonWalletCode: Cell.fromBoc(
|
|
234
|
+
Buffer.from(
|
|
235
|
+
'b5ee9c7201020f010003f0000114ff00f4a413f4bcf2c80b01020162020302f8d001d0d3030171b08e48135f038020d721ed44d0d303fa00fa40fa40d104d31f01840f218210178d4519ba0282107bdd97deba12b1f2f48040d721fa003012a0401303c8cb0358fa0201cf1601cf16c9ed54e0fa40fa4031fa0031f401fa0031fa00013170f83a02d31f012082100f8a7ea5ba8e85303459db3ce03304050201200d0e01f603d33f0101fa00fa4021fa4430c000f2e14ded44d0d303fa00fa40fa40d15305c705531ac7052571b0c00021b1f2ad523cc705500bb1f2e0495126a120c2fff2af04fa40f401fa002020d70b009ad74bc00101c001b0f2b19130e2c88210178d451901cb1f500a01cb3f5008fa0222cf1601cf1626fa025007cf160602d0228210178d4519ba8e84325adb3ce034218210595f07bcba8e843101db3ce032208210eed236d3ba8e2f30018040d721d303d1ed44d0d303fa00fa40fa40d1335142c705f2e04a403303c8cb0358fa0201cf1601cf16c9ed54e06c218210d372158cbadc840ff2f0080901d0c9088e1533c8801801cb0523cf1670fa0250077158cb6accc98e4af82a54244070546004131503c8cb0358fa0201cf1601cf16c921c8cb0113f40012f400cb00c920f9007074c8cb02ca07cbffc9d0c8801801cb0501cf1670fa024018775003cb6bccccc9e245370700b62191729171e2f839206e938124b89120e2216e94318128739101e25023a813a0738103a370f83ca00270f83612a00170f836a07381040982100966018070f837a0bcf2b0048050fb00430003c8cb0358fa0201cf1601cf16c9ed5403f4ed44d0d303fa00fa40fa40d12372b0c002f26d07d33f0101fa005141a004fa40fa4053bac705f82a5464e070546004131503c8cb0358fa0201cf1601cf16c921c8cb0113f40012f400cb00c9f9007074c8cb02ca07cbffc9d0500cc7051bb1f2e04a09fa0021925f04e30d26d70b01c000b393306c33e30d55020a0b0c01f2ed44d0d303fa00fa40fa40d106d33f0101fa00fa40f401d15141a15288c705f2e04926c2fff2afc882107bdd97de01cb1f5801cb3f01fa0221cf1658cf16c9c8801801cb0526cf1670fa02017158cb6accc903f839206e943081180fde718102f270f8380170f836a0811ba470f836a0bcf2b0028050fb00030c0060c882107362d09c01cb1f2501cb3f5004fa0258cf1658cf16c9c8801001cb0524cf1658fa02017158cb6accc98011fb00007a5054a1f82fa07381040982100966018070f837b60972fb02c8801001cb055005cf1670fa027001cb6a8210d53276db01cb1f5801cb3fc9810082fb0059002003c8cb0358fa0201cf1601cf16c9ed540027bfd8176a2686981fd007d207d206899fc15209840021bc508f6a2686981fd007d207d2068af81c',
|
|
236
|
+
'hex',
|
|
237
|
+
),
|
|
238
|
+
)[0],
|
|
239
|
+
};
|
|
240
|
+
|
|
241
|
+
export const TSUSDE_MAINNET: PoolAssetConfig = {
|
|
242
|
+
name: 'tsUSDe',
|
|
243
|
+
assetId: ASSET_ID.tsUSDe,
|
|
244
|
+
jettonMasterAddress: Address.parse('EQDQ5UUyPHrLcQJlPAczd_fjxn8SLrlNQwolBznxCdSlfQwr'),
|
|
245
|
+
jettonWalletCode: Cell.fromBoc(
|
|
246
|
+
Buffer.from(
|
|
247
|
+
'b5ee9c72010219010006bf000114ff00f4a413f4bcf2c80b01020162020302f6d001d0d3030171b08ef0135f038020d721ed44d0d303fa00fa40fa40fa00d33fd106d31f01840f218210178d4519ba228210b2583ed5bab12282107bdd97debab1f2f4018040d721fa0030218210178d4519ba0282107bdd97deba12b18e19a0550405c8cb035004fa0258cf1601cf1601fa02cb3fc9ed54e30de004050201201516003614a004413505c8cb035004fa0258cf1601cf1601fa02cb3fc9ed5404a0fa40fa4031fa0031f401fa0031fa00013170f83a02d31f012082100f8a7ea5ba8e85303459db3ce0208210d750cec9ba8e85303459db3ce033228210178d4519ba8e84325adb3ce0228210b2583ed5ba0607080901ec03d33f0101fa00fa4021fa4430c000f2e14ded44d0d303fa00fa40fa40fa00d33fd15327c705533cc7052771b0c00021b1f2ad525ec705500db1f2e0495148a120c2fff2af06fa40f401fa002020d70b009ad74bc00101c001b0f2b19130e22d8e1170c80101ca0001cf16c971c8cb00ccc9d0de70c80a01f603d33f0101fa00fa4021fa4430c000f2e14ded44d0d303fa00fa40fa40fa00d33fd15228c705532bc7052671b0c00021b1f2ad524dc705500cb1f2e049f82327bcf2e14e0af2e04b5196a120c2fff2af04fa40f401fa002020d70b009ad74bc00101c001b0f2b19130e27fc80101ca0001cf16c971c8cb00ccc9d00d01f4ed44d0d303fa00fa40fa40fa00d33fd12572b0c002f26d09d33f0101fa005161a006d33f31fa40fa40536cc705f82a5464907054700020103510241037102605c8cb035004fa0258cf1601cf1601fa02cb3fc921c8cb0113f40012f400cb00c9f9007074c8cb02ca07cbffc9d0500ec7051db1f2e04a0bfa00210f02d88e84325adb3ce034218210595f07bcba8e843101db3ce032208210eed236d3ba8e3b30018040d721d303d1ed44d0d303fa00fa40fa40fa00d33fd1355161c705f2e04a1045551205c8cb035004fa0258cf1601cf1601fa02cb3fc9ed54e06c218210d372158cbadc840ff2f0111202fe8210178d451901cb1f500d01cb3f500bfa021bcb3f24cf1601cf1629fa025008cf16c90a8e57f82a5426607054700020103510241037102605c8cb035004fa0258cf1601cf1601fa02cb3fc921c8cb0113f40012f400cb00c920f9007074c8cb02ca07cbffc9d0c8801801cb0501cf1670fa02401a775003cb6bccccc9e30d0b0c002a35c8801801cb0525cf1670fa0250097158cb6accc900cc47692191729171e2f839206e938126e29120e2216e9431812a169101e25023a813a0738103e770f83ca00270f83612a00170f836a07381044d82100966018070f837a0bcf2b0068050fb00103510340205c8cb035004fa0258cf1601cf1601fa02cb3fc9ed5401fe70c88210b2583ed501cb1f500b01cb3f5009fa0219cb3f22cf1601cf1627fa025006cf16c9c8801801cb0529cf1670fa02017158cb6accc947692191729171e2f839206e938126e29120e2216e9431812a169101e25023a813a0738103e770f83ca00270f83612a00170f836a07381044d82100966018070f837a0bcf2b0060e003c8050fb001035443005c8cb035004fa0258cf1601cf1601fa02cb3fc9ed5401be8e30c882107362d09c01cb1f2501cb3f5004fa0258cf1658cf16c9c8801001cb0526cf1658fa02017158cb6accc98011fb00925f04e228d70b01c000b396301027353530e30d55300505c8cb035004fa0258cf1601cf1601fa02cb3fc9ed541000825076a1f82fa07381044d82100966018070f837b60972fb02c8801001cb055007cf1670fa027001cb6a8210d53276db01cb1f500401cb3fc9810082fb001024102301b8ed44d0d303fa00fa40fa40fa00d33fd1302472b0c002f26d08d33f0101fa00d33f50b2a001fa4031fa4030523ac705f2e04a28d70b01c000b39710381027365f03e30d55300505c8cb035004fa0258cf1601cf1601fa02cb3fc9ed541301f6ed44d0d303fa00fa40fa40fa00d33fd108d33f0101fa00fa40f401d15161a1524ac705f2e04928c2fff2afc882107bdd97de01cb1f5801cb3f01fa0223cf165004cf16c9c8801801cb0522cf1670fa02017158cb6accc905f839206e943081187fde718102f270f8380170f836a081203770f836a0bcf2b004805014007e5076a1f82fa07381044d82100966018070f837b60972fb02c8801001cb055007cf1670fa027001cb6a8210d53276db01cb1f500501cb3fc9810082fb0010340036fb0045130205c8cb035004fa0258cf1601cf1601fa02cb3fc9ed5402015817180029bc508f6a2686981fd007d207d207d00699fe8af82c0029b74e5da89a1a607f401f481f481f401a67fa2d88500031b7605da89a1a607f401f481f481f401a67fa2b667f05482610',
|
|
248
|
+
'hex',
|
|
249
|
+
),
|
|
250
|
+
)[0],
|
|
251
|
+
};
|
|
252
|
+
|
|
253
|
+
export const PT_tsUSDe_01Sep2025_MAINNET: PoolAssetConfig = {
|
|
254
|
+
name: 'PT_tsUSDe_01Sep2025',
|
|
255
|
+
assetId: ASSET_ID.PT_tsUSDe_01Sep2025,
|
|
256
|
+
jettonMasterAddress: Address.parse('EQDb90Bss5FnIyq7VMmnG2UeZIzZomQsILw9Hjo1wxaF1df3'),
|
|
257
|
+
jettonWalletCode: Cell.fromBoc(
|
|
258
|
+
Buffer.from(
|
|
259
|
+
'b5ee9c7201020f010003c2000114ff00f4a413f4bcf2c80b0102016202030202ce0405001da0f605da89a1f401f481f48061f05504b3420c700925f04e001d0d3030171b08e85135f03db3ce0fa40fa4031fa003171d721fa0031fa003073a9b40002d31f012082100f8a7ea5ba8e85303459db3ce0208210178d4519ba8e8630444403db3ce035248210595f07bcba80607080900114fa4430c000f2e14d800848020d721ed44d0fa00fa40fa403003d31f018200fff0218210178d4519ba0282107bdd97deba12b1f2f4d33f0130fa003012a002c85003fa0201cf1601cf16c9ed5401f403d33f0101fa00fa4021f002ed44d0fa00fa40fa40305125a15219c705f2e2c127c2fff2e2c2f82a5424207054201314c85003fa0201cf1601cf16c922c8cb0112f400f400cb00c920f9007074c8cb02ca07cbffc9d003fa40f40431fa0020d749c200f2e2c4c88210178d451901cb1f500901cb3f5007fa02250a02f4ed44d0fa00fa40fa403007d33f0101fa005141a004fa40fa4053bac705f82a5464e07054201314c85003fa0201cf1601cf16c922c8cb0112f400f400cb00c9f9007074c8cb02ca07cbffc9d0500cc7051bb1f2e2c309fa005197a121951049385f04e30d038208989680b60972fb0224d70b01c30002c20012b00b0c02ce8e843459db3ce06c22ed44d0fa00fa40fa403030312382106d8e5e3cba8e37335222c705f2e2c1820898968070fb02c8801001cb0558cf1670fa027001cb6a8210d53276db01cb1f01d33f013101cb3fc9810082fb00e0038210768a50b2bae3025f03840ff2f00d0e009ccf1601cf1625fa025006cf16c9c8801801cb055003cf1670fa025052775003cb6bcccc2291729171e25007a812a082096e3600a013bcf2e2c503c98040fb0058c85003fa0201cf1601cf16c9ed5400725219a017a1c882107362d09c01cb1f2401cb3f5003fa0201cf165007cf16c9c8801001cb0523cf165005fa0250047158cb6accc971fb00102400748e25c8801001cb055004cf1670fa027001cb6a8210d53276db01cb1f5801cb3fc9810082fb0001926c22e202c85003fa0201cf1601cf16c9ed5400deed44d0fa00fa40fa403006d33f0101fa00fa40305141a15238c705f2e2c126c2fff2e2c2048208d59f80a015bcf2e2c3c882107bdd97de01cb1f500401cb3f58fa0222cf1601cf16c9c8801801cb0524cf1670fa02017158cb6accc98040fb0058c85003fa0201cf1601cf16c9ed5400965222c705f2e2c1d33f0101fa40fa00f40430c8801801cb055003cf1670fa0270c882100f8a7ea501cb1f500501cb3f58fa0224cf165004cf16f40070fa02ca00c97158cb6accc98040fb00',
|
|
260
|
+
'hex',
|
|
261
|
+
),
|
|
262
|
+
)[0],
|
|
263
|
+
};
|
|
264
|
+
|
|
265
|
+
export const TONUSDT_STONFI_MAINNET: PoolAssetConfig = {
|
|
266
|
+
name: 'TONUSDT_STONFI',
|
|
267
|
+
assetId: ASSET_ID.TONUSDT_STONFI,
|
|
268
|
+
jettonMasterAddress: Address.parse('EQCGScrZe1xbyWqWDvdI6mzP-GAcAWFv6ZXuaJOuSqemxku4'),
|
|
269
|
+
jettonWalletCode: Cell.fromBoc(
|
|
270
|
+
Buffer.from(
|
|
271
|
+
'b5ee9c7201010101002300084202c00836440d084e44fb94316132ac5a21417ef4f429ee09b5560b5678b334c3e8',
|
|
272
|
+
'hex',
|
|
273
|
+
),
|
|
274
|
+
)[0],
|
|
275
|
+
};
|
|
276
|
+
|
|
277
|
+
export const STON_MAINNET: PoolAssetConfig = {
|
|
278
|
+
name: 'STON',
|
|
279
|
+
assetId: ASSET_ID.STON,
|
|
280
|
+
jettonMasterAddress: Address.parse('EQA2kCVNwVsil2EM2mB0SkXytxCqQjS4mttjDpnXmwG9T6bO'),
|
|
281
|
+
jettonWalletCode: Cell.fromBoc(
|
|
282
|
+
Buffer.from(
|
|
283
|
+
'b5ee9c7201021201000334000114ff00f4a413f4bcf2c80b0102016202030202cc0405001ba0f605da89a1f401f481f481a8610201d40607020148080900c30831c02497c138007434c0c05c6c2544d7c0fc02f83e903e900c7e800c5c75c87e800c7e800c1cea6d0000b4c7e08403e29fa954882ea54c4d167c0238208405e3514654882ea58c511100fc02780d60841657c1ef2ea4d67c02b817c12103fcbc2000113e910c1c2ebcb853600201200a0b020120101101f100f4cffe803e90087c007b51343e803e903e90350c144da8548ab1c17cb8b04a30bffcb8b0950d109c150804d50500f214013e809633c58073c5b33248b232c044bd003d0032c032483e401c1d3232c0b281f2fff274013e903d010c7e800835d270803cb8b11de0063232c1540233c59c3e8085f2dac4f3200c03f73b51343e803e903e90350c0234cffe80145468017e903e9014d6f1c1551cdb5c150804d50500f214013e809633c58073c5b33248b232c044bd003d0032c0327e401c1d3232c0b281f2fff274140371c1472c7cb8b0c2be80146a2860822625a020822625a004ad8228608239387028062849f8c3c975c2c070c008e00d0e0f00ae8210178d4519c8cb1f19cb3f5007fa0222cf165006cf1625fa025003cf16c95005cc2391729171e25008a813a08208e4e1c0aa008208989680a0a014bcf2e2c504c98040fb001023c85004fa0258cf1601cf16ccc9ed5400705279a018a182107362d09cc8cb1f5230cb3f58fa025007cf165007cf16c9718010c8cb0524cf165006fa0215cb6a14ccc971fb0010241023000e10491038375f040076c200b08e218210d53276db708010c8cb055008cf165004fa0216cb6a12cb1f12cb3fc972fb0093356c21e203c85004fa0258cf1601cf16ccc9ed5400db3b51343e803e903e90350c01f4cffe803e900c145468549271c17cb8b049f0bffcb8b0a0823938702a8005a805af3cb8b0e0841ef765f7b232c7c572cfd400fe8088b3c58073c5b25c60063232c14933c59c3e80b2dab33260103ec01004f214013e809633c58073c5b3327b55200083200835c87b51343e803e903e90350c0134c7e08405e3514654882ea0841ef765f784ee84ac7cb8b174cfcc7e800c04e81408f214013e809633c58073c5b3327b5520',
|
|
284
|
+
'hex',
|
|
285
|
+
),
|
|
286
|
+
)[0],
|
|
287
|
+
};
|
package/src/constants/general.ts
CHANGED
|
@@ -27,10 +27,15 @@ export const EVAA_LP_MAINNET = Address.parse('EQBIlZX2URWkXCSg3QF2MJZU-wC5XkBoLw
|
|
|
27
27
|
export const EVAA_LP_MAINNET_VERSION = 3;
|
|
28
28
|
export const EVAA_ALTS_MAINNET = Address.parse('EQANURVS3fhBO9bivig34iyJQi97FhMbpivo1aUEAS2GYSu-');
|
|
29
29
|
export const EVAA_ALTS_MAINNET_VERSION = 0;
|
|
30
|
+
export const EVAA_STABLE_MAINNET = Address.parse('EQCdIdXf1kA_2Hd9mbGzSFDEPA-Px-et8qTWHEXgRGo0K3zd');
|
|
31
|
+
export const STABLE_VERSION = 0;
|
|
32
|
+
|
|
33
|
+
export const EVAA_ETHENA_MAINNET = Address.parse('EQCn95X_qLJa5VUXfyIQkWDH2iq3PTatsO4esunMaIsnyyeW');
|
|
34
|
+
export const EVAA_ETHENA_VERSION = 0;
|
|
30
35
|
|
|
31
36
|
export const EVAA_REWARDS_MASTER_TESTNET = Address.parse('EQCnp0iRGcfDJAvnKhAEN9sB-nPYSPuc83Ff4y75s8AtoSW1');
|
|
32
37
|
export const EVAA_USDT_REWARDS_MASTER_MAINNET = Address.parse('EQD22Fhylp1tX-xoVX81aMTSJNPV8j9klwApTLgjGmofISVD');
|
|
33
|
-
export const EVAA_TON_REWARDS_MASTER_MAINNET = Address.parse('
|
|
38
|
+
export const EVAA_TON_REWARDS_MASTER_MAINNET = Address.parse('EQDM_gdrntBg4fy5Rg9DgDF0AUu3FYoqxHEOsHNIC4_DTDuC');
|
|
34
39
|
|
|
35
40
|
export const ORACLES_MAINNET: OracleNFT[] = [
|
|
36
41
|
{id: 0, address: '0xd3a8c0b9fd44fd25a49289c631e3ac45689281f2f8cf0744400b4c65bed38e5d', pubkey: Buffer.from('b404f4a2ebb62f2623b370c89189748a0276c071965b1646b996407f10d72eb9', 'hex') },
|
package/src/constants/pools.ts
CHANGED
|
@@ -8,19 +8,26 @@ import {
|
|
|
8
8
|
JUSDC_MAINNET,
|
|
9
9
|
JUSDT_MAINNET,
|
|
10
10
|
NOT_MAINNET,
|
|
11
|
+
PT_tsUSDe_01Sep2025_MAINNET,
|
|
12
|
+
STON_MAINNET,
|
|
11
13
|
STTON_MAINNET,
|
|
12
14
|
TGBTC_TESTNET,
|
|
13
15
|
TON_MAINNET,
|
|
14
16
|
TON_STORM_MAINNET,
|
|
15
17
|
TON_TESTNET,
|
|
16
18
|
TONUSDT_DEDUST_MAINNET,
|
|
19
|
+
TONUSDT_STONFI_MAINNET,
|
|
17
20
|
TSTON_MAINNET,
|
|
21
|
+
TSUSDE_MAINNET,
|
|
22
|
+
USDE_MAINNET,
|
|
18
23
|
USDT_MAINNET,
|
|
19
24
|
USDT_STORM_MAINNET,
|
|
20
25
|
} from './assets';
|
|
21
26
|
import {
|
|
22
27
|
EVAA_ALTS_MAINNET,
|
|
23
28
|
EVAA_ALTS_MAINNET_VERSION,
|
|
29
|
+
EVAA_ETHENA_MAINNET,
|
|
30
|
+
EVAA_ETHENA_VERSION,
|
|
24
31
|
EVAA_LP_MAINNET,
|
|
25
32
|
EVAA_LP_MAINNET_VERSION,
|
|
26
33
|
EVAA_MASTER_MAINNET,
|
|
@@ -30,6 +37,7 @@ import {
|
|
|
30
37
|
EVAA_REWARDS_MASTER_TESTNET,
|
|
31
38
|
EVAA_REWARDS_USER_CODE_MAINNET,
|
|
32
39
|
EVAA_REWARDS_USER_CODE_TESTNET,
|
|
40
|
+
EVAA_STABLE_MAINNET,
|
|
33
41
|
EVAA_TON_REWARDS_MASTER_MAINNET,
|
|
34
42
|
EVAA_USDT_REWARDS_MASTER_MAINNET,
|
|
35
43
|
LENDING_CODE,
|
|
@@ -39,6 +47,7 @@ import {
|
|
|
39
47
|
ORACLES_LP,
|
|
40
48
|
ORACLES_MAINNET,
|
|
41
49
|
ORACLES_TESTNET,
|
|
50
|
+
STABLE_VERSION,
|
|
42
51
|
TESTNET_VERSION,
|
|
43
52
|
} from './general';
|
|
44
53
|
|
|
@@ -55,7 +64,37 @@ export const MAINNET_POOL_CONFIG: PoolConfig = {
|
|
|
55
64
|
STTON_MAINNET,
|
|
56
65
|
TSTON_MAINNET,
|
|
57
66
|
USDT_MAINNET,
|
|
58
|
-
|
|
67
|
+
USDE_MAINNET,
|
|
68
|
+
TSUSDE_MAINNET,
|
|
69
|
+
// UTON_MAINNET // announce xdddd fake announce
|
|
70
|
+
],
|
|
71
|
+
lendingCode: LENDING_CODE,
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
export const MAINNET_STABLE_POOL_CONFIG: PoolConfig = {
|
|
75
|
+
masterAddress: EVAA_STABLE_MAINNET,
|
|
76
|
+
masterVersion: STABLE_VERSION,
|
|
77
|
+
masterConstants: MASTER_CONSTANTS,
|
|
78
|
+
oracles: ORACLES_MAINNET,
|
|
79
|
+
minimalOracles: 3,
|
|
80
|
+
poolAssetsConfig: [
|
|
81
|
+
USDT_MAINNET,
|
|
82
|
+
USDE_MAINNET,
|
|
83
|
+
TSUSDE_MAINNET,
|
|
84
|
+
PT_tsUSDe_01Sep2025_MAINNET
|
|
85
|
+
],
|
|
86
|
+
lendingCode: LENDING_CODE,
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
export const MAINNET_TEST_ETHENA_POOL_CONFIG: PoolConfig = {
|
|
90
|
+
masterAddress: EVAA_ETHENA_MAINNET,
|
|
91
|
+
masterVersion: EVAA_ETHENA_VERSION,
|
|
92
|
+
masterConstants: MASTER_CONSTANTS,
|
|
93
|
+
oracles: ORACLES_MAINNET,
|
|
94
|
+
minimalOracles: 3,
|
|
95
|
+
poolAssetsConfig: [
|
|
96
|
+
TON_MAINNET,
|
|
97
|
+
USDE_MAINNET,
|
|
59
98
|
],
|
|
60
99
|
lendingCode: LENDING_CODE,
|
|
61
100
|
};
|
|
@@ -76,7 +115,7 @@ export const MAINNET_LP_POOL_CONFIG: PoolConfig = {
|
|
|
76
115
|
masterConstants: MASTER_CONSTANTS,
|
|
77
116
|
oracles: ORACLES_LP,
|
|
78
117
|
minimalOracles: 3,
|
|
79
|
-
poolAssetsConfig: [TON_MAINNET, USDT_MAINNET, TONUSDT_DEDUST_MAINNET, TON_STORM_MAINNET, USDT_STORM_MAINNET],
|
|
118
|
+
poolAssetsConfig: [TON_MAINNET, USDT_MAINNET, TONUSDT_DEDUST_MAINNET, TON_STORM_MAINNET, USDT_STORM_MAINNET, TONUSDT_STONFI_MAINNET],
|
|
80
119
|
lendingCode: LENDING_CODE,
|
|
81
120
|
};
|
|
82
121
|
|
|
@@ -86,7 +125,7 @@ export const MAINNET_ALTS_POOL_CONFIG: PoolConfig = {
|
|
|
86
125
|
masterConstants: MASTER_CONSTANTS,
|
|
87
126
|
oracles: ORACLES_ALTS,
|
|
88
127
|
minimalOracles: 3,
|
|
89
|
-
poolAssetsConfig: [TON_MAINNET, USDT_MAINNET, CATI_MAINNET, NOT_MAINNET, DOGS_MAINNET],
|
|
128
|
+
poolAssetsConfig: [TON_MAINNET, USDT_MAINNET, CATI_MAINNET, NOT_MAINNET, DOGS_MAINNET/*, STON_MAINNET announce*/],
|
|
90
129
|
lendingCode: LENDING_CODE,
|
|
91
130
|
};
|
|
92
131
|
|
|
@@ -117,7 +156,7 @@ export const MAINNET_MASTER_TON_REWARD_CONFIG: EvaaRewardsConfig = {
|
|
|
117
156
|
rewardUserCode: EVAA_REWARDS_USER_CODE_MAINNET,
|
|
118
157
|
asset: TON_MAINNET,
|
|
119
158
|
availableReward: 0,
|
|
120
|
-
publicKey: Buffer.from('
|
|
159
|
+
publicKey: Buffer.from('bfe9a30221db4dff4c17e55d985e0b13a8f597bbb28002f311dc4429dad1ca95', 'hex'), // adminAddress publicKey
|
|
121
160
|
};
|
|
122
161
|
|
|
123
162
|
export const MAINNET_MASTER_USDT_REWARD_CONFIG: EvaaRewardsConfig = {
|
|
@@ -129,3 +168,10 @@ export const MAINNET_MASTER_USDT_REWARD_CONFIG: EvaaRewardsConfig = {
|
|
|
129
168
|
availableReward: 0,
|
|
130
169
|
publicKey: Buffer.from('9813725d6cead1c9bbc0e24b21d4fc62a7fa8ac4bb01b6758df30169a71dba67', 'hex'), // adminAddress publicKey
|
|
131
170
|
};
|
|
171
|
+
|
|
172
|
+
export const ALL_MAINNET_POOLS: PoolConfig[] = [
|
|
173
|
+
MAINNET_POOL_CONFIG,
|
|
174
|
+
MAINNET_LP_POOL_CONFIG,
|
|
175
|
+
MAINNET_ALTS_POOL_CONFIG,
|
|
176
|
+
MAINNET_STABLE_POOL_CONFIG,
|
|
177
|
+
];
|
package/src/index.ts
CHANGED
|
@@ -99,53 +99,9 @@ export {
|
|
|
99
99
|
} from './types/User';
|
|
100
100
|
|
|
101
101
|
// Constants
|
|
102
|
-
export
|
|
103
|
-
EVAA_MASTER_MAINNET,
|
|
104
|
-
MAINNET_VERSION,
|
|
105
|
-
EVAA_MASTER_TESTNET,
|
|
106
|
-
TESTNET_VERSION,
|
|
107
|
-
LENDING_CODE,
|
|
108
|
-
OPCODES,
|
|
109
|
-
FEES,
|
|
110
|
-
MASTER_CONSTANTS,
|
|
111
|
-
EVAA_REWARDS_MASTER_TESTNET,
|
|
112
|
-
EVAA_REWARDS_MASTER_CODE_TESTNET,
|
|
113
|
-
EVAA_REWARDS_USER_CODE_TESTNET,
|
|
114
|
-
EVAA_REWARDS_MASTER_CODE_MAINNET,
|
|
115
|
-
EVAA_REWARDS_USER_CODE_MAINNET,
|
|
116
|
-
} from './constants/general';
|
|
117
|
-
|
|
118
|
-
export {
|
|
119
|
-
MAINNET_POOL_CONFIG,
|
|
120
|
-
TESTNET_POOL_CONFIG,
|
|
121
|
-
MAINNET_LP_POOL_CONFIG,
|
|
122
|
-
MAINNET_ALTS_POOL_CONFIG,
|
|
123
|
-
// Reward Pools
|
|
124
|
-
TESTNET_MASTER_REWARD_CONFIG,
|
|
125
|
-
MAINNET_MASTER_TON_REWARD_CONFIG,
|
|
126
|
-
MAINNET_MASTER_USDT_REWARD_CONFIG,
|
|
127
|
-
} from './constants/pools';
|
|
102
|
+
export * from './constants/general';
|
|
128
103
|
|
|
129
|
-
export
|
|
130
|
-
ASSET_ID,
|
|
131
|
-
UNDEFINED_ASSET,
|
|
132
|
-
TON_MAINNET,
|
|
133
|
-
USDT_MAINNET,
|
|
134
|
-
TONUSDT_DEDUST_MAINNET,
|
|
135
|
-
TON_STORM_MAINNET,
|
|
136
|
-
USDT_STORM_MAINNET,
|
|
137
|
-
DOGS_MAINNET,
|
|
138
|
-
CATI_MAINNET,
|
|
139
|
-
UTON_MAINNET,
|
|
140
|
-
NOT_MAINNET,
|
|
141
|
-
JUSDT_MAINNET,
|
|
142
|
-
JUSDC_MAINNET,
|
|
143
|
-
STTON_MAINNET,
|
|
144
|
-
TSTON_MAINNET,
|
|
145
|
-
JUSDT_TESTNET,
|
|
146
|
-
JUSDC_TESTNET,
|
|
147
|
-
STTON_TESTNET
|
|
148
|
-
} from './constants/assets';
|
|
104
|
+
export * from './constants/pools';
|
|
149
105
|
|
|
150
106
|
export * from './constants/assets';
|
|
151
107
|
export * from './utils/utils';
|
|
@@ -99,13 +99,20 @@ export class PricesCollector {
|
|
|
99
99
|
pricesFiltered = newerPrices.sort((a, b) => a.oracleId - b.oracleId);
|
|
100
100
|
}
|
|
101
101
|
|
|
102
|
-
const medianData = assets.map(asset => ({
|
|
103
|
-
|
|
102
|
+
const medianData = assets.map((asset) => ({
|
|
103
|
+
assetId: asset.assetId,
|
|
104
|
+
medianPrice: getMedianPrice(pricesFiltered, asset.assetId),
|
|
105
|
+
}));
|
|
106
|
+
|
|
104
107
|
const nonEmptymedianData = medianData.filter(x => x.medianPrice != null) as { assetId: bigint, medianPrice: bigint }[];
|
|
105
108
|
|
|
106
109
|
const packedMedianData = packAssetsData(nonEmptymedianData);
|
|
107
110
|
|
|
108
|
-
const oraclesData =
|
|
111
|
+
const oraclesData = pricesFiltered.map((x) => ({
|
|
112
|
+
oracle: { id: x.oracleId, pubkey: x.pubkey },
|
|
113
|
+
data: { timestamp: x.timestamp, prices: x.dict },
|
|
114
|
+
signature: x.signature,
|
|
115
|
+
}));
|
|
109
116
|
const packedOracleData = packOraclesData(oraclesData, nonEmptymedianData.map(x => x.assetId));
|
|
110
117
|
|
|
111
118
|
const dict = Dictionary.empty<bigint, bigint>();
|
package/src/prices/Types.ts
CHANGED
|
@@ -7,9 +7,6 @@ export type PriceSourcesConfig = {
|
|
|
7
7
|
/** Endpoints for backend price data */
|
|
8
8
|
backendEndpoints: string[];
|
|
9
9
|
|
|
10
|
-
/** Endpoints for IOTA price data */
|
|
11
|
-
iotaEndpoints: string[];
|
|
12
|
-
|
|
13
10
|
/** Endpoints for ICP price data */
|
|
14
11
|
icpEndpoints: string[];
|
|
15
12
|
};
|
|
@@ -18,8 +15,7 @@ export type PriceSourcesConfig = {
|
|
|
18
15
|
* Default configuration for price source endpoints.
|
|
19
16
|
*/
|
|
20
17
|
export const DefaultPriceSourcesConfig: PriceSourcesConfig = {
|
|
21
|
-
backendEndpoints: ['evaa.space'],
|
|
22
|
-
iotaEndpoints: ['api.stardust-mainnet.iotaledger.net'],
|
|
18
|
+
backendEndpoints: ['api.evaa.space', 'evaa.space'],
|
|
23
19
|
icpEndpoints: ['6khmc-aiaaa-aaaap-ansfq-cai.raw.icp0.io'],
|
|
24
20
|
}
|
|
25
21
|
|
package/src/prices/utils.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { beginCell, Cell, Dictionary, Slice } from "@ton/core"
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import { beginCell, Cell, Dictionary, Slice } from "@ton/core"
|
|
2
|
+
import { signVerify } from "@ton/crypto"
|
|
3
|
+
import { BackendPriceSource, DefaultPriceSourcesConfig, IcpPriceSource, MAINNET_POOL_CONFIG, OraclePricesData, PriceData, PriceSource, PriceSourcesConfig, RawPriceData, TTL_ORACLE_DATA_SEC } from ".."
|
|
4
|
+
import { Oracle, OracleNFT, PoolConfig } from "../types/Master"
|
|
5
|
+
import { convertToMerkleProof, generateMerkleProofDirect } from "../utils/merkleProof"
|
|
6
6
|
|
|
7
7
|
export function verifyPricesTimestamp() {
|
|
8
8
|
return function(priceData: RawPriceData): boolean {
|
|
@@ -119,7 +119,6 @@ export function generatePriceSources(config: PriceSourcesConfig = DefaultPriceSo
|
|
|
119
119
|
let result: PriceSource[] = config.backendEndpoints.map(x => new BackendPriceSource(x, nfts));
|
|
120
120
|
|
|
121
121
|
result.push(...config.icpEndpoints.map(x => new IcpPriceSource(x, nfts)));
|
|
122
|
-
result.push(...config.iotaEndpoints.map(x => new IotaPriceSource(x, nfts)));
|
|
123
122
|
|
|
124
123
|
return result;
|
|
125
124
|
}
|
|
@@ -128,7 +127,7 @@ export async function collectAndFilterPrices(priceSource: PriceSource, poolConfi
|
|
|
128
127
|
const prices = await priceSource.getPrices();
|
|
129
128
|
|
|
130
129
|
//console.debug('[FILTERING] before filtering prices len ', priceSource.sourceName, prices.length);
|
|
131
|
-
return
|
|
130
|
+
return (async () => {
|
|
132
131
|
const acceptedPrices: RawPriceData[] = prices.filter(
|
|
133
132
|
price => verifyPricesTimestamp()(price) && verifyPricesSign(poolConfig.oracles)(price)
|
|
134
133
|
);
|
|
@@ -15,12 +15,28 @@ function getUserJettonData(ownerAddress: Address, assetName: string, jettonWalle
|
|
|
15
15
|
case 'DOGS':
|
|
16
16
|
case 'NOT':
|
|
17
17
|
case 'USDT':
|
|
18
|
+
case 'USDe':
|
|
18
19
|
return beginCell()
|
|
19
20
|
.storeUint(0, 4)
|
|
20
21
|
.storeCoins(0)
|
|
21
22
|
.storeAddress(ownerAddress)
|
|
22
23
|
.storeAddress(jettonMasterAddress)
|
|
23
24
|
.endCell();
|
|
25
|
+
case 'PT_tsUSDe_01Sep2025':
|
|
26
|
+
return beginCell()
|
|
27
|
+
.storeCoins(0)
|
|
28
|
+
.storeAddress(ownerAddress)
|
|
29
|
+
.storeAddress(jettonMasterAddress)
|
|
30
|
+
.endCell();
|
|
31
|
+
case 'tsUSDe':
|
|
32
|
+
return beginCell()
|
|
33
|
+
.storeUint(0, 4)
|
|
34
|
+
.storeCoins(0)
|
|
35
|
+
.storeAddress(ownerAddress)
|
|
36
|
+
.storeAddress(jettonMasterAddress)
|
|
37
|
+
.storeCoins(0)
|
|
38
|
+
.storeUint(0, 64)
|
|
39
|
+
.endCell();
|
|
24
40
|
case 'tsTON':
|
|
25
41
|
return beginCell()
|
|
26
42
|
.storeCoins(0)
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { PriceSource } from "./PriceSource";
|
|
2
|
-
import { RawPriceData } from "..";
|
|
3
|
-
export declare class IotaPriceSource extends PriceSource {
|
|
4
|
-
protected priceSourceName: string;
|
|
5
|
-
getPrices(): Promise<RawPriceData[]>;
|
|
6
|
-
loadOracleData(oracleNftId: String): Promise<OutputData>;
|
|
7
|
-
parsePrices(outputData: OutputData, oracleId: number): RawPriceData;
|
|
8
|
-
}
|
|
9
|
-
type OutputData = {
|
|
10
|
-
metadata: {
|
|
11
|
-
blockId: string;
|
|
12
|
-
transactionId: string;
|
|
13
|
-
outputIndex: number;
|
|
14
|
-
isSpent: boolean;
|
|
15
|
-
milestoneIndexSpent: number;
|
|
16
|
-
milestoneTimestampSpent: number;
|
|
17
|
-
transactionIdSpent: string;
|
|
18
|
-
milestoneIndexBooked: number;
|
|
19
|
-
milestoneTimestampBooked: number;
|
|
20
|
-
ledgerIndex: number;
|
|
21
|
-
};
|
|
22
|
-
output: {
|
|
23
|
-
type: number;
|
|
24
|
-
amount: string;
|
|
25
|
-
nftId: string;
|
|
26
|
-
unlockConditions: {
|
|
27
|
-
type: number;
|
|
28
|
-
address: {
|
|
29
|
-
type: number;
|
|
30
|
-
pubKeyHash: string;
|
|
31
|
-
};
|
|
32
|
-
}[];
|
|
33
|
-
features: {
|
|
34
|
-
type: number;
|
|
35
|
-
data: string;
|
|
36
|
-
}[];
|
|
37
|
-
};
|
|
38
|
-
};
|
|
39
|
-
export {};
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.IotaPriceSource = void 0;
|
|
4
|
-
const core_1 = require("@ton/core");
|
|
5
|
-
const PriceSource_1 = require("./PriceSource");
|
|
6
|
-
class IotaPriceSource extends PriceSource_1.PriceSource {
|
|
7
|
-
constructor() {
|
|
8
|
-
super(...arguments);
|
|
9
|
-
this.priceSourceName = 'IotaPriceSource';
|
|
10
|
-
}
|
|
11
|
-
async getPrices() {
|
|
12
|
-
return await Promise.all(this.nfts.map(nft => this.loadOracleData(nft.address)
|
|
13
|
-
.then(x => this.parsePrices(x, nft.id))));
|
|
14
|
-
}
|
|
15
|
-
async loadOracleData(oracleNftId) {
|
|
16
|
-
let result = await fetch(`https://${this._endpoint}/api/indexer/v1/outputs/nft/${oracleNftId}`, {
|
|
17
|
-
headers: { accept: 'application/json' },
|
|
18
|
-
signal: AbortSignal.timeout(5000)
|
|
19
|
-
});
|
|
20
|
-
let outputId = (await result.json());
|
|
21
|
-
result = await fetch(`https://${this._endpoint}/api/core/v2/outputs/${outputId.items[0]}`, {
|
|
22
|
-
headers: { accept: 'application/json' },
|
|
23
|
-
signal: AbortSignal.timeout(5000)
|
|
24
|
-
});
|
|
25
|
-
return await result.json();
|
|
26
|
-
}
|
|
27
|
-
parsePrices(outputData, oracleId) {
|
|
28
|
-
const data = JSON.parse(decodeURIComponent(outputData.output.features[0].data.replace('0x', '').replace(/[0-9a-f]{2}/g, '%$&')));
|
|
29
|
-
try {
|
|
30
|
-
const pricesCell = core_1.Cell.fromBoc(Buffer.from(data['packedPrices'], 'hex'))[0];
|
|
31
|
-
const signature = Buffer.from(data['signature'], 'hex');
|
|
32
|
-
const publicKey = Buffer.from(data['publicKey'], 'hex');
|
|
33
|
-
const timestamp = Number(data['timestamp']);
|
|
34
|
-
return {
|
|
35
|
-
dict: pricesCell.beginParse().loadRef().beginParse().loadDictDirect(core_1.Dictionary.Keys.BigUint(256), core_1.Dictionary.Values.BigVarUint(4)),
|
|
36
|
-
dataCell: (0, core_1.beginCell)().storeRef(pricesCell).storeBuffer(signature).endCell(),
|
|
37
|
-
oracleId: oracleId,
|
|
38
|
-
signature: signature,
|
|
39
|
-
pubkey: publicKey,
|
|
40
|
-
timestamp: timestamp,
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
catch (error) {
|
|
44
|
-
//console.debug(`Price source error ${this.priceSourceName} ${outputData} ${error}`);
|
|
45
|
-
throw error;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
exports.IotaPriceSource = IotaPriceSource;
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import { beginCell, Cell, Dictionary } from "@ton/core";
|
|
2
|
-
import { PriceSource } from "./PriceSource";
|
|
3
|
-
import { RawPriceData } from "..";
|
|
4
|
-
|
|
5
|
-
export class IotaPriceSource extends PriceSource {
|
|
6
|
-
protected priceSourceName: string = 'IotaPriceSource';
|
|
7
|
-
|
|
8
|
-
async getPrices(): Promise<RawPriceData[]> {
|
|
9
|
-
return await Promise.all(this.nfts.map(nft => this.loadOracleData(nft.address)
|
|
10
|
-
.then(x => this.parsePrices(x, nft.id))));
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
async loadOracleData(oracleNftId: String): Promise<OutputData> {
|
|
14
|
-
let result = await fetch(`https://${this._endpoint}/api/indexer/v1/outputs/nft/${oracleNftId}`, {
|
|
15
|
-
headers: { accept: 'application/json' },
|
|
16
|
-
signal: AbortSignal.timeout(5000)
|
|
17
|
-
});
|
|
18
|
-
let outputId = (await result.json()) as NftData;
|
|
19
|
-
|
|
20
|
-
result = await fetch(`https://${this._endpoint}/api/core/v2/outputs/${outputId.items[0]}`, {
|
|
21
|
-
headers: { accept: 'application/json' },
|
|
22
|
-
signal: AbortSignal.timeout(5000)
|
|
23
|
-
});
|
|
24
|
-
return (await result.json() as OutputData);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
parsePrices(outputData: OutputData, oracleId: number): RawPriceData {
|
|
29
|
-
const data = JSON.parse(
|
|
30
|
-
decodeURIComponent(outputData.output.features[0].data.replace('0x', '').replace(/[0-9a-f]{2}/g, '%$&')),
|
|
31
|
-
);
|
|
32
|
-
|
|
33
|
-
try {
|
|
34
|
-
const pricesCell = Cell.fromBoc(Buffer.from(data['packedPrices'], 'hex'))[0];
|
|
35
|
-
const signature = Buffer.from(data['signature'], 'hex');
|
|
36
|
-
const publicKey = Buffer.from(data['publicKey'], 'hex');
|
|
37
|
-
const timestamp = Number(data['timestamp']);
|
|
38
|
-
|
|
39
|
-
return {
|
|
40
|
-
dict: pricesCell.beginParse().loadRef().beginParse().loadDictDirect(Dictionary.Keys.BigUint(256), Dictionary.Values.BigVarUint(4)),
|
|
41
|
-
dataCell: beginCell().storeRef(pricesCell).storeBuffer(signature).endCell(),
|
|
42
|
-
oracleId: oracleId,
|
|
43
|
-
signature: signature,
|
|
44
|
-
pubkey: publicKey,
|
|
45
|
-
timestamp: timestamp,
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
catch (error) {
|
|
49
|
-
//console.debug(`Price source error ${this.priceSourceName} ${outputData} ${error}`);
|
|
50
|
-
throw error;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
type NftData = {
|
|
56
|
-
ledgerIndex: number;
|
|
57
|
-
pageSize: number;
|
|
58
|
-
items: string[];
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
type OutputData = {
|
|
62
|
-
metadata: {
|
|
63
|
-
blockId: string;
|
|
64
|
-
transactionId: string;
|
|
65
|
-
outputIndex: number;
|
|
66
|
-
isSpent: boolean;
|
|
67
|
-
milestoneIndexSpent: number;
|
|
68
|
-
milestoneTimestampSpent: number;
|
|
69
|
-
transactionIdSpent: string;
|
|
70
|
-
milestoneIndexBooked: number;
|
|
71
|
-
milestoneTimestampBooked: number;
|
|
72
|
-
ledgerIndex: number;
|
|
73
|
-
};
|
|
74
|
-
output: {
|
|
75
|
-
type: number;
|
|
76
|
-
amount: string;
|
|
77
|
-
nftId: string;
|
|
78
|
-
unlockConditions: {
|
|
79
|
-
type: number;
|
|
80
|
-
address: {
|
|
81
|
-
type: number;
|
|
82
|
-
pubKeyHash: string;
|
|
83
|
-
};
|
|
84
|
-
}[];
|
|
85
|
-
features: {
|
|
86
|
-
type: number;
|
|
87
|
-
data: string;
|
|
88
|
-
}[];
|
|
89
|
-
};
|
|
90
|
-
};
|