@aurigami/sdk 1.20.1 → 1.20.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/sdk.cjs.development.js +41 -72
- 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 +41 -72
- package/dist/sdk.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/interactors/MoneyMarket.ts +24 -23
package/dist/sdk.esm.js
CHANGED
|
@@ -2959,46 +2959,15 @@ var MoneyMarketRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
2959
2959
|
}();
|
|
2960
2960
|
_proto.getDepositStaderAPY = /*#__PURE__*/function () {
|
|
2961
2961
|
var _getDepositStaderAPY = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
|
|
2962
|
-
var rewardStartTime, currentTime, _yield$Promise$all7, totalDeposited, underlyingPrice, depositStaderApy;
|
|
2963
2962
|
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
2964
2963
|
while (1) switch (_context14.prev = _context14.next) {
|
|
2965
2964
|
case 0:
|
|
2966
|
-
rewardStartTime = 1675346400;
|
|
2967
|
-
currentTime = getCurrentTimestamp();
|
|
2968
|
-
if (!(currentTime < rewardStartTime)) {
|
|
2969
|
-
_context14.next = 4;
|
|
2970
|
-
break;
|
|
2971
|
-
}
|
|
2972
2965
|
return _context14.abrupt("return", new BigNumber(0));
|
|
2973
|
-
case
|
|
2974
|
-
_context14.next = 6;
|
|
2975
|
-
return Promise.all([this.getTotalTokenDeposited(), fetchPrice(this.underlying.address, this._networkConnection.provider)]);
|
|
2976
|
-
case 6:
|
|
2977
|
-
_yield$Promise$all7 = _context14.sent;
|
|
2978
|
-
totalDeposited = _yield$Promise$all7[0];
|
|
2979
|
-
underlyingPrice = _yield$Promise$all7[1];
|
|
2980
|
-
if (!isSameAddress(this.underlying.address, networkAddresses.tokens.NEARX)) {
|
|
2981
|
-
_context14.next = 18;
|
|
2982
|
-
break;
|
|
2983
|
-
}
|
|
2984
|
-
_context14.t0 = helpers;
|
|
2985
|
-
_context14.next = 13;
|
|
2986
|
-
return fetchValuation(TokenAmount.fromAddressAndAmount(networkAddresses.tokens.STADER, '40', false), this._networkConnection.provider);
|
|
2987
|
-
case 13:
|
|
2988
|
-
_context14.t1 = _context14.sent;
|
|
2989
|
-
_context14.t2 = underlyingPrice.multipliedBy(totalDeposited.formattedAmount());
|
|
2990
|
-
depositStaderApy = _context14.t0.calcLMRewardApr.call(_context14.t0, _context14.t1, _context14.t2, 365);
|
|
2991
|
-
_context14.next = 19;
|
|
2992
|
-
break;
|
|
2993
|
-
case 18:
|
|
2994
|
-
depositStaderApy = new BigNumber(0);
|
|
2995
|
-
case 19:
|
|
2996
|
-
return _context14.abrupt("return", depositStaderApy);
|
|
2997
|
-
case 20:
|
|
2966
|
+
case 1:
|
|
2998
2967
|
case "end":
|
|
2999
2968
|
return _context14.stop();
|
|
3000
2969
|
}
|
|
3001
|
-
}, _callee14
|
|
2970
|
+
}, _callee14);
|
|
3002
2971
|
}));
|
|
3003
2972
|
function getDepositStaderAPY() {
|
|
3004
2973
|
return _getDepositStaderAPY.apply(this, arguments);
|
|
@@ -3007,30 +2976,30 @@ var MoneyMarketRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
3007
2976
|
}();
|
|
3008
2977
|
_proto.getDetails = /*#__PURE__*/function () {
|
|
3009
2978
|
var _getDetails = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15() {
|
|
3010
|
-
var _yield$Promise$
|
|
2979
|
+
var _yield$Promise$all7, totalDeposited, totalBorrowed, depositAPY, borrowAPY, collateralRatio, rewardSpeeds, _yield$Promise$all8, depositPlyAPY, borrowPlyAPY, depositNearAPY, borrowNearAPY, depositMetaAPY, staderDepositApy;
|
|
3011
2980
|
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
|
3012
2981
|
while (1) switch (_context15.prev = _context15.next) {
|
|
3013
2982
|
case 0:
|
|
3014
2983
|
_context15.next = 2;
|
|
3015
2984
|
return Promise.all([this.getTotalTokenDeposited(), this.getTotalTokenBorrowed(), this.getDepositAPY(), this.getBorrowAPY(), this.getCollateralRatio(), this.getRewardSpeeds()]);
|
|
3016
2985
|
case 2:
|
|
3017
|
-
_yield$Promise$
|
|
3018
|
-
totalDeposited = _yield$Promise$
|
|
3019
|
-
totalBorrowed = _yield$Promise$
|
|
3020
|
-
depositAPY = _yield$Promise$
|
|
3021
|
-
borrowAPY = _yield$Promise$
|
|
3022
|
-
collateralRatio = _yield$Promise$
|
|
3023
|
-
rewardSpeeds = _yield$Promise$
|
|
2986
|
+
_yield$Promise$all7 = _context15.sent;
|
|
2987
|
+
totalDeposited = _yield$Promise$all7[0];
|
|
2988
|
+
totalBorrowed = _yield$Promise$all7[1];
|
|
2989
|
+
depositAPY = _yield$Promise$all7[2];
|
|
2990
|
+
borrowAPY = _yield$Promise$all7[3];
|
|
2991
|
+
collateralRatio = _yield$Promise$all7[4];
|
|
2992
|
+
rewardSpeeds = _yield$Promise$all7[5];
|
|
3024
2993
|
_context15.next = 11;
|
|
3025
2994
|
return Promise.all([this.getDepositPlyAPY(), this.getBorrowPlyAPY(), this.getDepositNearAPY(), this.getBorrowNearAPY(), this.getDepositMetaAPY(), this.getDepositStaderAPY()]);
|
|
3026
2995
|
case 11:
|
|
3027
|
-
_yield$Promise$
|
|
3028
|
-
depositPlyAPY = _yield$Promise$
|
|
3029
|
-
borrowPlyAPY = _yield$Promise$
|
|
3030
|
-
depositNearAPY = _yield$Promise$
|
|
3031
|
-
borrowNearAPY = _yield$Promise$
|
|
3032
|
-
depositMetaAPY = _yield$Promise$
|
|
3033
|
-
staderDepositApy = _yield$Promise$
|
|
2996
|
+
_yield$Promise$all8 = _context15.sent;
|
|
2997
|
+
depositPlyAPY = _yield$Promise$all8[0];
|
|
2998
|
+
borrowPlyAPY = _yield$Promise$all8[1];
|
|
2999
|
+
depositNearAPY = _yield$Promise$all8[2];
|
|
3000
|
+
borrowNearAPY = _yield$Promise$all8[3];
|
|
3001
|
+
depositMetaAPY = _yield$Promise$all8[4];
|
|
3002
|
+
staderDepositApy = _yield$Promise$all8[5];
|
|
3034
3003
|
return _context15.abrupt("return", {
|
|
3035
3004
|
auTokenAddress: this.auToken.address,
|
|
3036
3005
|
totalTokenDeposited: totalDeposited,
|
|
@@ -3176,17 +3145,17 @@ var MoneyMarketRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
3176
3145
|
}();
|
|
3177
3146
|
_proto.getDepositBorrowValue = /*#__PURE__*/function () {
|
|
3178
3147
|
var _getDepositBorrowValue = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(userAddress) {
|
|
3179
|
-
var _yield$Promise$
|
|
3148
|
+
var _yield$Promise$all9, price, depositBalance, borrowBalance, suppliedValue, borrowedValue;
|
|
3180
3149
|
return _regeneratorRuntime().wrap(function _callee20$(_context20) {
|
|
3181
3150
|
while (1) switch (_context20.prev = _context20.next) {
|
|
3182
3151
|
case 0:
|
|
3183
3152
|
_context20.next = 2;
|
|
3184
3153
|
return Promise.all([this.getUnderlyingPrice(), this.getUserDepositBalance(userAddress), this.getUserBorrowBalance(userAddress)]);
|
|
3185
3154
|
case 2:
|
|
3186
|
-
_yield$Promise$
|
|
3187
|
-
price = _yield$Promise$
|
|
3188
|
-
depositBalance = _yield$Promise$
|
|
3189
|
-
borrowBalance = _yield$Promise$
|
|
3155
|
+
_yield$Promise$all9 = _context20.sent;
|
|
3156
|
+
price = _yield$Promise$all9[0];
|
|
3157
|
+
depositBalance = _yield$Promise$all9[1];
|
|
3158
|
+
borrowBalance = _yield$Promise$all9[2];
|
|
3190
3159
|
suppliedValue = price.multipliedBy(depositBalance.formattedAmount());
|
|
3191
3160
|
borrowedValue = price.multipliedBy(borrowBalance.formattedAmount());
|
|
3192
3161
|
return _context20.abrupt("return", {
|
|
@@ -3206,19 +3175,19 @@ var MoneyMarketRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
3206
3175
|
}();
|
|
3207
3176
|
_proto.getApyWithoutIncentive = /*#__PURE__*/function () {
|
|
3208
3177
|
var _getApyWithoutIncentive = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(userAddress) {
|
|
3209
|
-
var _yield$Promise$
|
|
3178
|
+
var _yield$Promise$all10, price, depositApy, borrowApy, depositBalance, borrowBalance, suppliedValue, borrowedValue, sum;
|
|
3210
3179
|
return _regeneratorRuntime().wrap(function _callee21$(_context21) {
|
|
3211
3180
|
while (1) switch (_context21.prev = _context21.next) {
|
|
3212
3181
|
case 0:
|
|
3213
3182
|
_context21.next = 2;
|
|
3214
3183
|
return Promise.all([this.getUnderlyingPrice(), this.getDepositAPY(), this.getBorrowAPY(), this.getUserDepositBalance(userAddress), this.getUserBorrowBalance(userAddress)]);
|
|
3215
3184
|
case 2:
|
|
3216
|
-
_yield$Promise$
|
|
3217
|
-
price = _yield$Promise$
|
|
3218
|
-
depositApy = _yield$Promise$
|
|
3219
|
-
borrowApy = _yield$Promise$
|
|
3220
|
-
depositBalance = _yield$Promise$
|
|
3221
|
-
borrowBalance = _yield$Promise$
|
|
3185
|
+
_yield$Promise$all10 = _context21.sent;
|
|
3186
|
+
price = _yield$Promise$all10[0];
|
|
3187
|
+
depositApy = _yield$Promise$all10[1];
|
|
3188
|
+
borrowApy = _yield$Promise$all10[2];
|
|
3189
|
+
depositBalance = _yield$Promise$all10[3];
|
|
3190
|
+
borrowBalance = _yield$Promise$all10[4];
|
|
3222
3191
|
suppliedValue = price.multipliedBy(depositBalance.formattedAmount());
|
|
3223
3192
|
borrowedValue = price.multipliedBy(borrowBalance.formattedAmount());
|
|
3224
3193
|
sum = calcNetApy(suppliedValue, depositApy, borrowedValue, borrowApy);
|
|
@@ -3240,24 +3209,24 @@ var MoneyMarketRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
3240
3209
|
}();
|
|
3241
3210
|
_proto.getApyWithIncentive = /*#__PURE__*/function () {
|
|
3242
3211
|
var _getApyWithIncentive = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(userAddress) {
|
|
3243
|
-
var _yield$Promise$
|
|
3212
|
+
var _yield$Promise$all11, price, depositApy, borrowApy, depositBalance, borrowBalance, nearDepositApy, plyDepositApy, metaDepositApy, nearBorrowApy, plyBorrowApy, staderDepositApy, suppliedValue, borrowedValue, totalDepositApy, totalBorrowApy, sum;
|
|
3244
3213
|
return _regeneratorRuntime().wrap(function _callee22$(_context22) {
|
|
3245
3214
|
while (1) switch (_context22.prev = _context22.next) {
|
|
3246
3215
|
case 0:
|
|
3247
3216
|
_context22.next = 2;
|
|
3248
3217
|
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()]);
|
|
3249
3218
|
case 2:
|
|
3250
|
-
_yield$Promise$
|
|
3251
|
-
price = _yield$Promise$
|
|
3252
|
-
depositApy = _yield$Promise$
|
|
3253
|
-
borrowApy = _yield$Promise$
|
|
3254
|
-
depositBalance = _yield$Promise$
|
|
3255
|
-
borrowBalance = _yield$Promise$
|
|
3256
|
-
nearDepositApy = _yield$Promise$
|
|
3257
|
-
plyDepositApy = _yield$Promise$
|
|
3258
|
-
metaDepositApy = _yield$Promise$
|
|
3259
|
-
nearBorrowApy = _yield$Promise$
|
|
3260
|
-
plyBorrowApy = _yield$Promise$
|
|
3219
|
+
_yield$Promise$all11 = _context22.sent;
|
|
3220
|
+
price = _yield$Promise$all11[0];
|
|
3221
|
+
depositApy = _yield$Promise$all11[1];
|
|
3222
|
+
borrowApy = _yield$Promise$all11[2];
|
|
3223
|
+
depositBalance = _yield$Promise$all11[3];
|
|
3224
|
+
borrowBalance = _yield$Promise$all11[4];
|
|
3225
|
+
nearDepositApy = _yield$Promise$all11[5];
|
|
3226
|
+
plyDepositApy = _yield$Promise$all11[6];
|
|
3227
|
+
metaDepositApy = _yield$Promise$all11[7];
|
|
3228
|
+
nearBorrowApy = _yield$Promise$all11[8];
|
|
3229
|
+
plyBorrowApy = _yield$Promise$all11[9];
|
|
3261
3230
|
_context22.next = 15;
|
|
3262
3231
|
return this.getDepositStaderAPY();
|
|
3263
3232
|
case 15:
|