@aurigami/sdk 1.1.4 → 1.1.6
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/MoneyMarket.d.ts +2 -0
- package/dist/sdk.cjs.development.js +62 -14
- 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 +62 -14
- package/dist/sdk.esm.js.map +1 -1
- package/dist/types.d.ts +3 -0
- package/package.json +1 -1
- package/src/MoneyMarket.ts +32 -1
- package/src/constants.ts +2 -0
- package/src/decimals.ts +11 -11
- package/src/types.ts +3 -0
package/dist/MoneyMarket.d.ts
CHANGED
|
@@ -29,6 +29,8 @@ export declare class MoneyMarketRead extends BlockchainEntityRead {
|
|
|
29
29
|
getDetails(): Promise<MoneyMarketDetails>;
|
|
30
30
|
getUserBorrowBalance(userAddress: string): Promise<TokenAmount>;
|
|
31
31
|
getUserDepositBalance(userAddress: string): Promise<TokenAmount>;
|
|
32
|
+
private getDepositNEARRewardPerWeek;
|
|
33
|
+
private getBorrowNEARRewardPerWeek;
|
|
32
34
|
}
|
|
33
35
|
export declare class MoneyMarketReadWrite extends MoneyMarketRead {
|
|
34
36
|
protected _EthRepayHelper: EthRepayHelper;
|
|
@@ -964,6 +964,8 @@ var networkAddresses = {
|
|
|
964
964
|
AURORA: /*#__PURE__*/"0x8bec47865ade3b172a928df8f990bc7f2a3b9f79".toLowerCase(),
|
|
965
965
|
PLY: /*#__PURE__*/"0x981bD5832EAB9C8F607940E0e9faCBf8C09ee20a".toLowerCase(),
|
|
966
966
|
stNEAR: /*#__PURE__*/"0x07f9f7f963c5cd2bbffd30ccfb964be114332e30".toLowerCase(),
|
|
967
|
+
USDC: /*#__PURE__*/'0xb12bfca5a55806aaf64e99521918a4bf0fc40802'.toLowerCase(),
|
|
968
|
+
WNEAR: /*#__PURE__*/'0xC42C30aC6Cc15faC9bD938618BcaA1a1FaE8501d'.toLowerCase(),
|
|
967
969
|
AURPLY: /*#__PURE__*/dummyAddress.toLowerCase()
|
|
968
970
|
}
|
|
969
971
|
};
|
|
@@ -976,22 +978,22 @@ var INF = /*#__PURE__*/ethers.BigNumber.from(2).pow(256).sub(1);
|
|
|
976
978
|
|
|
977
979
|
var decimalRecords = {
|
|
978
980
|
'0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee': 18,
|
|
981
|
+
'0xcfb6b0498cb7555e7e21502e0f449bf28760adbb': 8,
|
|
982
|
+
'0x8888682e24dd4df7b7ff2b91fccb575737e433bf': 8,
|
|
983
|
+
'0xc42c30ac6cc15fac9bd938618bcaa1a1fae8501d': 24,
|
|
979
984
|
'0x07f9f7f963c5cd2bbffd30ccfb964be114332e30': 24,
|
|
985
|
+
'0xad5a2437ff55ed7a8cad3b797b3ec7c5a19b1c54': 8,
|
|
986
|
+
'0xe3520349f477a5f6eb06107066048508498a291b': 18,
|
|
987
|
+
'0x981bd5832eab9c8f607940e0e9facbf8c09ee20a': 18,
|
|
980
988
|
'0xae4fac24dcdae0132c6d04f564dcf059616e9423': 8,
|
|
981
|
-
'0xb12bfca5a55806aaf64e99521918a4bf0fc40802': 6,
|
|
982
|
-
'0xca9511b610ba5fc7e311fdef9ce16050ee4449e9': 8,
|
|
983
989
|
'0xce4166363e3a584dac84a47bcd3414b43efcdd1c': 8,
|
|
984
|
-
'
|
|
990
|
+
'0xca9511b610ba5fc7e311fdef9ce16050ee4449e9': 8,
|
|
991
|
+
'0x3195949f267702723bc614cae037cdc8d1e94786': 8,
|
|
992
|
+
'0x4f0d864b1abf4b701799a0b30b57a22dfeb5917b': 8,
|
|
985
993
|
'0x8bec47865ade3b172a928df8f990bc7f2a3b9f79': 18,
|
|
994
|
+
'0xb12bfca5a55806aaf64e99521918a4bf0fc40802': 6,
|
|
986
995
|
'0x4988a896b1227218e4a686fde5eabdcabd91571f': 6,
|
|
987
|
-
'
|
|
988
|
-
'0x4f0d864b1abf4b701799a0b30b57a22dfeb5917b': 8,
|
|
989
|
-
'0xc42c30ac6cc15fac9bd938618bcaa1a1fae8501d': 24,
|
|
990
|
-
'0xcfb6b0498cb7555e7e21502e0f449bf28760adbb': 8,
|
|
991
|
-
'0xad5a2437ff55ed7a8cad3b797b3ec7c5a19b1c54': 8,
|
|
992
|
-
'0xf4eb217ba2454613b15dbdea6e5f22276410e89e': 8,
|
|
993
|
-
'0x3195949f267702723bc614cae037cdc8d1e94786': 8,
|
|
994
|
-
'0x981bd5832eab9c8f607940e0e9facbf8c09ee20a': 18
|
|
996
|
+
'0xf4eb217ba2454613b15dbdea6e5f22276410e89e': 8
|
|
995
997
|
};
|
|
996
998
|
|
|
997
999
|
function formatObject(object) {
|
|
@@ -2671,7 +2673,7 @@ var MoneyMarketRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
2671
2673
|
|
|
2672
2674
|
_proto.getDetails = /*#__PURE__*/function () {
|
|
2673
2675
|
var _getDetails = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee9() {
|
|
2674
|
-
var promises, totalDeposited, totalBorrowed, depositAPY, borrowAPY, collateralRatio, plyPrice, underlyingPrice, rewardSpeeds, borrowPlyApy, depositPlyApy;
|
|
2676
|
+
var promises, totalDeposited, totalBorrowed, depositAPY, borrowAPY, collateralRatio, plyPrice, underlyingPrice, rewardSpeeds, borrowPlyApy, depositPlyApy, depositNEARApy, borrowNEARApy, depositMETAApy;
|
|
2675
2677
|
return runtime_1.wrap(function _callee9$(_context9) {
|
|
2676
2678
|
while (1) {
|
|
2677
2679
|
switch (_context9.prev = _context9.next) {
|
|
@@ -2707,6 +2709,29 @@ var MoneyMarketRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
2707
2709
|
case 11:
|
|
2708
2710
|
borrowPlyApy = calcLMRewardApr(calcValuation(new TokenAmount(PLYToken, rewardSpeeds.plyRewardBorrowSpeed.toString()), plyPrice), underlyingPrice.multipliedBy(totalBorrowed.formattedAmount()), ONE_YEAR);
|
|
2709
2711
|
depositPlyApy = calcLMRewardApr(calcValuation(new TokenAmount(PLYToken, rewardSpeeds.plyRewardSupplySpeed.toString()), plyPrice), underlyingPrice.multipliedBy(totalDeposited.formattedAmount()), ONE_YEAR);
|
|
2712
|
+
_context9.t0 = calcLMRewardApr;
|
|
2713
|
+
_context9.next = 16;
|
|
2714
|
+
return fetchValuation(this.getDepositNEARRewardPerWeek(), this._networkConnection.provider);
|
|
2715
|
+
|
|
2716
|
+
case 16:
|
|
2717
|
+
_context9.t1 = _context9.sent;
|
|
2718
|
+
_context9.t2 = underlyingPrice.multipliedBy(totalDeposited.formattedAmount());
|
|
2719
|
+
depositNEARApy = (0, _context9.t0)(_context9.t1, _context9.t2, 52);
|
|
2720
|
+
_context9.t3 = calcLMRewardApr;
|
|
2721
|
+
_context9.next = 22;
|
|
2722
|
+
return fetchValuation(this.getBorrowNEARRewardPerWeek(), this._networkConnection.provider);
|
|
2723
|
+
|
|
2724
|
+
case 22:
|
|
2725
|
+
_context9.t4 = _context9.sent;
|
|
2726
|
+
_context9.t5 = underlyingPrice.multipliedBy(totalBorrowed.formattedAmount());
|
|
2727
|
+
borrowNEARApy = (0, _context9.t3)(_context9.t4, _context9.t5, 52);
|
|
2728
|
+
|
|
2729
|
+
if (isSameAddress(this.underlying.address, networkAddresses.tokens.stNEAR)) {
|
|
2730
|
+
depositMETAApy = calcLMRewardApr(new BigNumber(50000), underlyingPrice.multipliedBy(totalDeposited.formattedAmount()), 12);
|
|
2731
|
+
} else {
|
|
2732
|
+
depositMETAApy = new BigNumber(0);
|
|
2733
|
+
}
|
|
2734
|
+
|
|
2710
2735
|
return _context9.abrupt("return", {
|
|
2711
2736
|
auTokenAddress: this.auToken.address,
|
|
2712
2737
|
totalTokenDeposited: totalDeposited,
|
|
@@ -2717,10 +2742,13 @@ var MoneyMarketRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
2717
2742
|
borrowPlyApy: borrowPlyApy.toNumber(),
|
|
2718
2743
|
collateralRatio: collateralRatio,
|
|
2719
2744
|
depositPlyPerWeek: new TokenAmount(PLYToken, rewardSpeeds.plyRewardSupplySpeed.mul(ONE_DAY).mul(7).toString()),
|
|
2720
|
-
borrowPlyPerWeek: new TokenAmount(PLYToken, rewardSpeeds.plyRewardBorrowSpeed.mul(ONE_DAY).mul(7).toString())
|
|
2745
|
+
borrowPlyPerWeek: new TokenAmount(PLYToken, rewardSpeeds.plyRewardBorrowSpeed.mul(ONE_DAY).mul(7).toString()),
|
|
2746
|
+
depositNEARApy: depositNEARApy.toNumber(),
|
|
2747
|
+
borrowNEARApy: borrowNEARApy.toNumber(),
|
|
2748
|
+
depositMETAApy: depositMETAApy.toNumber()
|
|
2721
2749
|
});
|
|
2722
2750
|
|
|
2723
|
-
case
|
|
2751
|
+
case 27:
|
|
2724
2752
|
case "end":
|
|
2725
2753
|
return _context9.stop();
|
|
2726
2754
|
}
|
|
@@ -2793,6 +2821,26 @@ var MoneyMarketRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
2793
2821
|
return getUserDepositBalance;
|
|
2794
2822
|
}();
|
|
2795
2823
|
|
|
2824
|
+
_proto.getDepositNEARRewardPerWeek = function getDepositNEARRewardPerWeek() {
|
|
2825
|
+
var NEARToken = new Token(networkAddresses.tokens.WNEAR, getDecimal(networkAddresses.tokens.WNEAR));
|
|
2826
|
+
|
|
2827
|
+
if (isSameAddress(this.underlying.address, networkAddresses.tokens.USDC)) {
|
|
2828
|
+
return new TokenAmount(NEARToken, "5000", false);
|
|
2829
|
+
} else {
|
|
2830
|
+
return new TokenAmount(NEARToken, "0");
|
|
2831
|
+
}
|
|
2832
|
+
};
|
|
2833
|
+
|
|
2834
|
+
_proto.getBorrowNEARRewardPerWeek = function getBorrowNEARRewardPerWeek() {
|
|
2835
|
+
var NEARToken = new Token(networkAddresses.tokens.WNEAR, getDecimal(networkAddresses.tokens.WNEAR));
|
|
2836
|
+
|
|
2837
|
+
if (isSameAddress(this.underlying.address, networkAddresses.tokens.USDC)) {
|
|
2838
|
+
return new TokenAmount(NEARToken, "15000", false);
|
|
2839
|
+
} else {
|
|
2840
|
+
return new TokenAmount(NEARToken, "0");
|
|
2841
|
+
}
|
|
2842
|
+
};
|
|
2843
|
+
|
|
2796
2844
|
return MoneyMarketRead;
|
|
2797
2845
|
}(BlockchainEntityRead);
|
|
2798
2846
|
var MoneyMarketReadWrite = /*#__PURE__*/function (_MoneyMarketRead) {
|