@evaafi/sdk 0.9.1 → 0.9.2-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.
Files changed (42) hide show
  1. package/dist/api/feeds.d.ts +0 -1
  2. package/dist/api/prices.d.ts +0 -1
  3. package/dist/constants/assets/assetId.d.ts +3 -1
  4. package/dist/constants/assets/assetId.js +5 -1
  5. package/dist/constants/assets/mainnet.d.ts +2 -0
  6. package/dist/constants/assets/mainnet.js +13 -1
  7. package/dist/constants/general/mainnet.d.ts +2 -1
  8. package/dist/constants/general/mainnet.js +3 -2
  9. package/dist/constants/pools/mainnet.d.ts +4 -0
  10. package/dist/constants/pools/mainnet.js +25 -10
  11. package/dist/contracts/PythMaster.d.ts +0 -1
  12. package/dist/contracts/PythOracle.d.ts +0 -1
  13. package/dist/oracles/Types.d.ts +0 -1
  14. package/dist/oracles/collectors/ClassicCollector.js +1 -1
  15. package/dist/oracles/collectors/PythCollector.js +18 -4
  16. package/dist/oracles/prices/PythPrices.d.ts +0 -1
  17. package/dist/oracles/sources/Backend.js +11 -8
  18. package/dist/oracles/sources/Icp.js +10 -6
  19. package/dist/oracles/utils.d.ts +0 -1
  20. package/dist/rewards/RewardMaster.d.ts +0 -1
  21. package/dist/rewards/RewardUser.d.ts +0 -1
  22. package/dist/types/Master.d.ts +0 -1
  23. package/dist/types/MasterRewards.d.ts +0 -1
  24. package/dist/types/UserRewards.d.ts +0 -1
  25. package/dist/utils/fivaUtils.d.ts +2 -0
  26. package/dist/utils/fivaUtils.js +19 -0
  27. package/dist/utils/sha256BigInt.d.ts +0 -1
  28. package/dist/utils/userJettonWallet.js +15 -1
  29. package/dist/utils/utils.d.ts +1 -1
  30. package/dist/utils/utils.js +4 -2
  31. package/package.json +3 -2
  32. package/src/constants/assets/assetId.ts +7 -1
  33. package/src/constants/assets/mainnet.ts +24 -0
  34. package/src/constants/general/mainnet.ts +2 -1
  35. package/src/constants/pools/mainnet.ts +22 -3
  36. package/src/oracles/collectors/ClassicCollector.ts +1 -1
  37. package/src/oracles/collectors/PythCollector.ts +22 -8
  38. package/src/oracles/sources/Backend.ts +12 -11
  39. package/src/oracles/sources/Icp.ts +10 -9
  40. package/src/utils/fivaUtils.ts +19 -0
  41. package/src/utils/userJettonWallet.ts +18 -1
  42. package/src/utils/utils.ts +4 -2
@@ -1,5 +1,4 @@
1
1
  /// <reference types="node" />
2
- /// <reference types="node" />
3
2
  import { HexString } from '@pythnetwork/hermes-client';
4
3
  import { Dictionary } from '@ton/ton';
5
4
  import { Buffer } from 'buffer';
@@ -1,5 +1,4 @@
1
1
  /// <reference types="node" />
2
- /// <reference types="node" />
3
2
  import { HexString } from '@pythnetwork/hermes-client';
4
3
  import { Cell } from '@ton/core';
5
4
  import { Buffer } from 'buffer';
@@ -1,4 +1,5 @@
1
1
  export declare const ASSET_ID: {
2
+ EVAA: bigint;
2
3
  TON: bigint;
3
4
  USDT: bigint;
4
5
  jUSDT: bigint;
@@ -8,7 +9,6 @@ export declare const ASSET_ID: {
8
9
  tgBTC: bigint;
9
10
  USDe: bigint;
10
11
  tsUSDe: bigint;
11
- PT_tsUSDe_01Sep2025: bigint;
12
12
  TONUSDT_DEDUST: bigint;
13
13
  TONUSDT_STONFI: bigint;
14
14
  TON_STORM: bigint;
@@ -17,6 +17,8 @@ export declare const ASSET_ID: {
17
17
  DOGS: bigint;
18
18
  CATI: bigint;
19
19
  STON: bigint;
20
+ PT_tsUSDe_01Sep2025: bigint;
21
+ PT_tsUSDe_18Dec2025: bigint;
20
22
  EUSDT: bigint;
21
23
  EUSDC: bigint;
22
24
  };
@@ -3,6 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ASSET_ID = void 0;
4
4
  const sha256BigInt_1 = require("../../utils/sha256BigInt");
5
5
  exports.ASSET_ID = {
6
+ EVAA: (0, sha256BigInt_1.sha256Hash)('EVAA'),
7
+ // Main
6
8
  TON: (0, sha256BigInt_1.sha256Hash)('TON'),
7
9
  USDT: (0, sha256BigInt_1.sha256Hash)('USDT'),
8
10
  jUSDT: (0, sha256BigInt_1.sha256Hash)('jUSDT'),
@@ -12,7 +14,6 @@ exports.ASSET_ID = {
12
14
  tgBTC: (0, sha256BigInt_1.sha256Hash)('tgBTC'),
13
15
  USDe: (0, sha256BigInt_1.sha256Hash)('USDe'),
14
16
  tsUSDe: (0, sha256BigInt_1.sha256Hash)('tsUSDe'),
15
- PT_tsUSDe_01Sep2025: (0, sha256BigInt_1.sha256Hash)('PT_tsUSDe_01Sep2025'),
16
17
  // LP
17
18
  TONUSDT_DEDUST: (0, sha256BigInt_1.sha256Hash)('TONUSDT_DEDUST'),
18
19
  TONUSDT_STONFI: (0, sha256BigInt_1.sha256Hash)('TONUSDT_STONFI'),
@@ -23,6 +24,9 @@ exports.ASSET_ID = {
23
24
  DOGS: (0, sha256BigInt_1.sha256Hash)('DOGS'),
24
25
  CATI: (0, sha256BigInt_1.sha256Hash)('CATI'),
25
26
  STON: (0, sha256BigInt_1.sha256Hash)('STON'),
27
+ // STABLE
28
+ PT_tsUSDe_01Sep2025: (0, sha256BigInt_1.sha256Hash)('PT_tsUSDe_01Sep2025'),
29
+ PT_tsUSDe_18Dec2025: (0, sha256BigInt_1.sha256Hash)('PT_tsUSDe_18Dec2025'),
26
30
  // Testnet assets, faucet t.me/evaabuidl
27
31
  EUSDT: (0, sha256BigInt_1.sha256Hash)('EUSDT'),
28
32
  EUSDC: (0, sha256BigInt_1.sha256Hash)('EUSDC'),
@@ -15,5 +15,7 @@ export declare const NOT_MAINNET: PoolAssetConfig;
15
15
  export declare const USDE_MAINNET: PoolAssetConfig;
16
16
  export declare const TSUSDE_MAINNET: PoolAssetConfig;
17
17
  export declare const PT_tsUSDe_01Sep2025_MAINNET: PoolAssetConfig;
18
+ export declare const PT_tsUSDe_18Dec2025_MAINNET: PoolAssetConfig;
18
19
  export declare const TONUSDT_STONFI_MAINNET: PoolAssetConfig;
19
20
  export declare const STON_MAINNET: PoolAssetConfig;
21
+ export declare const EVAA_MAINNET: PoolAssetConfig;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.STON_MAINNET = exports.TONUSDT_STONFI_MAINNET = exports.PT_tsUSDe_01Sep2025_MAINNET = exports.TSUSDE_MAINNET = exports.USDE_MAINNET = exports.NOT_MAINNET = exports.DOGS_MAINNET = exports.CATI_MAINNET = exports.USDT_STORM_MAINNET = exports.TON_STORM_MAINNET = exports.TONUSDT_DEDUST_MAINNET = exports.USDT_MAINNET = exports.TSTON_MAINNET = exports.STTON_MAINNET = exports.JUSDC_MAINNET = exports.JUSDT_MAINNET = exports.TON_MAINNET = exports.UNDEFINED_ASSET = void 0;
3
+ exports.EVAA_MAINNET = exports.STON_MAINNET = exports.TONUSDT_STONFI_MAINNET = exports.PT_tsUSDe_18Dec2025_MAINNET = exports.PT_tsUSDe_01Sep2025_MAINNET = exports.TSUSDE_MAINNET = exports.USDE_MAINNET = exports.NOT_MAINNET = exports.DOGS_MAINNET = exports.CATI_MAINNET = exports.USDT_STORM_MAINNET = exports.TON_STORM_MAINNET = exports.TONUSDT_DEDUST_MAINNET = exports.USDT_MAINNET = exports.TSTON_MAINNET = exports.STTON_MAINNET = exports.JUSDC_MAINNET = exports.JUSDT_MAINNET = exports.TON_MAINNET = exports.UNDEFINED_ASSET = void 0;
4
4
  const core_1 = require("@ton/core");
5
5
  const general_1 = require("../general");
6
6
  const assetId_1 = require("./assetId");
@@ -100,6 +100,12 @@ exports.PT_tsUSDe_01Sep2025_MAINNET = {
100
100
  jettonMasterAddress: core_1.Address.parse('EQDb90Bss5FnIyq7VMmnG2UeZIzZomQsILw9Hjo1wxaF1df3'),
101
101
  jettonWalletCode: core_1.Cell.fromBoc(Buffer.from('b5ee9c7201020f010003c2000114ff00f4a413f4bcf2c80b0102016202030202ce0405001da0f605da89a1f401f481f48061f05504b3420c700925f04e001d0d3030171b08e85135f03db3ce0fa40fa4031fa003171d721fa0031fa003073a9b40002d31f012082100f8a7ea5ba8e85303459db3ce0208210178d4519ba8e8630444403db3ce035248210595f07bcba80607080900114fa4430c000f2e14d800848020d721ed44d0fa00fa40fa403003d31f018200fff0218210178d4519ba0282107bdd97deba12b1f2f4d33f0130fa003012a002c85003fa0201cf1601cf16c9ed5401f403d33f0101fa00fa4021f002ed44d0fa00fa40fa40305125a15219c705f2e2c127c2fff2e2c2f82a5424207054201314c85003fa0201cf1601cf16c922c8cb0112f400f400cb00c920f9007074c8cb02ca07cbffc9d003fa40f40431fa0020d749c200f2e2c4c88210178d451901cb1f500901cb3f5007fa02250a02f4ed44d0fa00fa40fa403007d33f0101fa005141a004fa40fa4053bac705f82a5464e07054201314c85003fa0201cf1601cf16c922c8cb0112f400f400cb00c9f9007074c8cb02ca07cbffc9d0500cc7051bb1f2e2c309fa005197a121951049385f04e30d038208989680b60972fb0224d70b01c30002c20012b00b0c02ce8e843459db3ce06c22ed44d0fa00fa40fa403030312382106d8e5e3cba8e37335222c705f2e2c1820898968070fb02c8801001cb0558cf1670fa027001cb6a8210d53276db01cb1f01d33f013101cb3fc9810082fb00e0038210768a50b2bae3025f03840ff2f00d0e009ccf1601cf1625fa025006cf16c9c8801801cb055003cf1670fa025052775003cb6bcccc2291729171e25007a812a082096e3600a013bcf2e2c503c98040fb0058c85003fa0201cf1601cf16c9ed5400725219a017a1c882107362d09c01cb1f2401cb3f5003fa0201cf165007cf16c9c8801001cb0523cf165005fa0250047158cb6accc971fb00102400748e25c8801001cb055004cf1670fa027001cb6a8210d53276db01cb1f5801cb3fc9810082fb0001926c22e202c85003fa0201cf1601cf16c9ed5400deed44d0fa00fa40fa403006d33f0101fa00fa40305141a15238c705f2e2c126c2fff2e2c2048208d59f80a015bcf2e2c3c882107bdd97de01cb1f500401cb3f58fa0222cf1601cf16c9c8801801cb0524cf1670fa02017158cb6accc98040fb0058c85003fa0201cf1601cf16c9ed5400965222c705f2e2c1d33f0101fa40fa00f40430c8801801cb055003cf1670fa0270c882100f8a7ea501cb1f500501cb3f58fa0224cf165004cf16f40070fa02ca00c97158cb6accc98040fb00', 'hex'))[0],
102
102
  };
103
+ exports.PT_tsUSDe_18Dec2025_MAINNET = {
104
+ name: 'PT_tsUSDe_18Dec2025',
105
+ assetId: assetId_1.ASSET_ID.PT_tsUSDe_18Dec2025,
106
+ jettonMasterAddress: core_1.Address.parse('EQBxIkea3baUXLtPVuVaSMsWIkC5S0It3OcM8MeYpPnoEWeM'),
107
+ jettonWalletCode: core_1.Cell.fromBoc(Buffer.from('b5ee9c7201020f010003eb000114ff00f4a413f4bcf2c80b0102016202030202ce0405001da0f605da89a1f401f481f48061f05504b3420c700925f04e001d0d3030171b08e85135f03db3ce0fa40fa4031fa003171d721fa0031fa003073a9b40002d31f012082100f8a7ea5ba8e85303459db3ce0208210178d4519ba8e8630444403db3ce035248210595f07bcba80607080900114fa4430c000f2e14d800848020d721ed44d0fa00fa40fa403003d31f018200fff0218210178d4519ba0282107bdd97deba12b1f2f4d33f0130fa003012a002c85003fa0201cf1601cf16c9ed5401f603d33f0101fa00fa4021f002ed44d0fa00fa40fa40305125a15219c705f2e2c127c2fff2e2c2f82a5424207054201314c85003fa0201cf1601cf16c9227871c8cb00cb04cb0012f400f400cb00c95301fa44318100ffaaf7b001f90084f7b0b17074c8cb02ca07cbffc9d003fa40f40431fa0020d749c200f2e2c40a02f2ed44d0fa00fa40fa403007d33f0101fa005141a004fa40fa40f82a5463d07054201314c85003fa0201cf1601cf16c9227871c8cb00cb04cb0012f400f400cb00c92cfa44318100ffaaf7b001f90084f7b0b17074c8cb02ca07cbffc9d053cbc7050cc7051bb1f2e2c309fa005197a121951049385f04e30d030b0c02ce8e843459db3ce06c22ed44d0fa00fa40fa403030312382106d8e5e3cba8e37335222c705f2e2c1820898968070fb02c8801001cb0558cf1670fa027001cb6a8210d53276db01cb1f01d33f013101cb3fc9810082fb00e0038210768a50b2bae3025f03840ff2f00d0e00c4c88210178d451901cb1f500901cb3f5007fa0225cf1601cf1625fa025006cf16c9c8801801cb055003cf1670fa025052775003cb6bcccc2291729171e25007a812a082096e3600a013bcf2e2c503c98040fb0058c85003fa0201cf1601cf16c9ed5400725219a017a1c882107362d09c01cb1f2401cb3f5003fa0201cf165007cf16c9c8801001cb0523cf165005fa0250047158cb6accc971fb001024009e8208989680b60972fb0224d70b01c30002c20012b08e25c8801001cb055004cf1670fa027001cb6a8210d53276db01cb1f5801cb3fc9810082fb0001926c22e202c85003fa0201cf1601cf16c9ed5400deed44d0fa00fa40fa403006d33f0101fa00fa40305141a15238c705f2e2c126c2fff2e2c2048208d59f80a015bcf2e2c3c882107bdd97de01cb1f500401cb3f58fa0222cf1601cf16c9c8801801cb0524cf1670fa02017158cb6accc98040fb0058c85003fa0201cf1601cf16c9ed5400965222c705f2e2c1d33f0101fa40fa00f40430c8801801cb055003cf1670fa0270c882100f8a7ea501cb1f500501cb3f58fa0224cf165004cf16f40070fa02ca00c97158cb6accc98040fb00', 'hex'))[0],
108
+ };
103
109
  exports.TONUSDT_STONFI_MAINNET = {
104
110
  name: 'TONUSDT_STONFI',
105
111
  assetId: assetId_1.ASSET_ID.TONUSDT_STONFI,
@@ -112,3 +118,9 @@ exports.STON_MAINNET = {
112
118
  jettonMasterAddress: core_1.Address.parse('EQA2kCVNwVsil2EM2mB0SkXytxCqQjS4mttjDpnXmwG9T6bO'),
113
119
  jettonWalletCode: core_1.Cell.fromBoc(Buffer.from('b5ee9c7201021201000334000114ff00f4a413f4bcf2c80b0102016202030202cc0405001ba0f605da89a1f401f481f481a8610201d40607020148080900c30831c02497c138007434c0c05c6c2544d7c0fc02f83e903e900c7e800c5c75c87e800c7e800c1cea6d0000b4c7e08403e29fa954882ea54c4d167c0238208405e3514654882ea58c511100fc02780d60841657c1ef2ea4d67c02b817c12103fcbc2000113e910c1c2ebcb853600201200a0b020120101101f100f4cffe803e90087c007b51343e803e903e90350c144da8548ab1c17cb8b04a30bffcb8b0950d109c150804d50500f214013e809633c58073c5b33248b232c044bd003d0032c032483e401c1d3232c0b281f2fff274013e903d010c7e800835d270803cb8b11de0063232c1540233c59c3e8085f2dac4f3200c03f73b51343e803e903e90350c0234cffe80145468017e903e9014d6f1c1551cdb5c150804d50500f214013e809633c58073c5b33248b232c044bd003d0032c0327e401c1d3232c0b281f2fff274140371c1472c7cb8b0c2be80146a2860822625a020822625a004ad8228608239387028062849f8c3c975c2c070c008e00d0e0f00ae8210178d4519c8cb1f19cb3f5007fa0222cf165006cf1625fa025003cf16c95005cc2391729171e25008a813a08208e4e1c0aa008208989680a0a014bcf2e2c504c98040fb001023c85004fa0258cf1601cf16ccc9ed5400705279a018a182107362d09cc8cb1f5230cb3f58fa025007cf165007cf16c9718010c8cb0524cf165006fa0215cb6a14ccc971fb0010241023000e10491038375f040076c200b08e218210d53276db708010c8cb055008cf165004fa0216cb6a12cb1f12cb3fc972fb0093356c21e203c85004fa0258cf1601cf16ccc9ed5400db3b51343e803e903e90350c01f4cffe803e900c145468549271c17cb8b049f0bffcb8b0a0823938702a8005a805af3cb8b0e0841ef765f7b232c7c572cfd400fe8088b3c58073c5b25c60063232c14933c59c3e80b2dab33260103ec01004f214013e809633c58073c5b3327b55200083200835c87b51343e803e903e90350c0134c7e08405e3514654882ea0841ef765f784ee84ac7cb8b174cfcc7e800c04e81408f214013e809633c58073c5b3327b5520', 'hex'))[0],
114
120
  };
121
+ exports.EVAA_MAINNET = {
122
+ name: 'EVAA',
123
+ assetId: assetId_1.ASSET_ID.EVAA,
124
+ jettonMasterAddress: core_1.Address.parse('EQBKMfjX_a_dsOLm-juxyVZytFP7_KKnzGv6J01kGc72gVBp'),
125
+ jettonWalletCode: core_1.Cell.fromBoc(Buffer.from('b5ee9c7201021101000323000114ff00f4a413f4bcf2c80b0102016202030202cc0405001ba0f605da89a1f401f481f481a8610201d40607020120080900c30831c02497c138007434c0c05c6c2544d7c0fc03383e903e900c7e800c5c75c87e800c7e800c1cea6d0000b4c7e08403e29fa954882ea54c4d167c0278208405e3514654882ea58c511100fc02b80d60841657c1ef2ea4d67c02f817c12103fcbc2000113e910c1c2ebcb853600201200a0b0083d40106b90f6a2687d007d207d206a1802698fc1080bc6a28ca9105d41083deecbef09dd0958f97162e99f98fd001809d02811e428027d012c678b00e78b6664f6aa401f1503d33ffa00fa4021f001ed44d0fa00fa40fa40d4305136a1522ac705f2e2c128c2fff2e2c254344270542013541403c85004fa0258cf1601cf16ccc922c8cb0112f400f400cb00c920f9007074c8cb02ca07cbffc9d004fa40f40431fa0020d749c200f2e2c4778018c8cb055008cf1670fa0217cb6b13cc80c0201200d0e009e8210178d4519c8cb1f19cb3f5007fa0222cf165006cf1625fa025003cf16c95005cc2391729171e25008a813a08209c9c380a014bcf2e2c504c98040fb001023c85004fa0258cf1601cf16ccc9ed5402f73b51343e803e903e90350c0234cffe80145468017e903e9014d6f1c1551cdb5c150804d50500f214013e809633c58073c5b33248b232c044bd003d0032c0327e401c1d3232c0b281f2fff274140371c1472c7cb8b0c2be80146a2860822625a019ad822860822625a028062849e5c412440e0dd7c138c34975c2c0600f1000d73b51343e803e903e90350c01f4cffe803e900c145468549271c17cb8b049f0bffcb8b08160824c4b402805af3cb8b0e0841ef765f7b232c7c572cfd400fe8088b3c58073c5b25c60063232c14933c59c3e80b2dab33260103ec01004f214013e809633c58073c5b3327b552000705279a018a182107362d09cc8cb1f5230cb3f58fa025007cf165007cf16c9718010c8cb0524cf165006fa0215cb6a14ccc971fb0010241023007cc30023c200b08e218210d53276db708010c8cb055008cf165004fa0216cb6a12cb1f12cb3fc972fb0093356c21e203c85004fa0258cf1601cf16ccc9ed54', 'hex'))[0],
126
+ };
@@ -7,13 +7,14 @@ export declare const EVAA_LP_MAINNET_VERSION = 5;
7
7
  export declare const EVAA_ALTS_MAINNET: Address;
8
8
  export declare const EVAA_ALTS_MAINNET_VERSION = 3;
9
9
  export declare const EVAA_STABLE_MAINNET: Address;
10
- export declare const STABLE_VERSION = 1;
10
+ export declare const STABLE_VERSION = 2;
11
11
  export declare const EVAA_TOB_MAINNET: Address;
12
12
  export declare const EVAA_TOB_VERSION = 0;
13
13
  export declare const EVAA_PYTH_TOB_MAINNET: Address;
14
14
  export declare const EVAA_PYTH_TOB_VERSION = 0;
15
15
  export declare const EVAA_USDT_REWARDS_MASTER_MAINNET: Address;
16
16
  export declare const EVAA_TON_REWARDS_MASTER_MAINNET: Address;
17
+ export declare const EVAA_EVAA_REWARDS_MASTER_MAINNET: Address;
17
18
  export declare const ORACLES_MAINNET: ExtendedEvaaOracle[];
18
19
  export declare const PYTH_ORACLE_MAINNET: Address;
19
20
  export declare const ORACLES_LP: ExtendedEvaaOracle[];
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.EVAA_REWARDS_USER_CODE_MAINNET = exports.EVAA_REWARDS_MASTER_CODE_MAINNET = exports.JETTON_WALLET_STANDART_CODE = exports.LENDING_CODE = exports.ORACLES_ALTS = exports.ORACLES_LP = exports.PYTH_ORACLE_MAINNET = exports.ORACLES_MAINNET = exports.EVAA_TON_REWARDS_MASTER_MAINNET = exports.EVAA_USDT_REWARDS_MASTER_MAINNET = exports.EVAA_PYTH_TOB_VERSION = exports.EVAA_PYTH_TOB_MAINNET = exports.EVAA_TOB_VERSION = exports.EVAA_TOB_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.MAINNET_VERSION = exports.EVAA_MASTER_MAINNET = void 0;
3
+ exports.EVAA_REWARDS_USER_CODE_MAINNET = exports.EVAA_REWARDS_MASTER_CODE_MAINNET = exports.JETTON_WALLET_STANDART_CODE = exports.LENDING_CODE = exports.ORACLES_ALTS = exports.ORACLES_LP = exports.PYTH_ORACLE_MAINNET = exports.ORACLES_MAINNET = exports.EVAA_EVAA_REWARDS_MASTER_MAINNET = exports.EVAA_TON_REWARDS_MASTER_MAINNET = exports.EVAA_USDT_REWARDS_MASTER_MAINNET = exports.EVAA_PYTH_TOB_VERSION = exports.EVAA_PYTH_TOB_MAINNET = exports.EVAA_TOB_VERSION = exports.EVAA_TOB_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.MAINNET_VERSION = exports.EVAA_MASTER_MAINNET = void 0;
4
4
  const core_1 = require("@ton/core");
5
5
  /* MAIN POOL */
6
6
  exports.EVAA_MASTER_MAINNET = core_1.Address.parse('EQC8rUZqR_pWV1BylWUlPNBzyiTYVoBEmQkMIQDZXICfnuRr');
@@ -13,7 +13,7 @@ exports.EVAA_ALTS_MAINNET = core_1.Address.parse('EQANURVS3fhBO9bivig34iyJQi97Fh
13
13
  exports.EVAA_ALTS_MAINNET_VERSION = 3;
14
14
  /* STABLE POOL */
15
15
  exports.EVAA_STABLE_MAINNET = core_1.Address.parse('EQCdIdXf1kA_2Hd9mbGzSFDEPA-Px-et8qTWHEXgRGo0K3zd');
16
- exports.STABLE_VERSION = 1;
16
+ exports.STABLE_VERSION = 2;
17
17
  /* EVAA V8 Trail of Bits Audited Pool */
18
18
  exports.EVAA_TOB_MAINNET = core_1.Address.parse('EQDrSGBBunrWNmIdHgdaA7Weu4yUr8Ckw3C9wNWobq7osn3H');
19
19
  exports.EVAA_TOB_VERSION = 0;
@@ -22,6 +22,7 @@ exports.EVAA_PYTH_TOB_MAINNET = core_1.Address.parse('EQCsOdQPDO1Xndzutn9dDclool
22
22
  exports.EVAA_PYTH_TOB_VERSION = 0;
23
23
  exports.EVAA_USDT_REWARDS_MASTER_MAINNET = core_1.Address.parse('EQD22Fhylp1tX-xoVX81aMTSJNPV8j9klwApTLgjGmofISVD');
24
24
  exports.EVAA_TON_REWARDS_MASTER_MAINNET = core_1.Address.parse('EQDM_gdrntBg4fy5Rg9DgDF0AUu3FYoqxHEOsHNIC4_DTDuC');
25
+ exports.EVAA_EVAA_REWARDS_MASTER_MAINNET = core_1.Address.parse('EQBLjRyn69hqC9WAVjqjSjF0nnxxWBW-Atx_3T7dCF-tBdnM');
25
26
  exports.ORACLES_MAINNET = [
26
27
  {
27
28
  id: 0,
@@ -1,6 +1,9 @@
1
1
  import { PoolConfig } from '../../types/Master';
2
2
  import { EvaaRewardsConfig } from '../../types/MasterRewards';
3
3
  export declare const MAINNET_POOL_ASSETS_CONFIG: import("../../types/Master").PoolAssetConfig[];
4
+ export declare const MAINNET_STABLE_POOL_ASSETS_CONFIG: import("../../types/Master").PoolAssetConfig[];
5
+ export declare const MAINNET_LP_POOL_ASSETS_CONFIG: import("../../types/Master").PoolAssetConfig[];
6
+ export declare const MAINNET_ALTS_POOL_ASSETS_CONFIG: import("../../types/Master").PoolAssetConfig[];
4
7
  export declare const MAINNET_POOL_CONFIG: PoolConfig;
5
8
  export declare const MAINNET_STABLE_POOL_CONFIG: PoolConfig;
6
9
  export declare const MAINNET_LP_POOL_CONFIG: PoolConfig;
@@ -11,4 +14,5 @@ export declare const MAINNET_V8_TOB_POOL_ASSETS_CONFIG: import("../../types/Mast
11
14
  export declare const MAINNET_V8_TOB_POOL_CONFIG: PoolConfig;
12
15
  export declare const MAINNET_MASTER_TON_REWARD_CONFIG: EvaaRewardsConfig;
13
16
  export declare const MAINNET_MASTER_USDT_REWARD_CONFIG: EvaaRewardsConfig;
17
+ export declare const MAINNET_MASTER_EVAA_REWARD_CONFIG: EvaaRewardsConfig;
14
18
  export declare const ALL_MAINNET_POOLS: PoolConfig[];
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ALL_MAINNET_POOLS = exports.MAINNET_MASTER_USDT_REWARD_CONFIG = exports.MAINNET_MASTER_TON_REWARD_CONFIG = exports.MAINNET_V8_TOB_POOL_CONFIG = exports.MAINNET_V8_TOB_POOL_ASSETS_CONFIG = exports.MAINNET_PYTH_V8_TOB_POOL_CONFIG = exports.MAINNET_PYTH_V8_TOB_POOL_ASSETS_CONFIG = exports.MAINNET_ALTS_POOL_CONFIG = exports.MAINNET_LP_POOL_CONFIG = exports.MAINNET_STABLE_POOL_CONFIG = exports.MAINNET_POOL_CONFIG = exports.MAINNET_POOL_ASSETS_CONFIG = void 0;
3
+ exports.ALL_MAINNET_POOLS = exports.MAINNET_MASTER_EVAA_REWARD_CONFIG = exports.MAINNET_MASTER_USDT_REWARD_CONFIG = exports.MAINNET_MASTER_TON_REWARD_CONFIG = exports.MAINNET_V8_TOB_POOL_CONFIG = exports.MAINNET_V8_TOB_POOL_ASSETS_CONFIG = exports.MAINNET_PYTH_V8_TOB_POOL_CONFIG = exports.MAINNET_PYTH_V8_TOB_POOL_ASSETS_CONFIG = exports.MAINNET_ALTS_POOL_CONFIG = exports.MAINNET_LP_POOL_CONFIG = exports.MAINNET_STABLE_POOL_CONFIG = exports.MAINNET_POOL_CONFIG = exports.MAINNET_ALTS_POOL_ASSETS_CONFIG = exports.MAINNET_LP_POOL_ASSETS_CONFIG = exports.MAINNET_STABLE_POOL_ASSETS_CONFIG = exports.MAINNET_POOL_ASSETS_CONFIG = void 0;
4
4
  const core_1 = require("@ton/core");
5
5
  const feeds_1 = require("../../api/feeds");
6
6
  const oracles_1 = require("../../oracles");
@@ -17,8 +17,14 @@ exports.MAINNET_POOL_ASSETS_CONFIG = [
17
17
  assets_1.USDE_MAINNET,
18
18
  assets_1.TSUSDE_MAINNET,
19
19
  ];
20
- const MAINNET_STABLE_POOL_ASSETS_CONFIG = [assets_1.USDT_MAINNET, assets_1.USDE_MAINNET, assets_1.TSUSDE_MAINNET, assets_1.PT_tsUSDe_01Sep2025_MAINNET];
21
- const MAINNET_LP_POOL_ASSETS_CONFIG = [
20
+ exports.MAINNET_STABLE_POOL_ASSETS_CONFIG = [
21
+ assets_1.USDT_MAINNET,
22
+ assets_1.USDE_MAINNET,
23
+ assets_1.TSUSDE_MAINNET,
24
+ assets_1.PT_tsUSDe_01Sep2025_MAINNET,
25
+ assets_1.PT_tsUSDe_18Dec2025_MAINNET,
26
+ ];
27
+ exports.MAINNET_LP_POOL_ASSETS_CONFIG = [
22
28
  assets_1.TON_MAINNET,
23
29
  assets_1.USDT_MAINNET,
24
30
  assets_1.TONUSDT_DEDUST_MAINNET,
@@ -26,7 +32,7 @@ const MAINNET_LP_POOL_ASSETS_CONFIG = [
26
32
  assets_1.USDT_STORM_MAINNET,
27
33
  assets_1.TONUSDT_STONFI_MAINNET,
28
34
  ];
29
- const MAINNET_ALTS_POOL_ASSETS_CONFIG = [assets_1.TON_MAINNET, assets_1.USDT_MAINNET, assets_1.CATI_MAINNET, assets_1.NOT_MAINNET, assets_1.DOGS_MAINNET];
35
+ exports.MAINNET_ALTS_POOL_ASSETS_CONFIG = [assets_1.TON_MAINNET, assets_1.USDT_MAINNET, assets_1.CATI_MAINNET, assets_1.NOT_MAINNET, assets_1.DOGS_MAINNET];
30
36
  exports.MAINNET_POOL_CONFIG = {
31
37
  masterAddress: general_1.EVAA_MASTER_MAINNET,
32
38
  masterVersion: general_1.MAINNET_VERSION,
@@ -57,11 +63,11 @@ exports.MAINNET_STABLE_POOL_CONFIG = {
57
63
  masterVersion: general_1.STABLE_VERSION,
58
64
  masterConstants: general_1.MASTER_CONSTANTS,
59
65
  collector: new oracles_1.ClassicCollector({
60
- poolAssetsConfig: MAINNET_STABLE_POOL_ASSETS_CONFIG,
66
+ poolAssetsConfig: exports.MAINNET_STABLE_POOL_ASSETS_CONFIG,
61
67
  minimalOracles: 3,
62
68
  evaaOracles: general_1.ORACLES_MAINNET,
63
69
  }),
64
- poolAssetsConfig: MAINNET_STABLE_POOL_ASSETS_CONFIG,
70
+ poolAssetsConfig: exports.MAINNET_STABLE_POOL_ASSETS_CONFIG,
65
71
  lendingCode: general_1.LENDING_CODE,
66
72
  };
67
73
  exports.MAINNET_LP_POOL_CONFIG = {
@@ -69,11 +75,11 @@ exports.MAINNET_LP_POOL_CONFIG = {
69
75
  masterVersion: general_1.EVAA_LP_MAINNET_VERSION,
70
76
  masterConstants: general_1.MASTER_CONSTANTS,
71
77
  collector: new oracles_1.ClassicCollector({
72
- poolAssetsConfig: MAINNET_LP_POOL_ASSETS_CONFIG,
78
+ poolAssetsConfig: exports.MAINNET_LP_POOL_ASSETS_CONFIG,
73
79
  minimalOracles: 3,
74
80
  evaaOracles: general_1.ORACLES_LP,
75
81
  }),
76
- poolAssetsConfig: MAINNET_LP_POOL_ASSETS_CONFIG,
82
+ poolAssetsConfig: exports.MAINNET_LP_POOL_ASSETS_CONFIG,
77
83
  lendingCode: general_1.LENDING_CODE,
78
84
  };
79
85
  exports.MAINNET_ALTS_POOL_CONFIG = {
@@ -81,11 +87,11 @@ exports.MAINNET_ALTS_POOL_CONFIG = {
81
87
  masterVersion: general_1.EVAA_ALTS_MAINNET_VERSION,
82
88
  masterConstants: general_1.MASTER_CONSTANTS,
83
89
  collector: new oracles_1.ClassicCollector({
84
- poolAssetsConfig: MAINNET_ALTS_POOL_ASSETS_CONFIG,
90
+ poolAssetsConfig: exports.MAINNET_ALTS_POOL_ASSETS_CONFIG,
85
91
  minimalOracles: 3,
86
92
  evaaOracles: general_1.ORACLES_ALTS,
87
93
  }),
88
- poolAssetsConfig: MAINNET_ALTS_POOL_ASSETS_CONFIG,
94
+ poolAssetsConfig: exports.MAINNET_ALTS_POOL_ASSETS_CONFIG,
89
95
  lendingCode: general_1.LENDING_CODE,
90
96
  };
91
97
  exports.MAINNET_PYTH_V8_TOB_POOL_ASSETS_CONFIG = [assets_1.TON_MAINNET, assets_1.USDT_MAINNET, assets_1.JUSDT_MAINNET];
@@ -139,6 +145,15 @@ exports.MAINNET_MASTER_USDT_REWARD_CONFIG = {
139
145
  availableReward: 0,
140
146
  publicKey: Buffer.from('9813725d6cead1c9bbc0e24b21d4fc62a7fa8ac4bb01b6758df30169a71dba67', 'hex'), // adminAddress publicKey
141
147
  };
148
+ exports.MAINNET_MASTER_EVAA_REWARD_CONFIG = {
149
+ adminAddress: general_1.EVAA_EVAA_REWARDS_MASTER_MAINNET,
150
+ evaaMasterAddress: new core_1.Address(0, Buffer.alloc(32, 0)),
151
+ rewardMasterCode: general_1.EVAA_REWARDS_MASTER_CODE_MAINNET,
152
+ rewardUserCode: general_1.EVAA_REWARDS_USER_CODE_MAINNET,
153
+ asset: assets_1.EVAA_MAINNET,
154
+ availableReward: 0,
155
+ publicKey: Buffer.from('b8eb0e312a9aa6394edceef21573f2d45e7d7a616a924e33190bd52fa31c8bb1', 'hex'), // adminAddress publicKey
156
+ };
142
157
  exports.ALL_MAINNET_POOLS = [
143
158
  exports.MAINNET_POOL_CONFIG,
144
159
  exports.MAINNET_LP_POOL_CONFIG,
@@ -1,5 +1,4 @@
1
1
  /// <reference types="node" />
2
- /// <reference types="node" />
3
2
  import { HexString } from '@pythnetwork/hermes-client';
4
3
  import { Address, Cell, ContractProvider, Dictionary, Sender } from '@ton/core';
5
4
  import { PythOracleInfo } from '../api/parsers/PythOracleParser';
@@ -1,5 +1,4 @@
1
1
  /// <reference types="node" />
2
- /// <reference types="node" />
3
2
  import { Address, Cell, Contract, ContractProvider } from '@ton/core';
4
3
  export declare class PythOracle implements Contract {
5
4
  readonly address: Address;
@@ -1,5 +1,4 @@
1
1
  /// <reference types="node" />
2
- /// <reference types="node" />
3
2
  import type { PriceUpdate } from '@pythnetwork/hermes-client';
4
3
  import type { Cell, Dictionary } from '@ton/core';
5
4
  /**
@@ -137,7 +137,7 @@ _ClassicCollector_prices = new WeakMap(), _ClassicCollector_poolAssetsConfig = n
137
137
  }, _ClassicCollector_collectPrices = async function _ClassicCollector_collectPrices(fetchConfig) {
138
138
  for (const priceSource of __classPrivateFieldGet(this, _ClassicCollector_priceSources, "f")) {
139
139
  try {
140
- __classPrivateFieldSet(this, _ClassicCollector_prices, await (0, utils_1.proxyFetchRetries)((0, utils_2.collectAndFilterPrices)(priceSource, __classPrivateFieldGet(this, _ClassicCollector_minimalOracles, "f"), fetchConfig), fetchConfig), "f");
140
+ __classPrivateFieldSet(this, _ClassicCollector_prices, await (0, utils_1.proxyFetchRetries)(() => (0, utils_2.collectAndFilterPrices)(priceSource, __classPrivateFieldGet(this, _ClassicCollector_minimalOracles, "f"), fetchConfig), fetchConfig), "f");
141
141
  return true;
142
142
  }
143
143
  catch (error) {
@@ -13,7 +13,6 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
13
13
  var _PythCollector_instances, _PythCollector_parsedFeedsMap, _PythCollector_pythConfig, _PythCollector_poolAssetsConfig, _PythCollector_allowedRefTokens, _PythCollector_assetToFeeds, _PythCollector_getPythFeedsUpdates, _PythCollector_fetchPythUpdatesWithRetry, _PythCollector_filterEmptyPrincipalsAndAssets;
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.PythCollector = void 0;
16
- const hermes_client_1 = require("@pythnetwork/hermes-client");
17
16
  const core_1 = require("@ton/core");
18
17
  const math_1 = require("../../api/math");
19
18
  const prices_1 = require("../../api/prices");
@@ -238,12 +237,27 @@ _PythCollector_parsedFeedsMap = new WeakMap(), _PythCollector_pythConfig = new W
238
237
  * @returns binary - buffer of feeds update, parsed - json feeds data
239
238
  */
240
239
  async function _PythCollector_getPythFeedsUpdates(feedIds) {
241
- const latestPriceUpdates = await Promise.any(__classPrivateFieldGet(this, _PythCollector_pythConfig, "f").pythEndpoints.map((x) => new hermes_client_1.HermesClient(x).getLatestPriceUpdates(feedIds, { encoding: 'hex' })));
240
+ const pythUpdateResponse = await Promise.any(__classPrivateFieldGet(this, _PythCollector_pythConfig, "f").pythEndpoints.map((x) => {
241
+ const endpoint = new URL(`./v2/updates/price/latest?encoding=hex`, `${x}${x.endsWith('/') ? '' : '/'}`);
242
+ for (const feedId of feedIds) {
243
+ endpoint.searchParams.append('ids[]', feedId);
244
+ }
245
+ return fetch(endpoint.toString());
246
+ }));
247
+ if (!pythUpdateResponse.ok) {
248
+ const text = await pythUpdateResponse.text();
249
+ throw new Error(`Failed to fetch Pyth updates: ${text}`);
250
+ }
251
+ const latestPriceUpdates = (await pythUpdateResponse.json());
242
252
  const parsed = latestPriceUpdates['parsed'];
243
- const binary = Buffer.from(latestPriceUpdates.binary.data[0], 'hex');
253
+ const binaryHex = latestPriceUpdates?.binary?.data?.[0];
254
+ if (!binaryHex) {
255
+ throw new Error('Pyth update missing binary data');
256
+ }
257
+ const binary = Buffer.from(binaryHex, 'hex');
244
258
  return { binary, parsed };
245
259
  }, _PythCollector_fetchPythUpdatesWithRetry = async function _PythCollector_fetchPythUpdatesWithRetry(requiredFeeds, fetchConfig) {
246
- return (0, utils_1.proxyFetchRetries)(__classPrivateFieldGet(this, _PythCollector_instances, "m", _PythCollector_getPythFeedsUpdates).call(this, requiredFeeds), fetchConfig);
260
+ return (0, utils_1.proxyFetchRetries)(() => __classPrivateFieldGet(this, _PythCollector_instances, "m", _PythCollector_getPythFeedsUpdates).call(this, requiredFeeds), fetchConfig);
247
261
  }, _PythCollector_filterEmptyPrincipalsAndAssets = function _PythCollector_filterEmptyPrincipalsAndAssets(principals) {
248
262
  return principals
249
263
  .keys()
@@ -1,5 +1,4 @@
1
1
  /// <reference types="node" />
2
- /// <reference types="node" />
3
2
  import { HexString } from '@pythnetwork/hermes-client';
4
3
  import { PoolAssetConfig } from '../../types/Master';
5
4
  import { AbstractPrices, PriceParameters } from './AbstractPrices';
@@ -14,19 +14,22 @@ class BackendPriceSource extends PriceSource_1.PriceSource {
14
14
  return data.map((outputData) => this.parsePrices(outputData));
15
15
  }
16
16
  async loadOracleData(fetchConfig = utils_1.DefaultFetchConfig) {
17
- const fetchPromise = fetch(`https://${this._endpoint}/api/prices`, {
18
- headers: { accept: 'application/json' },
19
- signal: AbortSignal.timeout(fetchConfig.timeout),
20
- }).then(async (response) => {
21
- const resp = await response.json();
22
- const data = resp;
17
+ return await (0, utils_1.proxyFetchRetries)(async () => {
18
+ const response = await fetch(`https://${this._endpoint}/api/prices`, {
19
+ headers: { accept: 'application/json' },
20
+ signal: AbortSignal.timeout(fetchConfig.timeout),
21
+ });
22
+ if (!response.ok) {
23
+ const body = await response.text().catch(() => '');
24
+ throw new Error(`HTTP error! status: ${response.status}${body ? `, body: ${body}` : ''}`);
25
+ }
26
+ const data = (await response.json());
23
27
  let outputData = [];
24
28
  for (const nft of this._nfts) {
25
29
  outputData.push({ oracleId: nft.id, data: data[nft.address] });
26
30
  }
27
31
  return outputData;
28
- });
29
- return await (0, utils_1.proxyFetchRetries)(fetchPromise, fetchConfig);
32
+ }, fetchConfig);
30
33
  }
31
34
  parsePrices(outputData) {
32
35
  try {
@@ -9,18 +9,22 @@ class IcpPriceSource extends _1.BackendPriceSource {
9
9
  this.priceSourceName = 'IcpPriceSource';
10
10
  }
11
11
  async loadOracleData(fetchConfig = utils_1.DefaultFetchConfig) {
12
- const fetchPromise = fetch(`https://${this._endpoint}/prices`, {
13
- headers: { accept: 'application/json' },
14
- signal: AbortSignal.timeout(fetchConfig.timeout)
15
- }).then(async (response) => {
12
+ return await (0, utils_1.proxyFetchRetries)(async () => {
13
+ const response = await fetch(`https://${this._endpoint}/prices`, {
14
+ headers: { accept: 'application/json' },
15
+ signal: AbortSignal.timeout(fetchConfig.timeout)
16
+ });
17
+ if (!response.ok) {
18
+ const body = await response.text().catch(() => '');
19
+ throw new Error(`HTTP error! status: ${response.status}${body ? `, body: ${body}` : ''}`);
20
+ }
16
21
  const data = (await response.json());
17
22
  let outputData = [];
18
23
  for (const nft of this._nfts) {
19
24
  outputData.push({ oracleId: nft.id, data: data[nft.address] });
20
25
  }
21
26
  return outputData;
22
- });
23
- return await (0, utils_1.proxyFetchRetries)(fetchPromise, fetchConfig);
27
+ }, fetchConfig);
24
28
  }
25
29
  }
26
30
  exports.IcpPriceSource = IcpPriceSource;
@@ -1,5 +1,4 @@
1
1
  /// <reference types="node" />
2
- /// <reference types="node" />
3
2
  import { Cell, Dictionary, Slice } from '@ton/core';
4
3
  import { EvaaOracle, ExtendedEvaaOracle } from '../types/Master';
5
4
  import { FetchConfig } from '../utils/utils';
@@ -1,5 +1,4 @@
1
1
  /// <reference types="node" />
2
- /// <reference types="node" />
3
2
  import { Address, Cell, Contract, ContractProvider, Sender, StateInit } from '@ton/ton';
4
3
  import { Maybe } from '@ton/ton/dist/utils/maybe';
5
4
  import { EvaaRewardsConfig } from '../types/MasterRewards';
@@ -1,5 +1,4 @@
1
1
  /// <reference types="node" />
2
- /// <reference types="node" />
3
2
  import { Address, Cell, Contract, ContractProvider, Sender, StateInit } from '@ton/ton';
4
3
  import { Maybe } from '@ton/ton/dist/utils/maybe';
5
4
  import { EvaaUserRewardsConfig } from '../types/UserRewards';
@@ -1,5 +1,4 @@
1
1
  /// <reference types="node" />
2
- /// <reference types="node" />
3
2
  import { Address, Cell, Dictionary } from '@ton/core';
4
3
  import { AbstractCollector } from '../oracles';
5
4
  export { FeedMapItem, parseFeedsMapDict } from '../api/feeds';
@@ -1,5 +1,4 @@
1
1
  /// <reference types="node" />
2
- /// <reference types="node" />
3
2
  import { Address, Cell } from '@ton/ton';
4
3
  import { PoolAssetConfig } from './Master';
5
4
  export type EvaaRewardsConfig = {
@@ -1,5 +1,4 @@
1
1
  /// <reference types="node" />
2
- /// <reference types="node" />
3
2
  import { Address, Cell } from '@ton/ton';
4
3
  import { PoolAssetConfig } from './Master';
5
4
  export type EvaaUserRewardsConfig = {
@@ -0,0 +1,2 @@
1
+ import { Address } from "@ton/core";
2
+ export declare function calculateCloseAddress(address: Address, closeToAddress: Address): Address;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.calculateCloseAddress = void 0;
4
+ const core_1 = require("@ton/core");
5
+ const sha256BigInt_1 = require("./sha256BigInt");
6
+ function calculateCloseAddress(address, closeToAddress) {
7
+ const curHashpart = BigInt('0x' + address.hash.toString('hex'));
8
+ const desiredHashpart = BigInt('0x' + closeToAddress.hash.toString('hex'));
9
+ const rewriteBits = 8;
10
+ const mask = (1n << BigInt(256 - rewriteBits)) - 1n;
11
+ const antimask = invertBigInt(mask, 256);
12
+ const newHashpart = (curHashpart & mask) | (desiredHashpart & antimask);
13
+ return new core_1.Address(0, (0, sha256BigInt_1.bigIntToBuffer)(newHashpart));
14
+ }
15
+ exports.calculateCloseAddress = calculateCloseAddress;
16
+ function invertBigInt(value, bits) {
17
+ const maxValue = (1n << BigInt(bits)) - 1n;
18
+ return value ^ maxValue;
19
+ }
@@ -1,4 +1,3 @@
1
1
  /// <reference types="node" />
2
- /// <reference types="node" />
3
2
  export declare function sha256Hash(input: string): bigint;
4
3
  export declare function bigIntToBuffer(value: bigint): Buffer;
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getUserJettonWallet = void 0;
4
4
  const core_1 = require("@ton/core");
5
5
  const assets_1 = require("../constants/assets");
6
+ const fivaUtils_1 = require("./fivaUtils");
6
7
  function getUserJettonData(ownerAddress, assetName, jettonWalletCode, jettonMasterAddress) {
7
8
  switch (assetName) {
8
9
  case 'DOGS':
@@ -16,6 +17,7 @@ function getUserJettonData(ownerAddress, assetName, jettonWalletCode, jettonMast
16
17
  .storeAddress(jettonMasterAddress)
17
18
  .endCell();
18
19
  case 'PT_tsUSDe_01Sep2025':
20
+ case 'PT_tsUSDe_18Dec2025':
19
21
  return (0, core_1.beginCell)()
20
22
  .storeCoins(0)
21
23
  .storeAddress(ownerAddress)
@@ -65,12 +67,24 @@ function getUserJettonWallet(ownerAddress, poolAssetConfig) {
65
67
  jettonWalletCode = new core_1.Cell({ exotic: true, bits: lib_prep.bits, refs: lib_prep.refs });
66
68
  }
67
69
  const jettonData = getUserJettonData(ownerAddress, assetName, jettonWalletCode, poolAssetConfig.jettonMasterAddress);
68
- const stateInit = (0, core_1.beginCell)()
70
+ let stateInit = (0, core_1.beginCell)()
69
71
  .store((0, core_1.storeStateInit)({
70
72
  code: jettonWalletCode,
71
73
  data: jettonData
72
74
  }))
73
75
  .endCell();
76
+ if (poolAssetConfig.name === 'PT_tsUSDe_18Dec2025') {
77
+ stateInit = (0, core_1.beginCell)()
78
+ .storeUint(1, 1) // fixed_prefix_length
79
+ .storeUint(8, 5) // rewrite_bits
80
+ .storeUint(0, 1) // special (Maybe=0)
81
+ .storeMaybeRef(jettonWalletCode) // code (Maybe)
82
+ .storeMaybeRef(jettonData) // data (Maybe)
83
+ .storeUint(0, 1) // libraries empty
84
+ .endCell();
85
+ const addr = new core_1.Address(0, stateInit.hash());
86
+ return (0, fivaUtils_1.calculateCloseAddress)(addr, poolAssetConfig.jettonMasterAddress);
87
+ }
74
88
  return new core_1.Address(0, stateInit.hash());
75
89
  }
76
90
  exports.getUserJettonWallet = getUserJettonWallet;
@@ -7,5 +7,5 @@ export interface FetchConfig {
7
7
  timeout: number;
8
8
  }
9
9
  export declare const DefaultFetchConfig: FetchConfig;
10
- export declare function proxyFetchRetries<T>(fetch: Promise<T>, config?: FetchConfig): Promise<T>;
10
+ export declare function proxyFetchRetries<T>(factory: () => Promise<T>, config?: FetchConfig): Promise<T>;
11
11
  export declare function isValidSubaccountId(subaccountId: number): boolean;
@@ -18,14 +18,16 @@ exports.DefaultFetchConfig = {
18
18
  retries: 3,
19
19
  timeout: 1000,
20
20
  };
21
- async function proxyFetchRetries(fetch, config = exports.DefaultFetchConfig) {
21
+ async function proxyFetchRetries(factory, config = exports.DefaultFetchConfig) {
22
22
  let lastError = null;
23
23
  for (let attempt = 0; attempt <= config.retries; attempt++) {
24
24
  try {
25
25
  const timeoutPromise = new Promise((_, reject) => {
26
26
  setTimeout(() => reject(new Error('Request timeout')), config.timeout);
27
27
  });
28
- return await Promise.race([fetch, timeoutPromise]);
28
+ // Create a fresh promise per attempt
29
+ const result = await Promise.race([factory(), timeoutPromise]);
30
+ return result;
29
31
  }
30
32
  catch (error) {
31
33
  lastError = error instanceof Error ? error : new Error(String(error));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@evaafi/sdk",
3
- "version": "0.9.1",
3
+ "version": "0.9.2-a",
4
4
  "description": "The EVAA SDK is designed to easily integrate with the EVAA lending protocol on TON blockchain.",
5
5
  "main": "dist/index.js",
6
6
  "files": [
@@ -41,5 +41,6 @@
41
41
  "@pythnetwork/pyth-ton-js": "^0.1.2",
42
42
  "@ton/ton": "14.0.0",
43
43
  "dotenv": "16.4.5"
44
- }
44
+ },
45
+ "packageManager": "yarn@4.9.2+sha512.1fc009bc09d13cfd0e19efa44cbfc2b9cf6ca61482725eb35bbc5e257e093ebf4130db6dfe15d604ff4b79efd8e1e8e99b25fa7d0a6197c9f9826358d4d65c3c"
45
46
  }
@@ -1,6 +1,9 @@
1
1
  import { sha256Hash } from '../../utils/sha256BigInt';
2
2
 
3
3
  export const ASSET_ID = {
4
+ EVAA: sha256Hash('EVAA'),
5
+
6
+ // Main
4
7
  TON: sha256Hash('TON'),
5
8
  USDT: sha256Hash('USDT'),
6
9
  jUSDT: sha256Hash('jUSDT'),
@@ -10,7 +13,6 @@ export const ASSET_ID = {
10
13
  tgBTC: sha256Hash('tgBTC'),
11
14
  USDe: sha256Hash('USDe'),
12
15
  tsUSDe: sha256Hash('tsUSDe'),
13
- PT_tsUSDe_01Sep2025: sha256Hash('PT_tsUSDe_01Sep2025'),
14
16
 
15
17
  // LP
16
18
  TONUSDT_DEDUST: sha256Hash('TONUSDT_DEDUST'),
@@ -24,6 +26,10 @@ export const ASSET_ID = {
24
26
  CATI: sha256Hash('CATI'),
25
27
  STON: sha256Hash('STON'),
26
28
 
29
+ // STABLE
30
+ PT_tsUSDe_01Sep2025: sha256Hash('PT_tsUSDe_01Sep2025'),
31
+ PT_tsUSDe_18Dec2025: sha256Hash('PT_tsUSDe_18Dec2025'),
32
+
27
33
  // Testnet assets, faucet t.me/evaabuidl
28
34
  EUSDT: sha256Hash('EUSDT'),
29
35
  EUSDC: sha256Hash('EUSDC'),
@@ -169,6 +169,18 @@ export const PT_tsUSDe_01Sep2025_MAINNET: PoolAssetConfig = {
169
169
  )[0],
170
170
  };
171
171
 
172
+ export const PT_tsUSDe_18Dec2025_MAINNET: PoolAssetConfig = {
173
+ name: 'PT_tsUSDe_18Dec2025',
174
+ assetId: ASSET_ID.PT_tsUSDe_18Dec2025,
175
+ jettonMasterAddress: Address.parse('EQBxIkea3baUXLtPVuVaSMsWIkC5S0It3OcM8MeYpPnoEWeM'),
176
+ jettonWalletCode: Cell.fromBoc(
177
+ Buffer.from(
178
+ 'b5ee9c7201020f010003eb000114ff00f4a413f4bcf2c80b0102016202030202ce0405001da0f605da89a1f401f481f48061f05504b3420c700925f04e001d0d3030171b08e85135f03db3ce0fa40fa4031fa003171d721fa0031fa003073a9b40002d31f012082100f8a7ea5ba8e85303459db3ce0208210178d4519ba8e8630444403db3ce035248210595f07bcba80607080900114fa4430c000f2e14d800848020d721ed44d0fa00fa40fa403003d31f018200fff0218210178d4519ba0282107bdd97deba12b1f2f4d33f0130fa003012a002c85003fa0201cf1601cf16c9ed5401f603d33f0101fa00fa4021f002ed44d0fa00fa40fa40305125a15219c705f2e2c127c2fff2e2c2f82a5424207054201314c85003fa0201cf1601cf16c9227871c8cb00cb04cb0012f400f400cb00c95301fa44318100ffaaf7b001f90084f7b0b17074c8cb02ca07cbffc9d003fa40f40431fa0020d749c200f2e2c40a02f2ed44d0fa00fa40fa403007d33f0101fa005141a004fa40fa40f82a5463d07054201314c85003fa0201cf1601cf16c9227871c8cb00cb04cb0012f400f400cb00c92cfa44318100ffaaf7b001f90084f7b0b17074c8cb02ca07cbffc9d053cbc7050cc7051bb1f2e2c309fa005197a121951049385f04e30d030b0c02ce8e843459db3ce06c22ed44d0fa00fa40fa403030312382106d8e5e3cba8e37335222c705f2e2c1820898968070fb02c8801001cb0558cf1670fa027001cb6a8210d53276db01cb1f01d33f013101cb3fc9810082fb00e0038210768a50b2bae3025f03840ff2f00d0e00c4c88210178d451901cb1f500901cb3f5007fa0225cf1601cf1625fa025006cf16c9c8801801cb055003cf1670fa025052775003cb6bcccc2291729171e25007a812a082096e3600a013bcf2e2c503c98040fb0058c85003fa0201cf1601cf16c9ed5400725219a017a1c882107362d09c01cb1f2401cb3f5003fa0201cf165007cf16c9c8801001cb0523cf165005fa0250047158cb6accc971fb001024009e8208989680b60972fb0224d70b01c30002c20012b08e25c8801001cb055004cf1670fa027001cb6a8210d53276db01cb1f5801cb3fc9810082fb0001926c22e202c85003fa0201cf1601cf16c9ed5400deed44d0fa00fa40fa403006d33f0101fa00fa40305141a15238c705f2e2c126c2fff2e2c2048208d59f80a015bcf2e2c3c882107bdd97de01cb1f500401cb3f58fa0222cf1601cf16c9c8801801cb0524cf1670fa02017158cb6accc98040fb0058c85003fa0201cf1601cf16c9ed5400965222c705f2e2c1d33f0101fa40fa00f40430c8801801cb055003cf1670fa0270c882100f8a7ea501cb1f500501cb3f58fa0224cf165004cf16f40070fa02ca00c97158cb6accc98040fb00',
179
+ 'hex',
180
+ ),
181
+ )[0],
182
+ };
183
+
172
184
  export const TONUSDT_STONFI_MAINNET: PoolAssetConfig = {
173
185
  name: 'TONUSDT_STONFI',
174
186
  assetId: ASSET_ID.TONUSDT_STONFI,
@@ -192,3 +204,15 @@ export const STON_MAINNET: PoolAssetConfig = {
192
204
  ),
193
205
  )[0],
194
206
  };
207
+
208
+ export const EVAA_MAINNET: PoolAssetConfig = {
209
+ name: 'EVAA',
210
+ assetId: ASSET_ID.EVAA,
211
+ jettonMasterAddress: Address.parse('EQBKMfjX_a_dsOLm-juxyVZytFP7_KKnzGv6J01kGc72gVBp'),
212
+ jettonWalletCode: Cell.fromBoc(
213
+ Buffer.from(
214
+ 'b5ee9c7201021101000323000114ff00f4a413f4bcf2c80b0102016202030202cc0405001ba0f605da89a1f401f481f481a8610201d40607020120080900c30831c02497c138007434c0c05c6c2544d7c0fc03383e903e900c7e800c5c75c87e800c7e800c1cea6d0000b4c7e08403e29fa954882ea54c4d167c0278208405e3514654882ea58c511100fc02b80d60841657c1ef2ea4d67c02f817c12103fcbc2000113e910c1c2ebcb853600201200a0b0083d40106b90f6a2687d007d207d206a1802698fc1080bc6a28ca9105d41083deecbef09dd0958f97162e99f98fd001809d02811e428027d012c678b00e78b6664f6aa401f1503d33ffa00fa4021f001ed44d0fa00fa40fa40d4305136a1522ac705f2e2c128c2fff2e2c254344270542013541403c85004fa0258cf1601cf16ccc922c8cb0112f400f400cb00c920f9007074c8cb02ca07cbffc9d004fa40f40431fa0020d749c200f2e2c4778018c8cb055008cf1670fa0217cb6b13cc80c0201200d0e009e8210178d4519c8cb1f19cb3f5007fa0222cf165006cf1625fa025003cf16c95005cc2391729171e25008a813a08209c9c380a014bcf2e2c504c98040fb001023c85004fa0258cf1601cf16ccc9ed5402f73b51343e803e903e90350c0234cffe80145468017e903e9014d6f1c1551cdb5c150804d50500f214013e809633c58073c5b33248b232c044bd003d0032c0327e401c1d3232c0b281f2fff274140371c1472c7cb8b0c2be80146a2860822625a019ad822860822625a028062849e5c412440e0dd7c138c34975c2c0600f1000d73b51343e803e903e90350c01f4cffe803e900c145468549271c17cb8b049f0bffcb8b08160824c4b402805af3cb8b0e0841ef765f7b232c7c572cfd400fe8088b3c58073c5b25c60063232c14933c59c3e80b2dab33260103ec01004f214013e809633c58073c5b3327b552000705279a018a182107362d09cc8cb1f5230cb3f58fa025007cf165007cf16c9718010c8cb0524cf165006fa0215cb6a14ccc971fb0010241023007cc30023c200b08e218210d53276db708010c8cb055008cf165004fa0216cb6a12cb1f12cb3fc972fb0093356c21e203c85004fa0258cf1601cf16ccc9ed54',
215
+ 'hex',
216
+ ),
217
+ )[0],
218
+ };
@@ -15,7 +15,7 @@ export const EVAA_ALTS_MAINNET_VERSION = 3;
15
15
 
16
16
  /* STABLE POOL */
17
17
  export const EVAA_STABLE_MAINNET = Address.parse('EQCdIdXf1kA_2Hd9mbGzSFDEPA-Px-et8qTWHEXgRGo0K3zd');
18
- export const STABLE_VERSION = 1;
18
+ export const STABLE_VERSION = 2;
19
19
 
20
20
  /* EVAA V8 Trail of Bits Audited Pool */
21
21
  export const EVAA_TOB_MAINNET = Address.parse('EQDrSGBBunrWNmIdHgdaA7Weu4yUr8Ckw3C9wNWobq7osn3H');
@@ -27,6 +27,7 @@ export const EVAA_PYTH_TOB_VERSION = 0;
27
27
 
28
28
  export const EVAA_USDT_REWARDS_MASTER_MAINNET = Address.parse('EQD22Fhylp1tX-xoVX81aMTSJNPV8j9klwApTLgjGmofISVD');
29
29
  export const EVAA_TON_REWARDS_MASTER_MAINNET = Address.parse('EQDM_gdrntBg4fy5Rg9DgDF0AUu3FYoqxHEOsHNIC4_DTDuC');
30
+ export const EVAA_EVAA_REWARDS_MASTER_MAINNET = Address.parse('EQBLjRyn69hqC9WAVjqjSjF0nnxxWBW-Atx_3T7dCF-tBdnM');
30
31
 
31
32
  export const ORACLES_MAINNET: ExtendedEvaaOracle[] = [
32
33
  {
@@ -8,10 +8,12 @@ import {
8
8
  ASSET_ID,
9
9
  CATI_MAINNET,
10
10
  DOGS_MAINNET,
11
+ EVAA_MAINNET,
11
12
  JUSDC_MAINNET,
12
13
  JUSDT_MAINNET,
13
14
  NOT_MAINNET,
14
15
  PT_tsUSDe_01Sep2025_MAINNET,
16
+ PT_tsUSDe_18Dec2025_MAINNET,
15
17
  STTON_MAINNET,
16
18
  TON_MAINNET,
17
19
  TON_STORM_MAINNET,
@@ -26,6 +28,7 @@ import {
26
28
  import {
27
29
  EVAA_ALTS_MAINNET,
28
30
  EVAA_ALTS_MAINNET_VERSION,
31
+ EVAA_EVAA_REWARDS_MASTER_MAINNET,
29
32
  EVAA_LP_MAINNET,
30
33
  EVAA_LP_MAINNET_VERSION,
31
34
  EVAA_MASTER_MAINNET,
@@ -60,9 +63,15 @@ export const MAINNET_POOL_ASSETS_CONFIG = [
60
63
  TSUSDE_MAINNET,
61
64
  ];
62
65
 
63
- const MAINNET_STABLE_POOL_ASSETS_CONFIG = [USDT_MAINNET, USDE_MAINNET, TSUSDE_MAINNET, PT_tsUSDe_01Sep2025_MAINNET];
66
+ export const MAINNET_STABLE_POOL_ASSETS_CONFIG = [
67
+ USDT_MAINNET,
68
+ USDE_MAINNET,
69
+ TSUSDE_MAINNET,
70
+ PT_tsUSDe_01Sep2025_MAINNET,
71
+ PT_tsUSDe_18Dec2025_MAINNET,
72
+ ];
64
73
 
65
- const MAINNET_LP_POOL_ASSETS_CONFIG = [
74
+ export const MAINNET_LP_POOL_ASSETS_CONFIG = [
66
75
  TON_MAINNET,
67
76
  USDT_MAINNET,
68
77
  TONUSDT_DEDUST_MAINNET,
@@ -71,7 +80,7 @@ const MAINNET_LP_POOL_ASSETS_CONFIG = [
71
80
  TONUSDT_STONFI_MAINNET,
72
81
  ];
73
82
 
74
- const MAINNET_ALTS_POOL_ASSETS_CONFIG = [TON_MAINNET, USDT_MAINNET, CATI_MAINNET, NOT_MAINNET, DOGS_MAINNET];
83
+ export const MAINNET_ALTS_POOL_ASSETS_CONFIG = [TON_MAINNET, USDT_MAINNET, CATI_MAINNET, NOT_MAINNET, DOGS_MAINNET];
75
84
 
76
85
  export const MAINNET_POOL_CONFIG: PoolConfig = {
77
86
  masterAddress: EVAA_MASTER_MAINNET,
@@ -195,6 +204,16 @@ export const MAINNET_MASTER_USDT_REWARD_CONFIG: EvaaRewardsConfig = {
195
204
  publicKey: Buffer.from('9813725d6cead1c9bbc0e24b21d4fc62a7fa8ac4bb01b6758df30169a71dba67', 'hex'), // adminAddress publicKey
196
205
  };
197
206
 
207
+ export const MAINNET_MASTER_EVAA_REWARD_CONFIG: EvaaRewardsConfig = {
208
+ adminAddress: EVAA_EVAA_REWARDS_MASTER_MAINNET,
209
+ evaaMasterAddress: new Address(0, Buffer.alloc(32, 0)),
210
+ rewardMasterCode: EVAA_REWARDS_MASTER_CODE_MAINNET,
211
+ rewardUserCode: EVAA_REWARDS_USER_CODE_MAINNET,
212
+ asset: EVAA_MAINNET,
213
+ availableReward: 0,
214
+ publicKey: Buffer.from('b8eb0e312a9aa6394edceef21573f2d45e7d7a616a924e33190bd52fa31c8bb1', 'hex'), // adminAddress publicKey
215
+ };
216
+
198
217
  export const ALL_MAINNET_POOLS: PoolConfig[] = [
199
218
  MAINNET_POOL_CONFIG,
200
219
  MAINNET_LP_POOL_CONFIG,
@@ -184,7 +184,7 @@ export class ClassicCollector extends AbstractCollector {
184
184
  for (const priceSource of this.#priceSources) {
185
185
  try {
186
186
  this.#prices = await proxyFetchRetries(
187
- collectAndFilterPrices(priceSource, this.#minimalOracles, fetchConfig),
187
+ () => collectAndFilterPrices(priceSource, this.#minimalOracles, fetchConfig),
188
188
  fetchConfig,
189
189
  );
190
190
  return true;
@@ -1,4 +1,4 @@
1
- import { HermesClient, HexString, PriceUpdate } from '@pythnetwork/hermes-client';
1
+ import { HexString, PriceUpdate } from '@pythnetwork/hermes-client';
2
2
  import { Dictionary } from '@ton/core';
3
3
  import { checkNotInDebtAtAll } from '../../api/math';
4
4
  import { OracleConfig } from '../../api/parsers/PythOracleParser';
@@ -275,15 +275,29 @@ export class PythCollector extends AbstractCollector {
275
275
  * @returns binary - buffer of feeds update, parsed - json feeds data
276
276
  */
277
277
  async #getPythFeedsUpdates(feedIds: HexString[]): Promise<PythFeedUpdateType> {
278
- const latestPriceUpdates: PriceUpdate = await Promise.any(
279
- this.#pythConfig.pythEndpoints.map((x) =>
280
- new HermesClient(x).getLatestPriceUpdates(feedIds, { encoding: 'hex' }),
281
- ),
278
+ const pythUpdateResponse = await Promise.any(
279
+ this.#pythConfig.pythEndpoints.map((x) => {
280
+ const endpoint = new URL(`./v2/updates/price/latest?encoding=hex`, `${x}${x.endsWith('/') ? '' : '/'}`);
281
+
282
+ for (const feedId of feedIds) {
283
+ endpoint.searchParams.append('ids[]', feedId);
284
+ }
285
+
286
+ return fetch(endpoint.toString());
287
+ }),
282
288
  );
289
+ if (!pythUpdateResponse.ok) {
290
+ const text = await pythUpdateResponse.text();
291
+ throw new Error(`Failed to fetch Pyth updates: ${text}`);
292
+ }
283
293
 
294
+ const latestPriceUpdates = (await pythUpdateResponse.json()) as PriceUpdate;
284
295
  const parsed = latestPriceUpdates['parsed'];
285
- const binary = Buffer.from(latestPriceUpdates.binary.data[0], 'hex');
286
-
296
+ const binaryHex = latestPriceUpdates?.binary?.data?.[0];
297
+ if (!binaryHex) {
298
+ throw new Error('Pyth update missing binary data');
299
+ }
300
+ const binary = Buffer.from(binaryHex, 'hex');
287
301
  return { binary, parsed };
288
302
  }
289
303
 
@@ -291,7 +305,7 @@ export class PythCollector extends AbstractCollector {
291
305
  requiredFeeds: HexString[],
292
306
  fetchConfig?: FetchConfig,
293
307
  ): Promise<PythFeedUpdateType> {
294
- return proxyFetchRetries(this.#getPythFeedsUpdates(requiredFeeds), fetchConfig);
308
+ return proxyFetchRetries(() => this.#getPythFeedsUpdates(requiredFeeds), fetchConfig);
295
309
  }
296
310
 
297
311
  /**
@@ -12,22 +12,23 @@ export class BackendPriceSource extends PriceSource {
12
12
  }
13
13
 
14
14
  async loadOracleData(fetchConfig: FetchConfig = DefaultFetchConfig): Promise<OutputData[]> {
15
- const fetchPromise = fetch(`https://${this._endpoint}/api/prices`, {
16
- headers: { accept: 'application/json' },
17
- signal: AbortSignal.timeout(fetchConfig.timeout),
18
- }).then(async (response) => {
19
- const resp = await response.json();
20
- const data = resp as Record<string, string>;
21
- let outputData: OutputData[] = [];
15
+ return await proxyFetchRetries(async () => {
16
+ const response = await fetch(`https://${this._endpoint}/api/prices`, {
17
+ headers: { accept: 'application/json' },
18
+ signal: AbortSignal.timeout(fetchConfig.timeout),
19
+ });
20
+ if (!response.ok) {
21
+ const body = await response.text().catch(() => '');
22
+ throw new Error(`HTTP error! status: ${response.status}${body ? `, body: ${body}` : ''}`);
23
+ }
24
+ const data = (await response.json()) as Record<string, string>;
22
25
 
26
+ let outputData: OutputData[] = [];
23
27
  for (const nft of this._nfts) {
24
28
  outputData.push({ oracleId: nft.id, data: data[nft.address] });
25
29
  }
26
-
27
30
  return outputData;
28
- });
29
-
30
- return await proxyFetchRetries(fetchPromise, fetchConfig);
31
+ }, fetchConfig);
31
32
  }
32
33
 
33
34
  parsePrices(outputData: OutputData): RawPriceData {
@@ -5,22 +5,23 @@ export class IcpPriceSource extends BackendPriceSource {
5
5
  protected priceSourceName: string = 'IcpPriceSource';
6
6
 
7
7
  async loadOracleData(fetchConfig: FetchConfig = DefaultFetchConfig): Promise<OutputData[]> {
8
- const fetchPromise = fetch(`https://${this._endpoint}/prices`, {
9
- headers: { accept: 'application/json' },
10
- signal: AbortSignal.timeout(fetchConfig.timeout)
11
- }).then(async (response) => {
8
+ return await proxyFetchRetries(async () => {
9
+ const response = await fetch(`https://${this._endpoint}/prices`, {
10
+ headers: { accept: 'application/json' },
11
+ signal: AbortSignal.timeout(fetchConfig.timeout)
12
+ });
13
+ if (!response.ok) {
14
+ const body = await response.text().catch(() => '');
15
+ throw new Error(`HTTP error! status: ${response.status}${body ? `, body: ${body}` : ''}`);
16
+ }
12
17
  const data = (await response.json()) as Record<string, string>;
13
18
 
14
19
  let outputData: OutputData[] = [];
15
-
16
20
  for (const nft of this._nfts) {
17
21
  outputData.push({oracleId: nft.id, data: data[nft.address] })
18
22
  }
19
-
20
23
  return outputData;
21
- });
22
-
23
- return await proxyFetchRetries(fetchPromise, fetchConfig);
24
+ }, fetchConfig);
24
25
  }
25
26
  }
26
27
 
@@ -0,0 +1,19 @@
1
+ import { Address } from "@ton/core";
2
+ import { bigIntToBuffer } from "./sha256BigInt";
3
+
4
+ export function calculateCloseAddress(address: Address, closeToAddress: Address): Address {
5
+ const curHashpart = BigInt('0x' + address.hash.toString('hex'));
6
+ const desiredHashpart = BigInt('0x' + closeToAddress.hash.toString('hex'));
7
+
8
+ const rewriteBits = 8;
9
+ const mask = (1n << BigInt(256 - rewriteBits)) - 1n;
10
+ const antimask = invertBigInt(mask, 256);
11
+
12
+ const newHashpart = (curHashpart & mask) | (desiredHashpart & antimask);
13
+ return new Address(0, bigIntToBuffer(newHashpart));
14
+ }
15
+
16
+ function invertBigInt(value: bigint, bits: number): bigint {
17
+ const maxValue = (1n << BigInt(bits)) - 1n;
18
+ return value ^ maxValue;
19
+ }
@@ -1,6 +1,7 @@
1
1
  import { Address, beginCell, Cell, storeStateInit } from '@ton/core';
2
2
  import { PoolAssetConfig } from '../types/Master';
3
3
  import { UNDEFINED_ASSET } from '../constants/assets';
4
+ import { calculateCloseAddress } from './fivaUtils';
4
5
 
5
6
  function getUserJettonData(ownerAddress: Address, assetName: string, jettonWalletCode: Cell, jettonMasterAddress: Address) {
6
7
  switch (assetName) {
@@ -15,6 +16,7 @@ function getUserJettonData(ownerAddress: Address, assetName: string, jettonWalle
15
16
  .storeAddress(jettonMasterAddress)
16
17
  .endCell();
17
18
  case 'PT_tsUSDe_01Sep2025':
19
+ case 'PT_tsUSDe_18Dec2025':
18
20
  return beginCell()
19
21
  .storeCoins(0)
20
22
  .storeAddress(ownerAddress)
@@ -67,7 +69,7 @@ export function getUserJettonWallet(ownerAddress: Address, poolAssetConfig: Pool
67
69
 
68
70
  const jettonData = getUserJettonData(ownerAddress, assetName, jettonWalletCode, poolAssetConfig.jettonMasterAddress);
69
71
 
70
- const stateInit = beginCell()
72
+ let stateInit = beginCell()
71
73
  .store(
72
74
  storeStateInit({
73
75
  code: jettonWalletCode,
@@ -76,5 +78,20 @@ export function getUserJettonWallet(ownerAddress: Address, poolAssetConfig: Pool
76
78
  )
77
79
  .endCell();
78
80
 
81
+
82
+ if (poolAssetConfig.name === 'PT_tsUSDe_18Dec2025') {
83
+ stateInit = beginCell()
84
+ .storeUint(1, 1) // fixed_prefix_length
85
+ .storeUint(8, 5) // rewrite_bits
86
+ .storeUint(0, 1) // special (Maybe=0)
87
+ .storeMaybeRef(jettonWalletCode) // code (Maybe)
88
+ .storeMaybeRef(jettonData) // data (Maybe)
89
+ .storeUint(0, 1) // libraries empty
90
+ .endCell();
91
+
92
+ const addr = new Address(0, stateInit.hash());
93
+ return calculateCloseAddress(addr, poolAssetConfig.jettonMasterAddress);
94
+ }
95
+
79
96
  return new Address(0, stateInit.hash());
80
97
  }
@@ -23,7 +23,7 @@ export const DefaultFetchConfig: FetchConfig = {
23
23
  timeout: 1000,
24
24
  };
25
25
 
26
- export async function proxyFetchRetries<T>(fetch: Promise<T>, config: FetchConfig = DefaultFetchConfig) {
26
+ export async function proxyFetchRetries<T>(factory: () => Promise<T>, config: FetchConfig = DefaultFetchConfig) {
27
27
  let lastError: Error | null = null;
28
28
  for (let attempt = 0; attempt <= config.retries; attempt++) {
29
29
  try {
@@ -31,7 +31,9 @@ export async function proxyFetchRetries<T>(fetch: Promise<T>, config: FetchConfi
31
31
  setTimeout(() => reject(new Error('Request timeout')), config.timeout);
32
32
  });
33
33
 
34
- return await Promise.race([fetch, timeoutPromise]);
34
+ // Create a fresh promise per attempt
35
+ const result = await Promise.race([factory(), timeoutPromise]);
36
+ return result;
35
37
  } catch (error) {
36
38
  lastError = error instanceof Error ? error : new Error(String(error));
37
39