@aurigami/sdk 1.3.1 → 1.3.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/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.3.1",
2
+ "version": "1.3.2",
3
3
  "license": "MIT",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
@@ -37,7 +37,7 @@ export class MoneyMarketRead extends BlockchainEntityRead {
37
37
  } else {
38
38
  this.auToken = new Contract(auToken, AuErc20ABI.abi, networkConnection.provider) as AuErc20;
39
39
  }
40
- this.underlying = new Token(
40
+ this.underlying = new Token(
41
41
  underlyingAsset,
42
42
  getDecimal(underlyingAsset),
43
43
  );
@@ -130,23 +130,23 @@ export class MoneyMarketRead extends BlockchainEntityRead {
130
130
  promises.push(this.getDepositAPY().then((res: BigNumber) => {depositAPY = res.toNumber()}));
131
131
  promises.push(this.getBorrowAPY().then((res: BigNumber) => {borrowAPY = res.toNumber()}));
132
132
  promises.push(this.getCollateralRatio().then((res: BigNumber) => {collateralRatio = res.toNumber()}));
133
-
133
+
134
134
  var plyPrice: BigNumber, underlyingPrice: BigNumber, rewardSpeeds: RewardSpeeds;
135
135
  promises.push(this.getRewardSpeeds().then((res) => {rewardSpeeds = res}));
136
136
  promises.push(fetchPrice(networkAddresses.tokens.PLY, this._networkConnection.provider).then((res) => {plyPrice = res}));
137
137
  promises.push(fetchPrice(this.underlying.address, this._networkConnection.provider).then((res) => {underlyingPrice = res}));
138
-
138
+
139
139
  await Promise.all(promises);
140
-
140
+
141
141
  var borrowPlyApy = calcLMRewardApr(
142
142
  calcValuation(
143
143
  new TokenAmount(
144
144
  PLYToken,
145
145
  rewardSpeeds!.plyRewardBorrowSpeed.toString()
146
- ),
146
+ ),
147
147
  plyPrice!
148
148
  ),
149
- underlyingPrice!.multipliedBy(totalBorrowed!.formattedAmount()),
149
+ underlyingPrice!.multipliedBy(totalBorrowed!.formattedAmount()),
150
150
  ONE_YEAR
151
151
  );
152
152
  var depositPlyApy = calcLMRewardApr(
@@ -154,10 +154,10 @@ export class MoneyMarketRead extends BlockchainEntityRead {
154
154
  new TokenAmount(
155
155
  PLYToken,
156
156
  rewardSpeeds!.plyRewardSupplySpeed.toString()
157
- ),
157
+ ),
158
158
  plyPrice!
159
159
  ),
160
- underlyingPrice!.multipliedBy(totalDeposited!.formattedAmount()),
160
+ underlyingPrice!.multipliedBy(totalDeposited!.formattedAmount()),
161
161
  ONE_YEAR
162
162
  );
163
163
 
@@ -175,9 +175,9 @@ export class MoneyMarketRead extends BlockchainEntityRead {
175
175
  totalTokenDeposited: totalDeposited!,
176
176
  totalTokenBorrowed: totalBorrowed!,
177
177
  depositApy: depositAPY!,
178
- depositPlyApy: depositPlyApy.toNumber(),
178
+ depositPlyApy: depositPlyApy.toNumber(),
179
179
  borrowApy: borrowAPY!,
180
- borrowPlyApy: borrowPlyApy.toNumber() * -1,
180
+ borrowPlyApy: borrowPlyApy.toNumber() * -1,
181
181
  collateralRatio: collateralRatio!,
182
182
  depositPlyPerWeek: new TokenAmount(
183
183
  PLYToken,
@@ -208,10 +208,10 @@ export class MoneyMarketRead extends BlockchainEntityRead {
208
208
  totalDeposit.toString()
209
209
  )
210
210
  }
211
-
211
+
212
212
  private getDepositNEARRewardPerWeek(): TokenAmount {
213
213
  const NEARToken = new Token(networkAddresses.tokens.WNEAR, getDecimal(networkAddresses.tokens.WNEAR));
214
- const rewardStopTime = 1649253600;
214
+ const rewardStopTime = 1650463200;
215
215
  if (isSameAddress(this.underlying.address, networkAddresses.tokens.USDC) && getCurrentTimestamp() <= rewardStopTime) {
216
216
  return new TokenAmount(NEARToken, "1250", false);
217
217
  } else {
@@ -221,7 +221,7 @@ export class MoneyMarketRead extends BlockchainEntityRead {
221
221
 
222
222
  private getBorrowNEARRewardPerWeek(): TokenAmount {
223
223
  const NEARToken = new Token(networkAddresses.tokens.WNEAR, getDecimal(networkAddresses.tokens.WNEAR));
224
- const rewardStopTime = 1649253600;
224
+ const rewardStopTime = 1650463200;
225
225
  if (isSameAddress(this.underlying.address, networkAddresses.tokens.USDC) && getCurrentTimestamp() <= rewardStopTime) {
226
226
  return new TokenAmount(NEARToken, "3750", false);
227
227
  } else {
@@ -116,7 +116,7 @@ function shouldFetchFromCoingecko(address: string) {
116
116
  export async function fetchPrice(address: Address, provider: providers.Provider): Promise<BigNumber> {
117
117
  if (hardcodePLYPrice && isSameAddress(address, networkAddresses.tokens.PLY)) return new BigNumber(0);
118
118
 
119
- if (isSameAddress(address, networkAddresses.tokens.stNEAR)) return fetchStNEARPrice();
119
+ // if (isSameAddress(address, networkAddresses.tokens.stNEAR)) return fetchStNEARPrice();
120
120
  if (shouldFetchFromCoingecko(address)) return fetchPriceFromCoingecko(address);
121
121
 
122
122
  const matchingAuToken = networkAddresses.auTokens.find((auToken) => {