@evaafi/sdk 0.6.4-a → 0.6.4-b
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/feeds.d.ts +27 -0
- package/dist/api/feeds.js +67 -0
- package/dist/api/pyth.d.ts +16 -0
- package/dist/api/pyth.js +39 -0
- package/dist/constants/general.d.ts +3 -3
- package/dist/constants/general.js +3 -3
- package/dist/constants/pools.js +1 -1
- package/dist/prices/Types.d.ts +1 -0
- package/dist/prices/sources/Iota.d.ts +39 -0
- package/dist/prices/sources/Iota.js +49 -0
- package/dist/prices/utils.d.ts +1 -0
- package/dist/rewards/RewardMaster.d.ts +1 -0
- package/dist/rewards/RewardUser.d.ts +1 -0
- package/dist/types/Master.d.ts +1 -0
- package/dist/types/MasterRewards.d.ts +1 -0
- package/dist/types/UserRewards.d.ts +1 -0
- package/dist/utils/sha256BigInt.d.ts +1 -0
- package/package.json +1 -1
- package/src/constants/general.ts +3 -3
- package/src/constants/pools.ts +1 -1
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
3
|
+
import { Buffer } from "buffer";
|
|
4
|
+
import { Dictionary } from "@ton/ton";
|
|
5
|
+
export declare const PYTH_TON_PRICE_FEED_ID = "0x8963217838ab4cf5cadc172203c1f0b763fbaa45f346d8ee50ba994bbcac3026";
|
|
6
|
+
export declare const PYTH_NOT_PRICE_FEED_ID = "0x75ec6f04d4bded6afdc1440689be4402dd1e23d2ff2c21e081871eb2739ceb36";
|
|
7
|
+
export declare const PYTH_DOGS_PRICE_FEED_ID = "0x3b75dbeeb6310f6264c812dd8411a6b30dc6d02cec4bca2447c88335127564f4";
|
|
8
|
+
export declare const PYTH_USDT_PRICE_FEED_ID = "0x2b89b9dc8fdf9f34709a5b106b472f0f39bb6ca9ce04b0fd7f2e971688e2e53b";
|
|
9
|
+
export declare const PYTH_STTON_PRICE_FEED_ID = "0x9145e059026a4d5a46f3b96408f7e572e33b3257b9c2dbe8dba551c772762002";
|
|
10
|
+
export declare const PYTH_TSTON_PRICE_FEED_ID = "0x3d1784128eeab5961ec60648fe497d3901eebd211b7f51e4bb0db9f024977d25";
|
|
11
|
+
export declare const PYTH_USDC_PRICE_FEED_ID = "0xeaa020c61cc479712813461ce153894a96a6c00b21ed0cfc2798d1f9a9e9c94a";
|
|
12
|
+
export declare function bigintToBuffer(value: bigint, size: number): Buffer;
|
|
13
|
+
export declare const packConnectedFeeds: (evaa_id: bigint, reffered_id: bigint) => Buffer;
|
|
14
|
+
export declare const EVAA_TON_PRICE_FEED_ID: bigint;
|
|
15
|
+
export declare const EVAA_NOT_PRICE_FEED_ID: bigint;
|
|
16
|
+
export declare const EVAA_DOGS_PRICE_FEED_ID: bigint;
|
|
17
|
+
export declare const EVAA_USDT_PRICE_FEED_ID: bigint;
|
|
18
|
+
export declare const EVAA_STTON_PRICE_FEED_ID: bigint;
|
|
19
|
+
export declare const EVAA_TSTON_PRICE_FEED_ID: bigint;
|
|
20
|
+
export declare const EVAA_USDC_PRICE_FEED_ID: bigint;
|
|
21
|
+
export declare const DEFAULT_FEEDS_MAP: Dictionary<bigint, Buffer>;
|
|
22
|
+
export declare const TEST_FEEDS_MAP: Dictionary<bigint, Buffer>;
|
|
23
|
+
export type FeedMapItem = {
|
|
24
|
+
evaaId: bigint;
|
|
25
|
+
referredPythFeed: bigint;
|
|
26
|
+
};
|
|
27
|
+
export declare function parseFeedsMapDict(dict: Dictionary<bigint, Buffer>): Map<bigint, FeedMapItem>;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseFeedsMapDict = exports.TEST_FEEDS_MAP = exports.DEFAULT_FEEDS_MAP = exports.EVAA_USDC_PRICE_FEED_ID = exports.EVAA_TSTON_PRICE_FEED_ID = exports.EVAA_STTON_PRICE_FEED_ID = exports.EVAA_USDT_PRICE_FEED_ID = exports.EVAA_DOGS_PRICE_FEED_ID = exports.EVAA_NOT_PRICE_FEED_ID = exports.EVAA_TON_PRICE_FEED_ID = exports.packConnectedFeeds = exports.bigintToBuffer = exports.PYTH_USDC_PRICE_FEED_ID = exports.PYTH_TSTON_PRICE_FEED_ID = exports.PYTH_STTON_PRICE_FEED_ID = exports.PYTH_USDT_PRICE_FEED_ID = exports.PYTH_DOGS_PRICE_FEED_ID = exports.PYTH_NOT_PRICE_FEED_ID = exports.PYTH_TON_PRICE_FEED_ID = void 0;
|
|
4
|
+
const buffer_1 = require("buffer");
|
|
5
|
+
const ton_1 = require("@ton/ton");
|
|
6
|
+
const assets_1 = require("../constants/assets");
|
|
7
|
+
exports.PYTH_TON_PRICE_FEED_ID = "0x8963217838ab4cf5cadc172203c1f0b763fbaa45f346d8ee50ba994bbcac3026";
|
|
8
|
+
exports.PYTH_NOT_PRICE_FEED_ID = "0x75ec6f04d4bded6afdc1440689be4402dd1e23d2ff2c21e081871eb2739ceb36";
|
|
9
|
+
exports.PYTH_DOGS_PRICE_FEED_ID = "0x3b75dbeeb6310f6264c812dd8411a6b30dc6d02cec4bca2447c88335127564f4";
|
|
10
|
+
exports.PYTH_USDT_PRICE_FEED_ID = "0x2b89b9dc8fdf9f34709a5b106b472f0f39bb6ca9ce04b0fd7f2e971688e2e53b";
|
|
11
|
+
exports.PYTH_STTON_PRICE_FEED_ID = "0x9145e059026a4d5a46f3b96408f7e572e33b3257b9c2dbe8dba551c772762002";
|
|
12
|
+
exports.PYTH_TSTON_PRICE_FEED_ID = "0x3d1784128eeab5961ec60648fe497d3901eebd211b7f51e4bb0db9f024977d25";
|
|
13
|
+
exports.PYTH_USDC_PRICE_FEED_ID = "0xeaa020c61cc479712813461ce153894a96a6c00b21ed0cfc2798d1f9a9e9c94a";
|
|
14
|
+
function bigintToBuffer(value, size) {
|
|
15
|
+
if (value < 0n) {
|
|
16
|
+
throw new Error('Only non-negative bigint is supported');
|
|
17
|
+
}
|
|
18
|
+
// it's questionable whether it stores in LE or BE
|
|
19
|
+
// and what option will TVM use, now by default it's BE
|
|
20
|
+
const hex = value.toString(16);
|
|
21
|
+
const padded = hex.padStart(size * 2, '0');
|
|
22
|
+
return buffer_1.Buffer.from(padded, 'hex');
|
|
23
|
+
}
|
|
24
|
+
exports.bigintToBuffer = bigintToBuffer;
|
|
25
|
+
const packConnectedFeeds = (evaa_id, reffered_id) => {
|
|
26
|
+
return buffer_1.Buffer.concat([bigintToBuffer(evaa_id, 32), bigintToBuffer(reffered_id, 32)]);
|
|
27
|
+
};
|
|
28
|
+
exports.packConnectedFeeds = packConnectedFeeds;
|
|
29
|
+
exports.EVAA_TON_PRICE_FEED_ID = assets_1.ASSET_ID.TON;
|
|
30
|
+
exports.EVAA_NOT_PRICE_FEED_ID = assets_1.ASSET_ID.NOT;
|
|
31
|
+
exports.EVAA_DOGS_PRICE_FEED_ID = assets_1.ASSET_ID.DOGS;
|
|
32
|
+
exports.EVAA_USDT_PRICE_FEED_ID = assets_1.ASSET_ID.USDT;
|
|
33
|
+
exports.EVAA_STTON_PRICE_FEED_ID = assets_1.ASSET_ID.stTON;
|
|
34
|
+
exports.EVAA_TSTON_PRICE_FEED_ID = assets_1.ASSET_ID.tsTON;
|
|
35
|
+
exports.EVAA_USDC_PRICE_FEED_ID = assets_1.ASSET_ID.jUSDC;
|
|
36
|
+
exports.DEFAULT_FEEDS_MAP = (() => {
|
|
37
|
+
const map = ton_1.Dictionary.empty();
|
|
38
|
+
map.set(BigInt(exports.PYTH_TON_PRICE_FEED_ID), (0, exports.packConnectedFeeds)(exports.EVAA_TON_PRICE_FEED_ID, 0n));
|
|
39
|
+
map.set(BigInt(exports.PYTH_USDT_PRICE_FEED_ID), (0, exports.packConnectedFeeds)(exports.EVAA_USDT_PRICE_FEED_ID, 0n));
|
|
40
|
+
map.set(BigInt(exports.PYTH_NOT_PRICE_FEED_ID), (0, exports.packConnectedFeeds)(exports.EVAA_NOT_PRICE_FEED_ID, 0n));
|
|
41
|
+
map.set(BigInt(exports.PYTH_DOGS_PRICE_FEED_ID), (0, exports.packConnectedFeeds)(exports.EVAA_DOGS_PRICE_FEED_ID, 0n));
|
|
42
|
+
map.set(BigInt(exports.PYTH_STTON_PRICE_FEED_ID), (0, exports.packConnectedFeeds)(exports.EVAA_STTON_PRICE_FEED_ID, BigInt(exports.PYTH_TON_PRICE_FEED_ID)));
|
|
43
|
+
map.set(BigInt(exports.PYTH_TSTON_PRICE_FEED_ID), (0, exports.packConnectedFeeds)(exports.EVAA_TSTON_PRICE_FEED_ID, BigInt(exports.PYTH_TON_PRICE_FEED_ID)));
|
|
44
|
+
return map;
|
|
45
|
+
})();
|
|
46
|
+
exports.TEST_FEEDS_MAP = (() => {
|
|
47
|
+
const map = ton_1.Dictionary.empty();
|
|
48
|
+
map.set(BigInt(exports.PYTH_TON_PRICE_FEED_ID), (0, exports.packConnectedFeeds)(exports.EVAA_TON_PRICE_FEED_ID, 0n));
|
|
49
|
+
map.set(BigInt(exports.PYTH_USDT_PRICE_FEED_ID), (0, exports.packConnectedFeeds)(exports.EVAA_USDT_PRICE_FEED_ID, 0n));
|
|
50
|
+
map.set(BigInt(exports.PYTH_STTON_PRICE_FEED_ID), (0, exports.packConnectedFeeds)(exports.EVAA_STTON_PRICE_FEED_ID, BigInt(exports.PYTH_TON_PRICE_FEED_ID)));
|
|
51
|
+
map.set(BigInt(exports.PYTH_TSTON_PRICE_FEED_ID), (0, exports.packConnectedFeeds)(exports.EVAA_TSTON_PRICE_FEED_ID, BigInt(exports.PYTH_TON_PRICE_FEED_ID)));
|
|
52
|
+
map.set(BigInt(exports.PYTH_USDC_PRICE_FEED_ID), (0, exports.packConnectedFeeds)(exports.EVAA_USDC_PRICE_FEED_ID, 0n));
|
|
53
|
+
return map;
|
|
54
|
+
})();
|
|
55
|
+
function parseFeedsMapDict(dict) {
|
|
56
|
+
const parsedData = new Map();
|
|
57
|
+
for (const key of dict.keys()) {
|
|
58
|
+
const buffer = dict.get(key);
|
|
59
|
+
const hex1 = '0x' + buffer.toString('hex', 0, 32);
|
|
60
|
+
const hex2 = '0x' + buffer.toString('hex', 32);
|
|
61
|
+
const evaaId = BigInt(hex1);
|
|
62
|
+
const referredPythFeed = BigInt(hex2);
|
|
63
|
+
parsedData.set(key, { evaaId, referredPythFeed });
|
|
64
|
+
}
|
|
65
|
+
return parsedData;
|
|
66
|
+
}
|
|
67
|
+
exports.parseFeedsMapDict = parseFeedsMapDict;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Address } from "@ton/ton";
|
|
2
|
+
import { Cell } from "@ton/core";
|
|
3
|
+
export declare function makePythProxyMessage(pythAddress: Address, targetAddress: Address, attachedTons: bigint, priceUpdateData: Cell, targetPythFeeds: Cell, minPublishTime: number | bigint, maxPublishTime: number | bigint, operationPayload: Cell): Cell;
|
|
4
|
+
/**
|
|
5
|
+
* This operation jetton transfer notification sends to master address
|
|
6
|
+
* @param args
|
|
7
|
+
*/
|
|
8
|
+
export declare function makeOnchainGetterMasterMessage(args: {
|
|
9
|
+
queryId: number | bigint;
|
|
10
|
+
opCode: number | bigint;
|
|
11
|
+
updateDataCell: Cell;
|
|
12
|
+
targetFeedsCell: Cell;
|
|
13
|
+
publishGap: number | bigint;
|
|
14
|
+
maxStaleness: number | bigint;
|
|
15
|
+
operationPayload: Cell;
|
|
16
|
+
}): Cell;
|
package/dist/api/pyth.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.makeOnchainGetterMasterMessage = exports.makePythProxyMessage = void 0;
|
|
4
|
+
// user --> pyth --> target
|
|
5
|
+
const ton_1 = require("@ton/ton");
|
|
6
|
+
function makePythProxyMessage(pythAddress, targetAddress, attachedTons, priceUpdateData, targetPythFeeds, minPublishTime, maxPublishTime, operationPayload) {
|
|
7
|
+
return (0, ton_1.beginCell)()
|
|
8
|
+
.storeUint(0x18, 6)
|
|
9
|
+
.storeAddress(pythAddress)
|
|
10
|
+
.storeCoins(attachedTons)
|
|
11
|
+
.storeUint(0, 107)
|
|
12
|
+
.storeUint(5, 32) // pyth::op_parse_price_feed_updates
|
|
13
|
+
.storeRef(priceUpdateData)
|
|
14
|
+
.storeRef(targetPythFeeds)
|
|
15
|
+
.storeUint(minPublishTime, 64)
|
|
16
|
+
.storeUint(maxPublishTime, 64)
|
|
17
|
+
.storeAddress(targetAddress) // inform pyth where to send positive response
|
|
18
|
+
.storeRef(operationPayload)
|
|
19
|
+
.endCell();
|
|
20
|
+
}
|
|
21
|
+
exports.makePythProxyMessage = makePythProxyMessage;
|
|
22
|
+
/**
|
|
23
|
+
* This operation jetton transfer notification sends to master address
|
|
24
|
+
* @param args
|
|
25
|
+
*/
|
|
26
|
+
function makeOnchainGetterMasterMessage(args) {
|
|
27
|
+
return (0, ton_1.beginCell)()
|
|
28
|
+
.storeUint(args.opCode, 32)
|
|
29
|
+
.storeUint(args.queryId, 64)
|
|
30
|
+
.storeRef((0, ton_1.beginCell)()
|
|
31
|
+
.storeRef(args.updateDataCell)
|
|
32
|
+
.storeRef(args.targetFeedsCell)
|
|
33
|
+
.storeUint(args.publishGap, 64)
|
|
34
|
+
.storeUint(args.maxStaleness, 64)
|
|
35
|
+
.endCell())
|
|
36
|
+
.storeRef(args.operationPayload)
|
|
37
|
+
.endCell();
|
|
38
|
+
}
|
|
39
|
+
exports.makeOnchainGetterMasterMessage = makeOnchainGetterMasterMessage;
|
|
@@ -15,13 +15,13 @@ export declare const MASTER_CONSTANTS: {
|
|
|
15
15
|
};
|
|
16
16
|
export declare const NULL_ADDRESS: Address;
|
|
17
17
|
export declare const EVAA_MASTER_MAINNET: Address;
|
|
18
|
-
export declare const MAINNET_VERSION =
|
|
18
|
+
export declare const MAINNET_VERSION = 7;
|
|
19
19
|
export declare const EVAA_MASTER_TESTNET: Address;
|
|
20
20
|
export declare const TESTNET_VERSION = 0;
|
|
21
21
|
export declare const EVAA_LP_MAINNET: Address;
|
|
22
|
-
export declare const EVAA_LP_MAINNET_VERSION =
|
|
22
|
+
export declare const EVAA_LP_MAINNET_VERSION = 4;
|
|
23
23
|
export declare const EVAA_ALTS_MAINNET: Address;
|
|
24
|
-
export declare const EVAA_ALTS_MAINNET_VERSION =
|
|
24
|
+
export declare const EVAA_ALTS_MAINNET_VERSION = 1;
|
|
25
25
|
export declare const EVAA_STABLE_MAINNET: Address;
|
|
26
26
|
export declare const STABLE_VERSION = 0;
|
|
27
27
|
export declare const EVAA_ETHENA_MAINNET: Address;
|
|
@@ -18,13 +18,13 @@ exports.MASTER_CONSTANTS = {
|
|
|
18
18
|
};
|
|
19
19
|
exports.NULL_ADDRESS = core_1.Address.parse('UQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJKZ');
|
|
20
20
|
exports.EVAA_MASTER_MAINNET = core_1.Address.parse('EQC8rUZqR_pWV1BylWUlPNBzyiTYVoBEmQkMIQDZXICfnuRr');
|
|
21
|
-
exports.MAINNET_VERSION =
|
|
21
|
+
exports.MAINNET_VERSION = 7;
|
|
22
22
|
exports.EVAA_MASTER_TESTNET = core_1.Address.parse('kQBae_Pt-NcxX0yhNnsYyK-Kh6ZBnIUQhxheKTvNLTgZf7AV');
|
|
23
23
|
exports.TESTNET_VERSION = 0;
|
|
24
24
|
exports.EVAA_LP_MAINNET = core_1.Address.parse('EQBIlZX2URWkXCSg3QF2MJZU-wC5XkBoLww-hdWk2G37Jc6N');
|
|
25
|
-
exports.EVAA_LP_MAINNET_VERSION =
|
|
25
|
+
exports.EVAA_LP_MAINNET_VERSION = 4;
|
|
26
26
|
exports.EVAA_ALTS_MAINNET = core_1.Address.parse('EQANURVS3fhBO9bivig34iyJQi97FhMbpivo1aUEAS2GYSu-');
|
|
27
|
-
exports.EVAA_ALTS_MAINNET_VERSION =
|
|
27
|
+
exports.EVAA_ALTS_MAINNET_VERSION = 1;
|
|
28
28
|
exports.EVAA_STABLE_MAINNET = core_1.Address.parse('EQCdIdXf1kA_2Hd9mbGzSFDEPA-Px-et8qTWHEXgRGo0K3zd');
|
|
29
29
|
exports.STABLE_VERSION = 0;
|
|
30
30
|
exports.EVAA_ETHENA_MAINNET = core_1.Address.parse('EQCn95X_qLJa5VUXfyIQkWDH2iq3PTatsO4esunMaIsnyyeW');
|
package/dist/constants/pools.js
CHANGED
|
@@ -64,7 +64,7 @@ exports.MAINNET_LP_POOL_CONFIG = {
|
|
|
64
64
|
masterConstants: general_1.MASTER_CONSTANTS,
|
|
65
65
|
oracles: general_1.ORACLES_LP,
|
|
66
66
|
minimalOracles: 3,
|
|
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
|
|
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 /*, TONUSDT_STONFI_MAINNET*/],
|
|
68
68
|
lendingCode: general_1.LENDING_CODE,
|
|
69
69
|
};
|
|
70
70
|
exports.MAINNET_ALTS_POOL_CONFIG = {
|
package/dist/prices/Types.d.ts
CHANGED
|
@@ -0,0 +1,39 @@
|
|
|
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 {};
|
|
@@ -0,0 +1,49 @@
|
|
|
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;
|
package/dist/prices/utils.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
2
3
|
import { Cell, Dictionary, Slice } from "@ton/core";
|
|
3
4
|
import { OraclePricesData, PriceData, PriceSource, PriceSourcesConfig, RawPriceData } from "..";
|
|
4
5
|
import { Oracle, OracleNFT, PoolConfig } from "../types/Master";
|
package/dist/types/Master.d.ts
CHANGED
package/package.json
CHANGED
package/src/constants/general.ts
CHANGED
|
@@ -20,13 +20,13 @@ export const MASTER_CONSTANTS = {
|
|
|
20
20
|
export const NULL_ADDRESS = Address.parse('UQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJKZ');
|
|
21
21
|
|
|
22
22
|
export const EVAA_MASTER_MAINNET = Address.parse('EQC8rUZqR_pWV1BylWUlPNBzyiTYVoBEmQkMIQDZXICfnuRr');
|
|
23
|
-
export const MAINNET_VERSION =
|
|
23
|
+
export const MAINNET_VERSION = 7;
|
|
24
24
|
export const EVAA_MASTER_TESTNET = Address.parse('kQBae_Pt-NcxX0yhNnsYyK-Kh6ZBnIUQhxheKTvNLTgZf7AV');
|
|
25
25
|
export const TESTNET_VERSION = 0;
|
|
26
26
|
export const EVAA_LP_MAINNET = Address.parse('EQBIlZX2URWkXCSg3QF2MJZU-wC5XkBoLww-hdWk2G37Jc6N');
|
|
27
|
-
export const EVAA_LP_MAINNET_VERSION =
|
|
27
|
+
export const EVAA_LP_MAINNET_VERSION = 4;
|
|
28
28
|
export const EVAA_ALTS_MAINNET = Address.parse('EQANURVS3fhBO9bivig34iyJQi97FhMbpivo1aUEAS2GYSu-');
|
|
29
|
-
export const EVAA_ALTS_MAINNET_VERSION =
|
|
29
|
+
export const EVAA_ALTS_MAINNET_VERSION = 1;
|
|
30
30
|
export const EVAA_STABLE_MAINNET = Address.parse('EQCdIdXf1kA_2Hd9mbGzSFDEPA-Px-et8qTWHEXgRGo0K3zd');
|
|
31
31
|
export const STABLE_VERSION = 0;
|
|
32
32
|
|
package/src/constants/pools.ts
CHANGED
|
@@ -115,7 +115,7 @@ export const MAINNET_LP_POOL_CONFIG: PoolConfig = {
|
|
|
115
115
|
masterConstants: MASTER_CONSTANTS,
|
|
116
116
|
oracles: ORACLES_LP,
|
|
117
117
|
minimalOracles: 3,
|
|
118
|
-
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*/],
|
|
119
119
|
lendingCode: LENDING_CODE,
|
|
120
120
|
};
|
|
121
121
|
|