@evaafi/sdk 0.6.1 → 0.6.2
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/CHANGELOG.md +240 -0
- package/LICENSE.md +7 -0
- package/dist/api/liquidation.js +1 -3
- package/dist/api/math.js +0 -2
- package/dist/api/parser.js +4 -9
- 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 -21
- package/dist/constants/pools.d.ts +1 -0
- package/dist/constants/pools.js +19 -3
- 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 +121 -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 +2 -1
- 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 +4 -11
- package/src/api/prices.ts +20 -7
- package/src/constants/assets.ts +57 -0
- package/src/constants/general.ts +10 -22
- package/src/constants/pools.ts +21 -5
- 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 +135 -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 +3 -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/CHANGELOG.md
ADDED
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
All notable changes to this project will be documented in this file.
|
|
3
|
+
|
|
4
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/)
|
|
5
|
+
and this project adheres to [Semantic Versioning](https://semver.org/).
|
|
6
|
+
|
|
7
|
+
## 0.6.2 - 2024-11-21
|
|
8
|
+
### Added
|
|
9
|
+
- ALTS Pool
|
|
10
|
+
- PricesCollector class
|
|
11
|
+
- Supports multiple prices sources [iota nft, evaa backend, internetcomputer (icp) http backend] (sources can be configured)
|
|
12
|
+
- Updates prices only when needed, prices may expire no earlier than a minute later
|
|
13
|
+
- Ability to cut prices and resign it and send only the necessary ones in order to reduce fee
|
|
14
|
+
- ```typescript
|
|
15
|
+
async getPricesForWithdraw(userPrincipals: Dictionary<bigint, bigint>, withdrawAsset: PoolAssetConfig, collateralToDebt = false, ....)
|
|
16
|
+
```
|
|
17
|
+
collateralToDebt param responsible for the fact that supply can go to borrow (there is no such case at the front end)
|
|
18
|
+
- ```typescript
|
|
19
|
+
async getPricesForLiquidate(userPrincipals: Dictionary<bigint, bigint> ...)
|
|
20
|
+
```
|
|
21
|
+
- Price Signature Vrification
|
|
22
|
+
- Minimal Oracles Number Verification
|
|
23
|
+
- Independent and parallel loading of prices (now the fastest but invalid response won't break anything)
|
|
24
|
+
- Support for partial number of assets from price sources
|
|
25
|
+
- Updated examples in docs/examples
|
|
26
|
+
- PricesCollector test coverage
|
|
27
|
+
- If the price is missing (for example, for security reasons), then there will be no error, it will simply NOT be added to the result dict
|
|
28
|
+
|
|
29
|
+
### Changed
|
|
30
|
+
- getPrices is deprecated use PricesCollector instead
|
|
31
|
+
|
|
32
|
+
## 0.6.1-a - 2024-10-29
|
|
33
|
+
### Changed
|
|
34
|
+
- updated `EVAA_LP_MAINNET_VERSION` to `3`
|
|
35
|
+
- `awaitedSupply` is always defined
|
|
36
|
+
### Fixed
|
|
37
|
+
- `applyDust` is `false` by default in `parseUserLiteData` and `parseUserData`
|
|
38
|
+
- `minimalOracles` is `3` in all pools
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
## 0.6.1 - 2024-10-22
|
|
42
|
+
### Changed
|
|
43
|
+
- added liquidation.ts with ```findAssetById```, ```calculateAssetsValues```, ```selectGreatestAssets```, ```calculateMinCollateralByTransferredAmount```, ```calculateLiquidationAmounts```, ```isLiquidatable```, ```isBadDebt```, ```addReserve```, ```deductReserve```, ```toAssetAmount```, ```toAssetWorth```, ```addLiquidationBonus```, ```deductLiquidationBonus```, ```PreparedAssetInfo```, ```prepareAssetInfo``` functions required or flexible liquidations calculation.
|
|
44
|
+
- user. ```getSync``` and ```getSyncLite``` new argument ```applyDust``` by default is ```false```;
|
|
45
|
+
- updated sdk usage example
|
|
46
|
+
### Fixed
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
## 0.6.0a - 2024-10-14
|
|
50
|
+
### Changed
|
|
51
|
+
- user. ```getSync``` and ```getSyncLite``` new argument ```applyDust``` by default is ```false```
|
|
52
|
+
### Fixed
|
|
53
|
+
- Healthfactor calculation minor bug
|
|
54
|
+
- createLiquidationMessage fix new field payloadForwardAmount
|
|
55
|
+
|
|
56
|
+
## 0.6.0 - 2024-10-10
|
|
57
|
+
### Added
|
|
58
|
+
- SDK Supports Evaa v6 smart contracts
|
|
59
|
+
### Fixed
|
|
60
|
+
- Updated documentation and examples for v6 interactions
|
|
61
|
+
- User Withdrawal and Borrow limits
|
|
62
|
+
## 0.5.6a - 2024-10-09
|
|
63
|
+
### Fixed
|
|
64
|
+
- Fix typo in ```calculateMaximumWithdrawAmount```
|
|
65
|
+
|
|
66
|
+
## 0.5.6 - 2024-09-28
|
|
67
|
+
|
|
68
|
+
### Added
|
|
69
|
+
- ```isTonAsset(PoolAssetConfig)``` function
|
|
70
|
+
### Fixed
|
|
71
|
+
Dust is a small amount of principal that is ignored
|
|
72
|
+
- ```parseUserLiteData``` (dust) & ```parseUserData``` (dust and withdrawLimits) calculations problem
|
|
73
|
+
- ```user.data.withdrawalLimits```, ```user.data.balance```, ```user.data.principals``` calculation for LP pool contract and main pool contract
|
|
74
|
+
### Changed
|
|
75
|
+
- ```parseUserLiteData``` (without prices), ```parseUserData``` applyDust argument default value changed to ```True```
|
|
76
|
+
- Many composite types were removed from sdk
|
|
77
|
+
- ```PoolTonAssetConfig, PoolJettonAssetConfig``` -> ```PoolAssetConfig```,
|
|
78
|
+
- ```JettonMessageParameters, SupplyBaseParameters, TonSupplyParameters, JettonSupplyParameters``` -> ```SupplyParameters```,
|
|
79
|
+
- ```LiquidationBasePrameters, TonLiquidationParameters, JettonLiquidationParameters``` -> ```LiquidationParameters```
|
|
80
|
+
|
|
81
|
+
## 0.5.5
|
|
82
|
+
|
|
83
|
+
### Added
|
|
84
|
+
- calculateMaximumWithdrawAmount function
|
|
85
|
+
### Fixed
|
|
86
|
+
- parseUserLiteData (dust) & parseUserData (dust and withdrawLimits) calculations problem
|
|
87
|
+
|
|
88
|
+
## 0.5.4 - 2024-09-09
|
|
89
|
+
|
|
90
|
+
check ```tests\supply_withdraw_test.ts``` for new examples
|
|
91
|
+
|
|
92
|
+
### Added
|
|
93
|
+
|
|
94
|
+
- Pools supports (new argument for Evaa master contract) + LP_POOL constants, default is MAINNET_POOL_CONFIG, default pool is MAINNET_POOL_CONFIG
|
|
95
|
+
```typescript
|
|
96
|
+
const evaa = client.open(new Evaa({poolConfig: TESTNET_LP_POOL_CONFIG}));
|
|
97
|
+
|
|
98
|
+
const evaaMainNet = clientMainNet.open(new Evaa({poolConfig: MAINNET_LP_POOL_CONFIG}));
|
|
99
|
+
```
|
|
100
|
+
- New types for pools initializtion, for assets
|
|
101
|
+
check ```constants\assets.ts``` for new examples
|
|
102
|
+
|
|
103
|
+
- getPrices - a new function inside Evaa, returns prices of current pool
|
|
104
|
+
|
|
105
|
+
```typescript
|
|
106
|
+
await evaaMainNet.getPrices()
|
|
107
|
+
```
|
|
108
|
+
### Changed
|
|
109
|
+
- New argument nftId (depends on pool) for getPrices
|
|
110
|
+
```typescript
|
|
111
|
+
export async function getPrices(endpoints: string[] = ["api.stardust-mainnet.iotaledger.net"], nftId: string = MAIN_POOL_NFT_ID) {
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
- Everything about working with assets, new assets list
|
|
115
|
+
```typescript
|
|
116
|
+
import { JUSDC_MAINNET, JUSDC_TESTNET, JUSDT_MAINNET, JUSDT_TESTNET, STTON_MAINNET, STTON_TESTNET, TON_MAINNET, TON_STORM_MAINNET, TONUSDT_DEDUST_MAINNET, TSTON_MAINNET, USDT_MAINNET, USDT_STORM_MAINNET } from "@evaafi/sdk";
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
```typescript
|
|
120
|
+
await evaaMainNet.sendSupply(sender_mainnet, toNano(1), {
|
|
121
|
+
queryID: 0n,
|
|
122
|
+
includeUserCode: true,
|
|
123
|
+
amount: 500_000_000n,
|
|
124
|
+
userAddress: address_mainnet,
|
|
125
|
+
asset: TON_MAINNET
|
|
126
|
+
});
|
|
127
|
+
```
|
|
128
|
+
### Fixed
|
|
129
|
+
- predictHealthFactor minor fixes
|
|
130
|
+
- getUserJettonWallet all currencies support
|
|
131
|
+
|
|
132
|
+
## 0.5.3 - 2024-08-20
|
|
133
|
+
|
|
134
|
+
### Fixed
|
|
135
|
+
- getPrices now supports several endpoints (works on the principle of which one will answer faster, whose answer is used) and throws an exception if prices are not loaded
|
|
136
|
+
|
|
137
|
+
## 0.5.2 - 2024-08-19
|
|
138
|
+
|
|
139
|
+
### Fixed
|
|
140
|
+
- predictHealthFactor argument processing improving
|
|
141
|
+
- getSync fixed parsing contract state, base64url was replaced to base64 encoding which has much higher support
|
|
142
|
+
|
|
143
|
+
## 0.5.1 - 2024-07-05
|
|
144
|
+
|
|
145
|
+
### Added
|
|
146
|
+
- predictHealthFactor function to predict a change in a health factor after repay, borrow, supply, withdraw
|
|
147
|
+
|
|
148
|
+
## 0.5.0 - 2024-06-29
|
|
149
|
+
This release contains breaking changes.
|
|
150
|
+
|
|
151
|
+
### Added
|
|
152
|
+
- Reserve variables parsing on user & master sc
|
|
153
|
+
- Added endpoint argument for getPrices, default api.stardust-mainnet.iotaledger.net
|
|
154
|
+
- Added applyDust (default false) option in parseUserLiteData and parseUserData
|
|
155
|
+
|
|
156
|
+
### Changed
|
|
157
|
+
- Master contracts' version
|
|
158
|
+
- Testnet master contract address
|
|
159
|
+
- Parsers on master sc
|
|
160
|
+
- Parsers on user sc
|
|
161
|
+
- Liquidation calculations now counts with reserve factor from master config
|
|
162
|
+
|
|
163
|
+
### Fixed
|
|
164
|
+
- UserBalance calculation was fixed
|
|
165
|
+
|
|
166
|
+
## 0.4.0 - 2024-06-01
|
|
167
|
+
This release contains breaking changes.
|
|
168
|
+
|
|
169
|
+
### Added
|
|
170
|
+
- Master storage onchain getter
|
|
171
|
+
- User storage onchain getter
|
|
172
|
+
- Testnet flag for `parseMasterData`, `parseUserData` and `parseUserLiteData` functions
|
|
173
|
+
- `maxTotalSupply` field to Assets Config
|
|
174
|
+
- Seperate Assets ID for Mainnet and Testnet
|
|
175
|
+
|
|
176
|
+
### Changed
|
|
177
|
+
- Master contracts' version
|
|
178
|
+
- Testnet master contract address
|
|
179
|
+
|
|
180
|
+
### Removed
|
|
181
|
+
- `ASSET_ID` constant
|
|
182
|
+
|
|
183
|
+
### Fixed
|
|
184
|
+
- Jetton wallets address calculation
|
|
185
|
+
- Field names in Assets Config and Assets Data serialization functions
|
|
186
|
+
|
|
187
|
+
## 0.3.2 - 2024-04-20
|
|
188
|
+
### Added
|
|
189
|
+
- New asset - Tether USD
|
|
190
|
+
|
|
191
|
+
## 0.3.1 - 2024-04-19
|
|
192
|
+
### Added
|
|
193
|
+
- New asset - tsTON
|
|
194
|
+
|
|
195
|
+
## 0.3.0 - 2024-04-04
|
|
196
|
+
### Added
|
|
197
|
+
- New asset - stTON
|
|
198
|
+
|
|
199
|
+
### Changed
|
|
200
|
+
- Price fetching from another source
|
|
201
|
+
- Testnet master contract address
|
|
202
|
+
- Master contracts' version
|
|
203
|
+
|
|
204
|
+
### Removed
|
|
205
|
+
- Ethereum dependencies
|
|
206
|
+
|
|
207
|
+
## 0.2.0 - 2024-03-13
|
|
208
|
+
This release contains breaking changes.
|
|
209
|
+
|
|
210
|
+
### Added
|
|
211
|
+
- BOC of last sent message via TonConnect. Can be obtained by `getLastSentBoc` function
|
|
212
|
+
- Calculation of user's health factor
|
|
213
|
+
|
|
214
|
+
### Changed
|
|
215
|
+
- Testnet master contract address and version
|
|
216
|
+
- Supply fee from 0.5 TON to 0.3 TON
|
|
217
|
+
- APY moved from user data to master data
|
|
218
|
+
|
|
219
|
+
### Removed
|
|
220
|
+
- Description of some methods in `UserContract` and `MasterContract`
|
|
221
|
+
|
|
222
|
+
### Fixed
|
|
223
|
+
- Calculation of borrow limits
|
|
224
|
+
|
|
225
|
+
## 0.1.0 - 2024-03-11
|
|
226
|
+
### Added
|
|
227
|
+
- Parsing user lite data, which does not require prices
|
|
228
|
+
- Assets reserves to `MasterData`
|
|
229
|
+
- Types and methods descriptions in `MasterContract` and `UserContract`
|
|
230
|
+
|
|
231
|
+
### Changed
|
|
232
|
+
- Added parallel price fetching
|
|
233
|
+
- Crypto library to 'crypto-js' for compatibility with browser
|
|
234
|
+
- Testnet Master version to 2
|
|
235
|
+
|
|
236
|
+
### Removed
|
|
237
|
+
- `sort-deep-object-arrays` dependency
|
|
238
|
+
|
|
239
|
+
### Fixed
|
|
240
|
+
- Getting user's jetton wallet
|
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
|
@@ -30,9 +30,7 @@ function createAssetData() {
|
|
|
30
30
|
buidler.storeUint(src.balance, 64);
|
|
31
31
|
buidler.storeUint(src.trackingSupplyIndex, 64);
|
|
32
32
|
buidler.storeUint(src.trackingBorrowIndex, 64);
|
|
33
|
-
|
|
34
|
-
buidler.storeUint(src.awaitedSupply, 64);
|
|
35
|
-
}
|
|
33
|
+
buidler.storeUint(src.awaitedSupply, 64);
|
|
36
34
|
},
|
|
37
35
|
parse: (src) => {
|
|
38
36
|
const sRate = BigInt(src.loadInt(64));
|
|
@@ -43,10 +41,7 @@ function createAssetData() {
|
|
|
43
41
|
const balance = BigInt(src.loadInt(64));
|
|
44
42
|
const trackingSupplyIndex = BigInt(src.loadUint(64));
|
|
45
43
|
const trackingBorrowIndex = BigInt(src.loadUint(64));
|
|
46
|
-
|
|
47
|
-
if (src.remainingBits == 64) {
|
|
48
|
-
awaitedSupply = BigInt(src.loadUint(64));
|
|
49
|
-
}
|
|
44
|
+
const awaitedSupply = BigInt(src.loadUint(64));
|
|
50
45
|
return { sRate, bRate, totalSupply, totalBorrow, lastAccural, balance, trackingSupplyIndex, trackingBorrowIndex, awaitedSupply };
|
|
51
46
|
},
|
|
52
47
|
};
|
|
@@ -181,7 +176,7 @@ function parseMasterData(masterDataBOC, poolAssetsConfig, masterConstants) {
|
|
|
181
176
|
};
|
|
182
177
|
}
|
|
183
178
|
exports.parseMasterData = parseMasterData;
|
|
184
|
-
function parseUserLiteData(userDataBOC, assetsData, assetsConfig, poolConfig, applyDust =
|
|
179
|
+
function parseUserLiteData(userDataBOC, assetsData, assetsConfig, poolConfig, applyDust = false) {
|
|
185
180
|
const poolAssetsConfig = poolConfig.poolAssetsConfig;
|
|
186
181
|
const masterConstants = poolConfig.masterConstants;
|
|
187
182
|
const userSlice = core_1.Cell.fromBase64(userDataBOC).beginParse();
|
|
@@ -244,7 +239,7 @@ function parseUserLiteData(userDataBOC, assetsData, assetsConfig, poolConfig, ap
|
|
|
244
239
|
};
|
|
245
240
|
}
|
|
246
241
|
exports.parseUserLiteData = parseUserLiteData;
|
|
247
|
-
function parseUserData(userLiteData, assetsData, assetsConfig, prices, poolConfig, applyDust =
|
|
242
|
+
function parseUserData(userLiteData, assetsData, assetsConfig, prices, poolConfig, applyDust = false) {
|
|
248
243
|
const poolAssetsConfig = poolConfig.poolAssetsConfig;
|
|
249
244
|
const masterConstants = poolConfig.masterConstants;
|
|
250
245
|
const withdrawalLimits = core_1.Dictionary.empty();
|
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
|
+
};
|
|
@@ -19,10 +19,13 @@ export declare const MAINNET_VERSION = 6;
|
|
|
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 = 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 = {
|
|
@@ -22,28 +22,18 @@ exports.MAINNET_VERSION = 6;
|
|
|
22
22
|
exports.EVAA_MASTER_TESTNET = core_1.Address.parse('EQDLsg3w-iBj26Gww7neYoJAxiT2t77Zo8ro56b0yuHsPp3C');
|
|
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 = 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: '0x3bb147a37b7a7f874c39320440f352bddd2c9337e31a778731910f0266391650' },
|
|
34
|
-
{ id: 1, address: '0x676767e93b05a21aec9023a65f73cffe1c725709c3c964a7c3f0fd4229089bfe' },
|
|
35
|
-
{ id: 2, address: '0x9c9e65951b0c5920c286bdb3410babcaf21f85bc9c90c13172988630f1244e0f' },
|
|
36
|
-
{ id: 3, address: '0x9dcf880229bfb68d7344fd294624b64f1e0b43b9d858f0fdb1bc6434616c08f5' },
|
|
37
|
-
{ id: 4, address: '0x4d1afcf7c0426ca61c405c8cfaef0053a0f0d143740ffed04c8716beb99cd614' },
|
|
38
|
-
{ id: 5, address: '0x11c6baa608ed10733051fd74134441d384e471722fbc496b43ea4e3c6652485f' },
|
|
39
|
-
{ id: 6, address: '0x2b685672f38dc2fce59013bb740bf24c6037049a1c267bb3b5f6f55d5b195f5f' },
|
|
40
|
-
];
|
|
41
|
-
exports.ORACLES_LP = [
|
|
42
|
-
{ id: 0, address: '0xd3a8c0b9fd44fd25a49289c631e3ac45689281f2f8cf0744400b4c65bed38e5d' },
|
|
43
|
-
{ id: 1, address: '0x2c21cabdaa89739de16bde7bc44e86401fac334a3c7e55305fe5e7563043e191' },
|
|
44
|
-
{ id: 2, address: '0x2eb258ce7b5d02466ab8a178ad8b0ba6ffa7b58ef21de3dc3b6dd359a1e16af0' },
|
|
45
|
-
{ 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') },
|
|
46
33
|
];
|
|
34
|
+
exports.ORACLES_TESTNET = exports.ORACLES_MAINNET;
|
|
35
|
+
exports.ORACLES_LP = exports.ORACLES_MAINNET;
|
|
36
|
+
exports.ORACLES_ALTS = exports.ORACLES_MAINNET;
|
|
47
37
|
exports.LENDING_CODE = core_1.Cell.fromBoc(Buffer.from('b5ee9c72c1010e0100fd000d12182a555a6065717691969efd0114ff00f4a413f4bcf2c80b010202c8050202039f740403001ff2f8276a2687d2018fd201800f883b840051d38642c678b64e4400780e58fc10802faf07f80e59fa801e78b096664c02078067c07c100627a7978402014807060007a0ddb0c60201c709080013a0fd007a026900aa90400201200b0a0031b8e1002191960aa00b9e2ca007f4042796d225e8019203f6010201200d0c000bf7c147d2218400b9d10e86981fd201840b07f8138d809797976a2687d2029116382f970fd9178089910374daf81b619fd20182c7883b8701981684100627910eba56001797a6a6ba610fd8200e8768f76a9f6aa00cc2a32a8292878809bef2f1889f883bbcdeb86f01', 'hex'))[0];
|
|
48
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=');
|
|
49
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
|
+
assets_1.UTON_MAINNET // announce
|
|
19
20
|
],
|
|
20
21
|
lendingCode: general_1.LENDING_CODE
|
|
21
22
|
};
|
|
@@ -24,7 +25,7 @@ exports.TESTNET_POOL_CONFIG = {
|
|
|
24
25
|
masterVersion: general_1.TESTNET_VERSION,
|
|
25
26
|
masterConstants: general_1.MASTER_CONSTANTS,
|
|
26
27
|
oracles: general_1.ORACLES_TESTNET,
|
|
27
|
-
minimalOracles:
|
|
28
|
+
minimalOracles: 3,
|
|
28
29
|
poolAssetsConfig: [
|
|
29
30
|
assets_1.TON_MAINNET,
|
|
30
31
|
assets_1.JUSDT_TESTNET,
|
|
@@ -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;
|