@aurigami/sdk 1.3.0 → 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.0",
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 {
@@ -1,11 +1,12 @@
1
1
  import { Provider } from "@ethersproject/abstract-provider";
2
2
  import { BlockchainEntity, BlockchainEntityRead } from "./BlockchainEntity";
3
3
  import { NetworkConnection } from "./types";
4
- import * as FileSystem from 'fs';
5
4
  import { BigNumber as BN } from "ethers";
6
5
  import { TransferEventQuery } from "./transfer-event-query";
7
6
  import { AIRDROP_START_TIMESTAMP, AIRDROP_KEEP_THRESHOLD, AIRDROP_END_TIMESTAMP } from "./constants";
8
7
  import { getBlockBeforeTimestamp, getCurrentTimestamp } from "./helpers";
8
+ import AIRDROP_AUTOKEN_INFO from "./airdrop_misc/auTokensInfo.json"
9
+ import AIRDROP_WHITELIST_ADDRESSES from "./airdrop_misc/whitelist.json"
9
10
 
10
11
  type AirdropUnderlyingInfo = {
11
12
  minDeposit: BN,
@@ -165,13 +166,10 @@ export class AirdropRead extends BlockchainEntityRead {
165
166
  private keepTrackers: AirdropAuTokenKeepTracker[] = [];
166
167
  public constructor(networkConnection: NetworkConnection) {
167
168
  super(networkConnection);
168
- this._whitelistedAddresses = new Set(
169
- FileSystem.readFileSync("airdrop_misc/whitelist.txt").toString().trim().split('\n')
170
- );
171
169
 
172
- let auTokens = JSON.parse(
173
- FileSystem.readFileSync("airdrop_misc/auTokensInfo.json").toString()
174
- )
170
+ this._whitelistedAddresses = new Set(AIRDROP_WHITELIST_ADDRESSES as string[]);
171
+
172
+ let auTokens: any = AIRDROP_AUTOKEN_INFO;
175
173
 
176
174
  for (let auToken in auTokens) {
177
175
  let { address, exchangeRate, deploymentBlock, underlying } = auTokens[auToken];
@@ -194,7 +192,6 @@ export class AirdropRead extends BlockchainEntityRead {
194
192
  }
195
193
  }
196
194
 
197
- // this is for testing purpose only
198
195
  public countWhitelistedAddresses(): number {
199
196
  return this._whitelistedAddresses.size;
200
197
  }
@@ -0,0 +1,34 @@
1
+ {
2
+ "auUSDC": {
3
+ "address": "0x4f0d864b1ABf4B701799a0b30b57A22dFEB5917b",
4
+ "exchangeRate": "200810680770707",
5
+ "deploymentBlock": "60501576",
6
+ "underlying": {
7
+ "minDeposit": "1000000000"
8
+ }
9
+ },
10
+ "auETH": {
11
+ "address": "0xca9511B610bA5fc7E311FDeF9cE16050eE4449E9",
12
+ "exchangeRate": "200390813218617347858934298",
13
+ "deploymentBlock": "60501625",
14
+ "underlying": {
15
+ "minDeposit": "300000000000000000"
16
+ }
17
+ },
18
+ "auWBTC": {
19
+ "address": "0xCFb6b0498cb7555e7e21502E0F449bf28760Adbb",
20
+ "exchangeRate": "20050472926613996",
21
+ "deploymentBlock": "60501670",
22
+ "underlying": {
23
+ "minDeposit": "2000000"
24
+ }
25
+ },
26
+ "auUSDT": {
27
+ "address": "0xaD5A2437Ff55ed7A8Cad3b797b3eC7c5a19B1c54",
28
+ "exchangeRate": "200868369820223",
29
+ "deploymentBlock": "60501723",
30
+ "underlying": {
31
+ "minDeposit": "1000000000"
32
+ }
33
+ }
34
+ }
@@ -0,0 +1,4 @@
1
+ 0x2b285e1b49ba0cb6f71d8b0d9cafdfbf9868fda9
2
+ 0xe8e9a0a2571299a0dabcaae98608352faf533e6a
3
+ 0xb3539af6596d8e08f75e96452d92bc17e3cdffc0
4
+ 0x0c5a5bd45078916ff5ff3acafeb19fe96fd747dc