@aurigami/sdk 1.20.2 → 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.
|
@@ -2964,46 +2964,15 @@ var MoneyMarketRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
2964
2964
|
}();
|
|
2965
2965
|
_proto.getDepositStaderAPY = /*#__PURE__*/function () {
|
|
2966
2966
|
var _getDepositStaderAPY = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
|
|
2967
|
-
var rewardStartTime, currentTime, _yield$Promise$all7, totalDeposited, underlyingPrice, depositStaderApy;
|
|
2968
2967
|
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
2969
2968
|
while (1) switch (_context14.prev = _context14.next) {
|
|
2970
2969
|
case 0:
|
|
2971
|
-
rewardStartTime = 1675346400;
|
|
2972
|
-
currentTime = getCurrentTimestamp();
|
|
2973
|
-
if (!(currentTime < rewardStartTime)) {
|
|
2974
|
-
_context14.next = 4;
|
|
2975
|
-
break;
|
|
2976
|
-
}
|
|
2977
2970
|
return _context14.abrupt("return", new BigNumber(0));
|
|
2978
|
-
case
|
|
2979
|
-
_context14.next = 6;
|
|
2980
|
-
return Promise.all([this.getTotalTokenDeposited(), fetchPrice(this.underlying.address, this._networkConnection.provider)]);
|
|
2981
|
-
case 6:
|
|
2982
|
-
_yield$Promise$all7 = _context14.sent;
|
|
2983
|
-
totalDeposited = _yield$Promise$all7[0];
|
|
2984
|
-
underlyingPrice = _yield$Promise$all7[1];
|
|
2985
|
-
if (!isSameAddress(this.underlying.address, networkAddresses.tokens.NEARX)) {
|
|
2986
|
-
_context14.next = 18;
|
|
2987
|
-
break;
|
|
2988
|
-
}
|
|
2989
|
-
_context14.t0 = helpers;
|
|
2990
|
-
_context14.next = 13;
|
|
2991
|
-
return fetchValuation(TokenAmount.fromAddressAndAmount(networkAddresses.tokens.STADER, '40', false), this._networkConnection.provider);
|
|
2992
|
-
case 13:
|
|
2993
|
-
_context14.t1 = _context14.sent;
|
|
2994
|
-
_context14.t2 = underlyingPrice.multipliedBy(totalDeposited.formattedAmount());
|
|
2995
|
-
depositStaderApy = _context14.t0.calcLMRewardApr.call(_context14.t0, _context14.t1, _context14.t2, 365);
|
|
2996
|
-
_context14.next = 19;
|
|
2997
|
-
break;
|
|
2998
|
-
case 18:
|
|
2999
|
-
depositStaderApy = new BigNumber(0);
|
|
3000
|
-
case 19:
|
|
3001
|
-
return _context14.abrupt("return", depositStaderApy);
|
|
3002
|
-
case 20:
|
|
2971
|
+
case 1:
|
|
3003
2972
|
case "end":
|
|
3004
2973
|
return _context14.stop();
|
|
3005
2974
|
}
|
|
3006
|
-
}, _callee14
|
|
2975
|
+
}, _callee14);
|
|
3007
2976
|
}));
|
|
3008
2977
|
function getDepositStaderAPY() {
|
|
3009
2978
|
return _getDepositStaderAPY.apply(this, arguments);
|
|
@@ -3012,30 +2981,30 @@ var MoneyMarketRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
3012
2981
|
}();
|
|
3013
2982
|
_proto.getDetails = /*#__PURE__*/function () {
|
|
3014
2983
|
var _getDetails = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15() {
|
|
3015
|
-
var _yield$Promise$
|
|
2984
|
+
var _yield$Promise$all7, totalDeposited, totalBorrowed, depositAPY, borrowAPY, collateralRatio, rewardSpeeds, _yield$Promise$all8, depositPlyAPY, borrowPlyAPY, depositNearAPY, borrowNearAPY, depositMetaAPY, staderDepositApy;
|
|
3016
2985
|
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
|
3017
2986
|
while (1) switch (_context15.prev = _context15.next) {
|
|
3018
2987
|
case 0:
|
|
3019
2988
|
_context15.next = 2;
|
|
3020
2989
|
return Promise.all([this.getTotalTokenDeposited(), this.getTotalTokenBorrowed(), this.getDepositAPY(), this.getBorrowAPY(), this.getCollateralRatio(), this.getRewardSpeeds()]);
|
|
3021
2990
|
case 2:
|
|
3022
|
-
_yield$Promise$
|
|
3023
|
-
totalDeposited = _yield$Promise$
|
|
3024
|
-
totalBorrowed = _yield$Promise$
|
|
3025
|
-
depositAPY = _yield$Promise$
|
|
3026
|
-
borrowAPY = _yield$Promise$
|
|
3027
|
-
collateralRatio = _yield$Promise$
|
|
3028
|
-
rewardSpeeds = _yield$Promise$
|
|
2991
|
+
_yield$Promise$all7 = _context15.sent;
|
|
2992
|
+
totalDeposited = _yield$Promise$all7[0];
|
|
2993
|
+
totalBorrowed = _yield$Promise$all7[1];
|
|
2994
|
+
depositAPY = _yield$Promise$all7[2];
|
|
2995
|
+
borrowAPY = _yield$Promise$all7[3];
|
|
2996
|
+
collateralRatio = _yield$Promise$all7[4];
|
|
2997
|
+
rewardSpeeds = _yield$Promise$all7[5];
|
|
3029
2998
|
_context15.next = 11;
|
|
3030
2999
|
return Promise.all([this.getDepositPlyAPY(), this.getBorrowPlyAPY(), this.getDepositNearAPY(), this.getBorrowNearAPY(), this.getDepositMetaAPY(), this.getDepositStaderAPY()]);
|
|
3031
3000
|
case 11:
|
|
3032
|
-
_yield$Promise$
|
|
3033
|
-
depositPlyAPY = _yield$Promise$
|
|
3034
|
-
borrowPlyAPY = _yield$Promise$
|
|
3035
|
-
depositNearAPY = _yield$Promise$
|
|
3036
|
-
borrowNearAPY = _yield$Promise$
|
|
3037
|
-
depositMetaAPY = _yield$Promise$
|
|
3038
|
-
staderDepositApy = _yield$Promise$
|
|
3001
|
+
_yield$Promise$all8 = _context15.sent;
|
|
3002
|
+
depositPlyAPY = _yield$Promise$all8[0];
|
|
3003
|
+
borrowPlyAPY = _yield$Promise$all8[1];
|
|
3004
|
+
depositNearAPY = _yield$Promise$all8[2];
|
|
3005
|
+
borrowNearAPY = _yield$Promise$all8[3];
|
|
3006
|
+
depositMetaAPY = _yield$Promise$all8[4];
|
|
3007
|
+
staderDepositApy = _yield$Promise$all8[5];
|
|
3039
3008
|
return _context15.abrupt("return", {
|
|
3040
3009
|
auTokenAddress: this.auToken.address,
|
|
3041
3010
|
totalTokenDeposited: totalDeposited,
|
|
@@ -3181,17 +3150,17 @@ var MoneyMarketRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
3181
3150
|
}();
|
|
3182
3151
|
_proto.getDepositBorrowValue = /*#__PURE__*/function () {
|
|
3183
3152
|
var _getDepositBorrowValue = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(userAddress) {
|
|
3184
|
-
var _yield$Promise$
|
|
3153
|
+
var _yield$Promise$all9, price, depositBalance, borrowBalance, suppliedValue, borrowedValue;
|
|
3185
3154
|
return _regeneratorRuntime().wrap(function _callee20$(_context20) {
|
|
3186
3155
|
while (1) switch (_context20.prev = _context20.next) {
|
|
3187
3156
|
case 0:
|
|
3188
3157
|
_context20.next = 2;
|
|
3189
3158
|
return Promise.all([this.getUnderlyingPrice(), this.getUserDepositBalance(userAddress), this.getUserBorrowBalance(userAddress)]);
|
|
3190
3159
|
case 2:
|
|
3191
|
-
_yield$Promise$
|
|
3192
|
-
price = _yield$Promise$
|
|
3193
|
-
depositBalance = _yield$Promise$
|
|
3194
|
-
borrowBalance = _yield$Promise$
|
|
3160
|
+
_yield$Promise$all9 = _context20.sent;
|
|
3161
|
+
price = _yield$Promise$all9[0];
|
|
3162
|
+
depositBalance = _yield$Promise$all9[1];
|
|
3163
|
+
borrowBalance = _yield$Promise$all9[2];
|
|
3195
3164
|
suppliedValue = price.multipliedBy(depositBalance.formattedAmount());
|
|
3196
3165
|
borrowedValue = price.multipliedBy(borrowBalance.formattedAmount());
|
|
3197
3166
|
return _context20.abrupt("return", {
|
|
@@ -3211,19 +3180,19 @@ var MoneyMarketRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
3211
3180
|
}();
|
|
3212
3181
|
_proto.getApyWithoutIncentive = /*#__PURE__*/function () {
|
|
3213
3182
|
var _getApyWithoutIncentive = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(userAddress) {
|
|
3214
|
-
var _yield$Promise$
|
|
3183
|
+
var _yield$Promise$all10, price, depositApy, borrowApy, depositBalance, borrowBalance, suppliedValue, borrowedValue, sum;
|
|
3215
3184
|
return _regeneratorRuntime().wrap(function _callee21$(_context21) {
|
|
3216
3185
|
while (1) switch (_context21.prev = _context21.next) {
|
|
3217
3186
|
case 0:
|
|
3218
3187
|
_context21.next = 2;
|
|
3219
3188
|
return Promise.all([this.getUnderlyingPrice(), this.getDepositAPY(), this.getBorrowAPY(), this.getUserDepositBalance(userAddress), this.getUserBorrowBalance(userAddress)]);
|
|
3220
3189
|
case 2:
|
|
3221
|
-
_yield$Promise$
|
|
3222
|
-
price = _yield$Promise$
|
|
3223
|
-
depositApy = _yield$Promise$
|
|
3224
|
-
borrowApy = _yield$Promise$
|
|
3225
|
-
depositBalance = _yield$Promise$
|
|
3226
|
-
borrowBalance = _yield$Promise$
|
|
3190
|
+
_yield$Promise$all10 = _context21.sent;
|
|
3191
|
+
price = _yield$Promise$all10[0];
|
|
3192
|
+
depositApy = _yield$Promise$all10[1];
|
|
3193
|
+
borrowApy = _yield$Promise$all10[2];
|
|
3194
|
+
depositBalance = _yield$Promise$all10[3];
|
|
3195
|
+
borrowBalance = _yield$Promise$all10[4];
|
|
3227
3196
|
suppliedValue = price.multipliedBy(depositBalance.formattedAmount());
|
|
3228
3197
|
borrowedValue = price.multipliedBy(borrowBalance.formattedAmount());
|
|
3229
3198
|
sum = calcNetApy(suppliedValue, depositApy, borrowedValue, borrowApy);
|
|
@@ -3245,24 +3214,24 @@ var MoneyMarketRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
3245
3214
|
}();
|
|
3246
3215
|
_proto.getApyWithIncentive = /*#__PURE__*/function () {
|
|
3247
3216
|
var _getApyWithIncentive = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(userAddress) {
|
|
3248
|
-
var _yield$Promise$
|
|
3217
|
+
var _yield$Promise$all11, price, depositApy, borrowApy, depositBalance, borrowBalance, nearDepositApy, plyDepositApy, metaDepositApy, nearBorrowApy, plyBorrowApy, staderDepositApy, suppliedValue, borrowedValue, totalDepositApy, totalBorrowApy, sum;
|
|
3249
3218
|
return _regeneratorRuntime().wrap(function _callee22$(_context22) {
|
|
3250
3219
|
while (1) switch (_context22.prev = _context22.next) {
|
|
3251
3220
|
case 0:
|
|
3252
3221
|
_context22.next = 2;
|
|
3253
3222
|
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()]);
|
|
3254
3223
|
case 2:
|
|
3255
|
-
_yield$Promise$
|
|
3256
|
-
price = _yield$Promise$
|
|
3257
|
-
depositApy = _yield$Promise$
|
|
3258
|
-
borrowApy = _yield$Promise$
|
|
3259
|
-
depositBalance = _yield$Promise$
|
|
3260
|
-
borrowBalance = _yield$Promise$
|
|
3261
|
-
nearDepositApy = _yield$Promise$
|
|
3262
|
-
plyDepositApy = _yield$Promise$
|
|
3263
|
-
metaDepositApy = _yield$Promise$
|
|
3264
|
-
nearBorrowApy = _yield$Promise$
|
|
3265
|
-
plyBorrowApy = _yield$Promise$
|
|
3224
|
+
_yield$Promise$all11 = _context22.sent;
|
|
3225
|
+
price = _yield$Promise$all11[0];
|
|
3226
|
+
depositApy = _yield$Promise$all11[1];
|
|
3227
|
+
borrowApy = _yield$Promise$all11[2];
|
|
3228
|
+
depositBalance = _yield$Promise$all11[3];
|
|
3229
|
+
borrowBalance = _yield$Promise$all11[4];
|
|
3230
|
+
nearDepositApy = _yield$Promise$all11[5];
|
|
3231
|
+
plyDepositApy = _yield$Promise$all11[6];
|
|
3232
|
+
metaDepositApy = _yield$Promise$all11[7];
|
|
3233
|
+
nearBorrowApy = _yield$Promise$all11[8];
|
|
3234
|
+
plyBorrowApy = _yield$Promise$all11[9];
|
|
3266
3235
|
_context22.next = 15;
|
|
3267
3236
|
return this.getDepositStaderAPY();
|
|
3268
3237
|
case 15:
|