@aurigami/sdk 1.16.0 → 1.16.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/dist/consts/constants.d.ts +1 -0
- package/dist/interactors/MoneyMarket.d.ts +1 -0
- package/dist/sdk.cjs.development.js +204 -140
- 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 +204 -140
- package/dist/sdk.esm.js.map +1 -1
- package/dist/types/index.d.ts +1 -0
- package/package.json +70 -71
- package/src/consts/constants.ts +1 -0
- package/src/interactors/MoneyMarket.ts +45 -9
- package/src/types/index.ts +1 -0
- package/src/.DS_Store +0 -0
package/dist/sdk.esm.js
CHANGED
|
@@ -133,7 +133,8 @@ var networkAddresses = {
|
|
|
133
133
|
USN: /*#__PURE__*/'0x5183e1b1091804bc2602586919e6880ac1cf2896'.toLowerCase(),
|
|
134
134
|
PLY_WNEAR: /*#__PURE__*/'0x044b6b0cd3bb13d2b9057781df4459c66781dce7'.toLowerCase(),
|
|
135
135
|
WNEAR_TRI: /*#__PURE__*/'0x84b123875f0f36b966d0b6ca14b31121bd9676ad'.toLowerCase(),
|
|
136
|
-
AURORA_WNEAR: /*#__PURE__*/'0x1e0e812fbcd3eb75d8562ad6f310ed94d258d008'.toLowerCase()
|
|
136
|
+
AURORA_WNEAR: /*#__PURE__*/'0x1e0e812fbcd3eb75d8562ad6f310ed94d258d008'.toLowerCase(),
|
|
137
|
+
NEARX: /*#__PURE__*/'0xb39eeb9e168ef6c639f5e282fef1f6bc4dcae375'.toLowerCase()
|
|
137
138
|
}
|
|
138
139
|
};
|
|
139
140
|
var DEPOSIT_ONLY_TOKENS = [/*#__PURE__*/MAINNET_ADDRESSES.auTokens.AURORA.toLowerCase(), /*#__PURE__*/MAINNET_ADDRESSES.auTokens.TRI.toLowerCase(), /*#__PURE__*/MAINNET_ADDRESSES.auTokens.PLY.toLowerCase(), /*#__PURE__*/MAINNET_ADDRESSES.auTokens.USN.toLowerCase()]; // All token that we can calculate the price via oracle + coingecko
|
|
@@ -3731,36 +3732,88 @@ var MoneyMarketRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
3731
3732
|
return getDepositMetaAPY;
|
|
3732
3733
|
}();
|
|
3733
3734
|
|
|
3734
|
-
_proto.
|
|
3735
|
-
var
|
|
3736
|
-
var
|
|
3735
|
+
_proto.getDepositStaderAPY = /*#__PURE__*/function () {
|
|
3736
|
+
var _getDepositStaderAPY = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee14() {
|
|
3737
|
+
var rewardStartTime, currentTime, _yield$Promise$all7, totalDeposited, underlyingPrice, depositStaderApy;
|
|
3737
3738
|
|
|
3738
3739
|
return runtime_1.wrap(function _callee14$(_context14) {
|
|
3739
3740
|
while (1) {
|
|
3740
3741
|
switch (_context14.prev = _context14.next) {
|
|
3741
3742
|
case 0:
|
|
3742
|
-
|
|
3743
|
-
|
|
3743
|
+
rewardStartTime = 1675346400;
|
|
3744
|
+
currentTime = getCurrentTimestamp();
|
|
3744
3745
|
|
|
3745
|
-
|
|
3746
|
+
if (!(currentTime < rewardStartTime)) {
|
|
3747
|
+
_context14.next = 4;
|
|
3748
|
+
break;
|
|
3749
|
+
}
|
|
3750
|
+
|
|
3751
|
+
return _context14.abrupt("return", new BigNumber(0));
|
|
3752
|
+
|
|
3753
|
+
case 4:
|
|
3754
|
+
_context14.next = 6;
|
|
3755
|
+
return Promise.all([this.getTotalTokenDeposited(), fetchPrice(this.underlying.address, this._networkConnection.provider)]);
|
|
3756
|
+
|
|
3757
|
+
case 6:
|
|
3746
3758
|
_yield$Promise$all7 = _context14.sent;
|
|
3747
3759
|
totalDeposited = _yield$Promise$all7[0];
|
|
3748
|
-
|
|
3749
|
-
|
|
3750
|
-
|
|
3751
|
-
|
|
3752
|
-
|
|
3753
|
-
|
|
3754
|
-
|
|
3760
|
+
underlyingPrice = _yield$Promise$all7[1];
|
|
3761
|
+
|
|
3762
|
+
if (isSameAddress(this.underlying.address, networkAddresses.tokens.NEARX)) {
|
|
3763
|
+
// 100$ a day
|
|
3764
|
+
depositStaderApy = calcLMRewardApr(new BigNumber(100), underlyingPrice.multipliedBy(totalDeposited.formattedAmount()), 365);
|
|
3765
|
+
} else {
|
|
3766
|
+
depositStaderApy = new BigNumber(0);
|
|
3767
|
+
}
|
|
3768
|
+
|
|
3769
|
+
return _context14.abrupt("return", depositStaderApy);
|
|
3755
3770
|
|
|
3756
3771
|
case 11:
|
|
3757
|
-
|
|
3758
|
-
|
|
3759
|
-
|
|
3760
|
-
|
|
3761
|
-
|
|
3762
|
-
|
|
3763
|
-
|
|
3772
|
+
case "end":
|
|
3773
|
+
return _context14.stop();
|
|
3774
|
+
}
|
|
3775
|
+
}
|
|
3776
|
+
}, _callee14, this);
|
|
3777
|
+
}));
|
|
3778
|
+
|
|
3779
|
+
function getDepositStaderAPY() {
|
|
3780
|
+
return _getDepositStaderAPY.apply(this, arguments);
|
|
3781
|
+
}
|
|
3782
|
+
|
|
3783
|
+
return getDepositStaderAPY;
|
|
3784
|
+
}();
|
|
3785
|
+
|
|
3786
|
+
_proto.getDetails = /*#__PURE__*/function () {
|
|
3787
|
+
var _getDetails = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee15() {
|
|
3788
|
+
var _yield$Promise$all8, totalDeposited, totalBorrowed, depositAPY, borrowAPY, collateralRatio, rewardSpeeds, _yield$Promise$all9, depositPlyAPY, borrowPlyAPY, depositNearAPY, borrowNearAPY, depositMetaAPY, staderDepositApy;
|
|
3789
|
+
|
|
3790
|
+
return runtime_1.wrap(function _callee15$(_context15) {
|
|
3791
|
+
while (1) {
|
|
3792
|
+
switch (_context15.prev = _context15.next) {
|
|
3793
|
+
case 0:
|
|
3794
|
+
_context15.next = 2;
|
|
3795
|
+
return Promise.all([this.getTotalTokenDeposited(), this.getTotalTokenBorrowed(), this.getDepositAPY(), this.getBorrowAPY(), this.getCollateralRatio(), this.getRewardSpeeds()]);
|
|
3796
|
+
|
|
3797
|
+
case 2:
|
|
3798
|
+
_yield$Promise$all8 = _context15.sent;
|
|
3799
|
+
totalDeposited = _yield$Promise$all8[0];
|
|
3800
|
+
totalBorrowed = _yield$Promise$all8[1];
|
|
3801
|
+
depositAPY = _yield$Promise$all8[2];
|
|
3802
|
+
borrowAPY = _yield$Promise$all8[3];
|
|
3803
|
+
collateralRatio = _yield$Promise$all8[4];
|
|
3804
|
+
rewardSpeeds = _yield$Promise$all8[5];
|
|
3805
|
+
_context15.next = 11;
|
|
3806
|
+
return Promise.all([this.getDepositPlyAPY(), this.getBorrowPlyAPY(), this.getDepositNearAPY(), this.getBorrowNearAPY(), this.getDepositMetaAPY(), this.getDepositStaderAPY()]);
|
|
3807
|
+
|
|
3808
|
+
case 11:
|
|
3809
|
+
_yield$Promise$all9 = _context15.sent;
|
|
3810
|
+
depositPlyAPY = _yield$Promise$all9[0];
|
|
3811
|
+
borrowPlyAPY = _yield$Promise$all9[1];
|
|
3812
|
+
depositNearAPY = _yield$Promise$all9[2];
|
|
3813
|
+
borrowNearAPY = _yield$Promise$all9[3];
|
|
3814
|
+
depositMetaAPY = _yield$Promise$all9[4];
|
|
3815
|
+
staderDepositApy = _yield$Promise$all9[5];
|
|
3816
|
+
return _context15.abrupt("return", {
|
|
3764
3817
|
auTokenAddress: this.auToken.address,
|
|
3765
3818
|
totalTokenDeposited: totalDeposited,
|
|
3766
3819
|
totalTokenBorrowed: totalBorrowed,
|
|
@@ -3773,15 +3826,16 @@ var MoneyMarketRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
3773
3826
|
borrowPlyPerWeek: new TokenAmount(PLYToken, rewardSpeeds.plyRewardBorrowSpeed.mul(ONE_DAY).mul(7).toString()),
|
|
3774
3827
|
depositNEARApy: depositNearAPY.toNumber(),
|
|
3775
3828
|
borrowNEARApy: borrowNearAPY.toNumber() * -1,
|
|
3776
|
-
depositMETAApy: depositMetaAPY.toNumber()
|
|
3829
|
+
depositMETAApy: depositMetaAPY.toNumber(),
|
|
3830
|
+
staderDepositApy: staderDepositApy.toNumber()
|
|
3777
3831
|
});
|
|
3778
3832
|
|
|
3779
|
-
case
|
|
3833
|
+
case 19:
|
|
3780
3834
|
case "end":
|
|
3781
|
-
return
|
|
3835
|
+
return _context15.stop();
|
|
3782
3836
|
}
|
|
3783
3837
|
}
|
|
3784
|
-
},
|
|
3838
|
+
}, _callee15, this);
|
|
3785
3839
|
}));
|
|
3786
3840
|
|
|
3787
3841
|
function getDetails() {
|
|
@@ -3792,25 +3846,25 @@ var MoneyMarketRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
3792
3846
|
}();
|
|
3793
3847
|
|
|
3794
3848
|
_proto.getUserBorrowBalance = /*#__PURE__*/function () {
|
|
3795
|
-
var _getUserBorrowBalance = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
3849
|
+
var _getUserBorrowBalance = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee16(userAddress) {
|
|
3796
3850
|
var totalBorrow;
|
|
3797
|
-
return runtime_1.wrap(function
|
|
3851
|
+
return runtime_1.wrap(function _callee16$(_context16) {
|
|
3798
3852
|
while (1) {
|
|
3799
|
-
switch (
|
|
3853
|
+
switch (_context16.prev = _context16.next) {
|
|
3800
3854
|
case 0:
|
|
3801
|
-
|
|
3855
|
+
_context16.next = 2;
|
|
3802
3856
|
return this.auToken.callStatic.borrowBalanceCurrent(userAddress);
|
|
3803
3857
|
|
|
3804
3858
|
case 2:
|
|
3805
|
-
totalBorrow =
|
|
3806
|
-
return
|
|
3859
|
+
totalBorrow = _context16.sent;
|
|
3860
|
+
return _context16.abrupt("return", new TokenAmount(this.underlying, totalBorrow.toString()));
|
|
3807
3861
|
|
|
3808
3862
|
case 4:
|
|
3809
3863
|
case "end":
|
|
3810
|
-
return
|
|
3864
|
+
return _context16.stop();
|
|
3811
3865
|
}
|
|
3812
3866
|
}
|
|
3813
|
-
},
|
|
3867
|
+
}, _callee16, this);
|
|
3814
3868
|
}));
|
|
3815
3869
|
|
|
3816
3870
|
function getUserBorrowBalance(_x) {
|
|
@@ -3821,25 +3875,25 @@ var MoneyMarketRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
3821
3875
|
}();
|
|
3822
3876
|
|
|
3823
3877
|
_proto.getUserDepositBalance = /*#__PURE__*/function () {
|
|
3824
|
-
var _getUserDepositBalance = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
3878
|
+
var _getUserDepositBalance = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee17(userAddress) {
|
|
3825
3879
|
var totalDeposit;
|
|
3826
|
-
return runtime_1.wrap(function
|
|
3880
|
+
return runtime_1.wrap(function _callee17$(_context17) {
|
|
3827
3881
|
while (1) {
|
|
3828
|
-
switch (
|
|
3882
|
+
switch (_context17.prev = _context17.next) {
|
|
3829
3883
|
case 0:
|
|
3830
|
-
|
|
3884
|
+
_context17.next = 2;
|
|
3831
3885
|
return this.auToken.callStatic.balanceOfUnderlying(userAddress);
|
|
3832
3886
|
|
|
3833
3887
|
case 2:
|
|
3834
|
-
totalDeposit =
|
|
3835
|
-
return
|
|
3888
|
+
totalDeposit = _context17.sent;
|
|
3889
|
+
return _context17.abrupt("return", new TokenAmount(this.underlying, totalDeposit.toString()));
|
|
3836
3890
|
|
|
3837
3891
|
case 4:
|
|
3838
3892
|
case "end":
|
|
3839
|
-
return
|
|
3893
|
+
return _context17.stop();
|
|
3840
3894
|
}
|
|
3841
3895
|
}
|
|
3842
|
-
},
|
|
3896
|
+
}, _callee17, this);
|
|
3843
3897
|
}));
|
|
3844
3898
|
|
|
3845
3899
|
function getUserDepositBalance(_x2) {
|
|
@@ -3884,26 +3938,26 @@ var MoneyMarketRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
3884
3938
|
};
|
|
3885
3939
|
|
|
3886
3940
|
_proto.mintCap = /*#__PURE__*/function () {
|
|
3887
|
-
var _mintCap = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
3888
|
-
return runtime_1.wrap(function
|
|
3941
|
+
var _mintCap = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee18() {
|
|
3942
|
+
return runtime_1.wrap(function _callee18$(_context18) {
|
|
3889
3943
|
while (1) {
|
|
3890
|
-
switch (
|
|
3944
|
+
switch (_context18.prev = _context18.next) {
|
|
3891
3945
|
case 0:
|
|
3892
|
-
|
|
3893
|
-
|
|
3894
|
-
|
|
3946
|
+
_context18.t0 = TokenAmount;
|
|
3947
|
+
_context18.t1 = this.underlying;
|
|
3948
|
+
_context18.next = 4;
|
|
3895
3949
|
return this.env.comptroller.mintCaps(this.auToken.address);
|
|
3896
3950
|
|
|
3897
3951
|
case 4:
|
|
3898
|
-
|
|
3899
|
-
return
|
|
3952
|
+
_context18.t2 = _context18.sent.toString();
|
|
3953
|
+
return _context18.abrupt("return", new _context18.t0(_context18.t1, _context18.t2));
|
|
3900
3954
|
|
|
3901
3955
|
case 6:
|
|
3902
3956
|
case "end":
|
|
3903
|
-
return
|
|
3957
|
+
return _context18.stop();
|
|
3904
3958
|
}
|
|
3905
3959
|
}
|
|
3906
|
-
},
|
|
3960
|
+
}, _callee18, this);
|
|
3907
3961
|
}));
|
|
3908
3962
|
|
|
3909
3963
|
function mintCap() {
|
|
@@ -3914,26 +3968,26 @@ var MoneyMarketRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
3914
3968
|
}();
|
|
3915
3969
|
|
|
3916
3970
|
_proto.borrowCap = /*#__PURE__*/function () {
|
|
3917
|
-
var _borrowCap = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
3918
|
-
return runtime_1.wrap(function
|
|
3971
|
+
var _borrowCap = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee19() {
|
|
3972
|
+
return runtime_1.wrap(function _callee19$(_context19) {
|
|
3919
3973
|
while (1) {
|
|
3920
|
-
switch (
|
|
3974
|
+
switch (_context19.prev = _context19.next) {
|
|
3921
3975
|
case 0:
|
|
3922
|
-
|
|
3923
|
-
|
|
3924
|
-
|
|
3976
|
+
_context19.t0 = TokenAmount;
|
|
3977
|
+
_context19.t1 = this.underlying;
|
|
3978
|
+
_context19.next = 4;
|
|
3925
3979
|
return this.env.comptroller.borrowCaps(this.auToken.address);
|
|
3926
3980
|
|
|
3927
3981
|
case 4:
|
|
3928
|
-
|
|
3929
|
-
return
|
|
3982
|
+
_context19.t2 = _context19.sent.toString();
|
|
3983
|
+
return _context19.abrupt("return", new _context19.t0(_context19.t1, _context19.t2));
|
|
3930
3984
|
|
|
3931
3985
|
case 6:
|
|
3932
3986
|
case "end":
|
|
3933
|
-
return
|
|
3987
|
+
return _context19.stop();
|
|
3934
3988
|
}
|
|
3935
3989
|
}
|
|
3936
|
-
},
|
|
3990
|
+
}, _callee19, this);
|
|
3937
3991
|
}));
|
|
3938
3992
|
|
|
3939
3993
|
function borrowCap() {
|
|
@@ -3944,27 +3998,27 @@ var MoneyMarketRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
3944
3998
|
}();
|
|
3945
3999
|
|
|
3946
4000
|
_proto.getApyWithoutIncentive = /*#__PURE__*/function () {
|
|
3947
|
-
var _getApyWithoutIncentive = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
3948
|
-
var _yield$Promise$
|
|
4001
|
+
var _getApyWithoutIncentive = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee20(userAddress) {
|
|
4002
|
+
var _yield$Promise$all10, price, depositApy, borrowApy, depositBalance, borrowBalance, suppliedValue, borrowedValue, sum;
|
|
3949
4003
|
|
|
3950
|
-
return runtime_1.wrap(function
|
|
4004
|
+
return runtime_1.wrap(function _callee20$(_context20) {
|
|
3951
4005
|
while (1) {
|
|
3952
|
-
switch (
|
|
4006
|
+
switch (_context20.prev = _context20.next) {
|
|
3953
4007
|
case 0:
|
|
3954
|
-
|
|
4008
|
+
_context20.next = 2;
|
|
3955
4009
|
return Promise.all([this.getUnderlyingPrice(), this.getDepositAPY(), this.getBorrowAPY(), this.getUserDepositBalance(userAddress), this.getUserBorrowBalance(userAddress)]);
|
|
3956
4010
|
|
|
3957
4011
|
case 2:
|
|
3958
|
-
_yield$Promise$
|
|
3959
|
-
price = _yield$Promise$
|
|
3960
|
-
depositApy = _yield$Promise$
|
|
3961
|
-
borrowApy = _yield$Promise$
|
|
3962
|
-
depositBalance = _yield$Promise$
|
|
3963
|
-
borrowBalance = _yield$Promise$
|
|
4012
|
+
_yield$Promise$all10 = _context20.sent;
|
|
4013
|
+
price = _yield$Promise$all10[0];
|
|
4014
|
+
depositApy = _yield$Promise$all10[1];
|
|
4015
|
+
borrowApy = _yield$Promise$all10[2];
|
|
4016
|
+
depositBalance = _yield$Promise$all10[3];
|
|
4017
|
+
borrowBalance = _yield$Promise$all10[4];
|
|
3964
4018
|
suppliedValue = price.multipliedBy(depositBalance.formattedAmount());
|
|
3965
4019
|
borrowedValue = price.multipliedBy(borrowBalance.formattedAmount());
|
|
3966
4020
|
sum = calcNetApy(suppliedValue, depositApy, borrowedValue, borrowApy);
|
|
3967
|
-
return
|
|
4021
|
+
return _context20.abrupt("return", {
|
|
3968
4022
|
sum: sum,
|
|
3969
4023
|
suppliedValue: suppliedValue,
|
|
3970
4024
|
borrowedValue: borrowedValue
|
|
@@ -3972,10 +4026,10 @@ var MoneyMarketRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
3972
4026
|
|
|
3973
4027
|
case 12:
|
|
3974
4028
|
case "end":
|
|
3975
|
-
return
|
|
4029
|
+
return _context20.stop();
|
|
3976
4030
|
}
|
|
3977
4031
|
}
|
|
3978
|
-
},
|
|
4032
|
+
}, _callee20, this);
|
|
3979
4033
|
}));
|
|
3980
4034
|
|
|
3981
4035
|
function getApyWithoutIncentive(_x3) {
|
|
@@ -3986,45 +4040,50 @@ var MoneyMarketRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
3986
4040
|
}();
|
|
3987
4041
|
|
|
3988
4042
|
_proto.getApyWithIncentive = /*#__PURE__*/function () {
|
|
3989
|
-
var _getApyWithIncentive = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
3990
|
-
var _yield$Promise$
|
|
4043
|
+
var _getApyWithIncentive = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee21(userAddress) {
|
|
4044
|
+
var _yield$Promise$all11, price, depositApy, borrowApy, depositBalance, borrowBalance, nearDepositApy, plyDepositApy, metaDepositApy, nearBorrowApy, plyBorrowApy, staderDepositApy, suppliedValue, borrowedValue, totalDepositApy, totalBorrowApy, sum;
|
|
3991
4045
|
|
|
3992
|
-
return runtime_1.wrap(function
|
|
4046
|
+
return runtime_1.wrap(function _callee21$(_context21) {
|
|
3993
4047
|
while (1) {
|
|
3994
|
-
switch (
|
|
4048
|
+
switch (_context21.prev = _context21.next) {
|
|
3995
4049
|
case 0:
|
|
3996
|
-
|
|
4050
|
+
_context21.next = 2;
|
|
3997
4051
|
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()]);
|
|
3998
4052
|
|
|
3999
4053
|
case 2:
|
|
4000
|
-
_yield$Promise$
|
|
4001
|
-
price = _yield$Promise$
|
|
4002
|
-
depositApy = _yield$Promise$
|
|
4003
|
-
borrowApy = _yield$Promise$
|
|
4004
|
-
depositBalance = _yield$Promise$
|
|
4005
|
-
borrowBalance = _yield$Promise$
|
|
4006
|
-
nearDepositApy = _yield$Promise$
|
|
4007
|
-
plyDepositApy = _yield$Promise$
|
|
4008
|
-
metaDepositApy = _yield$Promise$
|
|
4009
|
-
nearBorrowApy = _yield$Promise$
|
|
4010
|
-
plyBorrowApy = _yield$Promise$
|
|
4054
|
+
_yield$Promise$all11 = _context21.sent;
|
|
4055
|
+
price = _yield$Promise$all11[0];
|
|
4056
|
+
depositApy = _yield$Promise$all11[1];
|
|
4057
|
+
borrowApy = _yield$Promise$all11[2];
|
|
4058
|
+
depositBalance = _yield$Promise$all11[3];
|
|
4059
|
+
borrowBalance = _yield$Promise$all11[4];
|
|
4060
|
+
nearDepositApy = _yield$Promise$all11[5];
|
|
4061
|
+
plyDepositApy = _yield$Promise$all11[6];
|
|
4062
|
+
metaDepositApy = _yield$Promise$all11[7];
|
|
4063
|
+
nearBorrowApy = _yield$Promise$all11[8];
|
|
4064
|
+
plyBorrowApy = _yield$Promise$all11[9];
|
|
4065
|
+
_context21.next = 15;
|
|
4066
|
+
return this.getDepositStaderAPY();
|
|
4067
|
+
|
|
4068
|
+
case 15:
|
|
4069
|
+
staderDepositApy = _context21.sent;
|
|
4011
4070
|
suppliedValue = price.multipliedBy(depositBalance.formattedAmount());
|
|
4012
4071
|
borrowedValue = price.multipliedBy(borrowBalance.formattedAmount());
|
|
4013
|
-
totalDepositApy = depositApy.plus(nearDepositApy).plus(plyDepositApy).plus(metaDepositApy);
|
|
4072
|
+
totalDepositApy = depositApy.plus(nearDepositApy).plus(plyDepositApy).plus(metaDepositApy).plus(staderDepositApy);
|
|
4014
4073
|
totalBorrowApy = borrowApy.plus(nearBorrowApy).plus(plyBorrowApy);
|
|
4015
4074
|
sum = calcNetApy(suppliedValue, totalDepositApy, borrowedValue, totalBorrowApy);
|
|
4016
|
-
return
|
|
4075
|
+
return _context21.abrupt("return", {
|
|
4017
4076
|
sum: sum,
|
|
4018
4077
|
suppliedValue: suppliedValue,
|
|
4019
4078
|
borrowedValue: borrowedValue
|
|
4020
4079
|
});
|
|
4021
4080
|
|
|
4022
|
-
case
|
|
4081
|
+
case 22:
|
|
4023
4082
|
case "end":
|
|
4024
|
-
return
|
|
4083
|
+
return _context21.stop();
|
|
4025
4084
|
}
|
|
4026
4085
|
}
|
|
4027
|
-
},
|
|
4086
|
+
}, _callee21, this);
|
|
4028
4087
|
}));
|
|
4029
4088
|
|
|
4030
4089
|
function getApyWithIncentive(_x4) {
|
|
@@ -4102,6 +4161,11 @@ __decorate([cache({
|
|
|
4102
4161
|
type: CacheType.MEMO
|
|
4103
4162
|
}), __metadata("design:type", Function), __metadata("design:paramtypes", []), __metadata("design:returntype", Promise)], MoneyMarketRead.prototype, "getDepositMetaAPY", null);
|
|
4104
4163
|
|
|
4164
|
+
__decorate([cache({
|
|
4165
|
+
ttl: CACHE_TIMEOUT,
|
|
4166
|
+
type: CacheType.MEMO
|
|
4167
|
+
}), __metadata("design:type", Function), __metadata("design:paramtypes", []), __metadata("design:returntype", Promise)], MoneyMarketRead.prototype, "getDepositStaderAPY", null);
|
|
4168
|
+
|
|
4105
4169
|
var MoneyMarketReadWrite = /*#__PURE__*/function (_MoneyMarketRead) {
|
|
4106
4170
|
_inheritsLoose(MoneyMarketReadWrite, _MoneyMarketRead);
|
|
4107
4171
|
|
|
@@ -4116,29 +4180,29 @@ var MoneyMarketReadWrite = /*#__PURE__*/function (_MoneyMarketRead) {
|
|
|
4116
4180
|
var _proto2 = MoneyMarketReadWrite.prototype;
|
|
4117
4181
|
|
|
4118
4182
|
_proto2.deposit = /*#__PURE__*/function () {
|
|
4119
|
-
var _deposit = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
4120
|
-
return runtime_1.wrap(function
|
|
4183
|
+
var _deposit = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee22(amount) {
|
|
4184
|
+
return runtime_1.wrap(function _callee22$(_context22) {
|
|
4121
4185
|
while (1) {
|
|
4122
|
-
switch (
|
|
4186
|
+
switch (_context22.prev = _context22.next) {
|
|
4123
4187
|
case 0:
|
|
4124
4188
|
if (!isSameAddress(amount.token.address, ETHAddress)) {
|
|
4125
|
-
|
|
4189
|
+
_context22.next = 4;
|
|
4126
4190
|
break;
|
|
4127
4191
|
}
|
|
4128
4192
|
|
|
4129
|
-
return
|
|
4193
|
+
return _context22.abrupt("return", this.auToken.connect(this._networkConnection.signer).mint({
|
|
4130
4194
|
value: amount.rawAmount()
|
|
4131
4195
|
}));
|
|
4132
4196
|
|
|
4133
4197
|
case 4:
|
|
4134
|
-
return
|
|
4198
|
+
return _context22.abrupt("return", this.auToken.connect(this._networkConnection.signer).mint(amount.rawAmount()));
|
|
4135
4199
|
|
|
4136
4200
|
case 5:
|
|
4137
4201
|
case "end":
|
|
4138
|
-
return
|
|
4202
|
+
return _context22.stop();
|
|
4139
4203
|
}
|
|
4140
4204
|
}
|
|
4141
|
-
},
|
|
4205
|
+
}, _callee22, this);
|
|
4142
4206
|
}));
|
|
4143
4207
|
|
|
4144
4208
|
function deposit(_x5) {
|
|
@@ -4149,19 +4213,19 @@ var MoneyMarketReadWrite = /*#__PURE__*/function (_MoneyMarketRead) {
|
|
|
4149
4213
|
}();
|
|
4150
4214
|
|
|
4151
4215
|
_proto2.borrow = /*#__PURE__*/function () {
|
|
4152
|
-
var _borrow = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
4153
|
-
return runtime_1.wrap(function
|
|
4216
|
+
var _borrow = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee23(amount) {
|
|
4217
|
+
return runtime_1.wrap(function _callee23$(_context23) {
|
|
4154
4218
|
while (1) {
|
|
4155
|
-
switch (
|
|
4219
|
+
switch (_context23.prev = _context23.next) {
|
|
4156
4220
|
case 0:
|
|
4157
|
-
return
|
|
4221
|
+
return _context23.abrupt("return", this.auToken.connect(this._networkConnection.signer).borrow(amount.rawAmount()));
|
|
4158
4222
|
|
|
4159
4223
|
case 1:
|
|
4160
4224
|
case "end":
|
|
4161
|
-
return
|
|
4225
|
+
return _context23.stop();
|
|
4162
4226
|
}
|
|
4163
4227
|
}
|
|
4164
|
-
},
|
|
4228
|
+
}, _callee23, this);
|
|
4165
4229
|
}));
|
|
4166
4230
|
|
|
4167
4231
|
function borrow(_x6) {
|
|
@@ -4172,27 +4236,27 @@ var MoneyMarketReadWrite = /*#__PURE__*/function (_MoneyMarketRead) {
|
|
|
4172
4236
|
}();
|
|
4173
4237
|
|
|
4174
4238
|
_proto2.withdraw = /*#__PURE__*/function () {
|
|
4175
|
-
var _withdraw = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
4176
|
-
return runtime_1.wrap(function
|
|
4239
|
+
var _withdraw = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee24(amount) {
|
|
4240
|
+
return runtime_1.wrap(function _callee24$(_context24) {
|
|
4177
4241
|
while (1) {
|
|
4178
|
-
switch (
|
|
4242
|
+
switch (_context24.prev = _context24.next) {
|
|
4179
4243
|
case 0:
|
|
4180
4244
|
if (!new BigNumber(amount.rawAmount()).lt(0)) {
|
|
4181
|
-
|
|
4245
|
+
_context24.next = 2;
|
|
4182
4246
|
break;
|
|
4183
4247
|
}
|
|
4184
4248
|
|
|
4185
|
-
return
|
|
4249
|
+
return _context24.abrupt("return", this.auToken.connect(this._networkConnection.signer).redeemUnderlying(INF));
|
|
4186
4250
|
|
|
4187
4251
|
case 2:
|
|
4188
|
-
return
|
|
4252
|
+
return _context24.abrupt("return", this.auToken.connect(this._networkConnection.signer).redeemUnderlying(amount.rawAmount()));
|
|
4189
4253
|
|
|
4190
4254
|
case 3:
|
|
4191
4255
|
case "end":
|
|
4192
|
-
return
|
|
4256
|
+
return _context24.stop();
|
|
4193
4257
|
}
|
|
4194
4258
|
}
|
|
4195
|
-
},
|
|
4259
|
+
}, _callee24, this);
|
|
4196
4260
|
}));
|
|
4197
4261
|
|
|
4198
4262
|
function withdraw(_x7) {
|
|
@@ -4203,37 +4267,37 @@ var MoneyMarketReadWrite = /*#__PURE__*/function (_MoneyMarketRead) {
|
|
|
4203
4267
|
}();
|
|
4204
4268
|
|
|
4205
4269
|
_proto2.repay = /*#__PURE__*/function () {
|
|
4206
|
-
var _repay = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
4207
|
-
return runtime_1.wrap(function
|
|
4270
|
+
var _repay = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee25(amount) {
|
|
4271
|
+
return runtime_1.wrap(function _callee25$(_context25) {
|
|
4208
4272
|
while (1) {
|
|
4209
|
-
switch (
|
|
4273
|
+
switch (_context25.prev = _context25.next) {
|
|
4210
4274
|
case 0:
|
|
4211
4275
|
if (!isSameAddress(amount.token.address, ETHAddress)) {
|
|
4212
|
-
|
|
4276
|
+
_context25.next = 4;
|
|
4213
4277
|
break;
|
|
4214
4278
|
}
|
|
4215
4279
|
|
|
4216
|
-
return
|
|
4280
|
+
return _context25.abrupt("return", this._EthRepayHelper.connect(this._networkConnection.signer).repayBorrow({
|
|
4217
4281
|
value: amount.rawAmount()
|
|
4218
4282
|
}));
|
|
4219
4283
|
|
|
4220
4284
|
case 4:
|
|
4221
4285
|
if (!new BigNumber(amount.rawAmount()).lt(0)) {
|
|
4222
|
-
|
|
4286
|
+
_context25.next = 8;
|
|
4223
4287
|
break;
|
|
4224
4288
|
}
|
|
4225
4289
|
|
|
4226
|
-
return
|
|
4290
|
+
return _context25.abrupt("return", this.auToken.connect(this._networkConnection.signer).repayBorrow(INF));
|
|
4227
4291
|
|
|
4228
4292
|
case 8:
|
|
4229
|
-
return
|
|
4293
|
+
return _context25.abrupt("return", this.auToken.connect(this._networkConnection.signer).repayBorrow(amount.rawAmount()));
|
|
4230
4294
|
|
|
4231
4295
|
case 9:
|
|
4232
4296
|
case "end":
|
|
4233
|
-
return
|
|
4297
|
+
return _context25.stop();
|
|
4234
4298
|
}
|
|
4235
4299
|
}
|
|
4236
|
-
},
|
|
4300
|
+
}, _callee25, this);
|
|
4237
4301
|
}));
|
|
4238
4302
|
|
|
4239
4303
|
function repay(_x8) {
|
|
@@ -4244,19 +4308,19 @@ var MoneyMarketReadWrite = /*#__PURE__*/function (_MoneyMarketRead) {
|
|
|
4244
4308
|
}();
|
|
4245
4309
|
|
|
4246
4310
|
_proto2.enableCollateral = /*#__PURE__*/function () {
|
|
4247
|
-
var _enableCollateral = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
4248
|
-
return runtime_1.wrap(function
|
|
4311
|
+
var _enableCollateral = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee26() {
|
|
4312
|
+
return runtime_1.wrap(function _callee26$(_context26) {
|
|
4249
4313
|
while (1) {
|
|
4250
|
-
switch (
|
|
4314
|
+
switch (_context26.prev = _context26.next) {
|
|
4251
4315
|
case 0:
|
|
4252
|
-
return
|
|
4316
|
+
return _context26.abrupt("return", this.env.comptroller.connect(this._networkConnection.signer).enterMarkets([this.auToken.address]));
|
|
4253
4317
|
|
|
4254
4318
|
case 1:
|
|
4255
4319
|
case "end":
|
|
4256
|
-
return
|
|
4320
|
+
return _context26.stop();
|
|
4257
4321
|
}
|
|
4258
4322
|
}
|
|
4259
|
-
},
|
|
4323
|
+
}, _callee26, this);
|
|
4260
4324
|
}));
|
|
4261
4325
|
|
|
4262
4326
|
function enableCollateral() {
|
|
@@ -4267,19 +4331,19 @@ var MoneyMarketReadWrite = /*#__PURE__*/function (_MoneyMarketRead) {
|
|
|
4267
4331
|
}();
|
|
4268
4332
|
|
|
4269
4333
|
_proto2.disableCollateral = /*#__PURE__*/function () {
|
|
4270
|
-
var _disableCollateral = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
4271
|
-
return runtime_1.wrap(function
|
|
4334
|
+
var _disableCollateral = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee27() {
|
|
4335
|
+
return runtime_1.wrap(function _callee27$(_context27) {
|
|
4272
4336
|
while (1) {
|
|
4273
|
-
switch (
|
|
4337
|
+
switch (_context27.prev = _context27.next) {
|
|
4274
4338
|
case 0:
|
|
4275
|
-
return
|
|
4339
|
+
return _context27.abrupt("return", this.env.comptroller.connect(this._networkConnection.signer).exitMarket(this.auToken.address));
|
|
4276
4340
|
|
|
4277
4341
|
case 1:
|
|
4278
4342
|
case "end":
|
|
4279
|
-
return
|
|
4343
|
+
return _context27.stop();
|
|
4280
4344
|
}
|
|
4281
4345
|
}
|
|
4282
|
-
},
|
|
4346
|
+
}, _callee27, this);
|
|
4283
4347
|
}));
|
|
4284
4348
|
|
|
4285
4349
|
function disableCollateral() {
|