@aurigami/sdk 1.20.6 → 1.20.8
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 +384 -0
- package/dist/sdk.cjs.development.js +42 -65
- package/dist/sdk.cjs.development.js.map +1 -1
- package/dist/sdk.cjs.production.min.js +1 -1
- package/dist/sdk.cjs.production.min.js.map +1 -1
- package/dist/sdk.esm.js +42 -65
- package/dist/sdk.esm.js.map +1 -1
- package/package.json +70 -70
- package/src/interactors/MoneyMarket.ts +19 -18
package/ChangeLog.md
ADDED
|
@@ -0,0 +1,384 @@
|
|
|
1
|
+
# Change Logs
|
|
2
|
+
# 1.15.0:
|
|
3
|
+
- `SDKRead(...).setUserNotificationSettings(address: string, mail: string, utilisation: number, liquidation: boolean, captchaResponse: string)`:
|
|
4
|
+
- utilisation in range (0..1)
|
|
5
|
+
- `SDKRead(...).unsetUserNotificationSettings(address: string, captchaResponse: string)` use this to unsubscribe for notification
|
|
6
|
+
|
|
7
|
+
# 1.14.0:
|
|
8
|
+
- Fix cache bug
|
|
9
|
+
- Remove `stNEAR` in `DEPOSIT_ONLY_TOKENS` (this is for monitoring bot)
|
|
10
|
+
# 1.13.1
|
|
11
|
+
- Add `PlyGameRead(...).overallLeaderboard(): Promise<PlyGameLeaderboardItem[]>`: overall ranking of the top 50 users by amount of PULP unlocked
|
|
12
|
+
|
|
13
|
+
# 1.13.0
|
|
14
|
+
- Add `SdkRead(...).getNetApyWithIncentive` and `getNetApyWithoutIncentive`.
|
|
15
|
+
|
|
16
|
+
# 1.12.8:
|
|
17
|
+
|
|
18
|
+
- Add `mintCap(): Promise<TokenAmount>` return the mint cap of the autoken
|
|
19
|
+
- Add `borrowCap(): Promise<TokenAmount>)` return the borrow cap of the autoken
|
|
20
|
+
|
|
21
|
+
# 1.12.7:
|
|
22
|
+
|
|
23
|
+
- Add `(...).queuePosition(address: Address): Promise<number>` return the position of the address in referral queue. -1 if not in queue,
|
|
24
|
+
999 if not in top 600.
|
|
25
|
+
- `slotsInUse()` now will not accept any param, and return the total slots in total.
|
|
26
|
+
|
|
27
|
+
## 1.12.6:
|
|
28
|
+
|
|
29
|
+
- Remove `getJackpotResult`, use `getLastJackpotResult` instead.
|
|
30
|
+
- Hide winner address in jackpot result.
|
|
31
|
+
|
|
32
|
+
## 1.12.3
|
|
33
|
+
|
|
34
|
+
- Add `PlyGameRead(...).getJackpotResult(round:number): Promise<{amount: TokenAmount, winner: Address}>`: return jackpot winner of the given round
|
|
35
|
+
|
|
36
|
+
## 1.12.2
|
|
37
|
+
|
|
38
|
+
- Use DefiLlama API as an backup for Coingecko
|
|
39
|
+
|
|
40
|
+
## 1.12.0 + 1.12.1
|
|
41
|
+
|
|
42
|
+
- Use new referral contract
|
|
43
|
+
- Remove referral V1 data
|
|
44
|
+
|
|
45
|
+
- `ReferralRead(...).isNewUserAtReferralTime(address: Address): Promise<boolean>`: Return true if this is a new user of aurigami
|
|
46
|
+
when he got referred
|
|
47
|
+
- `...(...).depositedMoreThanMinimumAmount(address: Address): Promise<boolean>`: Return true if the user has deposited more than the minimum amount (100$)
|
|
48
|
+
|
|
49
|
+
- `ReferralRead(...).isWhitelistedAddress(address: Address): Promise<boolean>`: check whether a user is a whitelisted referrer or not
|
|
50
|
+
- `ReferralRead(...).isOnAuroraPlus(address: Address): Promise<boolean>`: Check whether a user on Aurora+ or not
|
|
51
|
+
|
|
52
|
+
- `ReferralRead(...).slotsInUse(referralCode: string): Promise<number>`
|
|
53
|
+
- `(...).totalReferralSlots(): number` -> return 500
|
|
54
|
+
- `(...).userReferralStatus(userAddr: Address): Promise<string>` -> return `notReferred`, `notQualified`, `Qualified`, or `Withdrawn` base on the user status
|
|
55
|
+
- Type changes: `ReferralReward` now will have `refereeAddress: string | null`
|
|
56
|
+
|
|
57
|
+
## 1.11.1
|
|
58
|
+
|
|
59
|
+
- PlyGame `getPlyGameResultsInTransaction` get result faster by using `getTransactionReceipt` instead of `waitForTransaction`
|
|
60
|
+
|
|
61
|
+
## 1.11.0
|
|
62
|
+
|
|
63
|
+
- Add support for Plygame with testing contract
|
|
64
|
+
- Type:
|
|
65
|
+
|
|
66
|
+
```ts
|
|
67
|
+
export type PlyGameBetResult = {
|
|
68
|
+
player: string;
|
|
69
|
+
outcome: string;
|
|
70
|
+
lostAmount: TokenAmount;
|
|
71
|
+
unlockedPulpAmount: TokenAmount;
|
|
72
|
+
|
|
73
|
+
block: number;
|
|
74
|
+
timestamp: number;
|
|
75
|
+
transactionHash: string;
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
type PlyGameLeaderboardItem = {
|
|
79
|
+
player: string;
|
|
80
|
+
gamesPlayed: number;
|
|
81
|
+
unlockedPulpAmount: TokenAmount;
|
|
82
|
+
};
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
- Read functions:
|
|
86
|
+
|
|
87
|
+
- `PlyGameRead(...).getUserPlyGameHistory(user) -> Promise<PlyGameBetResult[]>`: Get 100 most recent bets of the market users
|
|
88
|
+
- `(...).currentJackpotAmount(): Promise<TokenAmount>`
|
|
89
|
+
- `(...).earlyUnlockedPulpAmount(user): Promise<TokenAmount>`: get total unlocked pulp amount since launch.
|
|
90
|
+
- `(...).getPlyGameResultsInTransaction(txHash): Promise<PlyGameBetResult[]>`: Return list of bet made from the given transaction.
|
|
91
|
+
- `PlyGameRead(...).leaderboard(): Promise<PlyGameLeaderboardItem[]>`: ranking list of the top 100 users by amount of PULP unlocked
|
|
92
|
+
|
|
93
|
+
- Write functions:
|
|
94
|
+
|
|
95
|
+
- `PlyGameReadWrite(...).makeBetOnce(amount: TokenAmount)`
|
|
96
|
+
- `(...).approve(amount: TokenAmount)`: approve plygame contract spending user's PLY
|
|
97
|
+
|
|
98
|
+
## 1.10.0
|
|
99
|
+
|
|
100
|
+
- Public `PapermillRead(...).getWeek(timestamp: number): number`
|
|
101
|
+
|
|
102
|
+
## 1.9.7
|
|
103
|
+
|
|
104
|
+
- Change oracle address
|
|
105
|
+
|
|
106
|
+
## 1.9.6
|
|
107
|
+
|
|
108
|
+
- Add oracle to ENV
|
|
109
|
+
|
|
110
|
+
## 1.9.5
|
|
111
|
+
|
|
112
|
+
- Use compound formular to calculate market APY.
|
|
113
|
+
|
|
114
|
+
## 1.9.4
|
|
115
|
+
|
|
116
|
+
- Allow to set custom dust in sneak account
|
|
117
|
+
|
|
118
|
+
## 1.9.3
|
|
119
|
+
|
|
120
|
+
- Change ply circulating supply
|
|
121
|
+
|
|
122
|
+
## 1.9.2
|
|
123
|
+
|
|
124
|
+
- Use 10B for PLY total supply
|
|
125
|
+
|
|
126
|
+
## 1.9.1
|
|
127
|
+
|
|
128
|
+
- Handle error in fetching LP price
|
|
129
|
+
|
|
130
|
+
## 1.9.0
|
|
131
|
+
|
|
132
|
+
- Rename `contracts` folder to `interactors`.
|
|
133
|
+
- Catching fetch price error
|
|
134
|
+
|
|
135
|
+
## 1.8.6
|
|
136
|
+
|
|
137
|
+
- Fix bug in `formattedAmount` when using custom format.
|
|
138
|
+
|
|
139
|
+
## 1.8.5
|
|
140
|
+
|
|
141
|
+
- Able to customize format in TokenAmount.formattedAmount()
|
|
142
|
+
|
|
143
|
+
## 1.8.4
|
|
144
|
+
|
|
145
|
+
- Add campaign ids for referrals
|
|
146
|
+
|
|
147
|
+
## 1.8.3
|
|
148
|
+
|
|
149
|
+
- Markets rewards + staking rewards can be claim in one txn by `SdkReadWrite(...).claim()`
|
|
150
|
+
- Remove `SdkReadWrite(...).claimLpRewards()`
|
|
151
|
+
|
|
152
|
+
## 1.8.2
|
|
153
|
+
|
|
154
|
+
Bug fix on missing txnHash in referralReward type
|
|
155
|
+
|
|
156
|
+
## 1.8.1
|
|
157
|
+
|
|
158
|
+
- Change campaign id
|
|
159
|
+
|
|
160
|
+
## 1.8.0
|
|
161
|
+
|
|
162
|
+
- Return actual data for referral rewards.
|
|
163
|
+
- Change `ReferralRead(...).leaderboard()` to `ReferralRead(...).leaderboard(campaign: string)`: now can get the leaderboard of a given campaign.
|
|
164
|
+
|
|
165
|
+
## 1.7.9-dummy
|
|
166
|
+
|
|
167
|
+
- Add `userAddr` in ReferralReward type
|
|
168
|
+
|
|
169
|
+
## 1.7.8-dummy
|
|
170
|
+
|
|
171
|
+
- Update Meta rewards for stNEAR to `1,250,000` META.
|
|
172
|
+
|
|
173
|
+
## 1.7.7-dummy
|
|
174
|
+
|
|
175
|
+
- [Dummy data] Add `ReferralRead(...).referralRewards(userAddr: Address): Promise<ReferralReward[]>`: Array of rewards, sorted by time of the referral period (from latest to oldest)
|
|
176
|
+
- [Dummy data] Add `ReferralRead(...).leaderboard(): Promise<ReferralReward[]>`: Top 50 reward earners from the last round, sorted by token amount.
|
|
177
|
+
|
|
178
|
+
- Add `ReferralReadWrite(...).claimReferralRewards()`: Claim all unclaimed rewards for a given user
|
|
179
|
+
|
|
180
|
+
New type:
|
|
181
|
+
|
|
182
|
+
```ts
|
|
183
|
+
export type ReferralReward = {
|
|
184
|
+
campaign: string;
|
|
185
|
+
/**
|
|
186
|
+
* start timetamp of the referral round
|
|
187
|
+
*/
|
|
188
|
+
startTime: number;
|
|
189
|
+
/**
|
|
190
|
+
* end timetamp of the referral round
|
|
191
|
+
*/
|
|
192
|
+
endTime: number;
|
|
193
|
+
/**
|
|
194
|
+
* referrer's rewards
|
|
195
|
+
*/
|
|
196
|
+
isReferrer: boolean;
|
|
197
|
+
/**
|
|
198
|
+
* reward amount
|
|
199
|
+
*/
|
|
200
|
+
rewardTokenAmount: TokenAmount;
|
|
201
|
+
/**
|
|
202
|
+
* hash of the transaction on aurorascan (if no, return null)
|
|
203
|
+
*/
|
|
204
|
+
transactionHash: string | null;
|
|
205
|
+
};
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
## 1.7.3
|
|
209
|
+
|
|
210
|
+
- Add helper functions for Auri monitoring system
|
|
211
|
+
|
|
212
|
+
## 1.7.1 & 1.7.2
|
|
213
|
+
|
|
214
|
+
- Return correct timestamp in referrals list
|
|
215
|
+
|
|
216
|
+
## 1.7.0
|
|
217
|
+
|
|
218
|
+
- Add `ReferralRead(...).getReferralsList(userAddr: Address): Promise<{ user: string; timestamp: number }[]>`: Get 50 latest referrals of the given address, sorted descending by timestamp. Currently the timestamp is dummy data.
|
|
219
|
+
|
|
220
|
+
## 1.6.9
|
|
221
|
+
|
|
222
|
+
Support internal aurilens
|
|
223
|
+
|
|
224
|
+
## 1.6.6
|
|
225
|
+
|
|
226
|
+
Use `public readonly` modifier instead of `private/protected` in SDK.
|
|
227
|
+
|
|
228
|
+
## 1.6.5
|
|
229
|
+
|
|
230
|
+
SDK refactor #2, remove support for loterry campaign. Package size reduced from 3MB -> 200KB
|
|
231
|
+
|
|
232
|
+
## 1.6.4
|
|
233
|
+
|
|
234
|
+
Return meaningful result instead of INF in `calcLMRewardApr`
|
|
235
|
+
|
|
236
|
+
## 1.6.3
|
|
237
|
+
|
|
238
|
+
Add USN supports. Hardcoded USN price to $1.
|
|
239
|
+
|
|
240
|
+
## 1.6.2
|
|
241
|
+
|
|
242
|
+
- Add `ReferralRead(...).getUserReferralCode(userAddr: Address): Promise<string>`: Get the referral code for a given address, returns empty string if not found. Called to check if a user has a referral code.
|
|
243
|
+
- Add `ReferralRead(...).getReferralCodeOwner(code: string): Promise<Address>`: Get owner of a referral code, returns zero address if not found.
|
|
244
|
+
- Add `ReferralRead(...).getReferralCodeUsed(userAddr: Address): Promise<string>`: Get referral code that a user was referred by, returns empty string if not found.
|
|
245
|
+
- Add `ReferralReadWrite(...).registerNewReferralCode(): Promise<TransactionResponse>`: Generate a referral code for a given address. Called when an user want to creates his own referral code
|
|
246
|
+
- Add `ReferralReadWrite(...).useReferralCode(code: string): Promise<TransactionResponse>`: Called when an user confirms he is referred by a specified code
|
|
247
|
+
|
|
248
|
+
## 1.6.1
|
|
249
|
+
|
|
250
|
+
Add `PapermillRead(...).getNextWeekTimestamp(): number`: get the start timestamp of next week of the papermill contract.
|
|
251
|
+
|
|
252
|
+
Add `SdkRead(...).getPlyCirculatingSupply(): Promise<TokenAmount>`: get the ply's circulating supply
|
|
253
|
+
|
|
254
|
+
## 1.6.0
|
|
255
|
+
|
|
256
|
+
SDK refactor - Why?:
|
|
257
|
+
|
|
258
|
+
- more modular and less coupled.
|
|
259
|
+
- more testable.
|
|
260
|
+
- more maintainable.
|
|
261
|
+
|
|
262
|
+
Things to do:
|
|
263
|
+
|
|
264
|
+
- [x] Restructure the folder structure.
|
|
265
|
+
- Refactor the code - Use composition pattern to SDK class
|
|
266
|
+
- [x] Use address from contract package instead of hardcoded address.
|
|
267
|
+
|
|
268
|
+
## 1.5.8 + 1.5.9
|
|
269
|
+
|
|
270
|
+
Fix gas error on claim rewards: Instead of claim all the rewards in all market in 1 txns, we will claim rewards in 2 txns.
|
|
271
|
+
|
|
272
|
+
## 1.5.7
|
|
273
|
+
|
|
274
|
+
- Change return type of `SdkRead(...).LpBalanceOf` and `stakeBalanceOf` from `TokenValuation` to `TokenAmount` to match other functions in the SDK.
|
|
275
|
+
- `totalStakedLiquidity` field in `PLYWNEARPoolDetails` is now `TokenAmount` instead of `TokenValuation`.
|
|
276
|
+
|
|
277
|
+
```ts
|
|
278
|
+
export type PLYWNEARPoolDetails = {
|
|
279
|
+
totalStakedLiquidity: TokenAmount;
|
|
280
|
+
APYs: TokenAPY[];
|
|
281
|
+
};
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
## 1.5.6
|
|
285
|
+
|
|
286
|
+
Add PLYWNEAR pool to ALL_STAKING_POOLS
|
|
287
|
+
|
|
288
|
+
## 1.5.5
|
|
289
|
+
|
|
290
|
+
Add auPLY market, integrate new fair launch contract
|
|
291
|
+
|
|
292
|
+
Hard code PULP price to 0
|
|
293
|
+
|
|
294
|
+
## 1.5.4
|
|
295
|
+
|
|
296
|
+
Use browser-friendly assert
|
|
297
|
+
|
|
298
|
+
## 1.5.2
|
|
299
|
+
|
|
300
|
+
Added `SdkRead(...).unclaimedRewardsOf(userAddress: Address): Promise<TokenAmount[]>` to get unclaimed rewards of a user in LP staking.
|
|
301
|
+
|
|
302
|
+
## 1.5.1
|
|
303
|
+
|
|
304
|
+
Added `PapermillRead(...).getUnlockPortionAt(userAddress: Address, timestamp: number)`
|
|
305
|
+
|
|
306
|
+
```ts
|
|
307
|
+
export type TokenAPY = {
|
|
308
|
+
address: string;
|
|
309
|
+
apy: string;
|
|
310
|
+
};
|
|
311
|
+
|
|
312
|
+
export type PLYWNEARPoolDetails = {
|
|
313
|
+
totalStakedLiquidity: TokenValuation;
|
|
314
|
+
APYs: TokenAPY[];
|
|
315
|
+
//apy: string; removed
|
|
316
|
+
};
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
## 1.5.0 For staking PLYWNEAR
|
|
320
|
+
|
|
321
|
+
### Unchanged:
|
|
322
|
+
|
|
323
|
+
- Stake/unstake: Use `SdkReadWrite(...).stake(amount: TokenAmount)` (or `unstake`)
|
|
324
|
+
|
|
325
|
+
### Rename:
|
|
326
|
+
|
|
327
|
+
- `SdkRead(...).getPlyAuroraPoolDetails` -> `SdkRead(...).getPLYWNEARPoolDetails`
|
|
328
|
+
|
|
329
|
+
### Add
|
|
330
|
+
|
|
331
|
+
- Read:
|
|
332
|
+
- `SdkRead(...).LpBalanceOf(user: Address):TokenValuation` => amount and $ value of LP token in wallet. To get amount staked, use the old `stakeBalanceOf()` above
|
|
333
|
+
- Type:
|
|
334
|
+
- `TokenValuation` is a type that contains amount and $ value of token.
|
|
335
|
+
|
|
336
|
+
```ts
|
|
337
|
+
export type TokenValuation = {
|
|
338
|
+
tokenAmount: TokenAmount;
|
|
339
|
+
currencyAmount: CurrencyAmount;
|
|
340
|
+
};
|
|
341
|
+
```
|
|
342
|
+
|
|
343
|
+
```ts
|
|
344
|
+
export type PLYWNEARPoolDetails = {
|
|
345
|
+
totalStakedLiquidity: TokenValuation;
|
|
346
|
+
apy: string;
|
|
347
|
+
};
|
|
348
|
+
```
|
|
349
|
+
|
|
350
|
+
### Return type changed:
|
|
351
|
+
|
|
352
|
+
- `SdkRead(...).stakeBalanceOf()` will return `TokenValuation` instead of `TokenAmount`
|
|
353
|
+
|
|
354
|
+
### Remove:
|
|
355
|
+
|
|
356
|
+
- Type `PlyAuroraPoolDetails` removed.
|
|
357
|
+
|
|
358
|
+
## 1.5.0 For Papermill
|
|
359
|
+
|
|
360
|
+
### Add
|
|
361
|
+
|
|
362
|
+
- Read functions:
|
|
363
|
+
|
|
364
|
+
- `new PapermillRead(...).getPlyBalance(address: Address): TokenAmount` => PLY balance in user wallet
|
|
365
|
+
- `new PapermillRead(...).getPulpBalance(address: Address): TokenAmount` => PULP balance in user wallet
|
|
366
|
+
- `new PapermillRead(...).getLockingDetails(address: Address): UserLockingDetails`: Get locking details. This function is for convenience only, because the locking details are already available in the `UserLockingDetails` result (which you can get by calling the old `SdkRead(...).getUserDetails()`)
|
|
367
|
+
|
|
368
|
+
- Write functions:
|
|
369
|
+
|
|
370
|
+
- `new PapermillReadWrite(...).redeem(recipient: Address, amount: TokenAmount)` => Redeem Ply from PULP. Set `amount` to `ethers.constants.MaxUint256` for max redeem.
|
|
371
|
+
- `new PapermillReadWrite(...).selfRedeem(amount: TokenAmount)` => Redeem Ply from PULP to msg.sender. This is just a shortcut for the redeem function above.
|
|
372
|
+
- Collect all PLY reward from all markets + staking pool: No added functions, using the old `SdkReadWrite(...).claim()`
|
|
373
|
+
|
|
374
|
+
- Type:
|
|
375
|
+
- `UserLockingDetails` to store all user locking details
|
|
376
|
+
|
|
377
|
+
### Update
|
|
378
|
+
|
|
379
|
+
- `SdkRead(...).getUserDetails()`: this will include the result from `getLockingDetails`.
|
|
380
|
+
|
|
381
|
+
### Remove
|
|
382
|
+
|
|
383
|
+
- `SdkRead(...).getLockingDetails()`: Use the `getLockingDetails` in papermill instead if needed.
|
|
384
|
+
- Remove `LockingDetails` type
|
|
@@ -2922,38 +2922,15 @@ var MoneyMarketRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
2922
2922
|
}();
|
|
2923
2923
|
_proto.getDepositMetaAPY = /*#__PURE__*/function () {
|
|
2924
2924
|
var _getDepositMetaAPY = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
|
|
2925
|
-
var _yield$Promise$all6, totalDeposited, underlyingPrice, depositMETAApy;
|
|
2926
2925
|
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
2927
2926
|
while (1) switch (_context13.prev = _context13.next) {
|
|
2928
2927
|
case 0:
|
|
2929
|
-
_context13.
|
|
2930
|
-
|
|
2931
|
-
case 2:
|
|
2932
|
-
_yield$Promise$all6 = _context13.sent;
|
|
2933
|
-
totalDeposited = _yield$Promise$all6[0];
|
|
2934
|
-
underlyingPrice = _yield$Promise$all6[1];
|
|
2935
|
-
if (!isSameAddress(this.underlying.address, networkAddresses.tokens.stNEAR)) {
|
|
2936
|
-
_context13.next = 14;
|
|
2937
|
-
break;
|
|
2938
|
-
}
|
|
2939
|
-
_context13.t0 = helpers;
|
|
2940
|
-
_context13.next = 9;
|
|
2941
|
-
return fetchValuation(TokenAmount.fromAddressAndAmount(networkAddresses.tokens.META, '250000', false), this._networkConnection.provider);
|
|
2942
|
-
case 9:
|
|
2943
|
-
_context13.t1 = _context13.sent;
|
|
2944
|
-
_context13.t2 = underlyingPrice.multipliedBy(totalDeposited.formattedAmount());
|
|
2945
|
-
depositMETAApy = _context13.t0.calcLMRewardApr.call(_context13.t0, _context13.t1, _context13.t2, 12);
|
|
2946
|
-
_context13.next = 15;
|
|
2947
|
-
break;
|
|
2948
|
-
case 14:
|
|
2949
|
-
depositMETAApy = new BigNumber(0);
|
|
2950
|
-
case 15:
|
|
2951
|
-
return _context13.abrupt("return", depositMETAApy);
|
|
2952
|
-
case 16:
|
|
2928
|
+
return _context13.abrupt("return", new BigNumber(0));
|
|
2929
|
+
case 1:
|
|
2953
2930
|
case "end":
|
|
2954
2931
|
return _context13.stop();
|
|
2955
2932
|
}
|
|
2956
|
-
}, _callee13
|
|
2933
|
+
}, _callee13);
|
|
2957
2934
|
}));
|
|
2958
2935
|
function getDepositMetaAPY() {
|
|
2959
2936
|
return _getDepositMetaAPY.apply(this, arguments);
|
|
@@ -2979,30 +2956,30 @@ var MoneyMarketRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
2979
2956
|
}();
|
|
2980
2957
|
_proto.getDetails = /*#__PURE__*/function () {
|
|
2981
2958
|
var _getDetails = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15() {
|
|
2982
|
-
var _yield$Promise$
|
|
2959
|
+
var _yield$Promise$all6, totalDeposited, totalBorrowed, depositAPY, borrowAPY, collateralRatio, rewardSpeeds, _yield$Promise$all7, depositPlyAPY, borrowPlyAPY, depositNearAPY, borrowNearAPY, depositMetaAPY, staderDepositApy;
|
|
2983
2960
|
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
|
2984
2961
|
while (1) switch (_context15.prev = _context15.next) {
|
|
2985
2962
|
case 0:
|
|
2986
2963
|
_context15.next = 2;
|
|
2987
2964
|
return Promise.all([this.getTotalTokenDeposited(), this.getTotalTokenBorrowed(), this.getDepositAPY(), this.getBorrowAPY(), this.getCollateralRatio(), this.getRewardSpeeds()]);
|
|
2988
2965
|
case 2:
|
|
2989
|
-
_yield$Promise$
|
|
2990
|
-
totalDeposited = _yield$Promise$
|
|
2991
|
-
totalBorrowed = _yield$Promise$
|
|
2992
|
-
depositAPY = _yield$Promise$
|
|
2993
|
-
borrowAPY = _yield$Promise$
|
|
2994
|
-
collateralRatio = _yield$Promise$
|
|
2995
|
-
rewardSpeeds = _yield$Promise$
|
|
2966
|
+
_yield$Promise$all6 = _context15.sent;
|
|
2967
|
+
totalDeposited = _yield$Promise$all6[0];
|
|
2968
|
+
totalBorrowed = _yield$Promise$all6[1];
|
|
2969
|
+
depositAPY = _yield$Promise$all6[2];
|
|
2970
|
+
borrowAPY = _yield$Promise$all6[3];
|
|
2971
|
+
collateralRatio = _yield$Promise$all6[4];
|
|
2972
|
+
rewardSpeeds = _yield$Promise$all6[5];
|
|
2996
2973
|
_context15.next = 11;
|
|
2997
2974
|
return Promise.all([this.getDepositPlyAPY(), this.getBorrowPlyAPY(), this.getDepositNearAPY(), this.getBorrowNearAPY(), this.getDepositMetaAPY(), this.getDepositStaderAPY()]);
|
|
2998
2975
|
case 11:
|
|
2999
|
-
_yield$Promise$
|
|
3000
|
-
depositPlyAPY = _yield$Promise$
|
|
3001
|
-
borrowPlyAPY = _yield$Promise$
|
|
3002
|
-
depositNearAPY = _yield$Promise$
|
|
3003
|
-
borrowNearAPY = _yield$Promise$
|
|
3004
|
-
depositMetaAPY = _yield$Promise$
|
|
3005
|
-
staderDepositApy = _yield$Promise$
|
|
2976
|
+
_yield$Promise$all7 = _context15.sent;
|
|
2977
|
+
depositPlyAPY = _yield$Promise$all7[0];
|
|
2978
|
+
borrowPlyAPY = _yield$Promise$all7[1];
|
|
2979
|
+
depositNearAPY = _yield$Promise$all7[2];
|
|
2980
|
+
borrowNearAPY = _yield$Promise$all7[3];
|
|
2981
|
+
depositMetaAPY = _yield$Promise$all7[4];
|
|
2982
|
+
staderDepositApy = _yield$Promise$all7[5];
|
|
3006
2983
|
return _context15.abrupt("return", {
|
|
3007
2984
|
auTokenAddress: this.auToken.address,
|
|
3008
2985
|
totalTokenDeposited: totalDeposited,
|
|
@@ -3148,17 +3125,17 @@ var MoneyMarketRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
3148
3125
|
}();
|
|
3149
3126
|
_proto.getDepositBorrowValue = /*#__PURE__*/function () {
|
|
3150
3127
|
var _getDepositBorrowValue = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(userAddress) {
|
|
3151
|
-
var _yield$Promise$
|
|
3128
|
+
var _yield$Promise$all8, price, depositBalance, borrowBalance, suppliedValue, borrowedValue;
|
|
3152
3129
|
return _regeneratorRuntime().wrap(function _callee20$(_context20) {
|
|
3153
3130
|
while (1) switch (_context20.prev = _context20.next) {
|
|
3154
3131
|
case 0:
|
|
3155
3132
|
_context20.next = 2;
|
|
3156
3133
|
return Promise.all([this.getUnderlyingPrice(), this.getUserDepositBalance(userAddress), this.getUserBorrowBalance(userAddress)]);
|
|
3157
3134
|
case 2:
|
|
3158
|
-
_yield$Promise$
|
|
3159
|
-
price = _yield$Promise$
|
|
3160
|
-
depositBalance = _yield$Promise$
|
|
3161
|
-
borrowBalance = _yield$Promise$
|
|
3135
|
+
_yield$Promise$all8 = _context20.sent;
|
|
3136
|
+
price = _yield$Promise$all8[0];
|
|
3137
|
+
depositBalance = _yield$Promise$all8[1];
|
|
3138
|
+
borrowBalance = _yield$Promise$all8[2];
|
|
3162
3139
|
suppliedValue = price.multipliedBy(depositBalance.formattedAmount());
|
|
3163
3140
|
borrowedValue = price.multipliedBy(borrowBalance.formattedAmount());
|
|
3164
3141
|
return _context20.abrupt("return", {
|
|
@@ -3178,19 +3155,19 @@ var MoneyMarketRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
3178
3155
|
}();
|
|
3179
3156
|
_proto.getApyWithoutIncentive = /*#__PURE__*/function () {
|
|
3180
3157
|
var _getApyWithoutIncentive = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(userAddress) {
|
|
3181
|
-
var _yield$Promise$
|
|
3158
|
+
var _yield$Promise$all9, price, depositApy, borrowApy, depositBalance, borrowBalance, suppliedValue, borrowedValue, sum;
|
|
3182
3159
|
return _regeneratorRuntime().wrap(function _callee21$(_context21) {
|
|
3183
3160
|
while (1) switch (_context21.prev = _context21.next) {
|
|
3184
3161
|
case 0:
|
|
3185
3162
|
_context21.next = 2;
|
|
3186
3163
|
return Promise.all([this.getUnderlyingPrice(), this.getDepositAPY(), this.getBorrowAPY(), this.getUserDepositBalance(userAddress), this.getUserBorrowBalance(userAddress)]);
|
|
3187
3164
|
case 2:
|
|
3188
|
-
_yield$Promise$
|
|
3189
|
-
price = _yield$Promise$
|
|
3190
|
-
depositApy = _yield$Promise$
|
|
3191
|
-
borrowApy = _yield$Promise$
|
|
3192
|
-
depositBalance = _yield$Promise$
|
|
3193
|
-
borrowBalance = _yield$Promise$
|
|
3165
|
+
_yield$Promise$all9 = _context21.sent;
|
|
3166
|
+
price = _yield$Promise$all9[0];
|
|
3167
|
+
depositApy = _yield$Promise$all9[1];
|
|
3168
|
+
borrowApy = _yield$Promise$all9[2];
|
|
3169
|
+
depositBalance = _yield$Promise$all9[3];
|
|
3170
|
+
borrowBalance = _yield$Promise$all9[4];
|
|
3194
3171
|
suppliedValue = price.multipliedBy(depositBalance.formattedAmount());
|
|
3195
3172
|
borrowedValue = price.multipliedBy(borrowBalance.formattedAmount());
|
|
3196
3173
|
sum = calcNetApy(suppliedValue, depositApy, borrowedValue, borrowApy);
|
|
@@ -3212,24 +3189,24 @@ var MoneyMarketRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
3212
3189
|
}();
|
|
3213
3190
|
_proto.getApyWithIncentive = /*#__PURE__*/function () {
|
|
3214
3191
|
var _getApyWithIncentive = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(userAddress) {
|
|
3215
|
-
var _yield$Promise$
|
|
3192
|
+
var _yield$Promise$all10, price, depositApy, borrowApy, depositBalance, borrowBalance, nearDepositApy, plyDepositApy, metaDepositApy, nearBorrowApy, plyBorrowApy, staderDepositApy, suppliedValue, borrowedValue, totalDepositApy, totalBorrowApy, sum;
|
|
3216
3193
|
return _regeneratorRuntime().wrap(function _callee22$(_context22) {
|
|
3217
3194
|
while (1) switch (_context22.prev = _context22.next) {
|
|
3218
3195
|
case 0:
|
|
3219
3196
|
_context22.next = 2;
|
|
3220
3197
|
return Promise.all([this.getUnderlyingPrice(), this.getDepositAPY(), this.getBorrowAPY(), this.getUserDepositBalance(userAddress), this.getUserBorrowBalance(userAddress), this.getDepositNearAPY(), this.getDepositPlyAPY(), this.getDepositMetaAPY(), this.getBorrowNearAPY(), this.getBorrowPlyAPY()]);
|
|
3221
3198
|
case 2:
|
|
3222
|
-
_yield$Promise$
|
|
3223
|
-
price = _yield$Promise$
|
|
3224
|
-
depositApy = _yield$Promise$
|
|
3225
|
-
borrowApy = _yield$Promise$
|
|
3226
|
-
depositBalance = _yield$Promise$
|
|
3227
|
-
borrowBalance = _yield$Promise$
|
|
3228
|
-
nearDepositApy = _yield$Promise$
|
|
3229
|
-
plyDepositApy = _yield$Promise$
|
|
3230
|
-
metaDepositApy = _yield$Promise$
|
|
3231
|
-
nearBorrowApy = _yield$Promise$
|
|
3232
|
-
plyBorrowApy = _yield$Promise$
|
|
3199
|
+
_yield$Promise$all10 = _context22.sent;
|
|
3200
|
+
price = _yield$Promise$all10[0];
|
|
3201
|
+
depositApy = _yield$Promise$all10[1];
|
|
3202
|
+
borrowApy = _yield$Promise$all10[2];
|
|
3203
|
+
depositBalance = _yield$Promise$all10[3];
|
|
3204
|
+
borrowBalance = _yield$Promise$all10[4];
|
|
3205
|
+
nearDepositApy = _yield$Promise$all10[5];
|
|
3206
|
+
plyDepositApy = _yield$Promise$all10[6];
|
|
3207
|
+
metaDepositApy = _yield$Promise$all10[7];
|
|
3208
|
+
nearBorrowApy = _yield$Promise$all10[8];
|
|
3209
|
+
plyBorrowApy = _yield$Promise$all10[9];
|
|
3233
3210
|
_context22.next = 15;
|
|
3234
3211
|
return this.getDepositStaderAPY();
|
|
3235
3212
|
case 15:
|