@evaafi/sdk 0.6.1-a → 0.6.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.
- package/LICENSE.md +7 -0
- package/dist/api/liquidation.js +1 -3
- package/dist/api/math.js +0 -2
- package/dist/api/parser.js +7 -2
- package/dist/api/prices.d.ts +5 -2
- package/dist/api/prices.js +35 -13
- package/dist/constants/assets.d.ts +8 -0
- package/dist/constants/assets.js +31 -1
- package/dist/constants/general.d.ts +4 -1
- package/dist/constants/general.js +11 -18
- package/dist/constants/pools.d.ts +1 -0
- package/dist/constants/pools.js +18 -2
- package/dist/contracts/MasterContract.d.ts +5 -0
- package/dist/contracts/MasterContract.js +6 -0
- package/dist/index.d.ts +3 -3
- package/dist/index.js +7 -1
- package/dist/prices/Prices.d.ts +9 -0
- package/dist/prices/Prices.js +43 -0
- package/dist/prices/PricesCollector.d.ts +12 -0
- package/dist/prices/PricesCollector.js +123 -0
- package/dist/prices/Types.d.ts +33 -0
- package/dist/prices/Types.js +11 -0
- package/dist/prices/constants.d.ts +1 -0
- package/dist/prices/constants.js +4 -0
- package/dist/prices/index.d.ts +6 -0
- package/dist/prices/index.js +22 -0
- package/dist/prices/sources/Backend.d.ts +13 -0
- package/dist/prices/sources/Backend.js +52 -0
- package/dist/prices/sources/Icp.d.ts +10 -0
- package/dist/prices/sources/Icp.js +23 -0
- package/dist/prices/sources/Iota.d.ts +39 -0
- package/dist/prices/sources/Iota.js +49 -0
- package/dist/prices/sources/PriceSource.d.ts +14 -0
- package/dist/prices/sources/PriceSource.js +26 -0
- package/dist/prices/sources/index.d.ts +4 -0
- package/dist/prices/sources/index.js +20 -0
- package/dist/prices/utils.d.ts +23 -0
- package/dist/prices/utils.js +148 -0
- package/dist/types/Master.d.ts +1 -0
- package/dist/types/User.d.ts +1 -0
- package/dist/utils/userJettonWallet.js +42 -43
- package/dist/utils/utils.d.ts +1 -0
- package/dist/utils/utils.js +5 -1
- package/package.json +4 -2
- package/src/api/liquidation.ts +0 -1
- package/src/api/math.ts +1 -2
- package/src/api/parser.ts +6 -4
- package/src/api/prices.ts +20 -7
- package/src/constants/assets.ts +57 -0
- package/src/constants/general.ts +10 -19
- package/src/constants/pools.ts +20 -4
- package/src/contracts/MasterContract.ts +8 -1
- package/src/index.ts +7 -2
- package/src/prices/Prices.ts +32 -0
- package/src/prices/PricesCollector.ts +139 -0
- package/src/prices/Types.ts +44 -0
- package/src/prices/constants.ts +1 -0
- package/src/prices/index.ts +6 -0
- package/src/prices/sources/Backend.ts +62 -0
- package/src/prices/sources/Icp.ts +27 -0
- package/src/prices/sources/Iota.ts +90 -0
- package/src/prices/sources/PriceSource.ts +35 -0
- package/src/prices/sources/index.ts +4 -0
- package/src/prices/utils.ts +170 -0
- package/src/types/Master.ts +2 -1
- package/src/types/User.ts +2 -2
- package/src/utils/userJettonWallet.ts +43 -53
- package/src/utils/utils.ts +5 -1
- package/src/config.ts +0 -1
- package/src/types/Common.ts +0 -16
- package/src/utils/priceUtils.ts +0 -177
package/LICENSE.md
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
Copyright 2024 TON LANDING FOUNDATION
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
4
|
+
|
|
5
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
6
|
+
|
|
7
|
+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/dist/api/liquidation.js
CHANGED
|
@@ -121,9 +121,7 @@ principalsDict, pricesDict, assetsDataDict, assetsConfigDict, masterConstants) {
|
|
|
121
121
|
allowedCollateralValue = math_1.BigMath.min(allowedCollateralValue, math_1.BigMath.max(allowedCollateralValue / 2n, collateralThreshold));
|
|
122
122
|
}
|
|
123
123
|
const loanValue = toAssetWorth(loanInfo.balance, loanInfo.scale, loanInfo.price);
|
|
124
|
-
const baseLiquidationValue = math_1.BigMath.min(
|
|
125
|
-
// deductReserve(loanValue, reserveFactor, reserveFactorScale),
|
|
126
|
-
loanValue, deductLiquidationBonus(allowedCollateralValue, liquidationBonus, liquidationBonusScale));
|
|
124
|
+
const baseLiquidationValue = math_1.BigMath.min(loanValue, deductLiquidationBonus(allowedCollateralValue, liquidationBonus, liquidationBonusScale));
|
|
127
125
|
// calculate collateral amount
|
|
128
126
|
let collateralAmount = addLiquidationBonus(baseLiquidationValue, liquidationBonus, liquidationBonusScale);
|
|
129
127
|
collateralAmount = toAssetAmount(collateralAmount, collateralInfo.scale, collateralInfo.price);
|
package/dist/api/math.js
CHANGED
|
@@ -120,14 +120,12 @@ function getAgregatedBalances(assetsData, assetsConfig, principals, prices, mast
|
|
|
120
120
|
const price = prices.get(assetId);
|
|
121
121
|
const assetData = assetsData.get(assetId);
|
|
122
122
|
const assetConfig = assetsConfig.get(assetId);
|
|
123
|
-
// console.log('price', price);
|
|
124
123
|
if (principal < 0) {
|
|
125
124
|
user_total_borrow += presentValue(assetData.sRate, assetData.bRate, principal, masterConstants).amount * price / 10n ** assetConfig.decimals;
|
|
126
125
|
}
|
|
127
126
|
else {
|
|
128
127
|
user_total_supply += presentValue(assetData.sRate, assetData.bRate, principal, masterConstants).amount * price / 10n ** assetConfig.decimals;
|
|
129
128
|
}
|
|
130
|
-
// console.log('aggregated', assetId, presentValue(assetData.sRate, assetData.bRate, principal, masterConstants).type, presentValue(assetData.sRate, assetData.bRate, principal, masterConstants).amount * price / 10n ** assetConfig.decimals)
|
|
131
129
|
}
|
|
132
130
|
}
|
|
133
131
|
return { totalSupply: user_total_supply, totalBorrow: user_total_borrow };
|
package/dist/api/parser.js
CHANGED
|
@@ -183,7 +183,8 @@ function parseUserLiteData(userDataBOC, assetsData, assetsConfig, poolConfig, ap
|
|
|
183
183
|
const codeVersion = userSlice.loadCoins();
|
|
184
184
|
const masterAddress = userSlice.loadAddress();
|
|
185
185
|
const userAddress = userSlice.loadAddress();
|
|
186
|
-
const
|
|
186
|
+
const realPrincipals = userSlice.loadDict(core_1.Dictionary.Keys.BigUint(256), core_1.Dictionary.Values.BigInt(64));
|
|
187
|
+
const principalsDict = core_1.Dictionary.empty(core_1.Dictionary.Keys.BigUint(256), core_1.Dictionary.Values.BigInt(64));
|
|
187
188
|
const userState = userSlice.loadInt(64);
|
|
188
189
|
let trackingSupplyIndex = 0n;
|
|
189
190
|
let trackingBorrowIndex = 0n;
|
|
@@ -209,7 +210,7 @@ function parseUserLiteData(userDataBOC, assetsData, assetsConfig, poolConfig, ap
|
|
|
209
210
|
for (const [_, asset] of Object.entries(poolAssetsConfig)) {
|
|
210
211
|
const assetData = assetsData.get(asset.assetId);
|
|
211
212
|
const assetConfig = assetsConfig.get(asset.assetId);
|
|
212
|
-
let principal =
|
|
213
|
+
let principal = realPrincipals.get(asset.assetId) || 0n;
|
|
213
214
|
let balance = (0, math_1.presentValue)(assetData.sRate, assetData.bRate, principal, masterConstants);
|
|
214
215
|
if (applyDust && (principal > 0 && (principal < assetConfig.dust))) {
|
|
215
216
|
principal = 0n;
|
|
@@ -219,6 +220,9 @@ function parseUserLiteData(userDataBOC, assetsData, assetsConfig, poolConfig, ap
|
|
|
219
220
|
};
|
|
220
221
|
principalsDict.set(asset.assetId, 0n);
|
|
221
222
|
}
|
|
223
|
+
else {
|
|
224
|
+
principalsDict.set(asset.assetId, principal);
|
|
225
|
+
}
|
|
222
226
|
userBalances.set(asset.assetId, balance);
|
|
223
227
|
}
|
|
224
228
|
return {
|
|
@@ -227,6 +231,7 @@ function parseUserLiteData(userDataBOC, assetsData, assetsConfig, poolConfig, ap
|
|
|
227
231
|
masterAddress: masterAddress,
|
|
228
232
|
ownerAddress: userAddress,
|
|
229
233
|
principals: principalsDict,
|
|
234
|
+
realPrincipals: realPrincipals,
|
|
230
235
|
state: userState,
|
|
231
236
|
balances: userBalances,
|
|
232
237
|
trackingSupplyIndex: trackingSupplyIndex,
|
package/dist/api/prices.d.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
-
import { PriceData } from '../types/Common';
|
|
2
1
|
import { PoolConfig } from '../types/Master';
|
|
3
|
-
|
|
2
|
+
import { PriceData } from '../prices';
|
|
3
|
+
/**
|
|
4
|
+
* @deprecated Use PriceCollector istead of getPrices
|
|
5
|
+
*/
|
|
6
|
+
export declare function getPrices(endpoints?: string[], poolConfig?: PoolConfig): Promise<PriceData>;
|
package/dist/api/prices.js
CHANGED
|
@@ -1,35 +1,57 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getPrices = void 0;
|
|
4
|
-
const core_1 = require("@ton/core");
|
|
5
|
-
const priceUtils_1 = require("../utils/priceUtils");
|
|
6
4
|
const pools_1 = require("../constants/pools");
|
|
7
|
-
|
|
5
|
+
const prices_1 = require("../prices");
|
|
6
|
+
/**
|
|
7
|
+
* @deprecated Use PriceCollector istead of getPrices
|
|
8
|
+
*/
|
|
9
|
+
async function getPrices(endpoints = ["api.stardust-mainnet.iotaledger.net"], poolConfig = pools_1.MAINNET_POOL_CONFIG) {
|
|
8
10
|
if (endpoints.length == 0) {
|
|
9
11
|
throw new Error("Empty endpoint list");
|
|
10
12
|
}
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
+
const sources = {
|
|
14
|
+
iotaEndpoints: endpoints,
|
|
15
|
+
icpEndpoints: prices_1.DefaultPriceSourcesConfig.icpEndpoints,
|
|
16
|
+
backendEndpoints: prices_1.DefaultPriceSourcesConfig.backendEndpoints,
|
|
17
|
+
};
|
|
18
|
+
const priceCollector = new prices_1.PricesCollector(poolConfig, sources);
|
|
19
|
+
const prices = await priceCollector.getPrices();
|
|
20
|
+
return { dict: prices.dict, dataCell: prices.dataCell };
|
|
21
|
+
/*
|
|
22
|
+
Old code
|
|
23
|
+
const prices = await Promise.all(poolConfig.oracles.map(async x => await parsePrices(await loadPrices(x.address, endpoints), x.id)));
|
|
24
|
+
|
|
25
|
+
let acceptedPrices: RawPriceData[] = prices.filter(verifyPrices(poolConfig.poolAssetsConfig));
|
|
26
|
+
|
|
27
|
+
|
|
13
28
|
if (acceptedPrices.length < poolConfig.minimalOracles) {
|
|
14
29
|
throw new Error("Prices are outdated");
|
|
15
30
|
}
|
|
31
|
+
|
|
16
32
|
if (acceptedPrices.length > poolConfig.minimalOracles && acceptedPrices.length % 2 == 0) {
|
|
17
|
-
acceptedPrices = acceptedPrices.slice(0, acceptedPrices.length - 1);
|
|
33
|
+
acceptedPrices = acceptedPrices.slice(0, acceptedPrices.length - 1); // to reduce fees, MINIMAL_ORACLES_NUMBER is odd
|
|
18
34
|
}
|
|
35
|
+
|
|
19
36
|
if (acceptedPrices.length != poolConfig.minimalOracles) {
|
|
20
37
|
const sortedByTimestamp = acceptedPrices.slice().sort((a, b) => b.timestamp - a.timestamp);
|
|
21
38
|
const newerPrices = sortedByTimestamp.slice(0, poolConfig.minimalOracles);
|
|
22
39
|
acceptedPrices = newerPrices.sort((a, b) => a.oracleId - b.oracleId);
|
|
23
40
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
const
|
|
27
|
-
const
|
|
28
|
-
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
const medianData = poolConfig.poolAssetsConfig.map(asset => ({ assetId: asset.assetId, medianPrice: getMedianPrice(acceptedPrices, asset.assetId)}));
|
|
44
|
+
const packedMedianData = packAssetsData(medianData);
|
|
45
|
+
|
|
46
|
+
const oraclesData = acceptedPrices.map(x => ({oracle: {id: x.oracleId, pubkey: x.pubkey}, data: {timestamp: x.timestamp, prices: x.dict}, signature: x.signature}));
|
|
47
|
+
const packedOracleData = packOraclesData(oraclesData, poolConfig.poolAssetsConfig.map(x => x.assetId));
|
|
48
|
+
|
|
49
|
+
const dict = Dictionary.empty<bigint, bigint>();
|
|
29
50
|
medianData.forEach(x => dict.set(x.assetId, x.medianPrice));
|
|
51
|
+
|
|
30
52
|
return {
|
|
31
53
|
dict: dict,
|
|
32
|
-
dataCell:
|
|
33
|
-
}
|
|
54
|
+
dataCell: packPrices(packedMedianData, packedOracleData)
|
|
55
|
+
};*/
|
|
34
56
|
}
|
|
35
57
|
exports.getPrices = getPrices;
|
|
@@ -6,10 +6,14 @@ export declare const ASSET_ID: {
|
|
|
6
6
|
jUSDC: bigint;
|
|
7
7
|
stTON: bigint;
|
|
8
8
|
tsTON: bigint;
|
|
9
|
+
uTON: bigint;
|
|
9
10
|
TONUSDT_DEDUST: bigint;
|
|
10
11
|
TONUSDT_STONFI: bigint;
|
|
11
12
|
TON_STORM: bigint;
|
|
12
13
|
USDT_STORM: bigint;
|
|
14
|
+
NOT: bigint;
|
|
15
|
+
DOGS: bigint;
|
|
16
|
+
CATI: bigint;
|
|
13
17
|
};
|
|
14
18
|
export declare const UNDEFINED_ASSET: PoolAssetConfig;
|
|
15
19
|
export declare const TON_MAINNET: PoolAssetConfig;
|
|
@@ -25,3 +29,7 @@ export declare const STTON_TESTNET: PoolAssetConfig;
|
|
|
25
29
|
export declare const TONUSDT_DEDUST_MAINNET: PoolAssetConfig;
|
|
26
30
|
export declare const TON_STORM_MAINNET: PoolAssetConfig;
|
|
27
31
|
export declare const USDT_STORM_MAINNET: PoolAssetConfig;
|
|
32
|
+
export declare const CATI_MAINNET: PoolAssetConfig;
|
|
33
|
+
export declare const DOGS_MAINNET: PoolAssetConfig;
|
|
34
|
+
export declare const NOT_MAINNET: PoolAssetConfig;
|
|
35
|
+
export declare const UTON_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.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.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");
|
|
@@ -11,10 +11,16 @@ exports.ASSET_ID = {
|
|
|
11
11
|
jUSDC: (0, sha256BigInt_1.sha256Hash)('jUSDC'),
|
|
12
12
|
stTON: (0, sha256BigInt_1.sha256Hash)('stTON'),
|
|
13
13
|
tsTON: (0, sha256BigInt_1.sha256Hash)('tsTON'),
|
|
14
|
+
uTON: (0, sha256BigInt_1.sha256Hash)('uTON'),
|
|
15
|
+
// LP
|
|
14
16
|
TONUSDT_DEDUST: (0, sha256BigInt_1.sha256Hash)('TONUSDT_DEDUST'),
|
|
15
17
|
TONUSDT_STONFI: (0, sha256BigInt_1.sha256Hash)('TONUSDT_STONFI'),
|
|
16
18
|
TON_STORM: (0, sha256BigInt_1.sha256Hash)('TON_STORM'),
|
|
17
19
|
USDT_STORM: (0, sha256BigInt_1.sha256Hash)('USDT_STORM'),
|
|
20
|
+
// ALTS
|
|
21
|
+
NOT: (0, sha256BigInt_1.sha256Hash)('NOT'),
|
|
22
|
+
DOGS: (0, sha256BigInt_1.sha256Hash)('DOGS'),
|
|
23
|
+
CATI: (0, sha256BigInt_1.sha256Hash)('CATI'),
|
|
18
24
|
};
|
|
19
25
|
exports.UNDEFINED_ASSET = {
|
|
20
26
|
name: 'undefined_asset',
|
|
@@ -95,3 +101,27 @@ exports.USDT_STORM_MAINNET = {
|
|
|
95
101
|
jettonMasterAddress: core_1.Address.parse('EQCup4xxCulCcNwmOocM9HtDYPU8xe0449tQLp6a-5BLEegW'),
|
|
96
102
|
jettonWalletCode: core_1.Cell.fromBoc(Buffer.from('b5ee9c7241021301000380000114ff00f4a413f4bcf2c80b0102016202100202cd030f04add106380792000e8698180b8d8474289af81ed9e707d207d2018fd0018b8eb90fd0018fd001839d4da0001698f90c10807c53f52dd4742989a2ced9e7010c1080bc6a28cdd474318a22201ed9e701a9041082caf83de5d40405080c00888020d721ed44d0fa00fa40fa40d74c04d31f8200fff0228210178d4519ba0382107bdd97deba13b112f2f4d33f31fa003013a05023c85004fa0258cf1601cf16ccc9ed5401f603d33ffa00fa4021f007ed44d0fa00fa40fa40d74c5136a1522ac705f2e2c128c2fff2e2c2545255705202541304c85004fa0258cf1601cf16ccc921c8cb0113f40012f400cb00c97021f90074c8cb0212cb07cbffc9d004fa40f40431fa0020d749c200f2e2c48210178d4519c8cb1f1acb3f5008fa0223cf1601060176cf1626fa025007cf162591729171e2500aa815a0820a43d580a016bcf2e2c57007c9103741408040db3c4300c85004fa0258cf1601cf16ccc9ed5407002e778018c8cb055005cf165005fa0213cb6bccccc901fb0002f6ed44d0fa00fa40fa40d74c08d33ffa005151a005fa40fa40547c25705202541304c85004fa0258cf1601cf16ccc921c8cb0113f40012f400cb00c97021f90074c8cb0212cb07cbffc9d031536cc7050dc7051cb1f2e2c30afa0051a8a12195104a395f04e30d048208989680b60972fb0225d70b01c30003c20013090a014c521aa018a182107362d09cc8cb1f5240cb3f5003fa0201cf165008cf16c954253071db3c10350e0158b08e948210d53276dbc8cb1f14cb3f704055810082db3c923333e25003c85004fa0258cf1601cf16ccc9ed540b0030708018c8cb055004cf165004fa0212cb6a01cf17c901fb0002a08e843059db3ce06c22ed44d0fa00fa40fa40d74c10235f030182106d8e5e3cba8ea75202c705f2e2c1820898968070fb0201d70b3f8210d53276dbc8cb1fcb3f7001c912810082db3ce05f03840ff2f00d0e01bc30ed44d0fa00fa40fa40d74c06d33ffa00fa40305151a15248c705f2e2c126c2fff2e2c20582100ee6b280b9f2d2c782107bdd97dec8cb1fcb3f5004fa0221cf1658cf167001c952308040db3c4013c85004fa0258cf1601cf16ccc9ed540e002c718018c8cb055004cf165004fa0212cb6accc901fb000011f7d22186000797163402016611120021b5fe7da89a1f401f481f481ae9826be070001bb7605da89a1f401f481f481ae990c6f31b9d', 'hex'))[0],
|
|
97
103
|
};
|
|
104
|
+
exports.CATI_MAINNET = {
|
|
105
|
+
name: 'CATI',
|
|
106
|
+
assetId: exports.ASSET_ID.CATI,
|
|
107
|
+
jettonMasterAddress: core_1.Address.parse('EQD-cvR0Nz6XAyRBvbhz-abTrRC6sI5tvHvvpeQraV9UAAD7'),
|
|
108
|
+
jettonWalletCode: core_1.Cell.fromBoc(Buffer.from('b5ee9c7241021101000323000114ff00f4a413f4bcf2c80b0102016202030202cc0405001ba0f605da89a1f401f481f481a8610201d40607020120080900c30831c02497c138007434c0c05c6c2544d7c0fc03383e903e900c7e800c5c75c87e800c7e800c1cea6d0000b4c7e08403e29fa954882ea54c4d167c0278208405e3514654882ea58c511100fc02b80d60841657c1ef2ea4d67c02f817c12103fcbc2000113e910c1c2ebcb853600201200a0b0083d40106b90f6a2687d007d207d206a1802698fc1080bc6a28ca9105d41083deecbef09dd0958f97162e99f98fd001809d02811e428027d012c678b00e78b6664f6aa401f1503d33ffa00fa4021f001ed44d0fa00fa40fa40d4305136a1522ac705f2e2c128c2fff2e2c254344270542013541403c85004fa0258cf1601cf16ccc922c8cb0112f400f400cb00c920f9007074c8cb02ca07cbffc9d004fa40f40431fa0020d749c200f2e2c4778018c8cb055008cf1670fa0217cb6b13cc80c0201200d0e009e8210178d4519c8cb1f19cb3f5007fa0222cf165006cf1625fa025003cf16c95005cc2391729171e25008a813a08209c9c380a014bcf2e2c504c98040fb001023c85004fa0258cf1601cf16ccc9ed5402f73b51343e803e903e90350c0234cffe80145468017e903e9014d6f1c1551cdb5c150804d50500f214013e809633c58073c5b33248b232c044bd003d0032c0327e401c1d3232c0b281f2fff274140371c1472c7cb8b0c2be80146a2860822625a019ad822860822625a028062849e5c412440e0dd7c138c34975c2c0600f1000d73b51343e803e903e90350c01f4cffe803e900c145468549271c17cb8b049f0bffcb8b08160824c4b402805af3cb8b0e0841ef765f7b232c7c572cfd400fe8088b3c58073c5b25c60063232c14933c59c3e80b2dab33260103ec01004f214013e809633c58073c5b3327b552000705279a018a182107362d09cc8cb1f5230cb3f58fa025007cf165007cf16c9718010c8cb0524cf165006fa0215cb6a14ccc971fb0010241023007cc30023c200b08e218210d53276db708010c8cb055008cf165004fa0216cb6a12cb1f12cb3fc972fb0093356c21e203c85004fa0258cf1601cf16ccc9ed5495eaedd7', 'hex'))[0],
|
|
109
|
+
};
|
|
110
|
+
exports.DOGS_MAINNET = {
|
|
111
|
+
name: 'DOGS',
|
|
112
|
+
assetId: exports.ASSET_ID.DOGS,
|
|
113
|
+
jettonMasterAddress: core_1.Address.parse('EQCvxJy4eG8hyHBFsZ7eePxrRsUQSFE_jpptRAYBmcG_DOGS'),
|
|
114
|
+
jettonWalletCode: core_1.Cell.fromBoc(Buffer.from('b5ee9c7241010101002300084202ba2918c8947e9b25af9ac1b883357754173e5812f807a3d6e642a14709595395237ae3c3', 'hex'))[0],
|
|
115
|
+
};
|
|
116
|
+
exports.NOT_MAINNET = {
|
|
117
|
+
name: 'NOT',
|
|
118
|
+
assetId: exports.ASSET_ID.NOT,
|
|
119
|
+
jettonMasterAddress: core_1.Address.parse('EQAvlWFDxGF2lXm67y4yzC17wYKD9A0guwPkMs1gOsM__NOT'),
|
|
120
|
+
jettonWalletCode: core_1.Cell.fromBoc(Buffer.from('b5ee9c7201010101002300084202ba2918c8947e9b25af9ac1b883357754173e5812f807a3d6e642a14709595395', 'hex'))[0],
|
|
121
|
+
};
|
|
122
|
+
exports.UTON_MAINNET = {
|
|
123
|
+
name: 'uTON',
|
|
124
|
+
assetId: exports.ASSET_ID.uTON,
|
|
125
|
+
jettonMasterAddress: core_1.Address.parse('EQAfF5j3JMIpZlLmACv7Ub7RH7WmiVMuV4ivcgNYHvNnqHTz'),
|
|
126
|
+
jettonWalletCode: core_1.Cell.fromBoc(Buffer.from('b5ee9c7201021301000439000114ff00f4a413f4bcf2c80b0102016202030202cc0405020120111200bbd906380492f827000e8698180b8d84a89af81f807707d207d2018fd0018b8eb90fd0018fd001801698f90c10807c53f52dd4a989a2cf805f010c1080bc6a28cdd4b18a22201f8067000c1082caf83de5d4aa22201f806f02f82c207f9784020120060701f7f01e99ffd007d20381140816000fd23182c5d797a76a2687d00699ffd207d206a18027c30817c317c31fc327c32fc2091d0fc30fc21a8036382f97160fc20e17ff971617c227c22b82a300209aa0a82e42802fd0109e59f80e78b00e78b666490e4658089fa00097a00658064907c80383a6465816503e5ffe4e802c080201200a0b01fefa40f40431fa0020d749c200f2e2c4778018c8cb055009cf1670fa0218cb6b13cc8210178d4519c8cb1f15cb3f5003fa02f843cf1658cf1621fa025004cf16c901cc2291729171e25004a812a08208989680a08208989680a08208989680a0bcf2e2c5f841f842f843f844f845c85005fa0213cb3f01cf1601cf16ccc9ed5409000ac98040fb000201200c0d00b948020d721ed44d0fa00d33ffa40fa40d43004f86102f862f863f864f865d31f218210178d4519ba0282107bdd97deba12b1f2e2c5d33f31fa0030f84101a0f861f841f842f843f844f845c85005fa0213cb3f01cf1601cf16ccc9ed54801f53b51343e8034cffe903e90350c013e1840be18be18fe193e194134cffe803e1048a83e187e903e903e113e1149165c15180104d505417214017e8084f2cfc073c58073c5b332487232c044fd0004bd0032c0327e401c1d3232c0b281f2fff2740a31c17e11140271c1462c7cb8b0c1be80145a2860822625a019a00e01f73b51343e8034cffe903e90350c013e1840be18be18fe193e194134cffe803e903d010c1c0060083d03dbe87cb8b13434c7fe80204c0048b0803cbd350c3e10be10a93e18be1049a87e187e10d402b1c17cb8b07e1070bffcb8b0945e6860822625a019ad82284820822625a0281401e820822625a028086814a42f201001f2b608a18208989680a018a1278e355275a014a182107362d09cc8cb1f5230cb3f58fa025003cf165003cf16c9718018c8cb05f843cf165006fa0215cb6a14ccc971fb0094375b6c21e221d70b01c30023c200b08e208210d53276db708010c8cb055004cf165004fa0212cb6a12cb1fcb3fc972fb00925f03e20f0038f841f842f843f844f845c85005fa0213cb3f01cf1601cf16ccc9ed5400c0f2e2c5058208989680a018a1f841f842f843f844f845c85005fa0213cb3f01cf1601cf16ccc9ed5482107bdd97dec8cb1f14cb3ff843cf1616cb3f01fa0215cb1f5003cf1658fa02ccc9718018c8cb05f844cf165003fa0212cb6accc970fb000047bfd8176a2687d00699ffd207d206a18027c30817c317c31fc327c32fc20fc21fc227c22c004bbdd79f6a2687d00699ffd207d206a18027c30817c317c31fc327c32fc20fc217c21fc227c22c', 'hex'))[0],
|
|
127
|
+
};
|
|
@@ -17,12 +17,15 @@ export declare const NULL_ADDRESS: Address;
|
|
|
17
17
|
export declare const EVAA_MASTER_MAINNET: Address;
|
|
18
18
|
export declare const MAINNET_VERSION = 6;
|
|
19
19
|
export declare const EVAA_MASTER_TESTNET: Address;
|
|
20
|
-
export declare const TESTNET_VERSION =
|
|
20
|
+
export declare const TESTNET_VERSION = 1;
|
|
21
21
|
export declare const EVAA_LP_MAINNET: Address;
|
|
22
22
|
export declare const EVAA_LP_MAINNET_VERSION = 3;
|
|
23
|
+
export declare const EVAA_ALTS_MAINNET: Address;
|
|
24
|
+
export declare const EVAA_ALTS_MAINNET_VERSION = 0;
|
|
23
25
|
export declare const ORACLES_MAINNET: OracleNFT[];
|
|
24
26
|
export declare const ORACLES_TESTNET: OracleNFT[];
|
|
25
27
|
export declare const ORACLES_LP: OracleNFT[];
|
|
28
|
+
export declare const ORACLES_ALTS: OracleNFT[];
|
|
26
29
|
export declare const LENDING_CODE: Cell;
|
|
27
30
|
export declare const JETTON_WALLET_STANDART_CODE: Cell;
|
|
28
31
|
export declare const JETTON_WALLET_STANDART_CODE_TESTNET: Cell;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FEES = exports.OPCODES = exports.JETTON_WALLET_STANDART_CODE_TESTNET = exports.JETTON_WALLET_STANDART_CODE = exports.LENDING_CODE = exports.ORACLES_LP = exports.ORACLES_TESTNET = exports.ORACLES_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.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_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 = {
|
|
@@ -20,27 +20,20 @@ exports.NULL_ADDRESS = core_1.Address.parse('UQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
|
|
20
20
|
exports.EVAA_MASTER_MAINNET = core_1.Address.parse('EQC8rUZqR_pWV1BylWUlPNBzyiTYVoBEmQkMIQDZXICfnuRr');
|
|
21
21
|
exports.MAINNET_VERSION = 6;
|
|
22
22
|
exports.EVAA_MASTER_TESTNET = core_1.Address.parse('EQDLsg3w-iBj26Gww7neYoJAxiT2t77Zo8ro56b0yuHsPp3C');
|
|
23
|
-
exports.TESTNET_VERSION =
|
|
23
|
+
exports.TESTNET_VERSION = 1;
|
|
24
24
|
exports.EVAA_LP_MAINNET = core_1.Address.parse('EQBIlZX2URWkXCSg3QF2MJZU-wC5XkBoLww-hdWk2G37Jc6N');
|
|
25
25
|
exports.EVAA_LP_MAINNET_VERSION = 3;
|
|
26
|
+
exports.EVAA_ALTS_MAINNET = core_1.Address.parse('EQANURVS3fhBO9bivig34iyJQi97FhMbpivo1aUEAS2GYSu-');
|
|
27
|
+
exports.EVAA_ALTS_MAINNET_VERSION = 0;
|
|
26
28
|
exports.ORACLES_MAINNET = [
|
|
27
|
-
{ id: 0, address: '0xd3a8c0b9fd44fd25a49289c631e3ac45689281f2f8cf0744400b4c65bed38e5d' },
|
|
28
|
-
{ id: 1, address: '0x2c21cabdaa89739de16bde7bc44e86401fac334a3c7e55305fe5e7563043e191' },
|
|
29
|
-
{ id: 2, address: '0x2eb258ce7b5d02466ab8a178ad8b0ba6ffa7b58ef21de3dc3b6dd359a1e16af0' },
|
|
30
|
-
{ id: 3, address: '0xf9a0769954b4430bca95149fb3d876deb7799d8f74852e0ad4ccc5778ce68b52' },
|
|
31
|
-
];
|
|
32
|
-
exports.ORACLES_TESTNET = [
|
|
33
|
-
{ id: 0, address: '0xd3a8c0b9fd44fd25a49289c631e3ac45689281f2f8cf0744400b4c65bed38e5d' },
|
|
34
|
-
{ id: 1, address: '0x2c21cabdaa89739de16bde7bc44e86401fac334a3c7e55305fe5e7563043e191' },
|
|
35
|
-
{ id: 2, address: '0x2eb258ce7b5d02466ab8a178ad8b0ba6ffa7b58ef21de3dc3b6dd359a1e16af0' },
|
|
36
|
-
{ id: 3, address: '0xf9a0769954b4430bca95149fb3d876deb7799d8f74852e0ad4ccc5778ce68b52' },
|
|
37
|
-
];
|
|
38
|
-
exports.ORACLES_LP = [
|
|
39
|
-
{ id: 0, address: '0xd3a8c0b9fd44fd25a49289c631e3ac45689281f2f8cf0744400b4c65bed38e5d' },
|
|
40
|
-
{ id: 1, address: '0x2c21cabdaa89739de16bde7bc44e86401fac334a3c7e55305fe5e7563043e191' },
|
|
41
|
-
{ id: 2, address: '0x2eb258ce7b5d02466ab8a178ad8b0ba6ffa7b58ef21de3dc3b6dd359a1e16af0' },
|
|
42
|
-
{ id: 3, address: '0xf9a0769954b4430bca95149fb3d876deb7799d8f74852e0ad4ccc5778ce68b52' },
|
|
29
|
+
{ id: 0, address: '0xd3a8c0b9fd44fd25a49289c631e3ac45689281f2f8cf0744400b4c65bed38e5d', pubkey: Buffer.from('b404f4a2ebb62f2623b370c89189748a0276c071965b1646b996407f10d72eb9', 'hex') },
|
|
30
|
+
{ id: 1, address: '0x2c21cabdaa89739de16bde7bc44e86401fac334a3c7e55305fe5e7563043e191', pubkey: Buffer.from('9ad115087520d91b6b45d6a8521eb4616ee6914af07fabdc2e9d1826dbb17078', 'hex') },
|
|
31
|
+
{ id: 2, address: '0x2eb258ce7b5d02466ab8a178ad8b0ba6ffa7b58ef21de3dc3b6dd359a1e16af0', pubkey: Buffer.from('e503e02e8a9226b34e7c9deb463cbf7f19bce589362eb448a69a8ee7b2fca631', 'hex') },
|
|
32
|
+
{ id: 3, address: '0xf9a0769954b4430bca95149fb3d876deb7799d8f74852e0ad4ccc5778ce68b52', pubkey: Buffer.from('9cbf8374cf1f2cf17110134871d580198416e101683f4a61f54cf2a3e4e32070', 'hex') },
|
|
43
33
|
];
|
|
34
|
+
exports.ORACLES_TESTNET = exports.ORACLES_MAINNET;
|
|
35
|
+
exports.ORACLES_LP = exports.ORACLES_MAINNET;
|
|
36
|
+
exports.ORACLES_ALTS = exports.ORACLES_MAINNET;
|
|
44
37
|
exports.LENDING_CODE = core_1.Cell.fromBoc(Buffer.from('b5ee9c72c1010e0100fd000d12182a555a6065717691969efd0114ff00f4a413f4bcf2c80b010202c8050202039f740403001ff2f8276a2687d2018fd201800f883b840051d38642c678b64e4400780e58fc10802faf07f80e59fa801e78b096664c02078067c07c100627a7978402014807060007a0ddb0c60201c709080013a0fd007a026900aa90400201200b0a0031b8e1002191960aa00b9e2ca007f4042796d225e8019203f6010201200d0c000bf7c147d2218400b9d10e86981fd201840b07f8138d809797976a2687d2029116382f970fd9178089910374daf81b619fd20182c7883b8701981684100627910eba56001797a6a6ba610fd8200e8768f76a9f6aa00cc2a32a8292878809bef2f1889f883bbcdeb86f01', 'hex'))[0];
|
|
45
38
|
exports.JETTON_WALLET_STANDART_CODE = core_1.Cell.fromBase64('te6cckECEwEAA4UAART/APSkE/S88sgLAQIBYgIDAgLLBAUAG6D2BdqJofQB9IH0gamjAgHOBgcCAVgKCwL3CDHAJJfBOAB0NMDAXGwlRNfA/Ad4PpA+kAx+gAxcdch+gAx+gAwc6m0AALTHwHbPFsyNDQ0JIIQD4p+pbqaMGwiNl4xECPwGuAkghAXjUUZupswbCJeMhAkQwDwG+A3WzaCEFlfB7y6nwJxsPLSwFAjuvLixgHwHOBfBYAgJABE+kQwwADy4U2AAXIBP+DMgbpUwgLH4M94gbvLSmtDTBzHT/9P/9ATTB9Qw0PoA+gD6APoA+gD6ADAACIQP8vACAVgMDQIBSBESAfcBdM/AQH6APpAIfAB7UTQ+gD6QPpA1NFRNqFSLMcF8uLBKsL/8uLCVDRCcFQgE1QUA8hQBPoCWM8WAc8WzMkiyMsBEvQA9ADLAMkgcAH5AHTIywISygfL/8nQBPpA9AQx+gAg10nCAPLixMiAGAHLBVAHzxZw+gJ3ActrgDgLzO1E0PoA+kD6QNTRCtM/AQH6AFFRoAX6QPpAU13HBVRzb3BUIBNUFAPIUAT6AljPFgHPFszJIsjLARL0APQAywDJcAH5AHTIywISygfL/8nQUA/HBR6x8uLDDPoAUcqhKbYIGaFQB6AYoSaSbFXjDSXXCwHDACHCALCAPEACqE8zIghAXjUUZWAoCyx/LP1AH+gIizxZQBs8WJfoCUAPPFslQBcwjkXKRceJQB6gToAiqAFAEoBegFLzy4sUByYBA+wBDAMhQBPoCWM8WAc8WzMntVAByUmmgGKHIghBzYtCcKQLLH8s/UAf6AlAEzxZQB88WyciAEAHLBSfPFlAE+gJxActqE8zJcfsAUEITAHSOI8iAEAHLBVAGzxZQBfoCcAHLaoIQ1TJ221gFAssfyz/JcvsAklsz4kADyFAE+gJYzxYBzxbMye1UAOs7UTQ+gD6QPpA1NEF0z8BAfoAIcIA8uLC+kD0BAHQ05/RAdFRYqFSWMcF8uLBJsL/8uLCyIIQe92X3lgEAssfyz8B+gIjzxYBzxYTy5/JyIAYAcsFI88WcPoCcQHLaszJgED7AEATyFAE+gJYzxYBzxbMye1UgAIcgCDXIe1E0PoA+kD6QNTRBNMfAYQPIYIQF41FGboCghB73ZfeuhKx8vTTPwEw+gAwE6BQI8hQBPoCWM8WAc8WzMntVINjFu1o=');
|
|
46
39
|
exports.JETTON_WALLET_STANDART_CODE_TESTNET = core_1.Cell.fromBase64('te6cckECEQEAAyMAART/APSkE/S88sgLAQIBYgIDAgLMBAUAG6D2BdqJofQB9IH0gahhAgHUBgcCASAICQDDCDHAJJfBOAB0NMDAXGwlRNfA/AM4PpA+kAx+gAxcdch+gAx+gAwc6m0AALTH4IQD4p+pVIgupUxNFnwCeCCEBeNRRlSILqWMUREA/AK4DWCEFlfB7y6k1nwC+BfBIQP8vCAAET6RDBwuvLhTYAIBIAoLAIPUAQa5D2omh9AH0gfSBqGAJpj8EIC8aijKkQXUEIPe7L7wndCVj5cWLpn5j9ABgJ0CgR5CgCfQEsZ4sA54tmZPaqQB8VA9M/+gD6QCHwAe1E0PoA+kD6QNQwUTahUirHBfLiwSjC//LiwlQ0QnBUIBNUFAPIUAT6AljPFgHPFszJIsjLARL0APQAywDJIPkAcHTIywLKB8v/ydAE+kD0BDH6ACDXScIA8uLEd4AYyMsFUAjPFnD6AhfLaxPMgMAgEgDQ4AnoIQF41FGcjLHxnLP1AH+gIizxZQBs8WJfoCUAPPFslQBcwjkXKRceJQCKgToIIJycOAoBS88uLFBMmAQPsAECPIUAT6AljPFgHPFszJ7VQC9ztRND6APpA+kDUMAjTP/oAUVGgBfpA+kBTW8cFVHNtcFQgE1QUA8hQBPoCWM8WAc8WzMkiyMsBEvQA9ADLAMn5AHB0yMsCygfL/8nQUA3HBRyx8uLDCvoAUaihggiYloBmtgihggiYloCgGKEnlxBJEDg3XwTjDSXXCwGAPEADXO1E0PoA+kD6QNQwB9M/+gD6QDBRUaFSSccF8uLBJ8L/8uLCBYIJMS0AoBa88uLDghB73ZfeyMsfFcs/UAP6AiLPFgHPFslxgBjIywUkzxZw+gLLaszJgED7AEATyFAE+gJYzxYBzxbMye1UgAHBSeaAYoYIQc2LQnMjLH1Iwyz9Y+gJQB88WUAfPFslxgBDIywUkzxZQBvoCFctqFMzJcfsAECQQIwB8wwAjwgCwjiGCENUydttwgBDIywVQCM8WUAT6AhbLahLLHxLLP8ly+wCTNWwh4gPIUAT6AljPFgHPFszJ7VSV6u3X');
|
|
@@ -2,3 +2,4 @@ import { PoolConfig } from "../types/Master";
|
|
|
2
2
|
export declare const MAINNET_POOL_CONFIG: PoolConfig;
|
|
3
3
|
export declare const TESTNET_POOL_CONFIG: PoolConfig;
|
|
4
4
|
export declare const MAINNET_LP_POOL_CONFIG: PoolConfig;
|
|
5
|
+
export declare const MAINNET_ALTS_POOL_CONFIG: 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_LP_POOL_CONFIG = exports.TESTNET_POOL_CONFIG = exports.MAINNET_POOL_CONFIG = void 0;
|
|
3
|
+
exports.MAINNET_ALTS_POOL_CONFIG = exports.MAINNET_LP_POOL_CONFIG = exports.TESTNET_POOL_CONFIG = exports.MAINNET_POOL_CONFIG = void 0;
|
|
4
4
|
const assets_1 = require("./assets");
|
|
5
5
|
const general_1 = require("./general");
|
|
6
6
|
exports.MAINNET_POOL_CONFIG = {
|
|
@@ -15,7 +15,8 @@ exports.MAINNET_POOL_CONFIG = {
|
|
|
15
15
|
assets_1.JUSDC_MAINNET,
|
|
16
16
|
assets_1.STTON_MAINNET,
|
|
17
17
|
assets_1.TSTON_MAINNET,
|
|
18
|
-
assets_1.USDT_MAINNET
|
|
18
|
+
assets_1.USDT_MAINNET,
|
|
19
|
+
// UTON_MAINNET // announce
|
|
19
20
|
],
|
|
20
21
|
lendingCode: general_1.LENDING_CODE
|
|
21
22
|
};
|
|
@@ -48,3 +49,18 @@ exports.MAINNET_LP_POOL_CONFIG = {
|
|
|
48
49
|
],
|
|
49
50
|
lendingCode: general_1.LENDING_CODE
|
|
50
51
|
};
|
|
52
|
+
exports.MAINNET_ALTS_POOL_CONFIG = {
|
|
53
|
+
masterAddress: general_1.EVAA_ALTS_MAINNET,
|
|
54
|
+
masterVersion: general_1.EVAA_ALTS_MAINNET_VERSION,
|
|
55
|
+
masterConstants: general_1.MASTER_CONSTANTS,
|
|
56
|
+
oracles: general_1.ORACLES_ALTS,
|
|
57
|
+
minimalOracles: 3,
|
|
58
|
+
poolAssetsConfig: [
|
|
59
|
+
assets_1.TON_MAINNET,
|
|
60
|
+
assets_1.USDT_MAINNET,
|
|
61
|
+
assets_1.CATI_MAINNET,
|
|
62
|
+
assets_1.NOT_MAINNET,
|
|
63
|
+
assets_1.DOGS_MAINNET
|
|
64
|
+
],
|
|
65
|
+
lendingCode: general_1.LENDING_CODE
|
|
66
|
+
};
|
|
@@ -2,6 +2,7 @@ import { Address, Cell, Contract, ContractProvider, OpenedContract, Sender } fro
|
|
|
2
2
|
import { Maybe } from '@ton/core/dist/utils/maybe';
|
|
3
3
|
import { EvaaUser } from './UserContract';
|
|
4
4
|
import { MasterData, PoolAssetConfig, PoolConfig } from '../types/Master';
|
|
5
|
+
import { PricesCollector, PriceSourcesConfig } from '..';
|
|
5
6
|
/**
|
|
6
7
|
* Parameters for the Evaa contract
|
|
7
8
|
* @property testnet - true for testnet, false for mainnet
|
|
@@ -147,5 +148,9 @@ export declare class Evaa implements Contract {
|
|
|
147
148
|
* Sync master contract data
|
|
148
149
|
*/
|
|
149
150
|
getSync(provider: ContractProvider): Promise<void>;
|
|
151
|
+
/**
|
|
152
|
+
* @deprecated Use PriceCollector (createPriceCollector) istead of getPrices
|
|
153
|
+
*/
|
|
150
154
|
getPrices(provider: ContractProvider, endpoints?: string[]): Promise<import("..").PriceData>;
|
|
155
|
+
createPriceCollector(priceSourcesConfig?: PriceSourcesConfig): PricesCollector;
|
|
151
156
|
}
|
|
@@ -242,6 +242,9 @@ class Evaa {
|
|
|
242
242
|
throw Error('Master contract is not active');
|
|
243
243
|
}
|
|
244
244
|
}
|
|
245
|
+
/**
|
|
246
|
+
* @deprecated Use PriceCollector (createPriceCollector) istead of getPrices
|
|
247
|
+
*/
|
|
245
248
|
async getPrices(provider, endpoints) {
|
|
246
249
|
if ((endpoints?.length ?? 0) > 0) {
|
|
247
250
|
return await (0, __1.getPrices)(endpoints, this._poolConfig);
|
|
@@ -250,5 +253,8 @@ class Evaa {
|
|
|
250
253
|
return await (0, __1.getPrices)(undefined, this._poolConfig);
|
|
251
254
|
}
|
|
252
255
|
}
|
|
256
|
+
createPriceCollector(priceSourcesConfig = __1.DefaultPriceSourcesConfig) {
|
|
257
|
+
return new __1.PricesCollector(this._poolConfig, priceSourcesConfig);
|
|
258
|
+
}
|
|
253
259
|
}
|
|
254
260
|
exports.Evaa = Evaa;
|
package/dist/index.d.ts
CHANGED
|
@@ -5,13 +5,13 @@ export { getPrices } from './api/prices';
|
|
|
5
5
|
export { JettonWallet } from './contracts/JettonWallet';
|
|
6
6
|
export { EvaaParameters, WithdrawParameters, LiquidationBaseData, LiquidationParameters, Evaa } from './contracts/MasterContract';
|
|
7
7
|
export { EvaaUser } from './contracts/UserContract';
|
|
8
|
-
export { PriceData } from './types/Common';
|
|
9
8
|
export { UpgradeConfig, AssetConfig, MasterConfig, AssetData, AssetInterest, AssetApy, ExtendedAssetData, MasterData, PoolConfig, ExtendedAssetsData, ExtendedAssetsConfig, PoolAssetConfig, PoolAssetsConfig, MasterConstants } from './types/Master';
|
|
10
9
|
export { BalanceType, UserBalance, UserLiqudationData, LiquidableData, NonLiquidableData, LiquidationData, UserDataInactive, UserDataActive, UserData, BalanceChangeType } from './types/User';
|
|
11
10
|
export { EVAA_MASTER_MAINNET, MAINNET_VERSION, EVAA_MASTER_TESTNET, TESTNET_VERSION, LENDING_CODE, OPCODES, FEES, MASTER_CONSTANTS } from './constants/general';
|
|
12
|
-
export { MAINNET_POOL_CONFIG, TESTNET_POOL_CONFIG, MAINNET_LP_POOL_CONFIG } from './constants/pools';
|
|
13
|
-
export { ASSET_ID, UNDEFINED_ASSET, TON_MAINNET, USDT_MAINNET, TONUSDT_DEDUST_MAINNET, TON_STORM_MAINNET, USDT_STORM_MAINNET, JUSDT_MAINNET, JUSDC_MAINNET, STTON_MAINNET, TSTON_MAINNET, JUSDT_TESTNET, JUSDC_TESTNET, STTON_TESTNET } from './constants/assets';
|
|
11
|
+
export { MAINNET_POOL_CONFIG, TESTNET_POOL_CONFIG, MAINNET_LP_POOL_CONFIG, MAINNET_ALTS_POOL_CONFIG } from './constants/pools';
|
|
12
|
+
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';
|
|
14
13
|
export * from './constants/assets';
|
|
15
14
|
export * from './utils/utils';
|
|
15
|
+
export * from './prices';
|
|
16
16
|
export { getLastSentBoc, getTonConnectSender } from './utils/tonConnectSender';
|
|
17
17
|
export { getUserJettonWallet } from './utils/userJettonWallet';
|
package/dist/index.js
CHANGED
|
@@ -15,7 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
exports.TESTNET_POOL_CONFIG = exports.MAINNET_POOL_CONFIG = exports.MASTER_CONSTANTS = exports.FEES = exports.OPCODES = exports.LENDING_CODE = exports.TESTNET_VERSION = exports.EVAA_MASTER_TESTNET = exports.MAINNET_VERSION = exports.EVAA_MASTER_MAINNET = exports.BalanceChangeType = exports.BalanceType = 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.BigMath = 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 = exports.getTonConnectSender = exports.getLastSentBoc = exports.STTON_TESTNET = exports.JUSDC_TESTNET = exports.JUSDT_TESTNET = exports.TSTON_MAINNET = exports.STTON_MAINNET = exports.JUSDC_MAINNET = exports.JUSDT_MAINNET = exports.USDT_STORM_MAINNET = exports.TON_STORM_MAINNET = exports.TONUSDT_DEDUST_MAINNET = exports.USDT_MAINNET = exports.TON_MAINNET = exports.UNDEFINED_ASSET = exports.ASSET_ID = exports.MAINNET_LP_POOL_CONFIG = void 0;
|
|
18
|
+
exports.getUserJettonWallet = exports.getTonConnectSender = exports.getLastSentBoc = exports.STTON_TESTNET = exports.JUSDC_TESTNET = exports.JUSDT_TESTNET = exports.TSTON_MAINNET = exports.STTON_MAINNET = exports.JUSDC_MAINNET = exports.JUSDT_MAINNET = exports.NOT_MAINNET = exports.UTON_MAINNET = exports.CATI_MAINNET = exports.DOGS_MAINNET = exports.USDT_STORM_MAINNET = exports.TON_STORM_MAINNET = exports.TONUSDT_DEDUST_MAINNET = exports.USDT_MAINNET = exports.TON_MAINNET = exports.UNDEFINED_ASSET = exports.ASSET_ID = exports.MAINNET_ALTS_POOL_CONFIG = exports.MAINNET_LP_POOL_CONFIG = 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; } });
|
|
@@ -82,6 +82,7 @@ var pools_1 = require("./constants/pools");
|
|
|
82
82
|
Object.defineProperty(exports, "MAINNET_POOL_CONFIG", { enumerable: true, get: function () { return pools_1.MAINNET_POOL_CONFIG; } });
|
|
83
83
|
Object.defineProperty(exports, "TESTNET_POOL_CONFIG", { enumerable: true, get: function () { return pools_1.TESTNET_POOL_CONFIG; } });
|
|
84
84
|
Object.defineProperty(exports, "MAINNET_LP_POOL_CONFIG", { enumerable: true, get: function () { return pools_1.MAINNET_LP_POOL_CONFIG; } });
|
|
85
|
+
Object.defineProperty(exports, "MAINNET_ALTS_POOL_CONFIG", { enumerable: true, get: function () { return pools_1.MAINNET_ALTS_POOL_CONFIG; } });
|
|
85
86
|
var assets_1 = require("./constants/assets");
|
|
86
87
|
Object.defineProperty(exports, "ASSET_ID", { enumerable: true, get: function () { return assets_1.ASSET_ID; } });
|
|
87
88
|
Object.defineProperty(exports, "UNDEFINED_ASSET", { enumerable: true, get: function () { return assets_1.UNDEFINED_ASSET; } });
|
|
@@ -90,6 +91,10 @@ Object.defineProperty(exports, "USDT_MAINNET", { enumerable: true, get: function
|
|
|
90
91
|
Object.defineProperty(exports, "TONUSDT_DEDUST_MAINNET", { enumerable: true, get: function () { return assets_1.TONUSDT_DEDUST_MAINNET; } });
|
|
91
92
|
Object.defineProperty(exports, "TON_STORM_MAINNET", { enumerable: true, get: function () { return assets_1.TON_STORM_MAINNET; } });
|
|
92
93
|
Object.defineProperty(exports, "USDT_STORM_MAINNET", { enumerable: true, get: function () { return assets_1.USDT_STORM_MAINNET; } });
|
|
94
|
+
Object.defineProperty(exports, "DOGS_MAINNET", { enumerable: true, get: function () { return assets_1.DOGS_MAINNET; } });
|
|
95
|
+
Object.defineProperty(exports, "CATI_MAINNET", { enumerable: true, get: function () { return assets_1.CATI_MAINNET; } });
|
|
96
|
+
Object.defineProperty(exports, "UTON_MAINNET", { enumerable: true, get: function () { return assets_1.UTON_MAINNET; } });
|
|
97
|
+
Object.defineProperty(exports, "NOT_MAINNET", { enumerable: true, get: function () { return assets_1.NOT_MAINNET; } });
|
|
93
98
|
Object.defineProperty(exports, "JUSDT_MAINNET", { enumerable: true, get: function () { return assets_1.JUSDT_MAINNET; } });
|
|
94
99
|
Object.defineProperty(exports, "JUSDC_MAINNET", { enumerable: true, get: function () { return assets_1.JUSDC_MAINNET; } });
|
|
95
100
|
Object.defineProperty(exports, "STTON_MAINNET", { enumerable: true, get: function () { return assets_1.STTON_MAINNET; } });
|
|
@@ -99,6 +104,7 @@ Object.defineProperty(exports, "JUSDC_TESTNET", { enumerable: true, get: functio
|
|
|
99
104
|
Object.defineProperty(exports, "STTON_TESTNET", { enumerable: true, get: function () { return assets_1.STTON_TESTNET; } });
|
|
100
105
|
__exportStar(require("./constants/assets"), exports);
|
|
101
106
|
__exportStar(require("./utils/utils"), exports);
|
|
107
|
+
__exportStar(require("./prices"), exports);
|
|
102
108
|
// Utils
|
|
103
109
|
var tonConnectSender_1 = require("./utils/tonConnectSender");
|
|
104
110
|
Object.defineProperty(exports, "getLastSentBoc", { enumerable: true, get: function () { return tonConnectSender_1.getLastSentBoc; } });
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Cell, Dictionary } from "@ton/core";
|
|
2
|
+
import { PoolAssetConfig } from "../types/Master";
|
|
3
|
+
export declare class Prices {
|
|
4
|
+
#private;
|
|
5
|
+
constructor(dict: Dictionary<bigint, bigint>, dataCell: Cell);
|
|
6
|
+
get dict(): Dictionary<bigint, bigint>;
|
|
7
|
+
get dataCell(): Cell;
|
|
8
|
+
getAssetPrice<T extends bigint | PoolAssetConfig>(asset: T): bigint | undefined;
|
|
9
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
3
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
4
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
5
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
6
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
7
|
+
};
|
|
8
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
9
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
10
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
11
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
12
|
+
};
|
|
13
|
+
var _Prices_instances, _Prices_dict, _Prices_dataCell, _Prices_extractAssetId;
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.Prices = void 0;
|
|
16
|
+
const core_1 = require("@ton/core");
|
|
17
|
+
class Prices {
|
|
18
|
+
constructor(dict, dataCell) {
|
|
19
|
+
_Prices_instances.add(this);
|
|
20
|
+
_Prices_dict.set(this, void 0);
|
|
21
|
+
_Prices_dataCell.set(this, void 0);
|
|
22
|
+
__classPrivateFieldSet(this, _Prices_dict, dict, "f");
|
|
23
|
+
__classPrivateFieldSet(this, _Prices_dataCell, dataCell, "f");
|
|
24
|
+
}
|
|
25
|
+
get dict() {
|
|
26
|
+
const dict = core_1.Dictionary.empty();
|
|
27
|
+
for (const [key, value] of __classPrivateFieldGet(this, _Prices_dict, "f")) {
|
|
28
|
+
dict.set(key, value);
|
|
29
|
+
}
|
|
30
|
+
return dict;
|
|
31
|
+
}
|
|
32
|
+
get dataCell() {
|
|
33
|
+
return new core_1.Cell(__classPrivateFieldGet(this, _Prices_dataCell, "f"));
|
|
34
|
+
}
|
|
35
|
+
getAssetPrice(asset) {
|
|
36
|
+
const assetId = __classPrivateFieldGet(this, _Prices_instances, "m", _Prices_extractAssetId).call(this, asset);
|
|
37
|
+
return __classPrivateFieldGet(this, _Prices_dict, "f").get(assetId);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
exports.Prices = Prices;
|
|
41
|
+
_Prices_dict = new WeakMap(), _Prices_dataCell = new WeakMap(), _Prices_instances = new WeakSet(), _Prices_extractAssetId = function _Prices_extractAssetId(asset) {
|
|
42
|
+
return typeof asset === 'bigint' ? asset : asset.assetId;
|
|
43
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Dictionary } from "@ton/core";
|
|
2
|
+
import { PoolAssetConfig, PoolAssetsConfig, PoolConfig } from "../types/Master";
|
|
3
|
+
import { PriceSource } from "./sources";
|
|
4
|
+
import { PriceSourcesConfig } from "./Types";
|
|
5
|
+
import { Prices } from "./Prices";
|
|
6
|
+
export declare class PricesCollector {
|
|
7
|
+
#private;
|
|
8
|
+
constructor(poolConfig?: PoolConfig, sourcesConfig?: PriceSourcesConfig, additionalPriceSources?: PriceSource[]);
|
|
9
|
+
getPricesForLiquidate(realPrincipals: Dictionary<bigint, bigint>, retries?: number, timeout?: number): Promise<Prices>;
|
|
10
|
+
getPricesForWithdraw(realPrincipals: Dictionary<bigint, bigint>, withdrawAsset: PoolAssetConfig, collateralToDebt?: boolean, retries?: number, timeout?: number): Promise<Prices>;
|
|
11
|
+
getPrices(assets?: PoolAssetsConfig, retries?: number, timeout?: number): Promise<Prices>;
|
|
12
|
+
}
|